diff --git a/docs/prd/AI_NATIVE_BATTLE_SINGLE_ACTION_FUNCTION_PRD_2026-04-18.md b/docs/prd/AI_NATIVE_BATTLE_SINGLE_ACTION_FUNCTION_PRD_2026-04-18.md index c3cfb4bb..fcc9f02f 100644 --- a/docs/prd/AI_NATIVE_BATTLE_SINGLE_ACTION_FUNCTION_PRD_2026-04-18.md +++ b/docs/prd/AI_NATIVE_BATTLE_SINGLE_ACTION_FUNCTION_PRD_2026-04-18.md @@ -8,7 +8,7 @@ 1. 战斗中一次点击只完成一个明确行为,不再做连续多轮击打、连续多 actor 轮转的 function 设计。 2. 战斗中除逃跑外,不再为每次动作额外触发剧情推理,而是直接结算数值并刷新下一轮战斗选项。 -3. 只有在逃跑成功或战斗正式结束后,才触发一次剧情推理,生成脱战后的 storyText 与后续剧情选项。 +3. 战斗动作、逃跑、战斗胜利、切磋结束与玩家死亡都不再触发剧情推理,只做确定性数值结算与固定流程选项。 --- @@ -143,24 +143,13 @@ ongoing battle 的本地/后端结果文本只负责说明这一次动作结算 3. 直接刷新新一轮战斗选项 4. `storyText` 直接使用本次结算结果文本,不请求 AI 续写 -### 5.2 必须触发剧情推理的情况 +### 5.2 战斗结束后的固定流程 -以下情况必须触发剧情推理: +战斗正式结束后仍然不触发剧情推理,直接走固定 UI 流程: -1. `battle_escape_breakout` 执行后成功脱战 -2. 任意战斗动作执行后,战斗正式结束 - -战斗正式结束包括: - -- 敌方被击败 -- 切磋结束 -- 玩家被系统判定为本轮战斗已断开 - -此时系统行为为: - -1. 先完成数值结算与状态落地 -2. 再以“本次动作 + 本次战斗结果”为上下文触发一次剧情推理 -3. 生成脱战后的 `storyText` 与非战斗态 options +1. 敌方被击败或切磋结束:展示结算文本,并只给一个“继续前进”选项。 +2. 如果当前场景当前幕已经是最后一幕,则不再给“继续前进”,改为列出可前往的其他场景选项。 +3. 玩家血量小于等于 0:先播放死亡动画,三秒后把玩家复活到第一个场景第一幕。 --- @@ -196,7 +185,7 @@ ongoing battle 的本地/后端结果文本只负责说明这一次动作结算 1. 后端 runtime 战斗 option 池切换到单行为模型 2. 后端 combat resolution 支持普通攻击 / 指定技能 / 恢复 / 战斗物品 / 逃跑 -3. 后端只在逃跑或战斗结束后做剧情推理 +3. 后端和前端都不在战斗流程里触发剧情推理,胜负只走固定结算选项 4. 前端支持透传战斗 option 的 `runtimePayload` 5. 前端支持 disabled battle option 展示 6. 文档、测试同步更新 @@ -228,6 +217,6 @@ ongoing battle 的本地/后端结果文本只负责说明这一次动作结算 - 每个技能一个独立技能项 - 逃跑 3. 点击普通攻击 / 恢复 / 使用物品 / 技能时,不请求新的剧情推理,直接返回结算结果并刷新下一轮战斗 options。 -4. 点击逃跑成功后,会请求一次剧情推理并切回脱战后的剧情 options。 -5. 任意攻击或技能把敌人打死后,会请求一次剧情推理并切回脱战后的剧情 options。 +4. 点击逃跑成功后,不请求剧情推理,直接切回非战斗固定 options。 +5. 任意攻击或技能把敌人打死后,不请求剧情推理,直接显示“继续前进”或其他场景选项。 6. 旧存档里残留旧 battle functionId 时,不会因为 function 不识别而报错。 diff --git a/docs/technical/FOUNDATION_DRAFT_OPENING_SCENE_BATCH_DECOUPLING_2026-04-26.md b/docs/technical/FOUNDATION_DRAFT_OPENING_SCENE_BATCH_DECOUPLING_2026-04-26.md new file mode 100644 index 00000000..29f20db5 --- /dev/null +++ b/docs/technical/FOUNDATION_DRAFT_OPENING_SCENE_BATCH_DECOUPLING_2026-04-26.md @@ -0,0 +1,45 @@ +# 世界底稿开局场景批生成解耦说明 2026-04-26 + +## 背景 + +当前第一版世界底稿生成链路里,`framework` 阶段同时要求模型输出 `camp.sceneTaskDescription`、`camp.actBackgroundPromptTexts` 和 `camp.actEventDescriptions`。这让“世界核心骨架”和“开局场景多幕内容”混在同一次世界生成任务里,后续普通场景批生成又要单独生成相同粒度的场景任务、三幕事件、三幕背景和幕 NPC 分配。 + +这与《AI 原生多幕场景创作与玩法流程 PRD》中“开局场景不是特殊系统,只是玩家开局所处的第一个场景”的约束不一致。开局场景应复用普通场景的批生成能力,而不是由世界骨架阶段提前生成一套缩水版内容。 + +## 落地边界 + +1. `framework` 阶段只负责世界顶层信息和轻量 `camp` 占位: + - `name` + - `description` +2. 场景批生成阶段负责生成完整场景骨架: + - 场景名与描述 + - 默认场景生图描述 + - `sceneTaskDescription` + - `actBackgroundPromptTexts` + - `actEventDescriptions` + - `actNPCNames` + - `connectedLandmarkNames` + - `entryHook` +3. 批生成场景结果的第一项固定视为开局场景: + - 写回 `profile.camp` + - `camp.id` 缺失时固定为 `camp-1` + - `camp.kind` 固定为 `camp` +4. 批生成场景结果的其余项写入 `profile.landmarks`。 +5. `sceneChapterBlueprints` 仍由统一场景蓝图编译函数生成: + - 第 0 项来自 `camp` + - 后续项来自 `landmarks` + - 开局场景和普通场景共用三幕、NPC、任务、背景提示词规则 + +## 兼容策略 + +为了减少前端和存量链路改动,场景批生成 API 层仍沿用现有 `landmarks` JSON 字段名。字段名不再表示“只包含普通地标”,而表示“本批生成的场景条目”,其中第一项是 opening/camp 场景。 + +如果模型没有返回任何场景条目,则继续使用 `framework.camp` 的轻量占位构造兜底开局场景;这只是异常兜底,不是主生成路径。 + +## 验收点 + +1. 世界骨架 prompt 不再要求 `camp.sceneTaskDescription`、`camp.actBackgroundPromptTexts`、`camp.actEventDescriptions`。 +2. 场景批生成 prompt 明确要求第一项是开局场景。 +3. 生成后的 `profile.camp` 来自场景批生成第一项,而不是来自世界骨架阶段的开局多幕内容。 +4. `profile.landmarks[0]` 是第一个普通场景,不再重复包含开局场景。 +5. `sceneChapterBlueprints[0].sceneId === "camp-1"`,且仍包含 3 幕背景与事件描述。 diff --git a/docs/technical/RPG_BATTLE_DETERMINISTIC_END_FLOW_2026-04-26.md b/docs/technical/RPG_BATTLE_DETERMINISTIC_END_FLOW_2026-04-26.md new file mode 100644 index 00000000..ce6ed9c0 --- /dev/null +++ b/docs/technical/RPG_BATTLE_DETERMINISTIC_END_FLOW_2026-04-26.md @@ -0,0 +1,38 @@ +# RPG 战斗确定性结束流程 + +更新时间:`2026-04-26` + +## 背景 + +旧战斗单行为 PRD 允许在逃跑成功或战斗结束后再触发一次剧情推理。新的运行时规则改为:战斗过程与战斗结果都不再请求剧情推理,所有胜负出口都由确定性状态与固定选项驱动。 + +## 落地规则 + +1. 战斗中的 `battle_attack_basic / battle_use_skill / battle_recover_breath / inventory_use / battle_escape_breakout` 只结算数值、血量、冷却、物品与战斗状态,不再请求 `generateNextStep` 或 Rust `generate_action_story_payload` 的战斗推理。 +2. 玩家血量小于等于 0 时,先展示死亡动画;三秒后复活到当前世界的第一个场景第一幕。 +3. 复活状态必须清理战斗、遭遇、NPC 交互、战斗特效、当前 NPC 战斗结果,并把生命与灵力恢复到最大值。 +4. 战斗胜利或切磋结束时,弹出固定选项: + - 若当前场景仍有下一幕:只显示“继续前进”,并把下一幕运行时状态与可用选项挂到 `deferredRuntimeState / deferredOptions`,点击后只揭开下一幕选项,不触发剧情推理。 + - 若当前场景已是最后一幕:显示可前往的其他场景选项,每个选项透传 `runtimePayload.targetSceneId`。 +5. “继续前进”和“前往其他场景”都是本地状态推进,不展示额外说明面板,不把规则描述写入 UI。 + +## 工程落点 + +1. `src/hooks/rpg-runtime-story/postBattleFlow.ts` + - 生成死亡复活状态。 + - 生成战斗胜利后的固定 `StoryMoment`。 + - 解析下一幕或其他场景选项。 +2. `src/hooks/rpg-runtime-story/storyChoiceContinuation.ts` + - 本地 fallback 胜利分支不再调用 `generateStoryForState(...)`。 + - 玩家死亡分支播放死亡态并延迟复活。 +3. `src/hooks/rpg-runtime-story/storyChoiceRuntime.ts` + - 服务端 runtime action 回包若是战斗死亡或胜利,同样覆盖为固定流程。 +4. `server-rs/crates/api-server/src/runtime_story/compat/ai.rs` + - 战斗 outcome 不再触发 reasoned story payload。 + +## 验收 + +1. 战斗中普通攻击、技能、恢复、物品、逃跑不会触发剧情推理。 +2. 玩家被打到 0 血时先播放死亡动画,约三秒后复活到第一个场景第一幕。 +3. 战斗胜利后只出现“继续前进”;最后一幕后出现其他场景入口。 +4. 服务端 runtime action 与本地 fallback 两条链表现一致。 diff --git a/docs/technical/RPG_BATTLE_HEALTHBAR_AND_ACTION_PRESENTATION_FIX_2026-04-26.md b/docs/technical/RPG_BATTLE_HEALTHBAR_AND_ACTION_PRESENTATION_FIX_2026-04-26.md index b981d1ce..aff0123e 100644 --- a/docs/technical/RPG_BATTLE_HEALTHBAR_AND_ACTION_PRESENTATION_FIX_2026-04-26.md +++ b/docs/technical/RPG_BATTLE_HEALTHBAR_AND_ACTION_PRESENTATION_FIX_2026-04-26.md @@ -18,6 +18,8 @@ 3. `battle_use_skill` 的本地兜底结算必须尊重 `runtimePayload.skillId`,不能重新随机挑技能。 4. `battle_recover_breath` 的本地兜底不能伪装成攻击动作;它只做恢复、冷却推进和后续敌方压力。 5. 服务端战斗回包如果带 `presentation.battle`,前端先播放一次短动作和血量变化,再落 `hydratedSnapshot.gameState`,避免选项点击后血量直接跳变。 +6. 战斗中任一角色血量发生变化时,表现层根据前后血量差派生一次浮字:伤害使用红色负数,治疗使用绿色正数;该浮字只表达已经结算的血量差,不参与数值计算。 +7. 伤害浮字出现时,受击角色形象需要沿自身背向短距离后退再恢复;该后撤只作用在角色形象视觉容器,不改变 `playerX`、`sceneHostileNpcs.xMeters`、同伴站位或任何战斗结算字段。 ## 验收点 @@ -25,3 +27,5 @@ - 点击具体技能按钮时,播放与结算使用同一个 `skillId`。 - 点击恢复时不会出现玩家同时释放攻击技能的错位表现。 - 走服务端 runtime action 的战斗选项仍以 server-rs 返回快照为最终状态。 +- 受到伤害时,角色形象上方出现类似 `-9` 的红色浮字,并有短暂后撤回弹。 +- 获得治疗时,角色形象上方出现类似 `+1` 的绿色浮字,不触发受击后撤。 diff --git a/docs/technical/RPG_CREATION_AGENT_ENTITY_GENERATION_RESULT_SYNC_FIX_2026-04-26.md b/docs/technical/RPG_CREATION_AGENT_ENTITY_GENERATION_RESULT_SYNC_FIX_2026-04-26.md new file mode 100644 index 00000000..7df9c0fc --- /dev/null +++ b/docs/technical/RPG_CREATION_AGENT_ENTITY_GENERATION_RESULT_SYNC_FIX_2026-04-26.md @@ -0,0 +1,27 @@ +# RPG 创作结果页新增实体同步修复 2026-04-26 + +## 问题 + +Agent 草稿结果页点击“新增可扮演角色”后,后端生成请求已完成,但前端提示: + +`生成请求已完成,但结果页未收到新增内容,请返回创作页重新打开草稿后重试。` + +触发点在结果页实体生成完成后的数量校验:前端会执行 `generate_characters`,等待操作完成后重新拉取 Agent session,再把 session 编译成结果页 `CustomWorldProfile`。如果新 profile 中对应实体数量没有增加,就显示该错误。 + +## 根因 + +当前链路已经约定 `session.draftProfile` 是 Agent 草稿与 RPG 运行时的真相源,但 `rpgCreationPreviewAdapter.buildPreviewFromSession()` 仍优先读取 `session.resultPreview.preview`。 + +当后端 action 已把新增角色写入 `draftProfile`,但 `resultPreview` 仍是旧快照时,结果页会继续消费旧预览,导致数量校验误判为“没有新增内容”。 + +## 修复 + +- `buildCustomWorldProfileFromAgentSession()` 改为优先归一化 `session.draftProfile`。 +- `resultPreview.preview` 只作为 `draftProfile` 缺失时的兼容 fallback。 +- 更新单测,覆盖“session 同时存在 draftProfile 与 resultPreview 时,结果页 profile 必须来自 draftProfile”。 + +## 后续约束 + +- Agent 草稿结果页新增、删除、进入世界都应以 `draftProfile` 为数据源。 +- `resultPreview` 继续承载发布质量、blocker、预览外壳信息,不再作为结果页实体列表的优先数据源。 +- 若新增实体字段在结果页缺失,应扩展 `draftProfile` 的归一化兼容,而不是把实体读取切回 `resultPreview.preview`。 diff --git a/docs/technical/RPG_CREATION_HISTORY_ASSET_REUSE_2026-04-26.md b/docs/technical/RPG_CREATION_HISTORY_ASSET_REUSE_2026-04-26.md new file mode 100644 index 00000000..8b755171 --- /dev/null +++ b/docs/technical/RPG_CREATION_HISTORY_ASSET_REUSE_2026-04-26.md @@ -0,0 +1,102 @@ +# RPG 创作编辑器历史素材复用设计 + +日期:`2026-04-26` + +## 1. 本次目标 + +编辑场景角色与编辑场景图片时,玩家可以复用历史生成素材: + +1. 场景角色形象区删除 `基于预设素材修改` 入口,以及它打开的预设拼装编辑下游。 +2. 场景角色形象区新增 `使用历史素材`,打开独立素材面板。 +3. 场景图片的幕背景配置新增 `使用历史素材`,打开独立素材面板。 +4. 历史素材面板需要展示所有账号过去生成过的对应类型素材,并明确标注素材归属账号。 +5. 选择素材后直接应用到当前角色或当前幕背景,不触发新一轮生成。 + +## 2. 数据真相 + +历史素材不从前端草稿 profile 扫描,也不从预设素材目录扫描。 + +历史素材统一来自 SpacetimeDB 的 `asset_object` 表: + +| 使用位置 | `asset_kind` | 应用字段 | +| --- | --- | --- | +| 场景角色形象 | `character_visual` | `imageSrc`、`generatedVisualAssetId` | +| 场景幕背景 | `scene_image` | `backgroundImageSrc`、`backgroundAssetId` | + +`asset_object.owner_user_id` 是归属账号标注主源。为空时 UI 标注为 `未记录账号`,不能隐藏归属栏。 + +## 3. 后端接口 + +新增只读接口: + +```text +GET /api/assets/history?kind=character_visual +GET /api/assets/history?kind=scene_image +``` + +返回字段只包含前端选择所需脱敏信息: + +1. `assetObjectId` +2. `assetKind` +3. `imageSrc` +4. `ownerUserId` +5. `ownerLabel` +6. `profileId` +7. `entityId` +8. `createdAt` +9. `updatedAt` + +`asset_object` 仍保持 private table。读取历史列表必须通过 SpacetimeDB procedure + Axum facade,不能让前端直接订阅整表。 + +## 4. SpacetimeDB 设计 + +`module-assets` 新增: + +1. `AssetHistoryListInput` +2. `AssetHistoryEntrySnapshot` +3. `AssetHistoryListResult` + +`spacetime-module` 新增 procedure: + +```rust +list_asset_history_and_return(input: AssetHistoryListInput) -> AssetHistoryListResult +``` + +实现规则: + +1. 只允许 `character_visual`、`scene_image`。 +2. 按 `asset_kind` 过滤。 +3. 按 `created_at` 倒序返回。 +4. 默认最多返回 120 条,允许调用方传更小 limit。 +5. `image_src` 由 `object_key` 转为兼容代理路径:`/{object_key}`。 + +## 5. 前端交互 + +历史素材面板为独立弹层,不在当前面板下方展开。 + +角色历史素材卡片: + +1. 展示素材图。 +2. 展示归属账号。 +3. 展示创建时间。 +4. 点击 `使用` 后写入当前草稿角色: + - `imageSrc = imageSrc` + - `generatedVisualAssetId = assetObjectId` + - `generatedAnimationSetId = undefined` + - `animationMap = undefined` + +场景历史素材卡片: + +1. 展示 16:9 预览。 +2. 展示归属账号。 +3. 展示创建时间。 +4. 点击 `使用` 后写入当前幕: + - `backgroundImageSrc = imageSrc` + - `backgroundAssetId = assetObjectId` + +## 6. 非目标 + +1. 不新增图片生成模型能力。 +2. 不把历史素材复制成新 OSS 对象。 +3. 不修改旧预设素材目录。 +4. 不恢复 server-node 或 PostgreSQL 链路。 diff --git a/docs/technical/RPG_CREATION_SCENE_ACT_ASSET_CONSISTENCY_2026-04-26.md b/docs/technical/RPG_CREATION_SCENE_ACT_ASSET_CONSISTENCY_2026-04-26.md new file mode 100644 index 00000000..e8eba482 --- /dev/null +++ b/docs/technical/RPG_CREATION_SCENE_ACT_ASSET_CONSISTENCY_2026-04-26.md @@ -0,0 +1,24 @@ +# RPG 创作场景幕资产一致性修复 2026-04-26 + +## 背景 + +当前世界草稿和场景编辑器存在三类一致性问题: + +1. 世界草稿生成后,开局场景的三幕可能没有默认主角色。 +2. 开局场景列表层、幕卡片层、幕背景配置弹层可能显示不同图片。 +3. 幕背景智能生成弹层的默认提示词可能退回规则拼接文本,且预览图和外层当前幕不一致。 + +## 落地约束 + +1. 后端草稿生成必须为 `sceneChapterBlueprints[*].acts[*]` 写入稳定的幕级字段:`encounterNpcIds`、`primaryNpcId`、`oppositeNpcId`、`eventDescription`、`backgroundPromptText`。 +2. 开局场景 `camp` 在生成角色名单之前建立,但最终编译草稿时必须基于已生成的场景角色,为三幕自动补默认主角色,不允许把“开局关键角色”这类占位词留到可编辑草稿里。 +3. `backgroundPromptText` 必须优先来自模型生成的自然画面描述;缺失时才使用规则兜底,兜底也要基于真实主角色名。 +4. 前端场景编辑器展示某一幕时,列表卡、幕卡、配置弹层、智能生成弹层都应读取同一个幕级 `backgroundImageSrc`;只有旧草稿缺幕图时才展示场景主图作为视觉兜底,保存时不得把兜底图反写到所有幕。 +5. 智能生成幕背景时,默认提示词必须使用当前幕 `backgroundPromptText`,不再用标题、摘要、目标拼接替代。 + +## 验收点 + +1. 新生成的开局三幕每幕都有非空 `primaryNpcId`,并且第一位 `encounterNpcIds[0]` 与 `primaryNpcId` 一致。 +2. 普通场景与开局场景都能在幕背景生图 prompt 中写入真实主角色名。 +3. 开局场景第 2 幕在列表层、编辑卡片层、配置弹层、智能生成弹层中的预览图保持一致。 +4. 点击“跟随场景主图”只影响当前幕,不会把同一张图同步覆盖到三幕。 diff --git a/docs/technical/RPG_CREATION_WORLD_ATTRIBUTE_SCHEMA_EDITING_2026-04-26.md b/docs/technical/RPG_CREATION_WORLD_ATTRIBUTE_SCHEMA_EDITING_2026-04-26.md new file mode 100644 index 00000000..ea8827e6 --- /dev/null +++ b/docs/technical/RPG_CREATION_WORLD_ATTRIBUTE_SCHEMA_EDITING_2026-04-26.md @@ -0,0 +1,58 @@ +# RPG 创作世界角色维度信息编辑落地说明 + +更新时间:`2026-04-26` + +## 1. 背景 + +统一角色属性系统把一个世界中“角色能力如何被理解”收口到 `CustomWorldProfile.attributeSchema.slots`。这六个 slot 是世界级设定,不是单个角色自己的六个字段。 + +当前结果页世界页可以展示角色维度,但编辑世界信息时只能修改世界名称、概述、基调、目标等文本,尚不能手动修订六个维度本身的信息。 + +## 2. 本次目标 + +在“编辑世界信息”独立面板中允许用户编辑六个角色维度的信息: + +1. 修改 `attributeSchema.slots` 中每个维度的 `name`、`definition`、`positiveSignals`、`negativeSignals`、`combatUseText`、`socialUseText`、`explorationUseText`。 +2. 不在可扮演角色或场景角色编辑器中新增单角色六维数值编辑。 +3. 保存时同步更新 `profile.attributeSchema`。 +4. 若 `profile.ownedSettingLayers.ruleProfile.attributeSchema` 存在,同步写入同一份 schema,避免世界档案和设定层出现双源漂移。 +5. 前端只负责编辑结构化文本,不新增属性结算逻辑。 + +## 3. 交互设计 + +入口位置: + +- 世界页点击“世界概述”里的编辑按钮 +- 打开现有“编辑世界信息”面板 +- 在基础世界文本字段下方增加“角色维度”区块 + +每个维度展示并允许编辑: + +- 维度名称 +- 定义 +- 正向信号 +- 负向信号 +- 战斗体现 +- 社交体现 +- 探索体现 + +正向信号与负向信号使用逗号、中文逗号或换行拆分成数组。 + +## 4. 数据落点 + +保存路径: + +- `profile.attributeSchema.slots[n]` +- `profile.ownedSettingLayers.ruleProfile.attributeSchema.slots[n]`,仅当 `ownedSettingLayers` 已存在时同步 + +不修改: + +- `profile.playableNpcs[n].attributeProfile` +- `profile.storyNpcs[n].attributeProfile` + +## 5. 验收 + +1. 世界信息面板能看到六个角色维度。 +2. 修改任一维度名称、定义、信号或三类用途说明后,保存到 `profile.attributeSchema.slots`。 +3. 编辑角色自身时不出现单角色六维数值输入区。 +4. UI 仍读取当前世界 schema,不回退写死旧四维文案。 diff --git a/docs/technical/RPG_WORLD_ARCHIVE_PC_LAYOUT_EXPANSION_2026-04-26.md b/docs/technical/RPG_WORLD_ARCHIVE_PC_LAYOUT_EXPANSION_2026-04-26.md new file mode 100644 index 00000000..ce1a149b --- /dev/null +++ b/docs/technical/RPG_WORLD_ARCHIVE_PC_LAYOUT_EXPANSION_2026-04-26.md @@ -0,0 +1,19 @@ +# 世界档案 PC 布局扩展(2026-04-26) + +## 背景 + +世界档案结果页和各实体编辑子面板在 PC 端仍沿用偏窄的弹窗与两列列表布局,宽屏下画布利用率不足。移动端现有单列滚动、底部弹层和触控布局已经稳定,本次不改变移动端结构。 + +## 落地规则 + +1. 世界档案主页面只在 `xl` 及以上断点扩展画布宽度与内部间距,移动端和 `sm/md/lg` 断点保持原有布局。 +2. 场景、可扮演角色、场景角色列表在 PC 端提高列数上限,让宽屏能显示更多卡片。 +3. 世界 Tab 在 PC 端由窄两列调整为更充分的三列信息布局,减少首屏纵向堆叠。 +4. 世界信息、基本设定、角色与场景编辑子面板在 PC 端使用更宽的 `max-width` 与更高可用高度;移动端仍保持 `h-[92vh]` 的底部弹层。 +5. 不新增说明类 UI 文案,不改写现有中文内容,不改变保存、删除、生成、发布等行为。 + +## 验收点 + +1. PC 端世界档案结果页内容区域能接近占满工作区宽度,列表在 2K 宽屏下可呈现更多列。 +2. PC 端打开世界、基本设定、角色、场景子面板时,弹窗宽度明显大于旧版 `sm:max-w-2xl` 默认宽度。 +3. 移动端仍为单列滚动列表,编辑子面板仍从底部弹出且宽度为全屏。 diff --git a/docs/technical/RUNTIME_NPC_CHAT_LLM_MIGRATION_2026-04-25.md b/docs/technical/RUNTIME_NPC_CHAT_LLM_MIGRATION_2026-04-25.md index db2fc956..fa70c489 100644 --- a/docs/technical/RUNTIME_NPC_CHAT_LLM_MIGRATION_2026-04-25.md +++ b/docs/technical/RUNTIME_NPC_CHAT_LLM_MIGRATION_2026-04-25.md @@ -29,6 +29,7 @@ - 单轮变化限制在 `[-3, 3]`。 5. `chatDirective.forceExitAfterTurn / closingMode=foreshadow_close` 时不生成建议,返回空数组,并在 `complete.chatDirective.forceExit` 中显式告知前端退出。 6. LLM 未配置或失败时继续返回后端兜底 SSE,保证相遇和点击聊天链路不断。 +7. 在 Node 已完成平台账号鉴权并通过内部密钥转发到 Rust API 的链路中,`/api/runtime/chat/` 必须纳入 Rust 内部转发鉴权白名单;否则 NPC 主动开场会在进入 `runtime_chat` handler 前被 401 拒绝,前端只能收到“NPC 聊天续写失败”。 ## 暂不落地 @@ -46,11 +47,14 @@ - 优先 `LlmClient.stream_text(...)` 生成 `reply_delta`。 - 再调用 `request_text(...)` 生成建议。 - 计算 `affinityDelta / affinityText / chatDirective` 后输出 `complete`。 -3. 修改 `server-rs/crates/api-server/src/main.rs` +3. 修改 `server-rs/crates/api-server/src/auth.rs` + - `allows_internal_forwarded_auth(...)` 允许 `/api/runtime/chat/`,与 big-fish、puzzle 的内部转发鉴权策略保持一致。 + - 单测覆盖 `/api/runtime/chat/npc/turn/stream`,防止后续新增 runtime 路由时再次遗漏内部转发白名单。 +4. 修改 `server-rs/crates/api-server/src/main.rs` - 注册 `runtime_chat_prompt` 模块。 ## 验收 1. `cargo fmt -p api-server` 2. `cargo check -p api-server` -3. `node scripts/check-encoding.mjs docs/technical/RUNTIME_NPC_CHAT_LLM_MIGRATION_2026-04-25.md server-rs/crates/api-server/src/runtime_chat.rs server-rs/crates/api-server/src/runtime_chat_prompt.rs server-rs/crates/api-server/src/main.rs` +3. `node scripts/check-encoding.mjs docs/technical/RUNTIME_NPC_CHAT_LLM_MIGRATION_2026-04-25.md server-rs/crates/api-server/src/auth.rs server-rs/crates/api-server/src/runtime_chat.rs server-rs/crates/api-server/src/runtime_chat_prompt.rs server-rs/crates/api-server/src/main.rs` diff --git a/docs/technical/SPACETIMEDB_MAINCLOUD_PUBLISH_2026-04-24.md b/docs/technical/SPACETIMEDB_MAINCLOUD_PUBLISH_2026-04-24.md index 2abfcf22..59f5fcb1 100644 --- a/docs/technical/SPACETIMEDB_MAINCLOUD_PUBLISH_2026-04-24.md +++ b/docs/technical/SPACETIMEDB_MAINCLOUD_PUBLISH_2026-04-24.md @@ -8,19 +8,19 @@ Maincloud 发布不复用本地 `spacetime.local.json`,避免误把本地开发库名发布到云端。需要显式提供: -| 变量 | 用途 | -| --- | --- | -| `GENARRATIVE_SPACETIME_MAINCLOUD_DATABASE` | Maincloud 数据库名,发布脚本优先读取 | +| 变量 | 用途 | +| -------------------------------------------- | ------------------------------------------------------------ | +| `GENARRATIVE_SPACETIME_MAINCLOUD_DATABASE` | Maincloud 数据库名,发布脚本优先读取 | | `GENARRATIVE_SPACETIME_MAINCLOUD_SERVER_URL` | Maincloud 服务地址,默认 `https://maincloud.spacetimedb.com` | -| `GENARRATIVE_SPACETIME_MAINCLOUD_TOKEN` | `api-server` 连接 Maincloud 时使用的 token | +| `GENARRATIVE_SPACETIME_MAINCLOUD_TOKEN` | `api-server` 连接 Maincloud 时使用的 token | 兼容 `api-server` 现有变量: -| 变量 | 用途 | -| --- | --- | -| `GENARRATIVE_SPACETIME_SERVER_URL` | `api-server` 实际连接地址 | -| `GENARRATIVE_SPACETIME_DATABASE` | `api-server` 实际连接数据库 | -| `GENARRATIVE_SPACETIME_TOKEN` | `api-server` 实际连接 token | +| 变量 | 用途 | +| ---------------------------------- | --------------------------- | +| `GENARRATIVE_SPACETIME_SERVER_URL` | `api-server` 实际连接地址 | +| `GENARRATIVE_SPACETIME_DATABASE` | `api-server` 实际连接数据库 | +| `GENARRATIVE_SPACETIME_TOKEN` | `api-server` 实际连接 token | ## npm 命令 @@ -50,10 +50,12 @@ npm run api-server:maincloud 1. 从 `.env` 与 `.env.local` 读取默认环境。 2. 将 `GENARRATIVE_SPACETIME_MAINCLOUD_*` 映射为 `api-server` 已支持的 `GENARRATIVE_SPACETIME_*`。 -3. 启动 `cargo run -p api-server --manifest-path server-rs/Cargo.toml`。 +3. 在 Windows 启动前检查 `server-rs/target/debug/api-server.exe` 对应的旧进程;如果旧进程仍在运行,先停止它,避免 Rust 编译阶段覆盖 exe 时出现 `failed to remove file ... 拒绝访问。 (os error 5)`。 +4. 启动 `cargo run -p api-server --manifest-path server-rs/Cargo.toml`。 ## 设计约束 - Maincloud 数据库名必须显式配置,不能默认读取本地 `spacetime.local.json`。 - 发布脚本只处理 SpacetimeDB 模块发布,不启动本地 SpacetimeDB。 - `api-server` 继续通过 `SpacetimeClientConfig` 的 `server_url / database / token` 连接数据库,不在前端增加逻辑。 +- Windows 进程清理只能匹配本仓库 `server-rs/target/debug/api-server.exe` 的完整路径,不能按进程名泛化清理,避免影响其他 Rust 服务。 diff --git a/logs/llm-raw/1777207823146-31804-000001-read_stream_failed.input.json b/logs/llm-raw/1777207823146-31804-000001-read_stream_failed.input.json new file mode 100644 index 00000000..1d5b16b8 --- /dev/null +++ b/logs/llm-raw/1777207823146-31804-000001-read_stream_failed.input.json @@ -0,0 +1,17 @@ +{ + "provider": "ark", + "model": "doubao-1-5-pro-32k-character-250715", + "stream": true, + "attempt": 1, + "maxTokens": null, + "messages": [ + { + "role": "system", + "content": "你是一个负责和创作者共创拼图画面的中文创意策划。\n\n你要帮助用户把一句灵感逐步收束成可以发布成拼图关卡的视觉方案。\n\n你必须同时输出:\n1. 一段直接发给用户的中文回复 replyText\n2. 当前进度 progressPercent\n3. 下一轮完整可用的 nextAnchorPack\n\n硬约束:\n1. 只能输出 JSON,不能输出代码块或解释\n2. nextAnchorPack 必须是完整对象,不能只输出 patch\n3. replyText 必须是自然中文,不能提“字段”“锚点”“结构”“JSON”等内部词\n4. replyText 一次最多推进一个最关键问题\n5. 如果用户已经给出明确方向,就优先吸收和收束,不要机械反问\n6. progressPercent 范围只能是 0 到 100\n7. status 只能使用 missing / inferred / confirmed / locked\n\n\n模板目标:收束成可以发布为拼图关卡的视觉方案。\n\n本模板只通过以下锚点问题体现差异:\n1. 题材承诺(themePromise / 拼图共创):这张拼图给玩家的题材和完成期待是什么?;达成效果:明确拼图主题、辨识度和完成后的满足感。\n2. 画面主体(visualSubject / 拼图共创):画面中最需要被玩家一眼看懂的主体是什么?;达成效果:明确主体、层级和可被切片识别的形状。\n3. 视觉气质(visualMood / 拼图共创):整体色彩、光线、情绪和美术风格是什么?;达成效果:收束画面风格,避免结果图风格漂移。\n4. 拼图记忆点(compositionHooks / 拼图共创):哪些构图、纹理或局部细节会成为玩家拼接线索?;达成效果:提供适合拼图玩法的边缘、块面和局部记忆点。\n5. 标签与禁忌(tagsAndForbidden / 拼图共创):需要保留哪些关键词,又必须避开什么内容?;达成效果:锁定生成标签和负向约束。\n\n用户刚刚主动要求你自动补充剩余关键字。\n\n这表示用户接受你基于当前方向自行补完仍缺失的关键设定:当前题材方向里的拼图关键词\n\n本轮要求:\n1. 不要再继续提问\n2. 不要要求用户再提供素材、风格或禁忌\n3. 必须保留已有已确认内容,并直接补齐缺失或仍为空的关键项\n4. 对你自行推断补齐的项,应标记或表达为系统推断;已有明确内容继续保持确认或锁定状态\n5. progressPercent 直接输出为 100\n6. 输出完整 nextAnchorPack,直接补齐 value 为空或 status 为 missing 的项\n7. replyText 只做简短完成说明,引导用户可以生成结果页,不能出现问号\n\n当前是第 3 轮,当前进度 10% 。\n\n是否要求自动补充剩余关键字:是\n\n当前 anchor pack:\n{\n \"theme_promise\": {\n \"key\": \"themePromise\",\n \"label\": \"题材承诺\",\n \"value\": \"可爱小狗的温馨瞬间\",\n \"status\": \"Missing\"\n },\n \"visual_subject\": {\n \"key\": \"visualSubject\",\n \"label\": \"画面主体\",\n \"value\": \"\",\n \"status\": \"Missing\"\n },\n \"visual_mood\": {\n \"key\": \"visualMood\",\n \"label\": \"视觉气质\",\n \"value\": \"\",\n \"status\": \"Missing\"\n },\n \"composition_hooks\": {\n \"key\": \"compositionHooks\",\n \"label\": \"拼图记忆点\",\n \"value\": \"\",\n \"status\": \"Missing\"\n },\n \"tags_and_forbidden\": {\n \"key\": \"tagsAndForbidden\",\n \"label\": \"标签与禁忌\",\n \"value\": \"\",\n \"status\": \"Missing\"\n }\n}\n\n最近聊天记录:\n[\n {\n \"content\": \"先告诉我你想做一张什么样的拼图图像,我会帮你收束成可发布的题材锚点。\",\n \"kind\": \"chat\",\n \"role\": \"assistant\"\n },\n {\n \"content\": \"可爱小狗\",\n \"kind\": \"chat\",\n \"role\": \"user\"\n },\n {\n \"content\": \"可爱小狗确实是很受欢迎的拼图主题,那你希望这张拼图里的小狗在做什么呢?是玩耍、睡觉,还是其他的状态?\",\n \"kind\": \"chat\",\n \"role\": \"assistant\"\n },\n {\n \"content\": \"请补充剩余设定。\",\n \"kind\": \"chat\",\n \"role\": \"user\"\n }\n]\n\n请严格按以下 JSON 输出,不要输出其他文字:\n{\n \"replyText\": \"\",\n \"progressPercent\": 0,\n \"nextAnchorPack\": {\n \"themePromise\": {\n \"key\": \"themePromise\",\n \"label\": \"题材承诺\",\n \"value\": \"\",\n \"status\": \"missing\"\n },\n \"visualSubject\": {\n \"key\": \"visualSubject\",\n \"label\": \"画面主体\",\n \"value\": \"\",\n \"status\": \"missing\"\n },\n \"visualMood\": {\n \"key\": \"visualMood\",\n \"label\": \"视觉气质\",\n \"value\": \"\",\n \"status\": \"missing\"\n },\n \"compositionHooks\": {\n \"key\": \"compositionHooks\",\n \"label\": \"拼图记忆点\",\n \"value\": \"\",\n \"status\": \"missing\"\n },\n \"tagsAndForbidden\": {\n \"key\": \"tagsAndForbidden\",\n \"label\": \"标签与禁忌\",\n \"value\": \"\",\n \"status\": \"missing\"\n }\n }\n}" + }, + { + "role": "user", + "content": "请按约定输出这一轮的 JSON。" + } + ] +} \ No newline at end of file diff --git a/logs/llm-raw/1777207823146-31804-000001-read_stream_failed.output.txt b/logs/llm-raw/1777207823146-31804-000001-read_stream_failed.output.txt new file mode 100644 index 00000000..16034468 --- /dev/null +++ b/logs/llm-raw/1777207823146-31804-000001-read_stream_failed.output.txt @@ -0,0 +1,536 @@ +data: {"choices":[{"delta":{"content":"{","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\n","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" ","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"reply","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"Text","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\":","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"好","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"的","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":",","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"根据","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"你的","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"要求","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":",","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"我","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"为","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"你","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"补齐","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"了","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"拼图","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"的","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"设定","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"。","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"主题","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"是","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"‘","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"可爱","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"小狗","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"的","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"温馨","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"瞬间","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"’","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":",","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"画面","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"主体","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"是","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"一只","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"正在","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"打","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"盹","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"的","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"金毛","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"犬","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":",","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"躺在","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"柔软","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"的","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"地毯","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"上","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":",","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"旁边","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"有","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"一个","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"毛绒","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"玩具","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"。","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"视觉","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"气质","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"是","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"温暖","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"、","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"柔和","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"的","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"色调","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":",","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"整体","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"给","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"人","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"一种","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"温馨","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"、","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"舒适","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"的","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"感觉","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"。","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"拼图","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"记忆","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"点","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"可以","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"是","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"小狗","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"的","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"轮廓","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"、","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"毛发","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"纹理","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"、","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"玩具","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"的","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"形状","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"和","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"颜色","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"等","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"。","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"标签","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"为","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"‘","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"小狗","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"’","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"‘","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"温馨","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"’","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"‘","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"可爱","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"’","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":",","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"禁忌","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"是","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"避免","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"出现","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"血腥","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"、","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"暴力","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"、","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"恐怖","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"等","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"内容","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"。","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"你","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"可以","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"根据","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"这些","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"设定","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"生成","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"结果","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"页","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"了","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"。","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\",","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\n","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" ","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"progress","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"Percent","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\":","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" ","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"1","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"0","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"0","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":",","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\n","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" ","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"next","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"Anchor","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"Pack","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\":","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" {","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\n","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" ","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"theme","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"Promise","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\":","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" {","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\n","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" ","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"key","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\":","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"theme","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"Promise","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\",","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\n","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" ","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"label","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\":","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"题材","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"承诺","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\",","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\n","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" ","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"value","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\":","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"可爱","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"小狗","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"的","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"温馨","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"瞬间","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\",","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\n","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" ","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"status","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\":","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"confirmed","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\n","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" ","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" },","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\n","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" ","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"visual","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"Subject","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\":","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" {","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\n","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" ","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"key","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\":","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"visual","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"Subject","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\",","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\n","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" ","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"label","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\":","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"画面","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"主体","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\",","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\n","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" ","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"value","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\":","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"一只","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"正在","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"打","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"盹","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"的","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"金毛","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"犬","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":",","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"躺在","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"柔软","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"的","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"地毯","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"上","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":",","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"旁边","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"有","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"一个","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"毛绒","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"玩具","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\",","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\n","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" ","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"status","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\":","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"confirmed","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\n","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" ","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" },","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\n","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" ","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" \"","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"visual","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"M","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"ood","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\":","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":" {","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + +data: {"choices":[{"delta":{"content":"\n","role":"assistant"},"index":0}],"created":1777207793,"id":"02177720779340786f58f29daee4140bdf4a6e6f2c9a77d870731","model":"doubao-1-5-pro-32k-character-250715","service_tier":"default","object":"chat.completion.chunk","usage":null} + diff --git a/scripts/api-server-maincloud.mjs b/scripts/api-server-maincloud.mjs index 09688655..c84f9994 100644 --- a/scripts/api-server-maincloud.mjs +++ b/scripts/api-server-maincloud.mjs @@ -1,8 +1,12 @@ -import {spawn} from 'node:child_process'; -import {existsSync, readFileSync} from 'node:fs'; -import {resolve} from 'node:path'; +import { execFileSync, spawn } from 'node:child_process'; +import { existsSync, readFileSync } from 'node:fs'; +import { resolve } from 'node:path'; const repoRoot = process.cwd(); +const apiServerExePath = resolve( + repoRoot, + 'server-rs/target/debug/api-server.exe', +); function loadEnvFile(path, target) { if (!existsSync(path)) { @@ -30,7 +34,7 @@ function loadEnvFile(path, target) { } } -const mergedEnv = {...process.env}; +const mergedEnv = { ...process.env }; loadEnvFile(resolve(repoRoot, '.env'), mergedEnv); loadEnvFile(resolve(repoRoot, '.env.local'), mergedEnv); @@ -56,6 +60,50 @@ if (!mergedEnv.GENARRATIVE_SPACETIME_DATABASE) { process.exit(1); } +function stopExistingWindowsApiServer() { + if (process.platform !== 'win32') { + return; + } + + // Windows 下 cargo 重新编译时无法覆盖仍在运行的 exe,只清理本仓库 target 内的旧进程。 + const command = [ + '$target = [System.IO.Path]::GetFullPath($env:GENARRATIVE_API_SERVER_EXE_TARGET)', + '$processes = Get-Process -Name api-server -ErrorAction SilentlyContinue | Where-Object {', + ' $_.Path -and ([System.IO.Path]::GetFullPath($_.Path) -ieq $target)', + '}', + 'foreach ($process in $processes) {', + ' Stop-Process -Id $process.Id -Force', + ' Wait-Process -Id $process.Id -Timeout 5 -ErrorAction SilentlyContinue', + ' Write-Output $process.Id', + '}', + ].join('\n'); + + const output = execFileSync( + 'powershell.exe', + ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command', command], + { + encoding: 'utf8', + env: { + ...process.env, + GENARRATIVE_API_SERVER_EXE_TARGET: apiServerExePath, + }, + }, + ).trim(); + + if (output) { + console.log(`[api-server:maincloud] 已停止旧 api-server 进程: ${output}`); + } +} + +try { + stopExistingWindowsApiServer(); +} catch (error) { + console.error( + `[api-server:maincloud] 清理旧 api-server 进程失败: ${error.message}`, + ); + process.exit(1); +} + console.log( `[api-server:maincloud] SpacetimeDB ${mergedEnv.GENARRATIVE_SPACETIME_DATABASE} @ ${mergedEnv.GENARRATIVE_SPACETIME_SERVER_URL}`, ); @@ -67,7 +115,6 @@ const child = spawn( cwd: repoRoot, env: mergedEnv, stdio: 'inherit', - shell: process.platform === 'win32', }, ); diff --git a/server-rs/crates/api-server/src/app.rs b/server-rs/crates/api-server/src/app.rs index e16e2ddc..4323ea3b 100644 --- a/server-rs/crates/api-server/src/app.rs +++ b/server-rs/crates/api-server/src/app.rs @@ -23,7 +23,7 @@ use crate::{ }, assets::{ bind_asset_object_to_entity, confirm_asset_object, create_direct_upload_ticket, - create_sts_upload_credentials, get_asset_read_url, + create_sts_upload_credentials, get_asset_history, get_asset_read_url, }, auth::{ attach_refresh_session_token, inspect_auth_claims, inspect_refresh_session_cookie, @@ -394,6 +394,13 @@ pub fn build_router(state: AppState) -> Router { get(get_character_workflow_cache), ) .route("/api/assets/read-url", get(get_asset_read_url)) + .route( + "/api/assets/history", + get(get_asset_history).route_layer(middleware::from_fn_with_state( + state.clone(), + require_bearer_auth, + )), + ) .route( "/api/runtime/settings", get(get_runtime_settings) diff --git a/server-rs/crates/api-server/src/assets.rs b/server-rs/crates/api-server/src/assets.rs index f26c0291..122e26e1 100644 --- a/server-rs/crates/api-server/src/assets.rs +++ b/server-rs/crates/api-server/src/assets.rs @@ -14,10 +14,11 @@ use platform_oss::{ }; use serde_json::{Value, json}; use shared_contracts::assets::{ - AssetBindingPayload, AssetObjectPayload, AssetReadUrlPayload, BindAssetObjectRequest, - BindAssetObjectResponse, ConfirmAssetObjectAccessPolicy, ConfirmAssetObjectRequest, - ConfirmAssetObjectResponse, CreateDirectUploadTicketRequest, CreateDirectUploadTicketResponse, - DirectUploadTicketPayload, GetAssetReadUrlResponse, GetReadUrlQuery, + AssetBindingPayload, AssetHistoryEntryPayload, AssetHistoryListResponse, AssetHistoryQuery, + AssetObjectPayload, AssetReadUrlPayload, BindAssetObjectRequest, BindAssetObjectResponse, + ConfirmAssetObjectAccessPolicy, ConfirmAssetObjectRequest, ConfirmAssetObjectResponse, + CreateDirectUploadTicketRequest, CreateDirectUploadTicketResponse, DirectUploadTicketPayload, + GetAssetReadUrlResponse, GetReadUrlQuery, }; use spacetime_client::SpacetimeClientError; @@ -111,6 +112,51 @@ pub async fn get_asset_read_url( )) } +pub async fn get_asset_history( + State(state): State, + Extension(request_context): Extension, + Query(query): Query, +) -> Result, AppError> { + let asset_kind = query.kind.trim().to_string(); + if asset_kind != "character_visual" && asset_kind != "scene_image" { + return Err( + AppError::from_status(StatusCode::BAD_REQUEST).with_details(json!({ + "field": "kind", + "message": "历史素材类型只支持 character_visual 或 scene_image", + })), + ); + } + + let entries = state + .spacetime_client() + .list_asset_history(module_assets::AssetHistoryListInput { + asset_kind, + limit: query.limit.unwrap_or(120).clamp(1, 120), + }) + .await + .map_err(map_confirm_asset_object_error)?; + + Ok(json_success_body( + Some(&request_context), + AssetHistoryListResponse { + assets: entries + .into_iter() + .map(|entry| AssetHistoryEntryPayload { + owner_label: format_asset_owner_label(entry.owner_user_id.as_deref()), + asset_object_id: entry.asset_object_id, + asset_kind: entry.asset_kind, + image_src: entry.image_src, + owner_user_id: entry.owner_user_id, + profile_id: entry.profile_id, + entity_id: entry.entity_id, + created_at: entry.created_at, + updated_at: entry.updated_at, + }) + .collect(), + }, + )) +} + pub async fn create_sts_upload_credentials( Extension(_request_context): Extension, ) -> Result, AppError> { @@ -232,6 +278,16 @@ fn resolve_object_key_from_query(query: &GetReadUrlQuery) -> Option { .map(|value| value.trim_start_matches('/').to_string()) } +fn format_asset_owner_label(owner_user_id: Option<&str>) -> String { + let Some(owner_user_id) = owner_user_id + .map(str::trim) + .filter(|value| !value.is_empty()) + else { + return "未记录账号".to_string(); + }; + format!("账号 {owner_user_id}") +} + async fn build_confirm_asset_object_upsert_input( oss_client: &platform_oss::OssClient, payload: ConfirmAssetObjectRequest, diff --git a/server-rs/crates/api-server/src/auth.rs b/server-rs/crates/api-server/src/auth.rs index 6184ea85..080b617c 100644 --- a/server-rs/crates/api-server/src/auth.rs +++ b/server-rs/crates/api-server/src/auth.rs @@ -189,7 +189,9 @@ fn extract_bearer_token(headers: &HeaderMap) -> Result { fn allows_internal_forwarded_auth(path: &str) -> bool { // Node 代理已经完成平台账号 JWT 校验,Rust 运行时只信任这些明确的内部转发路径。 - path.starts_with("/api/runtime/big-fish/") || path.starts_with("/api/runtime/puzzle/") + path.starts_with("/api/runtime/big-fish/") + || path.starts_with("/api/runtime/chat/") + || path.starts_with("/api/runtime/puzzle/") } fn try_build_internal_forwarded_claims( @@ -282,6 +284,9 @@ mod tests { assert!(allows_internal_forwarded_auth( "/api/runtime/big-fish/sessions" )); + assert!(allows_internal_forwarded_auth( + "/api/runtime/chat/npc/turn/stream" + )); assert!(allows_internal_forwarded_auth("/api/runtime/puzzle/works")); assert!(!allows_internal_forwarded_auth("/api/auth/me")); } diff --git a/server-rs/crates/api-server/src/custom_world_foundation_draft.rs b/server-rs/crates/api-server/src/custom_world_foundation_draft.rs index b67db3f2..e5bb9c21 100644 --- a/server-rs/crates/api-server/src/custom_world_foundation_draft.rs +++ b/server-rs/crates/api-server/src/custom_world_foundation_draft.rs @@ -75,7 +75,7 @@ pub async fn generate_custom_world_foundation_draft( .await?; framework["storyNpcs"] = JsonValue::Array(story_outlines.clone()); - let landmarks = generate_foundation_landmark_seed_entries( + let generated_scene_entries = generate_foundation_landmark_seed_entries( llm_client, &framework, FOUNDATION_DRAFT_LANDMARK_COUNT, @@ -83,7 +83,7 @@ pub async fn generate_custom_world_foundation_draft( &mut on_progress, ) .await?; - framework["landmarks"] = JsonValue::Array(landmarks.clone()); + framework["landmarks"] = JsonValue::Array(generated_scene_entries.clone()); let playable_narrative = expand_foundation_role_entries( llm_client, @@ -137,7 +137,7 @@ pub async fn generate_custom_world_foundation_draft( framework, playable_detailed, story_detailed, - landmarks, + generated_scene_entries, session, setting_text.as_str(), ); @@ -304,6 +304,7 @@ async fn generate_foundation_landmark_seed_entries( } let batch_count = (total_count - merged_entries.len()).min(FOUNDATION_LANDMARK_BATCH_SIZE); let forbidden_names = names_from_entries(&merged_entries); + let is_opening_batch = batch_index == 0 && merged_entries.is_empty(); emit_foundation_draft_progress( on_progress, "生成关键场景", @@ -319,13 +320,19 @@ async fn generate_foundation_landmark_seed_entries( ); let raw = request_foundation_json_stage( llm_client, - build_custom_world_landmark_seed_batch_prompt(framework, batch_count, &forbidden_names), + build_custom_world_landmark_seed_batch_prompt( + framework, + batch_count, + &forbidden_names, + is_opening_batch, + ), format!("agent-foundation-landmark-seed-batch-{}", batch_index + 1).as_str(), |response_text| { build_custom_world_landmark_seed_batch_json_repair_prompt( response_text, batch_count, &forbidden_names, + is_opening_batch, ) }, format!( @@ -714,7 +721,7 @@ fn build_foundation_draft_profile_from_framework( framework: JsonValue, playable_detailed: Vec, story_detailed: Vec, - landmarks: Vec, + generated_scene_entries: Vec, session: &CustomWorldAgentSessionRecord, setting_text: &str, ) -> JsonMap { @@ -793,9 +800,14 @@ fn build_foundation_draft_profile_from_framework( setting_text, ), ); - let camp = framework.get("camp").cloned().unwrap_or_else( + let fallback_camp = framework.get("camp").cloned().unwrap_or_else( || json!({ "name": "开局归处", "description": "玩家进入世界后的第一处落脚点。" }), ); + let playable_detailed = assign_role_ids(playable_detailed, "playable-npc"); + let story_detailed = assign_role_ids(story_detailed, "story-npc"); + let scene_role_refs = collect_scene_role_refs(&story_detailed); + let (camp, landmarks) = + split_generated_scenes_into_camp_and_landmarks(fallback_camp, generated_scene_entries); object.insert("camp".to_string(), camp.clone()); object.insert( "playableNpcs".to_string(), @@ -803,7 +815,7 @@ fn build_foundation_draft_profile_from_framework( ); object.insert("storyNpcs".to_string(), JsonValue::Array(story_detailed)); let scene_chapter_blueprints = - build_scene_chapter_blueprints_from_camp_and_landmarks(&camp, &landmarks); + build_scene_chapter_blueprints_from_camp_and_landmarks(&camp, &landmarks, &scene_role_refs); object.insert("landmarks".to_string(), JsonValue::Array(landmarks)); object.insert("chapters".to_string(), JsonValue::Array(Vec::new())); object.insert( @@ -1095,9 +1107,50 @@ fn stable_ascii_slug(value: &str) -> String { format!("{hash:08x}") } +fn split_generated_scenes_into_camp_and_landmarks( + fallback_camp: JsonValue, + generated_scene_entries: Vec, +) -> (JsonValue, Vec) { + let mut entries = generated_scene_entries.into_iter(); + let opening_scene = entries.next().unwrap_or(fallback_camp); + let camp = normalize_generated_opening_scene(opening_scene); + let landmarks = entries.collect::>(); + (camp, landmarks) +} + +fn normalize_generated_opening_scene(scene: JsonValue) -> JsonValue { + let mut object = scene.as_object().cloned().unwrap_or_default(); + let name = object + .get("name") + .and_then(JsonValue::as_str) + .map(str::trim) + .filter(|value| !value.is_empty()) + .unwrap_or("开局归处") + .to_string(); + let description = object + .get("description") + .and_then(JsonValue::as_str) + .map(str::trim) + .filter(|value| !value.is_empty()) + .unwrap_or("玩家进入世界后的第一处落脚点。") + .to_string(); + object.insert("id".to_string(), JsonValue::String("camp-1".to_string())); + object.insert("kind".to_string(), JsonValue::String("camp".to_string())); + object.insert("name".to_string(), JsonValue::String(name)); + object.insert("description".to_string(), JsonValue::String(description)); + JsonValue::Object(object) +} + +#[derive(Clone, Debug, PartialEq, Eq)] +struct SceneRoleRef { + id: String, + name: String, +} + fn build_scene_chapter_blueprints_from_camp_and_landmarks( camp: &JsonValue, landmarks: &[JsonValue], + scene_role_refs: &[SceneRoleRef], ) -> Vec { let mut blueprints = Vec::with_capacity(landmarks.len() + 1); blueprints.push(build_scene_chapter_blueprint_from_scene( @@ -1105,12 +1158,19 @@ fn build_scene_chapter_blueprints_from_camp_and_landmarks( 0, "camp", "开局归处", + scene_role_refs, + )); + blueprints.extend(build_scene_chapter_blueprints_from_landmarks( + landmarks, + scene_role_refs, )); - blueprints.extend(build_scene_chapter_blueprints_from_landmarks(landmarks)); blueprints } -fn build_scene_chapter_blueprints_from_landmarks(landmarks: &[JsonValue]) -> Vec { +fn build_scene_chapter_blueprints_from_landmarks( + landmarks: &[JsonValue], + scene_role_refs: &[SceneRoleRef], +) -> Vec { // 幕背景描述必须来自关键场景生成步骤,不能在草稿合成阶段再用规则句拼接。 landmarks .iter() @@ -1121,6 +1181,7 @@ fn build_scene_chapter_blueprints_from_landmarks(landmarks: &[JsonValue]) -> Vec chapter_index, "saved-landmark", "关键场景", + scene_role_refs, ) }) .collect() @@ -1131,6 +1192,7 @@ fn build_scene_chapter_blueprint_from_scene( chapter_index: usize, id_prefix: &str, fallback_name_prefix: &str, + scene_role_refs: &[SceneRoleRef], ) -> JsonValue { let scene_name = json_text(scene, "name") .unwrap_or_else(|| format!("{}{}", fallback_name_prefix, chapter_index + 1)); @@ -1144,6 +1206,13 @@ fn build_scene_chapter_blueprint_from_scene( let act_npc_names = json_string_array(scene, "actNPCNames") .or_else(|| json_string_array(scene, "sceneNpcNames")) .unwrap_or_default(); + let resolved_act_roles = resolve_scene_act_roles(&act_npc_names, scene_role_refs); + let scene_npc_ids = dedupe_text_values( + &resolved_act_roles + .iter() + .map(|role| role.id.clone()) + .collect::>(), + ); json!({ "id": scene_id.clone(), @@ -1152,13 +1221,14 @@ fn build_scene_chapter_blueprint_from_scene( "summary": summary, "sceneTaskDescription": scene_task_description, "linkedLandmarkIds": [scene_id.clone()], + "sceneNpcIds": scene_npc_ids, "acts": (0..3) .map(|act_index| build_scene_act_blueprint_from_landmark( &scene_id, &summary, &act_prompts, &act_events, - &act_npc_names, + &resolved_act_roles, act_index, )) .collect::>(), @@ -1170,7 +1240,7 @@ fn build_scene_act_blueprint_from_landmark( scene_summary: &str, act_prompts: &[String], act_events: &[String], - act_npc_names: &[String], + act_roles: &[SceneRoleRef], act_index: usize, ) -> JsonValue { let act_title = if act_index == 0 { @@ -1184,10 +1254,17 @@ fn build_scene_act_blueprint_from_landmark( .map(str::trim) .filter(|value| !value.is_empty()) .map(ToOwned::to_owned); - let opposite_npc_id = act_npc_names + let opposite_role = act_roles .get(act_index) - .or_else(|| act_npc_names.first()) - .cloned() + .or_else(|| act_roles.first()) + .cloned(); + let opposite_npc_id = opposite_role + .as_ref() + .map(|role| role.id.clone()) + .unwrap_or_default(); + let opposite_role_name = opposite_role + .as_ref() + .map(|role| role.name.clone()) .unwrap_or_default(); let event_description = act_events .get(act_index) @@ -1196,12 +1273,16 @@ fn build_scene_act_blueprint_from_landmark( .filter(|value| !value.is_empty()) .map(ToOwned::to_owned) .unwrap_or_else(|| { - build_default_act_event_description(scene_summary, opposite_npc_id.as_str(), act_index) + build_default_act_event_description( + scene_summary, + opposite_role_name.as_str(), + act_index, + ) }); let background_prompt = prompt.unwrap_or_else(|| { build_default_act_background_prompt( scene_summary, - opposite_npc_id.as_str(), + opposite_role_name.as_str(), event_description.as_str(), act_index, ) @@ -1212,21 +1293,23 @@ fn build_scene_act_blueprint_from_landmark( "title": act_title, "summary": scene_summary, "backgroundPromptText": background_prompt, - "encounterNpcIds": build_act_encounter_npc_ids(act_npc_names, opposite_npc_id.as_str()), + "encounterNpcIds": build_act_encounter_npc_ids(act_roles, opposite_npc_id.as_str()), "primaryNpcId": opposite_npc_id, "oppositeNpcId": opposite_npc_id, + "primaryRoleName": opposite_role_name, + "oppositeRoleName": opposite_role_name, "eventDescription": event_description, }) } -fn build_act_encounter_npc_ids(act_npc_names: &[String], primary_npc_id: &str) -> Vec { - let mut names = Vec::with_capacity(act_npc_names.len().max(1)); +fn build_act_encounter_npc_ids(act_roles: &[SceneRoleRef], primary_npc_id: &str) -> Vec { + let mut names = Vec::with_capacity(act_roles.len().max(1)); let primary = primary_npc_id.trim(); if !primary.is_empty() { names.push(primary.to_string()); } - for name in act_npc_names { - let normalized = name.trim(); + for role in act_roles { + let normalized = role.id.trim(); if normalized.is_empty() || names.iter().any(|item| item == normalized) { continue; } @@ -1235,6 +1318,98 @@ fn build_act_encounter_npc_ids(act_npc_names: &[String], primary_npc_id: &str) - names } +fn assign_role_ids(entries: Vec, id_prefix: &str) -> Vec { + entries + .into_iter() + .enumerate() + .map(|(index, entry)| assign_role_id(entry, id_prefix, index)) + .collect() +} + +fn assign_role_id(mut entry: JsonValue, id_prefix: &str, index: usize) -> JsonValue { + let name = json_text(&entry, "name").unwrap_or_else(|| format!("角色{}", index + 1)); + let fallback_id = format!("{}-{}", id_prefix, stable_ascii_slug(name.as_str())); + let Some(object) = entry.as_object_mut() else { + return json!({ + "id": fallback_id, + "name": name, + }); + }; + if object + .get("id") + .and_then(JsonValue::as_str) + .map(str::trim) + .is_none_or(str::is_empty) + { + object.insert("id".to_string(), JsonValue::String(fallback_id)); + } + entry +} + +fn collect_scene_role_refs(entries: &[JsonValue]) -> Vec { + entries + .iter() + .filter_map(|entry| { + let name = json_text(entry, "name")?; + let id = json_text(entry, "id")?; + Some(SceneRoleRef { id, name }) + }) + .collect() +} + +fn resolve_scene_act_roles( + requested_role_names: &[String], + scene_role_refs: &[SceneRoleRef], +) -> Vec { + let mut resolved = requested_role_names + .iter() + .filter_map(|name| resolve_scene_role_ref(name, scene_role_refs)) + .collect::>(); + if resolved.is_empty() { + resolved.extend(scene_role_refs.iter().take(3).cloned()); + } + dedupe_scene_role_refs(resolved) +} + +fn resolve_scene_role_ref( + name_or_id: &str, + scene_role_refs: &[SceneRoleRef], +) -> Option { + let normalized = name_or_id.trim(); + if normalized.is_empty() { + return None; + } + scene_role_refs + .iter() + .find(|role| role.name == normalized || role.id == normalized) + .cloned() +} + +fn dedupe_scene_role_refs(entries: Vec) -> Vec { + let mut seen = Vec::new(); + let mut result = Vec::new(); + for entry in entries { + if entry.id.trim().is_empty() || seen.iter().any(|id| id == &entry.id) { + continue; + } + seen.push(entry.id.clone()); + result.push(entry); + } + result +} + +fn dedupe_text_values(values: &[String]) -> Vec { + let mut result = Vec::new(); + for value in values { + let normalized = value.trim(); + if normalized.is_empty() || result.iter().any(|item| item == normalized) { + continue; + } + result.push(normalized.to_string()); + } + result +} + fn build_default_scene_task_description(scene_name: &str, scene_summary: &str) -> String { if scene_summary.trim().is_empty() { return format!( @@ -1374,66 +1549,15 @@ fn normalize_framework_shape(framework: &mut JsonValue, setting_text: &str) { "description".to_string(), JsonValue::String(camp_description.clone()), ); - if !camp - .get("sceneTaskDescription") - .and_then(JsonValue::as_str) - .map(str::trim) - .is_some_and(|value| !value.is_empty()) - { - camp.insert( - "sceneTaskDescription".to_string(), - JsonValue::String(build_default_scene_task_description( - camp_name.as_str(), - camp_description.as_str(), - )), - ); - } - if !camp - .get("actBackgroundPromptTexts") - .and_then(JsonValue::as_array) - .is_some_and(|items| items.len() == 3) - { - // 中文注释:开局场景也必须进入逐幕生图队列;模型漏字段时用 camp 信息生成可用的三幕画面描述。 - camp.insert( - "actBackgroundPromptTexts".to_string(), - JsonValue::Array( - (0..3) - .map(|index| { - let event_description = build_default_act_event_description( - camp_description.as_str(), - "开局关键角色", - index, - ); - JsonValue::String(build_default_act_background_prompt( - camp_description.as_str(), - "开局关键角色", - event_description.as_str(), - index, - )) - }) - .collect(), - ), - ); - } - if !camp - .get("actEventDescriptions") - .and_then(JsonValue::as_array) - .is_some_and(|items| items.len() == 3) - { - camp.insert( - "actEventDescriptions".to_string(), - JsonValue::Array( - (0..3) - .map(|index| { - JsonValue::String(build_default_act_event_description( - camp_description.as_str(), - "开局关键角色", - index, - )) - }) - .collect(), - ), - ); + // 中文注释:framework 只保留开局归处占位;完整开局场景任务与三幕内容统一交给场景批生成阶段。 + for generated_scene_key in [ + "sceneTaskDescription", + "actBackgroundPromptTexts", + "actEventDescriptions", + "actNPCNames", + "sceneNpcNames", + ] { + camp.remove(generated_scene_key); } } } @@ -2024,7 +2148,18 @@ mod tests { "actNPCNames": ["灯童丁", "档吏庚", "灯童丁"] })]; - let blueprints = build_scene_chapter_blueprints_from_landmarks(&landmarks); + let scene_role_refs = vec![ + SceneRoleRef { + id: "story-npc-lamp-child".to_string(), + name: "灯童丁".to_string(), + }, + SceneRoleRef { + id: "story-npc-archive-clerk".to_string(), + name: "档吏庚".to_string(), + }, + ]; + let blueprints = + build_scene_chapter_blueprints_from_landmarks(&landmarks, &scene_role_refs); let acts = blueprints[0] .get("acts") .and_then(JsonValue::as_array) @@ -2043,10 +2178,23 @@ mod tests { "首次进入雾港码头时,查明黑潮船骨与灯童丁目击证词的关联。" )) ); - assert_eq!(acts[0].get("oppositeNpcId"), Some(&json!("灯童丁"))); - assert_eq!(acts[0].get("primaryNpcId"), Some(&json!("灯童丁"))); - assert_eq!(acts[1].get("oppositeNpcId"), Some(&json!("档吏庚"))); - assert_eq!(acts[1].get("primaryNpcId"), Some(&json!("档吏庚"))); + assert_eq!( + acts[0].get("oppositeNpcId"), + Some(&json!("story-npc-lamp-child")) + ); + assert_eq!( + acts[0].get("primaryNpcId"), + Some(&json!("story-npc-lamp-child")) + ); + assert_eq!(acts[0].get("primaryRoleName"), Some(&json!("灯童丁"))); + assert_eq!( + acts[1].get("oppositeNpcId"), + Some(&json!("story-npc-archive-clerk")) + ); + assert_eq!( + acts[1].get("primaryNpcId"), + Some(&json!("story-npc-archive-clerk")) + ); assert_eq!( acts[0].get("eventDescription"), Some(&json!( @@ -2081,7 +2229,16 @@ mod tests { "actBackgroundPromptTexts": ["斗技台晨雾未散,石阶旁少年们列队观望。", "木桩与兵器架围出训练区,族徽旗帜在风里猎猎。", "暮色压下斗技场,中央擂台留出一对一交锋空间。"] })]; - let blueprints = build_scene_chapter_blueprints_from_camp_and_landmarks(camp, &landmarks); + let scene_role_refs = vec![SceneRoleRef { + id: "story-npc-mentor".to_string(), + name: "药师长老".to_string(), + }]; + + let blueprints = build_scene_chapter_blueprints_from_camp_and_landmarks( + camp, + &landmarks, + &scene_role_refs, + ); let opening_chapter = &blueprints[0]; let opening_acts = opening_chapter .get("acts") @@ -2106,6 +2263,18 @@ mod tests { .and_then(JsonValue::as_str) .is_some_and(|value| !value.trim().is_empty()) })); + assert!(opening_acts.iter().all(|act| { + act.get("primaryNpcId") + .and_then(JsonValue::as_str) + .is_some_and(|value| value == "story-npc-mentor") + })); + assert!(opening_acts.iter().all(|act| { + act.get("encounterNpcIds") + .and_then(JsonValue::as_array) + .and_then(|items| items.first()) + .and_then(JsonValue::as_str) + .is_some_and(|value| value == "story-npc-mentor") + })); assert_eq!(blueprints.len(), 2); } @@ -2377,7 +2546,11 @@ mod tests { assert!(request_text.contains("attributeSchema")); assert!(request_text.contains("可扮演角色框架名单")); assert!(request_text.contains("场景角色框架名单")); - assert!(request_text.contains("关键场景框架名单")); + assert!(request_text.contains("场景框架名单")); + assert!(request_text.contains("第一条场景必须是玩家进入世界时所在的开局场景")); + assert!(request_text.contains("camp 只表示玩家开局时的落脚处占位")); + assert!(!request_text.contains("camp.sceneTaskDescription")); + assert!(!request_text.contains("camp.actBackgroundPromptTexts")); assert!(request_text.contains("actNPCNames")); assert!(!request_text.contains("\"sceneNpcNames\"")); assert!(request_text.contains("connectedLandmarkNames")); @@ -2434,6 +2607,43 @@ mod tests { .and_then(JsonValue::as_str) .is_some() ); + assert_eq!( + draft_profile + .get("camp") + .and_then(|entry| entry.get("name")) + .and_then(JsonValue::as_str), + Some("旧灯塔") + ); + assert_eq!( + draft_profile + .get("camp") + .and_then(|entry| entry.get("id")) + .and_then(JsonValue::as_str), + Some("camp-1") + ); + assert_eq!( + draft_profile + .get("camp") + .and_then(|entry| entry.get("sceneTaskDescription")) + .and_then(JsonValue::as_str), + Some("首次进入旧灯塔时,追查被篡改的灯火航线记录。") + ); + assert_eq!( + draft_profile + .get("landmarks") + .and_then(JsonValue::as_array) + .map(Vec::len), + Some(1) + ); + assert_eq!( + draft_profile + .get("landmarks") + .and_then(JsonValue::as_array) + .and_then(|entries| entries.first()) + .and_then(|entry| entry.get("name")) + .and_then(JsonValue::as_str), + Some("沉船湾") + ); assert_eq!( draft_profile .get("sceneChapterBlueprints") @@ -2462,19 +2672,57 @@ mod tests { .and_then(JsonValue::as_array) .and_then(|items| items.first()) .and_then(JsonValue::as_str), - Some("灯童丁") + Some("船魂戊") ); assert_eq!( draft_profile .get("sceneChapterBlueprints") .and_then(JsonValue::as_array) - .and_then(|entries| entries.get(1)) + .and_then(|entries| entries.first()) .and_then(|entry| entry.get("acts")) .and_then(JsonValue::as_array) .and_then(|acts| acts.get(1)) .and_then(|act| act.get("primaryNpcId")) .and_then(JsonValue::as_str), - Some("档吏庚") + Some("story-npc-0192680e") + ); + assert_eq!( + draft_profile + .get("sceneChapterBlueprints") + .and_then(JsonValue::as_array) + .and_then(|entries| entries.first()) + .and_then(|entry| entry.get("acts")) + .and_then(JsonValue::as_array) + .and_then(|acts| acts.first()) + .and_then(|act| act.get("primaryNpcId")) + .and_then(JsonValue::as_str), + Some("story-npc-01b5406b") + ); + assert_eq!( + draft_profile + .get("sceneChapterBlueprints") + .and_then(JsonValue::as_array) + .and_then(|entries| entries.first()) + .and_then(|entry| entry.get("acts")) + .and_then(JsonValue::as_array) + .and_then(|acts| acts.first()) + .and_then(|act| act.get("encounterNpcIds")) + .and_then(JsonValue::as_array) + .and_then(|items| items.first()) + .and_then(JsonValue::as_str), + Some("story-npc-01b5406b") + ); + assert_eq!( + draft_profile + .get("sceneChapterBlueprints") + .and_then(JsonValue::as_array) + .and_then(|entries| entries.first()) + .and_then(|entry| entry.get("acts")) + .and_then(JsonValue::as_array) + .and_then(|acts| acts.first()) + .and_then(|act| act.get("primaryRoleName")) + .and_then(JsonValue::as_str), + Some("灯童丁") ); assert_eq!( draft_profile @@ -2486,8 +2734,54 @@ mod tests { .and_then(|acts| acts.first()) .and_then(|act| act.get("primaryNpcId")) .and_then(JsonValue::as_str), - Some("灯童丁") + Some("story-npc-01fc0701") ); + assert_eq!( + draft_profile + .get("sceneChapterBlueprints") + .and_then(JsonValue::as_array) + .and_then(|entries| entries.get(1)) + .and_then(|entry| entry.get("acts")) + .and_then(JsonValue::as_array) + .and_then(|acts| acts.get(1)) + .and_then(|act| act.get("primaryNpcId")) + .and_then(JsonValue::as_str), + Some("story-npc-01acae6c") + ); + } + + #[test] + fn generated_scene_batch_first_entry_becomes_opening_camp() { + let fallback_camp = json!({ + "name": "世界骨架占位归处", + "description": "只来自 framework 的轻量占位。" + }); + let generated_scenes = vec![ + json!({ + "name": "旧灯塔", + "description": "雾中仍亮着错位灯火", + "sceneTaskDescription": "首次进入旧灯塔时,追查被篡改的灯火航线记录。", + "actBackgroundPromptTexts": ["一", "二", "三"], + "actEventDescriptions": ["甲", "乙", "丙"], + }), + json!({ + "name": "沉船湾", + "description": "退潮后露出旧船骨" + }), + ]; + + let (camp, landmarks) = + split_generated_scenes_into_camp_and_landmarks(fallback_camp, generated_scenes); + + assert_eq!(camp.get("id"), Some(&json!("camp-1"))); + assert_eq!(camp.get("kind"), Some(&json!("camp"))); + assert_eq!(camp.get("name"), Some(&json!("旧灯塔"))); + assert_eq!( + camp.get("sceneTaskDescription"), + Some(&json!("首次进入旧灯塔时,追查被篡改的灯火航线记录。")) + ); + assert_eq!(landmarks.len(), 1); + assert_eq!(landmarks[0].get("name"), Some(&json!("沉船湾"))); } fn llm_response(content: &str) -> String { diff --git a/server-rs/crates/api-server/src/prompt/foundation_draft.rs b/server-rs/crates/api-server/src/prompt/foundation_draft.rs index 49916ba5..6efce9af 100644 --- a/server-rs/crates/api-server/src/prompt/foundation_draft.rs +++ b/server-rs/crates/api-server/src/prompt/foundation_draft.rs @@ -6,7 +6,7 @@ pub(crate) fn build_custom_world_framework_prompt(setting_text: &str) -> String [ "请先根据下面的玩家设定创建一份“世界核心骨架”,后续我会分步骤生成角色名单、场景名单和详细档案。".to_string(), "你必须只输出一个能被 JSON.parse 直接解析的 JSON 对象,不要输出 Markdown、代码块、注释或解释。".to_string(), - "这一步只保留世界顶层信息与一个开局归处场景,不要输出 playableNpcs、storyNpcs、landmarks,也不要展开人物和地图细节。".to_string(), + "这一步只保留世界顶层信息与一个开局归处占位,不要输出 playableNpcs、storyNpcs、landmarks,也不要展开人物、地图细节或多幕场景内容。".to_string(), "玩家设定:".to_string(), setting_text.trim().to_string(), "".to_string(), @@ -33,10 +33,7 @@ pub(crate) fn build_custom_world_framework_prompt(setting_text: &str) -> String " },".to_string(), " \"camp\": {".to_string(), " \"name\": \"开局归处名称\",".to_string(), - " \"description\": \"这是玩家进入世界后的第一处落脚点描述\",".to_string(), - " \"sceneTaskDescription\": \"首次进入该场景时要生成的章节任务核心上下文\",".to_string(), - " \"actBackgroundPromptTexts\": [\"开局第一幕背景画面描述\", \"开局第二幕背景画面描述\", \"开局第三幕背景画面描述\"],".to_string(), - " \"actEventDescriptions\": [\"开局第一幕事件描述\", \"开局第二幕事件描述\", \"开局第三幕事件描述\"],".to_string(), + " \"description\": \"这是玩家进入世界后的第一处落脚点描述\"".to_string(), " }".to_string(), "}".to_string(), "".to_string(), @@ -45,10 +42,7 @@ pub(crate) fn build_custom_world_framework_prompt(setting_text: &str) -> String "- 这一步只输出顶层 10 个字段:name、subtitle、summary、tone、playerGoal、templateWorldType、majorFactions、coreConflicts、attributeSchema、camp。".to_string(), "- 这是一个完全独立的自定义世界;不要在任何正文里直接写出“武侠世界”“仙侠世界”等现成世界名。".to_string(), "- templateWorldType 只是系统兼容字段,不代表正文应当引用的世界名称。".to_string(), - "- camp 必须表示玩家开局时的落脚处,更接近归舍、住处、栖居、前哨居所这类“家/归处”的概念。".to_string(), - "- camp.sceneTaskDescription 必须描述玩家首次进入开局场景时要完成的核心任务,会作为游戏章节任务生成上下文,控制在 24 到 56 个汉字内。".to_string(), - "- camp.actEventDescriptions 必须恰好 3 条,分别描述每一幕发生的事件;第 1 幕负责铺垫,第 2 幕必须让冲突升级,第 3 幕必须形成高潮或关键抉择;事件必须和当前幕对面的角色强相关,控制在 24 到 56 个汉字内。".to_string(), - "- camp.actBackgroundPromptTexts 必须恰好 3 条,分别对应第 1/2/3 幕背景图画面内容描述;每条必须基于同序号 actEventDescriptions 和相关角色写出画面主体、站位空间、冲突痕迹与氛围,能直接交给生图模型,控制在 40 到 90 个汉字内。".to_string(), + "- camp 只表示玩家开局时的落脚处占位,更接近归舍、住处、栖居、前哨居所这类“家/归处”的概念;不要在这一步生成开局场景任务、三幕事件或三幕背景。".to_string(), "- 不要输出 playableNpcs、storyNpcs、landmarks、items,也不要输出任何角色和地图细节。".to_string(), "- majorFactions 保持 2 到 3 个,coreConflicts 保持 2 到 3 个。".to_string(), "- attributeSchema 必须是本世界专属的角色六维属性体系,slots 必须恰好 6 个,slotId 固定为 axis_a 到 axis_f,维度名必须是 2 到 4 个汉字且互不重复。".to_string(), @@ -68,7 +62,7 @@ pub(crate) fn build_custom_world_framework_json_repair_prompt(response_text: &st "不要输出 playableNpcs、storyNpcs、landmarks、items 或任何其他字段。", "majorFactions 与 coreConflicts 必须是字符串数组。", "attributeSchema 必须是对象,且包含 schemaName 与 slots;slots 必须恰好 6 个,slotId 固定为 axis_a 到 axis_f。", - "camp 必须是对象,且包含:name、description、sceneTaskDescription、actBackgroundPromptTexts、actEventDescriptions。", + "camp 必须是对象,且只包含:name、description。", "原始文本:", response_text.trim(), ].join("\n") @@ -154,16 +148,26 @@ pub(crate) fn build_custom_world_landmark_seed_batch_prompt( framework: &JsonValue, batch_count: usize, forbidden_names: &[String], + is_opening_batch: bool, ) -> String { let story_npc_names = names_from_entries(&array_field(framework, "storyNpcs")); [ - "请根据下面的世界核心信息,生成一批关键场景框架名单。".to_string(), - "这一步必须一次性生成场景骨架、地点默认生图描述、逐幕背景描述、幕 NPC 分配和相连场景信息。".to_string(), + "请根据下面的世界核心信息,批量生成场景框架名单。".to_string(), + if is_opening_batch { + "这一步必须一次性生成开局场景和普通关键场景的场景骨架、默认生图描述、逐幕背景描述、幕 NPC 分配和相连场景信息。".to_string() + } else { + "这一步必须一次性生成普通关键场景的场景骨架、默认生图描述、逐幕背景描述、幕 NPC 分配和相连场景信息。".to_string() + }, "你必须只输出一个能被 JSON.parse 直接解析的 JSON 对象,不要输出 Markdown、代码块、注释或解释。".to_string(), "世界核心信息:".to_string(), build_framework_summary_text(framework, 0), if story_npc_names.is_empty() { "".to_string() } else { format!("可用场景角色名单:{}", story_npc_names.join("、")) }, - if forbidden_names.is_empty() { "".to_string() } else { format!("这些地点已经生成,禁止重复:{}", forbidden_names.join("、")) }, + if is_opening_batch { + "第一条场景必须是玩家进入世界时所在的开局场景,后续条目才是普通关键场景。".to_string() + } else { + "本批只生成普通关键场景,不要再生成开局场景。".to_string() + }, + if forbidden_names.is_empty() { "".to_string() } else { format!("这些场景已经生成,禁止重复:{}", forbidden_names.join("、")) }, "".to_string(), "输出 JSON 模板:".to_string(), "{".to_string(), @@ -183,16 +187,21 @@ pub(crate) fn build_custom_world_landmark_seed_batch_prompt( "}".to_string(), "".to_string(), "要求:".to_string(), - format!("- 必须生成恰好 {batch_count} 个关键场景。"), - "- 这是一个完全独立的自定义世界;地点名称必须直接服务玩家输入主题。".to_string(), - "- 名称必须具体且互不重复,不要使用 地点1、场景1 之类的占位名。".to_string(), - "- 每个地点只保留:name、description、visualDescription、sceneTaskDescription、actBackgroundPromptTexts、actEventDescriptions、actNPCNames、connectedLandmarkNames、entryHook。".to_string(), + if is_opening_batch { + format!("- 必须生成恰好 {batch_count} 个场景,第 1 个必须是开局场景。") + } else { + format!("- 必须生成恰好 {batch_count} 个普通关键场景,不能包含开局场景。") + }, + if is_opening_batch { "- 开局场景也必须按普通场景同级规则生成完整字段,不能只给 camp 简介。".to_string() } else { "".to_string() }, + "- 这是一个完全独立的自定义世界;场景名称必须直接服务玩家输入主题。".to_string(), + "- 名称必须具体且互不重复,不要使用 地点1、场景1、开局场景 之类的占位名。".to_string(), + "- 每个场景只保留:name、description、visualDescription、sceneTaskDescription、actBackgroundPromptTexts、actEventDescriptions、actNPCNames、connectedLandmarkNames、entryHook。".to_string(), "- sceneTaskDescription 必须描述玩家首次进入该场景时要完成的核心任务,会作为游戏章节任务生成上下文,控制在 24 到 56 个汉字内。".to_string(), "- visualDescription 是打开场景背景图像生成面板时默认填入的场景描述,必须具体到画面主体、远近景层次、地面可站立区域和氛围识别点,控制在 32 到 80 个汉字内。".to_string(), "- actNPCNames 只能引用上方可用场景角色名单中的名字,表示第 1/2/3 幕各自的主场景角色;如果名单为空,输出空数组。".to_string(), "- 可用场景角色名单非空时,actNPCNames 必须恰好 3 个;可以重复使用同一角色,但每一项都必须服务对应幕事件。".to_string(), "- actNPCNames[n] 会成为第 n+1 幕对面主角色;三幕事件和幕背景必须围绕对应角色的行动、阻碍、试探或求助展开。".to_string(), - "- connectedLandmarkNames 优先引用本批或已知关键场景名称,每个地点 1 到 3 个;只有 1 个地点时可以输出空数组。".to_string(), + "- connectedLandmarkNames 优先引用本批或已知场景名称,每个场景 1 到 3 个;只有 1 个场景时可以输出空数组。".to_string(), "- entryHook 控制在 16 到 36 个汉字内。".to_string(), "- actEventDescriptions 必须恰好 3 条,分别描述每一幕发生的事件;第 1 幕负责铺垫,第 2 幕必须让冲突升级,第 3 幕必须形成高潮或关键抉择;事件必须和当前幕对面的角色强相关,控制在 24 到 56 个汉字内。".to_string(), "- actBackgroundPromptTexts 必须恰好 3 条,分别对应这个场景章节的第 1/2/3 幕背景图画面内容描述;每条都必须基于同序号 actEventDescriptions、当前地点和可出场角色直接写出画面主体、站位空间、冲突痕迹与氛围,控制在 40 到 90 个汉字内。".to_string(), @@ -207,14 +216,16 @@ pub(crate) fn build_custom_world_landmark_seed_batch_json_repair_prompt( response_text: &str, expected_count: usize, forbidden_names: &[String], + is_opening_batch: bool, ) -> String { [ - "下面这段文本本应是自定义世界关键场景框架名单批次的单个 JSON 对象,但当前不能被 JSON.parse 直接解析。".to_string(), + "下面这段文本本应是自定义世界场景框架名单批次的单个 JSON 对象,但当前不能被 JSON.parse 直接解析。".to_string(), "请只输出修复后的 JSON 对象。".to_string(), "顶层必须只包含一个 landmarks 数组。".to_string(), - format!("必须保留恰好 {expected_count} 个地点对象。"), + format!("必须保留恰好 {expected_count} 个场景对象。"), + if is_opening_batch { "第一项必须是开局场景,且字段粒度与普通场景一致。".to_string() } else { "本批只保留普通关键场景,不要包含开局场景。".to_string() }, if forbidden_names.is_empty() { "".to_string() } else { format!("禁止使用这些重复名:{}。", forbidden_names.join("、")) }, - "每个地点只包含:name、description、visualDescription、sceneTaskDescription、actBackgroundPromptTexts、actEventDescriptions、actNPCNames、connectedLandmarkNames、entryHook。".to_string(), + "每个场景只包含:name、description、visualDescription、sceneTaskDescription、actBackgroundPromptTexts、actEventDescriptions、actNPCNames、connectedLandmarkNames、entryHook。".to_string(), "如果缺少字段:字符串补空字符串,actBackgroundPromptTexts、actEventDescriptions、actNPCNames 和 connectedLandmarkNames 补空数组。".to_string(), "不要输出 items 或任何其他字段。".to_string(), "原始文本:".to_string(), diff --git a/server-rs/crates/api-server/src/runtime_story/compat/ai.rs b/server-rs/crates/api-server/src/runtime_story/compat/ai.rs index 26841429..91694879 100644 --- a/server-rs/crates/api-server/src/runtime_story/compat/ai.rs +++ b/server-rs/crates/api-server/src/runtime_story/compat/ai.rs @@ -212,11 +212,10 @@ pub(super) async fn generate_reasoned_story_payload( } pub(super) fn should_generate_reasoned_combat_story( - battle: Option<&RuntimeBattlePresentation>, + _battle: Option<&RuntimeBattlePresentation>, ) -> bool { - battle - .and_then(|presentation| presentation.outcome.as_deref()) - .is_some_and(|outcome| matches!(outcome, "victory" | "spar_complete" | "escaped")) + // 战斗动作、逃跑、胜利、切磋结束与死亡都只走确定性结算,避免战斗链路再次触发剧情推理。 + false } pub(super) fn build_action_story_history( diff --git a/server-rs/crates/api-server/src/runtime_story/compat/tests.rs b/server-rs/crates/api-server/src/runtime_story/compat/tests.rs index 6f81077a..181c941e 100644 --- a/server-rs/crates/api-server/src/runtime_story/compat/tests.rs +++ b/server-rs/crates/api-server/src/runtime_story/compat/tests.rs @@ -1913,7 +1913,7 @@ fn runtime_story_quest_turn_in_marks_quest_rewards_and_affinity() { } #[test] -fn runtime_story_reasoned_combat_story_guard_only_targets_terminal_outcomes() { +fn runtime_story_reasoned_combat_story_guard_blocks_all_battle_outcomes() { assert!(!should_generate_reasoned_combat_story(None)); assert!(!should_generate_reasoned_combat_story(Some( &RuntimeBattlePresentation { @@ -1924,7 +1924,7 @@ fn runtime_story_reasoned_combat_story_guard_only_targets_terminal_outcomes() { outcome: Some("ongoing".to_string()), } ))); - assert!(should_generate_reasoned_combat_story(Some( + assert!(!should_generate_reasoned_combat_story(Some( &RuntimeBattlePresentation { target_id: Some("npc_merchant_01".to_string()), target_name: Some("沈七".to_string()), @@ -1933,7 +1933,7 @@ fn runtime_story_reasoned_combat_story_guard_only_targets_terminal_outcomes() { outcome: Some("victory".to_string()), } ))); - assert!(should_generate_reasoned_combat_story(Some( + assert!(!should_generate_reasoned_combat_story(Some( &RuntimeBattlePresentation { target_id: Some("npc_merchant_01".to_string()), target_name: Some("沈七".to_string()), diff --git a/server-rs/crates/module-assets/src/asset_object_core.rs b/server-rs/crates/module-assets/src/asset_object_core.rs index b1ba7754..a825c901 100644 --- a/server-rs/crates/module-assets/src/asset_object_core.rs +++ b/server-rs/crates/module-assets/src/asset_object_core.rs @@ -56,6 +56,34 @@ pub struct AssetObjectProcedureResult { pub error_message: Option, } +#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +pub struct AssetHistoryListInput { + pub asset_kind: String, + pub limit: u32, +} + +#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +pub struct AssetHistoryEntrySnapshot { + pub asset_object_id: String, + pub asset_kind: String, + pub image_src: String, + pub owner_user_id: Option, + pub profile_id: Option, + pub entity_id: Option, + pub created_at_micros: i64, + pub updated_at_micros: i64, +} + +#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +pub struct AssetHistoryListResult { + pub ok: bool, + pub entries: Vec, + pub error_message: Option, +} + #[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))] #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct AssetEntityBindingProcedureResult { @@ -151,6 +179,18 @@ pub struct AssetObjectRecord { pub updated_at: String, } +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct AssetHistoryEntryRecord { + pub asset_object_id: String, + pub asset_kind: String, + pub image_src: String, + pub owner_user_id: Option, + pub profile_id: Option, + pub entity_id: Option, + pub created_at: String, + pub updated_at: String, +} + #[derive(Clone, Debug, PartialEq, Eq)] pub struct ConfirmAssetObjectResult { pub record: AssetObjectRecord, @@ -297,6 +337,21 @@ pub fn build_asset_object_record(snapshot: AssetObjectUpsertSnapshot) -> AssetOb } } +pub fn build_asset_history_entry_record( + snapshot: AssetHistoryEntrySnapshot, +) -> AssetHistoryEntryRecord { + AssetHistoryEntryRecord { + asset_object_id: snapshot.asset_object_id, + asset_kind: snapshot.asset_kind, + image_src: snapshot.image_src, + owner_user_id: snapshot.owner_user_id, + profile_id: snapshot.profile_id, + entity_id: snapshot.entity_id, + created_at: format_timestamp_micros(snapshot.created_at_micros), + updated_at: format_timestamp_micros(snapshot.updated_at_micros), + } +} + #[allow(clippy::too_many_arguments)] pub fn build_asset_entity_binding_input( binding_id: String, diff --git a/server-rs/crates/module-assets/src/lib.rs b/server-rs/crates/module-assets/src/lib.rs index 0dcae760..ccec64a2 100644 --- a/server-rs/crates/module-assets/src/lib.rs +++ b/server-rs/crates/module-assets/src/lib.rs @@ -5,12 +5,14 @@ mod asset_object_service; pub use asset_object_core::{ ASSET_BINDING_ID_PREFIX, ASSET_OBJECT_ID_PREFIX, AssetEntityBindingInput, AssetEntityBindingProcedureResult, AssetEntityBindingRecord, AssetEntityBindingSnapshot, - AssetObjectAccessPolicy, AssetObjectFieldError, AssetObjectProcedureResult, AssetObjectRecord, - AssetObjectUpsertInput, AssetObjectUpsertSnapshot, ConfirmAssetObjectInput, - ConfirmAssetObjectResult, INITIAL_ASSET_OBJECT_VERSION, build_asset_entity_binding_input, - build_asset_entity_binding_record, build_asset_object_record, build_asset_object_upsert_input, - generate_asset_binding_id, generate_asset_object_id, normalize_optional_value, - validate_asset_entity_binding_fields, validate_asset_object_fields, + AssetHistoryEntryRecord, AssetHistoryEntrySnapshot, AssetHistoryListInput, + AssetHistoryListResult, AssetObjectAccessPolicy, AssetObjectFieldError, + AssetObjectProcedureResult, AssetObjectRecord, AssetObjectUpsertInput, + AssetObjectUpsertSnapshot, ConfirmAssetObjectInput, ConfirmAssetObjectResult, + INITIAL_ASSET_OBJECT_VERSION, build_asset_entity_binding_input, + build_asset_entity_binding_record, build_asset_history_entry_record, build_asset_object_record, + build_asset_object_upsert_input, generate_asset_binding_id, generate_asset_object_id, + normalize_optional_value, validate_asset_entity_binding_fields, validate_asset_object_fields, }; #[cfg(feature = "server-service")] pub use asset_object_service::{ diff --git a/server-rs/crates/shared-contracts/src/assets.rs b/server-rs/crates/shared-contracts/src/assets.rs index a39915c8..83fa7b60 100644 --- a/server-rs/crates/shared-contracts/src/assets.rs +++ b/server-rs/crates/shared-contracts/src/assets.rs @@ -84,6 +84,34 @@ pub struct BindAssetObjectRequest { pub profile_id: Option, } +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct AssetHistoryQuery { + pub kind: String, + #[serde(default)] + pub limit: Option, +} + +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct AssetHistoryEntryPayload { + pub asset_object_id: String, + pub asset_kind: String, + pub image_src: String, + pub owner_user_id: Option, + pub owner_label: String, + pub profile_id: Option, + pub entity_id: Option, + pub created_at: String, + pub updated_at: String, +} + +#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] +#[serde(rename_all = "camelCase")] +pub struct AssetHistoryListResponse { + pub assets: Vec, +} + #[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] #[serde(rename_all = "kebab-case")] pub enum CharacterVisualSourceMode { diff --git a/server-rs/crates/spacetime-client/src/assets.rs b/server-rs/crates/spacetime-client/src/assets.rs index cc27d9ac..1745d936 100644 --- a/server-rs/crates/spacetime-client/src/assets.rs +++ b/server-rs/crates/spacetime-client/src/assets.rs @@ -1,6 +1,26 @@ use super::*; impl SpacetimeClient { + pub async fn list_asset_history( + &self, + input: module_assets::AssetHistoryListInput, + ) -> Result, SpacetimeClientError> { + let procedure_input = input.into(); + + self.call_after_connect(move |connection, sender| { + connection.procedures().list_asset_history_and_return_then( + procedure_input, + move |_, result| { + let mapped = result + .map_err(|error| SpacetimeClientError::Procedure(error.to_string())) + .and_then(map_asset_history_list_result); + send_once(&sender, mapped); + }, + ); + }) + .await + } + pub async fn confirm_asset_object( &self, input: module_assets::AssetObjectUpsertInput, diff --git a/server-rs/crates/spacetime-client/src/lib.rs b/server-rs/crates/spacetime-client/src/lib.rs index 94e722cb..a2379f1f 100644 --- a/server-rs/crates/spacetime-client/src/lib.rs +++ b/server-rs/crates/spacetime-client/src/lib.rs @@ -72,8 +72,8 @@ use module_ai::{ AiTextChunkAppendInput as DomainAiTextChunkAppendInput, }; use module_assets::{ - AssetEntityBindingRecord, AssetObjectAccessPolicy, AssetObjectRecord, - build_asset_entity_binding_record, build_asset_object_record, + AssetEntityBindingRecord, AssetHistoryEntryRecord, AssetObjectAccessPolicy, AssetObjectRecord, + build_asset_entity_binding_record, build_asset_history_entry_record, build_asset_object_record, }; use module_combat::{ BattleMode as DomainBattleMode, BattleStateInput as DomainBattleStateInput, diff --git a/server-rs/crates/spacetime-client/src/mapper.rs b/server-rs/crates/spacetime-client/src/mapper.rs index 568d52ca..c0213eb7 100644 --- a/server-rs/crates/spacetime-client/src/mapper.rs +++ b/server-rs/crates/spacetime-client/src/mapper.rs @@ -37,6 +37,15 @@ impl From for AssetObjectUpsertInput { } } +impl From for AssetHistoryListInput { + fn from(input: module_assets::AssetHistoryListInput) -> Self { + Self { + asset_kind: input.asset_kind, + limit: input.limit, + } + } +} + impl From for RuntimeSettingGetInput { fn from(input: module_runtime::RuntimeSettingGetInput) -> Self { Self { @@ -500,6 +509,25 @@ pub(crate) fn map_entity_binding_procedure_result( )) } +pub(crate) fn map_asset_history_list_result( + result: AssetHistoryListResult, +) -> Result, SpacetimeClientError> { + if !result.ok { + return Err(SpacetimeClientError::Procedure( + result + .error_message + .unwrap_or_else(|| "SpacetimeDB procedure 返回未知错误".to_string()), + )); + } + + Ok(result + .entries + .into_iter() + .map(map_asset_history_entry_snapshot) + .map(build_asset_history_entry_record) + .collect()) +} + pub(crate) fn map_runtime_setting_procedure_result( result: RuntimeSettingProcedureResult, ) -> Result { @@ -1430,6 +1458,21 @@ pub(crate) fn map_snapshot( } } +pub(crate) fn map_asset_history_entry_snapshot( + snapshot: AssetHistoryEntrySnapshot, +) -> module_assets::AssetHistoryEntrySnapshot { + module_assets::AssetHistoryEntrySnapshot { + asset_object_id: snapshot.asset_object_id, + asset_kind: snapshot.asset_kind, + image_src: snapshot.image_src, + owner_user_id: snapshot.owner_user_id, + profile_id: snapshot.profile_id, + entity_id: snapshot.entity_id, + created_at_micros: snapshot.created_at_micros, + updated_at_micros: snapshot.updated_at_micros, + } +} + pub(crate) fn map_runtime_setting_snapshot( snapshot: RuntimeSettingSnapshot, ) -> module_runtime::RuntimeSettingSnapshot { diff --git a/server-rs/crates/spacetime-client/src/module_bindings/ai_result_reference_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/ai_result_reference_table.rs deleted file mode 100644 index 6a648b5b..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/ai_result_reference_table.rs +++ /dev/null @@ -1,164 +0,0 @@ -// 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::ai_result_reference_type::AiResultReference; -use super::ai_result_reference_kind_type::AiResultReferenceKind; - -/// Table handle for the table `ai_result_reference`. -/// -/// Obtain a handle from the [`AiResultReferenceTableAccess::ai_result_reference`] method on [`super::RemoteTables`], -/// like `ctx.db.ai_result_reference()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.ai_result_reference().on_insert(...)`. -pub struct AiResultReferenceTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `ai_result_reference`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait AiResultReferenceTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`AiResultReferenceTableHandle`], which mediates access to the table `ai_result_reference`. - fn ai_result_reference(&self) -> AiResultReferenceTableHandle<'_>; -} - -impl AiResultReferenceTableAccess for super::RemoteTables { - fn ai_result_reference(&self) -> AiResultReferenceTableHandle<'_> { - AiResultReferenceTableHandle { - imp: self.imp.get_table::("ai_result_reference"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct AiResultReferenceInsertCallbackId(__sdk::CallbackId); -pub struct AiResultReferenceDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for AiResultReferenceTableHandle<'ctx> { - type Row = AiResultReference; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = AiResultReferenceInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> AiResultReferenceInsertCallbackId { - AiResultReferenceInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: AiResultReferenceInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = AiResultReferenceDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> AiResultReferenceDeleteCallbackId { - AiResultReferenceDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: AiResultReferenceDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct AiResultReferenceUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for AiResultReferenceTableHandle<'ctx> { - type UpdateCallbackId = AiResultReferenceUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> AiResultReferenceUpdateCallbackId { - AiResultReferenceUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: AiResultReferenceUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `result_reference_row_id` unique index on the table `ai_result_reference`, - /// which allows point queries on the field of the same name - /// via the [`AiResultReferenceResultReferenceRowIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.ai_result_reference().result_reference_row_id().find(...)`. - pub struct AiResultReferenceResultReferenceRowIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> AiResultReferenceTableHandle<'ctx> { - /// Get a handle on the `result_reference_row_id` unique index on the table `ai_result_reference`. - pub fn result_reference_row_id(&self) -> AiResultReferenceResultReferenceRowIdUnique<'ctx> { - AiResultReferenceResultReferenceRowIdUnique { - imp: self.imp.get_unique_constraint::("result_reference_row_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> AiResultReferenceResultReferenceRowIdUnique<'ctx> { - /// Find the subscribed row whose `result_reference_row_id` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &String) -> Option { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("ai_result_reference"); - _table.add_unique_constraint::("result_reference_row_id", |row| &row.result_reference_row_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `AiResultReference`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait ai_result_referenceQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `AiResultReference`. - fn ai_result_reference(&self) -> __sdk::__query_builder::Table; - } - - impl ai_result_referenceQueryTableAccess for __sdk::QueryTableAccessor { - fn ai_result_reference(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("ai_result_reference") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/ai_task_stage_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/ai_task_stage_table.rs deleted file mode 100644 index ae1617de..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/ai_task_stage_table.rs +++ /dev/null @@ -1,165 +0,0 @@ -// 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::ai_task_stage_type::AiTaskStage; -use super::ai_task_stage_kind_type::AiTaskStageKind; -use super::ai_task_stage_status_type::AiTaskStageStatus; - -/// Table handle for the table `ai_task_stage`. -/// -/// Obtain a handle from the [`AiTaskStageTableAccess::ai_task_stage`] method on [`super::RemoteTables`], -/// like `ctx.db.ai_task_stage()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.ai_task_stage().on_insert(...)`. -pub struct AiTaskStageTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `ai_task_stage`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait AiTaskStageTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`AiTaskStageTableHandle`], which mediates access to the table `ai_task_stage`. - fn ai_task_stage(&self) -> AiTaskStageTableHandle<'_>; -} - -impl AiTaskStageTableAccess for super::RemoteTables { - fn ai_task_stage(&self) -> AiTaskStageTableHandle<'_> { - AiTaskStageTableHandle { - imp: self.imp.get_table::("ai_task_stage"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct AiTaskStageInsertCallbackId(__sdk::CallbackId); -pub struct AiTaskStageDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for AiTaskStageTableHandle<'ctx> { - type Row = AiTaskStage; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = AiTaskStageInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> AiTaskStageInsertCallbackId { - AiTaskStageInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: AiTaskStageInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = AiTaskStageDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> AiTaskStageDeleteCallbackId { - AiTaskStageDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: AiTaskStageDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct AiTaskStageUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for AiTaskStageTableHandle<'ctx> { - type UpdateCallbackId = AiTaskStageUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> AiTaskStageUpdateCallbackId { - AiTaskStageUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: AiTaskStageUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `task_stage_id` unique index on the table `ai_task_stage`, - /// which allows point queries on the field of the same name - /// via the [`AiTaskStageTaskStageIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.ai_task_stage().task_stage_id().find(...)`. - pub struct AiTaskStageTaskStageIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> AiTaskStageTableHandle<'ctx> { - /// Get a handle on the `task_stage_id` unique index on the table `ai_task_stage`. - pub fn task_stage_id(&self) -> AiTaskStageTaskStageIdUnique<'ctx> { - AiTaskStageTaskStageIdUnique { - imp: self.imp.get_unique_constraint::("task_stage_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> AiTaskStageTaskStageIdUnique<'ctx> { - /// Find the subscribed row whose `task_stage_id` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &String) -> Option { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("ai_task_stage"); - _table.add_unique_constraint::("task_stage_id", |row| &row.task_stage_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `AiTaskStage`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait ai_task_stageQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `AiTaskStage`. - fn ai_task_stage(&self) -> __sdk::__query_builder::Table; - } - - impl ai_task_stageQueryTableAccess for __sdk::QueryTableAccessor { - fn ai_task_stage(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("ai_task_stage") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/ai_task_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/ai_task_table.rs deleted file mode 100644 index 60172196..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/ai_task_table.rs +++ /dev/null @@ -1,165 +0,0 @@ -// 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::ai_task_type::AiTask; -use super::ai_task_kind_type::AiTaskKind; -use super::ai_task_status_type::AiTaskStatus; - -/// Table handle for the table `ai_task`. -/// -/// Obtain a handle from the [`AiTaskTableAccess::ai_task`] method on [`super::RemoteTables`], -/// like `ctx.db.ai_task()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.ai_task().on_insert(...)`. -pub struct AiTaskTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `ai_task`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait AiTaskTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`AiTaskTableHandle`], which mediates access to the table `ai_task`. - fn ai_task(&self) -> AiTaskTableHandle<'_>; -} - -impl AiTaskTableAccess for super::RemoteTables { - fn ai_task(&self) -> AiTaskTableHandle<'_> { - AiTaskTableHandle { - imp: self.imp.get_table::("ai_task"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct AiTaskInsertCallbackId(__sdk::CallbackId); -pub struct AiTaskDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for AiTaskTableHandle<'ctx> { - type Row = AiTask; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = AiTaskInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> AiTaskInsertCallbackId { - AiTaskInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: AiTaskInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = AiTaskDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> AiTaskDeleteCallbackId { - AiTaskDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: AiTaskDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct AiTaskUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for AiTaskTableHandle<'ctx> { - type UpdateCallbackId = AiTaskUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> AiTaskUpdateCallbackId { - AiTaskUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: AiTaskUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `task_id` unique index on the table `ai_task`, - /// which allows point queries on the field of the same name - /// via the [`AiTaskTaskIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.ai_task().task_id().find(...)`. - pub struct AiTaskTaskIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> AiTaskTableHandle<'ctx> { - /// Get a handle on the `task_id` unique index on the table `ai_task`. - pub fn task_id(&self) -> AiTaskTaskIdUnique<'ctx> { - AiTaskTaskIdUnique { - imp: self.imp.get_unique_constraint::("task_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> AiTaskTaskIdUnique<'ctx> { - /// Find the subscribed row whose `task_id` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &String) -> Option { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("ai_task"); - _table.add_unique_constraint::("task_id", |row| &row.task_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `AiTask`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait ai_taskQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `AiTask`. - fn ai_task(&self) -> __sdk::__query_builder::Table; - } - - impl ai_taskQueryTableAccess for __sdk::QueryTableAccessor { - fn ai_task(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("ai_task") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/ai_text_chunk_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/ai_text_chunk_table.rs deleted file mode 100644 index 2ef5c6ad..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/ai_text_chunk_table.rs +++ /dev/null @@ -1,164 +0,0 @@ -// 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::ai_text_chunk_type::AiTextChunk; -use super::ai_task_stage_kind_type::AiTaskStageKind; - -/// Table handle for the table `ai_text_chunk`. -/// -/// Obtain a handle from the [`AiTextChunkTableAccess::ai_text_chunk`] method on [`super::RemoteTables`], -/// like `ctx.db.ai_text_chunk()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.ai_text_chunk().on_insert(...)`. -pub struct AiTextChunkTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `ai_text_chunk`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait AiTextChunkTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`AiTextChunkTableHandle`], which mediates access to the table `ai_text_chunk`. - fn ai_text_chunk(&self) -> AiTextChunkTableHandle<'_>; -} - -impl AiTextChunkTableAccess for super::RemoteTables { - fn ai_text_chunk(&self) -> AiTextChunkTableHandle<'_> { - AiTextChunkTableHandle { - imp: self.imp.get_table::("ai_text_chunk"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct AiTextChunkInsertCallbackId(__sdk::CallbackId); -pub struct AiTextChunkDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for AiTextChunkTableHandle<'ctx> { - type Row = AiTextChunk; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = AiTextChunkInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> AiTextChunkInsertCallbackId { - AiTextChunkInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: AiTextChunkInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = AiTextChunkDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> AiTextChunkDeleteCallbackId { - AiTextChunkDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: AiTextChunkDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct AiTextChunkUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for AiTextChunkTableHandle<'ctx> { - type UpdateCallbackId = AiTextChunkUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> AiTextChunkUpdateCallbackId { - AiTextChunkUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: AiTextChunkUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `text_chunk_row_id` unique index on the table `ai_text_chunk`, - /// which allows point queries on the field of the same name - /// via the [`AiTextChunkTextChunkRowIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.ai_text_chunk().text_chunk_row_id().find(...)`. - pub struct AiTextChunkTextChunkRowIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> AiTextChunkTableHandle<'ctx> { - /// Get a handle on the `text_chunk_row_id` unique index on the table `ai_text_chunk`. - pub fn text_chunk_row_id(&self) -> AiTextChunkTextChunkRowIdUnique<'ctx> { - AiTextChunkTextChunkRowIdUnique { - imp: self.imp.get_unique_constraint::("text_chunk_row_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> AiTextChunkTextChunkRowIdUnique<'ctx> { - /// Find the subscribed row whose `text_chunk_row_id` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &String) -> Option { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("ai_text_chunk"); - _table.add_unique_constraint::("text_chunk_row_id", |row| &row.text_chunk_row_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `AiTextChunk`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait ai_text_chunkQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `AiTextChunk`. - fn ai_text_chunk(&self) -> __sdk::__query_builder::Table; - } - - impl ai_text_chunkQueryTableAccess for __sdk::QueryTableAccessor { - fn ai_text_chunk(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("ai_text_chunk") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/asset_entity_binding_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/asset_entity_binding_table.rs deleted file mode 100644 index 13f7b47f..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/asset_entity_binding_table.rs +++ /dev/null @@ -1,163 +0,0 @@ -// 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::asset_entity_binding_type::AssetEntityBinding; - -/// Table handle for the table `asset_entity_binding`. -/// -/// Obtain a handle from the [`AssetEntityBindingTableAccess::asset_entity_binding`] method on [`super::RemoteTables`], -/// like `ctx.db.asset_entity_binding()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.asset_entity_binding().on_insert(...)`. -pub struct AssetEntityBindingTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `asset_entity_binding`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait AssetEntityBindingTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`AssetEntityBindingTableHandle`], which mediates access to the table `asset_entity_binding`. - fn asset_entity_binding(&self) -> AssetEntityBindingTableHandle<'_>; -} - -impl AssetEntityBindingTableAccess for super::RemoteTables { - fn asset_entity_binding(&self) -> AssetEntityBindingTableHandle<'_> { - AssetEntityBindingTableHandle { - imp: self.imp.get_table::("asset_entity_binding"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct AssetEntityBindingInsertCallbackId(__sdk::CallbackId); -pub struct AssetEntityBindingDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for AssetEntityBindingTableHandle<'ctx> { - type Row = AssetEntityBinding; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = AssetEntityBindingInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> AssetEntityBindingInsertCallbackId { - AssetEntityBindingInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: AssetEntityBindingInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = AssetEntityBindingDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> AssetEntityBindingDeleteCallbackId { - AssetEntityBindingDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: AssetEntityBindingDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct AssetEntityBindingUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for AssetEntityBindingTableHandle<'ctx> { - type UpdateCallbackId = AssetEntityBindingUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> AssetEntityBindingUpdateCallbackId { - AssetEntityBindingUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: AssetEntityBindingUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `binding_id` unique index on the table `asset_entity_binding`, - /// which allows point queries on the field of the same name - /// via the [`AssetEntityBindingBindingIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.asset_entity_binding().binding_id().find(...)`. - pub struct AssetEntityBindingBindingIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> AssetEntityBindingTableHandle<'ctx> { - /// Get a handle on the `binding_id` unique index on the table `asset_entity_binding`. - pub fn binding_id(&self) -> AssetEntityBindingBindingIdUnique<'ctx> { - AssetEntityBindingBindingIdUnique { - imp: self.imp.get_unique_constraint::("binding_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> AssetEntityBindingBindingIdUnique<'ctx> { - /// Find the subscribed row whose `binding_id` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &String) -> Option { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("asset_entity_binding"); - _table.add_unique_constraint::("binding_id", |row| &row.binding_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `AssetEntityBinding`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait asset_entity_bindingQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `AssetEntityBinding`. - fn asset_entity_binding(&self) -> __sdk::__query_builder::Table; - } - - impl asset_entity_bindingQueryTableAccess for __sdk::QueryTableAccessor { - fn asset_entity_binding(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("asset_entity_binding") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/asset_history_entry_snapshot_type.rs b/server-rs/crates/spacetime-client/src/module_bindings/asset_history_entry_snapshot_type.rs new file mode 100644 index 00000000..3cc6b38c --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/asset_history_entry_snapshot_type.rs @@ -0,0 +1,30 @@ +// 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 AssetHistoryEntrySnapshot { + pub asset_object_id: String, + pub asset_kind: String, + pub image_src: String, + pub owner_user_id: Option::, + pub profile_id: Option::, + pub entity_id: Option::, + pub created_at_micros: i64, + pub updated_at_micros: i64, +} + + +impl __sdk::InModule for AssetHistoryEntrySnapshot { + type Module = super::RemoteModule; +} + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/asset_history_list_input_type.rs b/server-rs/crates/spacetime-client/src/module_bindings/asset_history_list_input_type.rs new file mode 100644 index 00000000..3cf2b5fd --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/asset_history_list_input_type.rs @@ -0,0 +1,24 @@ +// 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 AssetHistoryListInput { + pub asset_kind: String, + pub limit: u32, +} + + +impl __sdk::InModule for AssetHistoryListInput { + type Module = super::RemoteModule; +} + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/asset_history_list_result_type.rs b/server-rs/crates/spacetime-client/src/module_bindings/asset_history_list_result_type.rs new file mode 100644 index 00000000..4eb8281d --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/asset_history_list_result_type.rs @@ -0,0 +1,26 @@ +// 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::asset_history_entry_snapshot_type::AssetHistoryEntrySnapshot; + +#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] +#[sats(crate = __lib)] +pub struct AssetHistoryListResult { + pub ok: bool, + pub entries: Vec::, + pub error_message: Option::, +} + + +impl __sdk::InModule for AssetHistoryListResult { + type Module = super::RemoteModule; +} + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/asset_object_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/asset_object_table.rs deleted file mode 100644 index 2aeb9a22..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/asset_object_table.rs +++ /dev/null @@ -1,164 +0,0 @@ -// 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::asset_object_type::AssetObject; -use super::asset_object_access_policy_type::AssetObjectAccessPolicy; - -/// Table handle for the table `asset_object`. -/// -/// Obtain a handle from the [`AssetObjectTableAccess::asset_object`] method on [`super::RemoteTables`], -/// like `ctx.db.asset_object()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.asset_object().on_insert(...)`. -pub struct AssetObjectTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `asset_object`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait AssetObjectTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`AssetObjectTableHandle`], which mediates access to the table `asset_object`. - fn asset_object(&self) -> AssetObjectTableHandle<'_>; -} - -impl AssetObjectTableAccess for super::RemoteTables { - fn asset_object(&self) -> AssetObjectTableHandle<'_> { - AssetObjectTableHandle { - imp: self.imp.get_table::("asset_object"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct AssetObjectInsertCallbackId(__sdk::CallbackId); -pub struct AssetObjectDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for AssetObjectTableHandle<'ctx> { - type Row = AssetObject; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = AssetObjectInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> AssetObjectInsertCallbackId { - AssetObjectInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: AssetObjectInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = AssetObjectDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> AssetObjectDeleteCallbackId { - AssetObjectDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: AssetObjectDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct AssetObjectUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for AssetObjectTableHandle<'ctx> { - type UpdateCallbackId = AssetObjectUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> AssetObjectUpdateCallbackId { - AssetObjectUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: AssetObjectUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `asset_object_id` unique index on the table `asset_object`, - /// which allows point queries on the field of the same name - /// via the [`AssetObjectAssetObjectIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.asset_object().asset_object_id().find(...)`. - pub struct AssetObjectAssetObjectIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> AssetObjectTableHandle<'ctx> { - /// Get a handle on the `asset_object_id` unique index on the table `asset_object`. - pub fn asset_object_id(&self) -> AssetObjectAssetObjectIdUnique<'ctx> { - AssetObjectAssetObjectIdUnique { - imp: self.imp.get_unique_constraint::("asset_object_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> AssetObjectAssetObjectIdUnique<'ctx> { - /// Find the subscribed row whose `asset_object_id` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &String) -> Option { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("asset_object"); - _table.add_unique_constraint::("asset_object_id", |row| &row.asset_object_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `AssetObject`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait asset_objectQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `AssetObject`. - fn asset_object(&self) -> __sdk::__query_builder::Table; - } - - impl asset_objectQueryTableAccess for __sdk::QueryTableAccessor { - fn asset_object(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("asset_object") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/auth_identity_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/auth_identity_table.rs deleted file mode 100644 index 07644b31..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/auth_identity_table.rs +++ /dev/null @@ -1,163 +0,0 @@ -// 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::auth_identity_type::AuthIdentity; - -/// Table handle for the table `auth_identity`. -/// -/// Obtain a handle from the [`AuthIdentityTableAccess::auth_identity`] method on [`super::RemoteTables`], -/// like `ctx.db.auth_identity()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.auth_identity().on_insert(...)`. -pub struct AuthIdentityTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `auth_identity`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait AuthIdentityTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`AuthIdentityTableHandle`], which mediates access to the table `auth_identity`. - fn auth_identity(&self) -> AuthIdentityTableHandle<'_>; -} - -impl AuthIdentityTableAccess for super::RemoteTables { - fn auth_identity(&self) -> AuthIdentityTableHandle<'_> { - AuthIdentityTableHandle { - imp: self.imp.get_table::("auth_identity"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct AuthIdentityInsertCallbackId(__sdk::CallbackId); -pub struct AuthIdentityDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for AuthIdentityTableHandle<'ctx> { - type Row = AuthIdentity; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = AuthIdentityInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> AuthIdentityInsertCallbackId { - AuthIdentityInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: AuthIdentityInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = AuthIdentityDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> AuthIdentityDeleteCallbackId { - AuthIdentityDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: AuthIdentityDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct AuthIdentityUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for AuthIdentityTableHandle<'ctx> { - type UpdateCallbackId = AuthIdentityUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> AuthIdentityUpdateCallbackId { - AuthIdentityUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: AuthIdentityUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `identity_id` unique index on the table `auth_identity`, - /// which allows point queries on the field of the same name - /// via the [`AuthIdentityIdentityIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.auth_identity().identity_id().find(...)`. - pub struct AuthIdentityIdentityIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> AuthIdentityTableHandle<'ctx> { - /// Get a handle on the `identity_id` unique index on the table `auth_identity`. - pub fn identity_id(&self) -> AuthIdentityIdentityIdUnique<'ctx> { - AuthIdentityIdentityIdUnique { - imp: self.imp.get_unique_constraint::("identity_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> AuthIdentityIdentityIdUnique<'ctx> { - /// Find the subscribed row whose `identity_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("auth_identity"); - _table.add_unique_constraint::("identity_id", |row| &row.identity_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `AuthIdentity`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait auth_identityQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `AuthIdentity`. - fn auth_identity(&self) -> __sdk::__query_builder::Table; - } - - impl auth_identityQueryTableAccess for __sdk::QueryTableAccessor { - fn auth_identity(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("auth_identity") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/auth_store_snapshot_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/auth_store_snapshot_table.rs deleted file mode 100644 index 2d9cf56f..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/auth_store_snapshot_table.rs +++ /dev/null @@ -1,163 +0,0 @@ -// 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::auth_store_snapshot_type::AuthStoreSnapshot; - -/// Table handle for the table `auth_store_snapshot`. -/// -/// Obtain a handle from the [`AuthStoreSnapshotTableAccess::auth_store_snapshot`] method on [`super::RemoteTables`], -/// like `ctx.db.auth_store_snapshot()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.auth_store_snapshot().on_insert(...)`. -pub struct AuthStoreSnapshotTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `auth_store_snapshot`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait AuthStoreSnapshotTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`AuthStoreSnapshotTableHandle`], which mediates access to the table `auth_store_snapshot`. - fn auth_store_snapshot(&self) -> AuthStoreSnapshotTableHandle<'_>; -} - -impl AuthStoreSnapshotTableAccess for super::RemoteTables { - fn auth_store_snapshot(&self) -> AuthStoreSnapshotTableHandle<'_> { - AuthStoreSnapshotTableHandle { - imp: self.imp.get_table::("auth_store_snapshot"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct AuthStoreSnapshotInsertCallbackId(__sdk::CallbackId); -pub struct AuthStoreSnapshotDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for AuthStoreSnapshotTableHandle<'ctx> { - type Row = AuthStoreSnapshot; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = AuthStoreSnapshotInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> AuthStoreSnapshotInsertCallbackId { - AuthStoreSnapshotInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: AuthStoreSnapshotInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = AuthStoreSnapshotDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> AuthStoreSnapshotDeleteCallbackId { - AuthStoreSnapshotDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: AuthStoreSnapshotDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct AuthStoreSnapshotUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for AuthStoreSnapshotTableHandle<'ctx> { - type UpdateCallbackId = AuthStoreSnapshotUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> AuthStoreSnapshotUpdateCallbackId { - AuthStoreSnapshotUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: AuthStoreSnapshotUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `snapshot_id` unique index on the table `auth_store_snapshot`, - /// which allows point queries on the field of the same name - /// via the [`AuthStoreSnapshotSnapshotIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.auth_store_snapshot().snapshot_id().find(...)`. - pub struct AuthStoreSnapshotSnapshotIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> AuthStoreSnapshotTableHandle<'ctx> { - /// Get a handle on the `snapshot_id` unique index on the table `auth_store_snapshot`. - pub fn snapshot_id(&self) -> AuthStoreSnapshotSnapshotIdUnique<'ctx> { - AuthStoreSnapshotSnapshotIdUnique { - imp: self.imp.get_unique_constraint::("snapshot_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> AuthStoreSnapshotSnapshotIdUnique<'ctx> { - /// Find the subscribed row whose `snapshot_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("auth_store_snapshot"); - _table.add_unique_constraint::("snapshot_id", |row| &row.snapshot_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `AuthStoreSnapshot`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait auth_store_snapshotQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `AuthStoreSnapshot`. - fn auth_store_snapshot(&self) -> __sdk::__query_builder::Table; - } - - impl auth_store_snapshotQueryTableAccess for __sdk::QueryTableAccessor { - fn auth_store_snapshot(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("auth_store_snapshot") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/battle_state_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/battle_state_table.rs deleted file mode 100644 index 53dc1ebb..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/battle_state_table.rs +++ /dev/null @@ -1,167 +0,0 @@ -// 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::battle_state_type::BattleState; -use super::battle_mode_type::BattleMode; -use super::battle_status_type::BattleStatus; -use super::runtime_item_reward_item_snapshot_type::RuntimeItemRewardItemSnapshot; -use super::combat_outcome_type::CombatOutcome; - -/// Table handle for the table `battle_state`. -/// -/// Obtain a handle from the [`BattleStateTableAccess::battle_state`] method on [`super::RemoteTables`], -/// like `ctx.db.battle_state()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.battle_state().on_insert(...)`. -pub struct BattleStateTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `battle_state`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait BattleStateTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`BattleStateTableHandle`], which mediates access to the table `battle_state`. - fn battle_state(&self) -> BattleStateTableHandle<'_>; -} - -impl BattleStateTableAccess for super::RemoteTables { - fn battle_state(&self) -> BattleStateTableHandle<'_> { - BattleStateTableHandle { - imp: self.imp.get_table::("battle_state"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct BattleStateInsertCallbackId(__sdk::CallbackId); -pub struct BattleStateDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for BattleStateTableHandle<'ctx> { - type Row = BattleState; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = BattleStateInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> BattleStateInsertCallbackId { - BattleStateInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: BattleStateInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = BattleStateDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> BattleStateDeleteCallbackId { - BattleStateDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: BattleStateDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct BattleStateUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for BattleStateTableHandle<'ctx> { - type UpdateCallbackId = BattleStateUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> BattleStateUpdateCallbackId { - BattleStateUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: BattleStateUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `battle_state_id` unique index on the table `battle_state`, - /// which allows point queries on the field of the same name - /// via the [`BattleStateBattleStateIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.battle_state().battle_state_id().find(...)`. - pub struct BattleStateBattleStateIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> BattleStateTableHandle<'ctx> { - /// Get a handle on the `battle_state_id` unique index on the table `battle_state`. - pub fn battle_state_id(&self) -> BattleStateBattleStateIdUnique<'ctx> { - BattleStateBattleStateIdUnique { - imp: self.imp.get_unique_constraint::("battle_state_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> BattleStateBattleStateIdUnique<'ctx> { - /// Find the subscribed row whose `battle_state_id` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &String) -> Option { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("battle_state"); - _table.add_unique_constraint::("battle_state_id", |row| &row.battle_state_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `BattleState`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait battle_stateQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `BattleState`. - fn battle_state(&self) -> __sdk::__query_builder::Table; - } - - impl battle_stateQueryTableAccess for __sdk::QueryTableAccessor { - fn battle_state(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("battle_state") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/big_fish_agent_message_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/big_fish_agent_message_table.rs deleted file mode 100644 index 59185a0b..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/big_fish_agent_message_table.rs +++ /dev/null @@ -1,165 +0,0 @@ -// 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::big_fish_agent_message_type::BigFishAgentMessage; -use super::big_fish_agent_message_role_type::BigFishAgentMessageRole; -use super::big_fish_agent_message_kind_type::BigFishAgentMessageKind; - -/// Table handle for the table `big_fish_agent_message`. -/// -/// Obtain a handle from the [`BigFishAgentMessageTableAccess::big_fish_agent_message`] method on [`super::RemoteTables`], -/// like `ctx.db.big_fish_agent_message()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.big_fish_agent_message().on_insert(...)`. -pub struct BigFishAgentMessageTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `big_fish_agent_message`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait BigFishAgentMessageTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`BigFishAgentMessageTableHandle`], which mediates access to the table `big_fish_agent_message`. - fn big_fish_agent_message(&self) -> BigFishAgentMessageTableHandle<'_>; -} - -impl BigFishAgentMessageTableAccess for super::RemoteTables { - fn big_fish_agent_message(&self) -> BigFishAgentMessageTableHandle<'_> { - BigFishAgentMessageTableHandle { - imp: self.imp.get_table::("big_fish_agent_message"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct BigFishAgentMessageInsertCallbackId(__sdk::CallbackId); -pub struct BigFishAgentMessageDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for BigFishAgentMessageTableHandle<'ctx> { - type Row = BigFishAgentMessage; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = BigFishAgentMessageInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> BigFishAgentMessageInsertCallbackId { - BigFishAgentMessageInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: BigFishAgentMessageInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = BigFishAgentMessageDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> BigFishAgentMessageDeleteCallbackId { - BigFishAgentMessageDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: BigFishAgentMessageDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct BigFishAgentMessageUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for BigFishAgentMessageTableHandle<'ctx> { - type UpdateCallbackId = BigFishAgentMessageUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> BigFishAgentMessageUpdateCallbackId { - BigFishAgentMessageUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: BigFishAgentMessageUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `message_id` unique index on the table `big_fish_agent_message`, - /// which allows point queries on the field of the same name - /// via the [`BigFishAgentMessageMessageIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.big_fish_agent_message().message_id().find(...)`. - pub struct BigFishAgentMessageMessageIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> BigFishAgentMessageTableHandle<'ctx> { - /// Get a handle on the `message_id` unique index on the table `big_fish_agent_message`. - pub fn message_id(&self) -> BigFishAgentMessageMessageIdUnique<'ctx> { - BigFishAgentMessageMessageIdUnique { - imp: self.imp.get_unique_constraint::("message_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> BigFishAgentMessageMessageIdUnique<'ctx> { - /// Find the subscribed row whose `message_id` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &String) -> Option { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("big_fish_agent_message"); - _table.add_unique_constraint::("message_id", |row| &row.message_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `BigFishAgentMessage`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait big_fish_agent_messageQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `BigFishAgentMessage`. - fn big_fish_agent_message(&self) -> __sdk::__query_builder::Table; - } - - impl big_fish_agent_messageQueryTableAccess for __sdk::QueryTableAccessor { - fn big_fish_agent_message(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("big_fish_agent_message") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/big_fish_asset_slot_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/big_fish_asset_slot_table.rs deleted file mode 100644 index 8b296390..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/big_fish_asset_slot_table.rs +++ /dev/null @@ -1,165 +0,0 @@ -// 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::big_fish_asset_slot_type::BigFishAssetSlot; -use super::big_fish_asset_kind_type::BigFishAssetKind; -use super::big_fish_asset_status_type::BigFishAssetStatus; - -/// Table handle for the table `big_fish_asset_slot`. -/// -/// Obtain a handle from the [`BigFishAssetSlotTableAccess::big_fish_asset_slot`] method on [`super::RemoteTables`], -/// like `ctx.db.big_fish_asset_slot()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.big_fish_asset_slot().on_insert(...)`. -pub struct BigFishAssetSlotTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `big_fish_asset_slot`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait BigFishAssetSlotTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`BigFishAssetSlotTableHandle`], which mediates access to the table `big_fish_asset_slot`. - fn big_fish_asset_slot(&self) -> BigFishAssetSlotTableHandle<'_>; -} - -impl BigFishAssetSlotTableAccess for super::RemoteTables { - fn big_fish_asset_slot(&self) -> BigFishAssetSlotTableHandle<'_> { - BigFishAssetSlotTableHandle { - imp: self.imp.get_table::("big_fish_asset_slot"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct BigFishAssetSlotInsertCallbackId(__sdk::CallbackId); -pub struct BigFishAssetSlotDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for BigFishAssetSlotTableHandle<'ctx> { - type Row = BigFishAssetSlot; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = BigFishAssetSlotInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> BigFishAssetSlotInsertCallbackId { - BigFishAssetSlotInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: BigFishAssetSlotInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = BigFishAssetSlotDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> BigFishAssetSlotDeleteCallbackId { - BigFishAssetSlotDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: BigFishAssetSlotDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct BigFishAssetSlotUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for BigFishAssetSlotTableHandle<'ctx> { - type UpdateCallbackId = BigFishAssetSlotUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> BigFishAssetSlotUpdateCallbackId { - BigFishAssetSlotUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: BigFishAssetSlotUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `slot_id` unique index on the table `big_fish_asset_slot`, - /// which allows point queries on the field of the same name - /// via the [`BigFishAssetSlotSlotIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.big_fish_asset_slot().slot_id().find(...)`. - pub struct BigFishAssetSlotSlotIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> BigFishAssetSlotTableHandle<'ctx> { - /// Get a handle on the `slot_id` unique index on the table `big_fish_asset_slot`. - pub fn slot_id(&self) -> BigFishAssetSlotSlotIdUnique<'ctx> { - BigFishAssetSlotSlotIdUnique { - imp: self.imp.get_unique_constraint::("slot_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> BigFishAssetSlotSlotIdUnique<'ctx> { - /// Find the subscribed row whose `slot_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("big_fish_asset_slot"); - _table.add_unique_constraint::("slot_id", |row| &row.slot_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `BigFishAssetSlot`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait big_fish_asset_slotQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `BigFishAssetSlot`. - fn big_fish_asset_slot(&self) -> __sdk::__query_builder::Table; - } - - impl big_fish_asset_slotQueryTableAccess for __sdk::QueryTableAccessor { - fn big_fish_asset_slot(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("big_fish_asset_slot") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/big_fish_creation_session_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/big_fish_creation_session_table.rs deleted file mode 100644 index 3eff808d..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/big_fish_creation_session_table.rs +++ /dev/null @@ -1,164 +0,0 @@ -// 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::big_fish_creation_session_type::BigFishCreationSession; -use super::big_fish_creation_stage_type::BigFishCreationStage; - -/// Table handle for the table `big_fish_creation_session`. -/// -/// Obtain a handle from the [`BigFishCreationSessionTableAccess::big_fish_creation_session`] method on [`super::RemoteTables`], -/// like `ctx.db.big_fish_creation_session()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.big_fish_creation_session().on_insert(...)`. -pub struct BigFishCreationSessionTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `big_fish_creation_session`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait BigFishCreationSessionTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`BigFishCreationSessionTableHandle`], which mediates access to the table `big_fish_creation_session`. - fn big_fish_creation_session(&self) -> BigFishCreationSessionTableHandle<'_>; -} - -impl BigFishCreationSessionTableAccess for super::RemoteTables { - fn big_fish_creation_session(&self) -> BigFishCreationSessionTableHandle<'_> { - BigFishCreationSessionTableHandle { - imp: self.imp.get_table::("big_fish_creation_session"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct BigFishCreationSessionInsertCallbackId(__sdk::CallbackId); -pub struct BigFishCreationSessionDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for BigFishCreationSessionTableHandle<'ctx> { - type Row = BigFishCreationSession; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = BigFishCreationSessionInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> BigFishCreationSessionInsertCallbackId { - BigFishCreationSessionInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: BigFishCreationSessionInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = BigFishCreationSessionDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> BigFishCreationSessionDeleteCallbackId { - BigFishCreationSessionDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: BigFishCreationSessionDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct BigFishCreationSessionUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for BigFishCreationSessionTableHandle<'ctx> { - type UpdateCallbackId = BigFishCreationSessionUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> BigFishCreationSessionUpdateCallbackId { - BigFishCreationSessionUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: BigFishCreationSessionUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `session_id` unique index on the table `big_fish_creation_session`, - /// which allows point queries on the field of the same name - /// via the [`BigFishCreationSessionSessionIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.big_fish_creation_session().session_id().find(...)`. - pub struct BigFishCreationSessionSessionIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> BigFishCreationSessionTableHandle<'ctx> { - /// Get a handle on the `session_id` unique index on the table `big_fish_creation_session`. - pub fn session_id(&self) -> BigFishCreationSessionSessionIdUnique<'ctx> { - BigFishCreationSessionSessionIdUnique { - imp: self.imp.get_unique_constraint::("session_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> BigFishCreationSessionSessionIdUnique<'ctx> { - /// Find the subscribed row whose `session_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("big_fish_creation_session"); - _table.add_unique_constraint::("session_id", |row| &row.session_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `BigFishCreationSession`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait big_fish_creation_sessionQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `BigFishCreationSession`. - fn big_fish_creation_session(&self) -> __sdk::__query_builder::Table; - } - - impl big_fish_creation_sessionQueryTableAccess for __sdk::QueryTableAccessor { - fn big_fish_creation_session(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("big_fish_creation_session") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/big_fish_runtime_run_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/big_fish_runtime_run_table.rs deleted file mode 100644 index 9ed2da19..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/big_fish_runtime_run_table.rs +++ /dev/null @@ -1,164 +0,0 @@ -// 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::big_fish_runtime_run_type::BigFishRuntimeRun; -use super::big_fish_run_status_type::BigFishRunStatus; - -/// Table handle for the table `big_fish_runtime_run`. -/// -/// Obtain a handle from the [`BigFishRuntimeRunTableAccess::big_fish_runtime_run`] method on [`super::RemoteTables`], -/// like `ctx.db.big_fish_runtime_run()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.big_fish_runtime_run().on_insert(...)`. -pub struct BigFishRuntimeRunTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `big_fish_runtime_run`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait BigFishRuntimeRunTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`BigFishRuntimeRunTableHandle`], which mediates access to the table `big_fish_runtime_run`. - fn big_fish_runtime_run(&self) -> BigFishRuntimeRunTableHandle<'_>; -} - -impl BigFishRuntimeRunTableAccess for super::RemoteTables { - fn big_fish_runtime_run(&self) -> BigFishRuntimeRunTableHandle<'_> { - BigFishRuntimeRunTableHandle { - imp: self.imp.get_table::("big_fish_runtime_run"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct BigFishRuntimeRunInsertCallbackId(__sdk::CallbackId); -pub struct BigFishRuntimeRunDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for BigFishRuntimeRunTableHandle<'ctx> { - type Row = BigFishRuntimeRun; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = BigFishRuntimeRunInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> BigFishRuntimeRunInsertCallbackId { - BigFishRuntimeRunInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: BigFishRuntimeRunInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = BigFishRuntimeRunDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> BigFishRuntimeRunDeleteCallbackId { - BigFishRuntimeRunDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: BigFishRuntimeRunDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct BigFishRuntimeRunUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for BigFishRuntimeRunTableHandle<'ctx> { - type UpdateCallbackId = BigFishRuntimeRunUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> BigFishRuntimeRunUpdateCallbackId { - BigFishRuntimeRunUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: BigFishRuntimeRunUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `run_id` unique index on the table `big_fish_runtime_run`, - /// which allows point queries on the field of the same name - /// via the [`BigFishRuntimeRunRunIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.big_fish_runtime_run().run_id().find(...)`. - pub struct BigFishRuntimeRunRunIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> BigFishRuntimeRunTableHandle<'ctx> { - /// Get a handle on the `run_id` unique index on the table `big_fish_runtime_run`. - pub fn run_id(&self) -> BigFishRuntimeRunRunIdUnique<'ctx> { - BigFishRuntimeRunRunIdUnique { - imp: self.imp.get_unique_constraint::("run_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> BigFishRuntimeRunRunIdUnique<'ctx> { - /// Find the subscribed row whose `run_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("big_fish_runtime_run"); - _table.add_unique_constraint::("run_id", |row| &row.run_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `BigFishRuntimeRun`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait big_fish_runtime_runQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `BigFishRuntimeRun`. - fn big_fish_runtime_run(&self) -> __sdk::__query_builder::Table; - } - - impl big_fish_runtime_runQueryTableAccess for __sdk::QueryTableAccessor { - fn big_fish_runtime_run(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("big_fish_runtime_run") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/chapter_progression_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/chapter_progression_table.rs deleted file mode 100644 index 5bd5c38c..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/chapter_progression_table.rs +++ /dev/null @@ -1,164 +0,0 @@ -// 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::chapter_progression_type::ChapterProgression; -use super::chapter_pace_band_type::ChapterPaceBand; - -/// Table handle for the table `chapter_progression`. -/// -/// Obtain a handle from the [`ChapterProgressionTableAccess::chapter_progression`] method on [`super::RemoteTables`], -/// like `ctx.db.chapter_progression()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.chapter_progression().on_insert(...)`. -pub struct ChapterProgressionTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `chapter_progression`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait ChapterProgressionTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`ChapterProgressionTableHandle`], which mediates access to the table `chapter_progression`. - fn chapter_progression(&self) -> ChapterProgressionTableHandle<'_>; -} - -impl ChapterProgressionTableAccess for super::RemoteTables { - fn chapter_progression(&self) -> ChapterProgressionTableHandle<'_> { - ChapterProgressionTableHandle { - imp: self.imp.get_table::("chapter_progression"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct ChapterProgressionInsertCallbackId(__sdk::CallbackId); -pub struct ChapterProgressionDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for ChapterProgressionTableHandle<'ctx> { - type Row = ChapterProgression; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = ChapterProgressionInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> ChapterProgressionInsertCallbackId { - ChapterProgressionInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: ChapterProgressionInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = ChapterProgressionDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> ChapterProgressionDeleteCallbackId { - ChapterProgressionDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: ChapterProgressionDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct ChapterProgressionUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for ChapterProgressionTableHandle<'ctx> { - type UpdateCallbackId = ChapterProgressionUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> ChapterProgressionUpdateCallbackId { - ChapterProgressionUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: ChapterProgressionUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `chapter_progression_id` unique index on the table `chapter_progression`, - /// which allows point queries on the field of the same name - /// via the [`ChapterProgressionChapterProgressionIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.chapter_progression().chapter_progression_id().find(...)`. - pub struct ChapterProgressionChapterProgressionIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> ChapterProgressionTableHandle<'ctx> { - /// Get a handle on the `chapter_progression_id` unique index on the table `chapter_progression`. - pub fn chapter_progression_id(&self) -> ChapterProgressionChapterProgressionIdUnique<'ctx> { - ChapterProgressionChapterProgressionIdUnique { - imp: self.imp.get_unique_constraint::("chapter_progression_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> ChapterProgressionChapterProgressionIdUnique<'ctx> { - /// Find the subscribed row whose `chapter_progression_id` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &String) -> Option { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("chapter_progression"); - _table.add_unique_constraint::("chapter_progression_id", |row| &row.chapter_progression_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `ChapterProgression`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait chapter_progressionQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `ChapterProgression`. - fn chapter_progression(&self) -> __sdk::__query_builder::Table; - } - - impl chapter_progressionQueryTableAccess for __sdk::QueryTableAccessor { - fn chapter_progression(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("chapter_progression") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/custom_world_agent_message_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/custom_world_agent_message_table.rs deleted file mode 100644 index 12cae6f1..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/custom_world_agent_message_table.rs +++ /dev/null @@ -1,165 +0,0 @@ -// 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::custom_world_agent_message_type::CustomWorldAgentMessage; -use super::rpg_agent_message_role_type::RpgAgentMessageRole; -use super::rpg_agent_message_kind_type::RpgAgentMessageKind; - -/// Table handle for the table `custom_world_agent_message`. -/// -/// Obtain a handle from the [`CustomWorldAgentMessageTableAccess::custom_world_agent_message`] method on [`super::RemoteTables`], -/// like `ctx.db.custom_world_agent_message()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.custom_world_agent_message().on_insert(...)`. -pub struct CustomWorldAgentMessageTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `custom_world_agent_message`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait CustomWorldAgentMessageTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`CustomWorldAgentMessageTableHandle`], which mediates access to the table `custom_world_agent_message`. - fn custom_world_agent_message(&self) -> CustomWorldAgentMessageTableHandle<'_>; -} - -impl CustomWorldAgentMessageTableAccess for super::RemoteTables { - fn custom_world_agent_message(&self) -> CustomWorldAgentMessageTableHandle<'_> { - CustomWorldAgentMessageTableHandle { - imp: self.imp.get_table::("custom_world_agent_message"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct CustomWorldAgentMessageInsertCallbackId(__sdk::CallbackId); -pub struct CustomWorldAgentMessageDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for CustomWorldAgentMessageTableHandle<'ctx> { - type Row = CustomWorldAgentMessage; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = CustomWorldAgentMessageInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> CustomWorldAgentMessageInsertCallbackId { - CustomWorldAgentMessageInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: CustomWorldAgentMessageInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = CustomWorldAgentMessageDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> CustomWorldAgentMessageDeleteCallbackId { - CustomWorldAgentMessageDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: CustomWorldAgentMessageDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct CustomWorldAgentMessageUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for CustomWorldAgentMessageTableHandle<'ctx> { - type UpdateCallbackId = CustomWorldAgentMessageUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> CustomWorldAgentMessageUpdateCallbackId { - CustomWorldAgentMessageUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: CustomWorldAgentMessageUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `message_id` unique index on the table `custom_world_agent_message`, - /// which allows point queries on the field of the same name - /// via the [`CustomWorldAgentMessageMessageIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.custom_world_agent_message().message_id().find(...)`. - pub struct CustomWorldAgentMessageMessageIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> CustomWorldAgentMessageTableHandle<'ctx> { - /// Get a handle on the `message_id` unique index on the table `custom_world_agent_message`. - pub fn message_id(&self) -> CustomWorldAgentMessageMessageIdUnique<'ctx> { - CustomWorldAgentMessageMessageIdUnique { - imp: self.imp.get_unique_constraint::("message_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> CustomWorldAgentMessageMessageIdUnique<'ctx> { - /// Find the subscribed row whose `message_id` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &String) -> Option { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("custom_world_agent_message"); - _table.add_unique_constraint::("message_id", |row| &row.message_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `CustomWorldAgentMessage`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait custom_world_agent_messageQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `CustomWorldAgentMessage`. - fn custom_world_agent_message(&self) -> __sdk::__query_builder::Table; - } - - impl custom_world_agent_messageQueryTableAccess for __sdk::QueryTableAccessor { - fn custom_world_agent_message(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("custom_world_agent_message") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/custom_world_agent_operation_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/custom_world_agent_operation_table.rs deleted file mode 100644 index 7e6b6b11..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/custom_world_agent_operation_table.rs +++ /dev/null @@ -1,165 +0,0 @@ -// 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::custom_world_agent_operation_type::CustomWorldAgentOperation; -use super::rpg_agent_operation_type_type::RpgAgentOperationType; -use super::rpg_agent_operation_status_type::RpgAgentOperationStatus; - -/// Table handle for the table `custom_world_agent_operation`. -/// -/// Obtain a handle from the [`CustomWorldAgentOperationTableAccess::custom_world_agent_operation`] method on [`super::RemoteTables`], -/// like `ctx.db.custom_world_agent_operation()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.custom_world_agent_operation().on_insert(...)`. -pub struct CustomWorldAgentOperationTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `custom_world_agent_operation`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait CustomWorldAgentOperationTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`CustomWorldAgentOperationTableHandle`], which mediates access to the table `custom_world_agent_operation`. - fn custom_world_agent_operation(&self) -> CustomWorldAgentOperationTableHandle<'_>; -} - -impl CustomWorldAgentOperationTableAccess for super::RemoteTables { - fn custom_world_agent_operation(&self) -> CustomWorldAgentOperationTableHandle<'_> { - CustomWorldAgentOperationTableHandle { - imp: self.imp.get_table::("custom_world_agent_operation"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct CustomWorldAgentOperationInsertCallbackId(__sdk::CallbackId); -pub struct CustomWorldAgentOperationDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for CustomWorldAgentOperationTableHandle<'ctx> { - type Row = CustomWorldAgentOperation; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = CustomWorldAgentOperationInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> CustomWorldAgentOperationInsertCallbackId { - CustomWorldAgentOperationInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: CustomWorldAgentOperationInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = CustomWorldAgentOperationDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> CustomWorldAgentOperationDeleteCallbackId { - CustomWorldAgentOperationDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: CustomWorldAgentOperationDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct CustomWorldAgentOperationUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for CustomWorldAgentOperationTableHandle<'ctx> { - type UpdateCallbackId = CustomWorldAgentOperationUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> CustomWorldAgentOperationUpdateCallbackId { - CustomWorldAgentOperationUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: CustomWorldAgentOperationUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `operation_id` unique index on the table `custom_world_agent_operation`, - /// which allows point queries on the field of the same name - /// via the [`CustomWorldAgentOperationOperationIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.custom_world_agent_operation().operation_id().find(...)`. - pub struct CustomWorldAgentOperationOperationIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> CustomWorldAgentOperationTableHandle<'ctx> { - /// Get a handle on the `operation_id` unique index on the table `custom_world_agent_operation`. - pub fn operation_id(&self) -> CustomWorldAgentOperationOperationIdUnique<'ctx> { - CustomWorldAgentOperationOperationIdUnique { - imp: self.imp.get_unique_constraint::("operation_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> CustomWorldAgentOperationOperationIdUnique<'ctx> { - /// Find the subscribed row whose `operation_id` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &String) -> Option { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("custom_world_agent_operation"); - _table.add_unique_constraint::("operation_id", |row| &row.operation_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `CustomWorldAgentOperation`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait custom_world_agent_operationQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `CustomWorldAgentOperation`. - fn custom_world_agent_operation(&self) -> __sdk::__query_builder::Table; - } - - impl custom_world_agent_operationQueryTableAccess for __sdk::QueryTableAccessor { - fn custom_world_agent_operation(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("custom_world_agent_operation") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/custom_world_agent_session_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/custom_world_agent_session_table.rs deleted file mode 100644 index 8b907a69..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/custom_world_agent_session_table.rs +++ /dev/null @@ -1,164 +0,0 @@ -// 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::custom_world_agent_session_type::CustomWorldAgentSession; -use super::rpg_agent_stage_type::RpgAgentStage; - -/// Table handle for the table `custom_world_agent_session`. -/// -/// Obtain a handle from the [`CustomWorldAgentSessionTableAccess::custom_world_agent_session`] method on [`super::RemoteTables`], -/// like `ctx.db.custom_world_agent_session()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.custom_world_agent_session().on_insert(...)`. -pub struct CustomWorldAgentSessionTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `custom_world_agent_session`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait CustomWorldAgentSessionTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`CustomWorldAgentSessionTableHandle`], which mediates access to the table `custom_world_agent_session`. - fn custom_world_agent_session(&self) -> CustomWorldAgentSessionTableHandle<'_>; -} - -impl CustomWorldAgentSessionTableAccess for super::RemoteTables { - fn custom_world_agent_session(&self) -> CustomWorldAgentSessionTableHandle<'_> { - CustomWorldAgentSessionTableHandle { - imp: self.imp.get_table::("custom_world_agent_session"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct CustomWorldAgentSessionInsertCallbackId(__sdk::CallbackId); -pub struct CustomWorldAgentSessionDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for CustomWorldAgentSessionTableHandle<'ctx> { - type Row = CustomWorldAgentSession; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = CustomWorldAgentSessionInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> CustomWorldAgentSessionInsertCallbackId { - CustomWorldAgentSessionInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: CustomWorldAgentSessionInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = CustomWorldAgentSessionDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> CustomWorldAgentSessionDeleteCallbackId { - CustomWorldAgentSessionDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: CustomWorldAgentSessionDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct CustomWorldAgentSessionUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for CustomWorldAgentSessionTableHandle<'ctx> { - type UpdateCallbackId = CustomWorldAgentSessionUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> CustomWorldAgentSessionUpdateCallbackId { - CustomWorldAgentSessionUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: CustomWorldAgentSessionUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `session_id` unique index on the table `custom_world_agent_session`, - /// which allows point queries on the field of the same name - /// via the [`CustomWorldAgentSessionSessionIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.custom_world_agent_session().session_id().find(...)`. - pub struct CustomWorldAgentSessionSessionIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> CustomWorldAgentSessionTableHandle<'ctx> { - /// Get a handle on the `session_id` unique index on the table `custom_world_agent_session`. - pub fn session_id(&self) -> CustomWorldAgentSessionSessionIdUnique<'ctx> { - CustomWorldAgentSessionSessionIdUnique { - imp: self.imp.get_unique_constraint::("session_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> CustomWorldAgentSessionSessionIdUnique<'ctx> { - /// Find the subscribed row whose `session_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("custom_world_agent_session"); - _table.add_unique_constraint::("session_id", |row| &row.session_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `CustomWorldAgentSession`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait custom_world_agent_sessionQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `CustomWorldAgentSession`. - fn custom_world_agent_session(&self) -> __sdk::__query_builder::Table; - } - - impl custom_world_agent_sessionQueryTableAccess for __sdk::QueryTableAccessor { - fn custom_world_agent_session(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("custom_world_agent_session") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/custom_world_draft_card_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/custom_world_draft_card_table.rs deleted file mode 100644 index 9d197db6..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/custom_world_draft_card_table.rs +++ /dev/null @@ -1,166 +0,0 @@ -// 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::custom_world_draft_card_type::CustomWorldDraftCard; -use super::rpg_agent_draft_card_kind_type::RpgAgentDraftCardKind; -use super::rpg_agent_draft_card_status_type::RpgAgentDraftCardStatus; -use super::custom_world_role_asset_status_type::CustomWorldRoleAssetStatus; - -/// Table handle for the table `custom_world_draft_card`. -/// -/// Obtain a handle from the [`CustomWorldDraftCardTableAccess::custom_world_draft_card`] method on [`super::RemoteTables`], -/// like `ctx.db.custom_world_draft_card()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.custom_world_draft_card().on_insert(...)`. -pub struct CustomWorldDraftCardTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `custom_world_draft_card`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait CustomWorldDraftCardTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`CustomWorldDraftCardTableHandle`], which mediates access to the table `custom_world_draft_card`. - fn custom_world_draft_card(&self) -> CustomWorldDraftCardTableHandle<'_>; -} - -impl CustomWorldDraftCardTableAccess for super::RemoteTables { - fn custom_world_draft_card(&self) -> CustomWorldDraftCardTableHandle<'_> { - CustomWorldDraftCardTableHandle { - imp: self.imp.get_table::("custom_world_draft_card"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct CustomWorldDraftCardInsertCallbackId(__sdk::CallbackId); -pub struct CustomWorldDraftCardDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for CustomWorldDraftCardTableHandle<'ctx> { - type Row = CustomWorldDraftCard; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = CustomWorldDraftCardInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> CustomWorldDraftCardInsertCallbackId { - CustomWorldDraftCardInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: CustomWorldDraftCardInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = CustomWorldDraftCardDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> CustomWorldDraftCardDeleteCallbackId { - CustomWorldDraftCardDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: CustomWorldDraftCardDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct CustomWorldDraftCardUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for CustomWorldDraftCardTableHandle<'ctx> { - type UpdateCallbackId = CustomWorldDraftCardUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> CustomWorldDraftCardUpdateCallbackId { - CustomWorldDraftCardUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: CustomWorldDraftCardUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `card_id` unique index on the table `custom_world_draft_card`, - /// which allows point queries on the field of the same name - /// via the [`CustomWorldDraftCardCardIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.custom_world_draft_card().card_id().find(...)`. - pub struct CustomWorldDraftCardCardIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> CustomWorldDraftCardTableHandle<'ctx> { - /// Get a handle on the `card_id` unique index on the table `custom_world_draft_card`. - pub fn card_id(&self) -> CustomWorldDraftCardCardIdUnique<'ctx> { - CustomWorldDraftCardCardIdUnique { - imp: self.imp.get_unique_constraint::("card_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> CustomWorldDraftCardCardIdUnique<'ctx> { - /// Find the subscribed row whose `card_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("custom_world_draft_card"); - _table.add_unique_constraint::("card_id", |row| &row.card_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `CustomWorldDraftCard`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait custom_world_draft_cardQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `CustomWorldDraftCard`. - fn custom_world_draft_card(&self) -> __sdk::__query_builder::Table; - } - - impl custom_world_draft_cardQueryTableAccess for __sdk::QueryTableAccessor { - fn custom_world_draft_card(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("custom_world_draft_card") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/custom_world_profile_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/custom_world_profile_table.rs deleted file mode 100644 index 69639bf3..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/custom_world_profile_table.rs +++ /dev/null @@ -1,165 +0,0 @@ -// 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::custom_world_profile_type::CustomWorldProfile; -use super::custom_world_theme_mode_type::CustomWorldThemeMode; -use super::custom_world_publication_status_type::CustomWorldPublicationStatus; - -/// Table handle for the table `custom_world_profile`. -/// -/// Obtain a handle from the [`CustomWorldProfileTableAccess::custom_world_profile`] method on [`super::RemoteTables`], -/// like `ctx.db.custom_world_profile()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.custom_world_profile().on_insert(...)`. -pub struct CustomWorldProfileTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `custom_world_profile`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait CustomWorldProfileTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`CustomWorldProfileTableHandle`], which mediates access to the table `custom_world_profile`. - fn custom_world_profile(&self) -> CustomWorldProfileTableHandle<'_>; -} - -impl CustomWorldProfileTableAccess for super::RemoteTables { - fn custom_world_profile(&self) -> CustomWorldProfileTableHandle<'_> { - CustomWorldProfileTableHandle { - imp: self.imp.get_table::("custom_world_profile"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct CustomWorldProfileInsertCallbackId(__sdk::CallbackId); -pub struct CustomWorldProfileDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for CustomWorldProfileTableHandle<'ctx> { - type Row = CustomWorldProfile; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = CustomWorldProfileInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> CustomWorldProfileInsertCallbackId { - CustomWorldProfileInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: CustomWorldProfileInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = CustomWorldProfileDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> CustomWorldProfileDeleteCallbackId { - CustomWorldProfileDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: CustomWorldProfileDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct CustomWorldProfileUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for CustomWorldProfileTableHandle<'ctx> { - type UpdateCallbackId = CustomWorldProfileUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> CustomWorldProfileUpdateCallbackId { - CustomWorldProfileUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: CustomWorldProfileUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `profile_id` unique index on the table `custom_world_profile`, - /// which allows point queries on the field of the same name - /// via the [`CustomWorldProfileProfileIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.custom_world_profile().profile_id().find(...)`. - pub struct CustomWorldProfileProfileIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> CustomWorldProfileTableHandle<'ctx> { - /// Get a handle on the `profile_id` unique index on the table `custom_world_profile`. - pub fn profile_id(&self) -> CustomWorldProfileProfileIdUnique<'ctx> { - CustomWorldProfileProfileIdUnique { - imp: self.imp.get_unique_constraint::("profile_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> CustomWorldProfileProfileIdUnique<'ctx> { - /// Find the subscribed row whose `profile_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("custom_world_profile"); - _table.add_unique_constraint::("profile_id", |row| &row.profile_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `CustomWorldProfile`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait custom_world_profileQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `CustomWorldProfile`. - fn custom_world_profile(&self) -> __sdk::__query_builder::Table; - } - - impl custom_world_profileQueryTableAccess for __sdk::QueryTableAccessor { - fn custom_world_profile(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("custom_world_profile") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/custom_world_session_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/custom_world_session_table.rs deleted file mode 100644 index 4d44d0ff..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/custom_world_session_table.rs +++ /dev/null @@ -1,165 +0,0 @@ -// 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::custom_world_session_type::CustomWorldSession; -use super::custom_world_generation_mode_type::CustomWorldGenerationMode; -use super::custom_world_session_status_type::CustomWorldSessionStatus; - -/// Table handle for the table `custom_world_session`. -/// -/// Obtain a handle from the [`CustomWorldSessionTableAccess::custom_world_session`] method on [`super::RemoteTables`], -/// like `ctx.db.custom_world_session()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.custom_world_session().on_insert(...)`. -pub struct CustomWorldSessionTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `custom_world_session`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait CustomWorldSessionTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`CustomWorldSessionTableHandle`], which mediates access to the table `custom_world_session`. - fn custom_world_session(&self) -> CustomWorldSessionTableHandle<'_>; -} - -impl CustomWorldSessionTableAccess for super::RemoteTables { - fn custom_world_session(&self) -> CustomWorldSessionTableHandle<'_> { - CustomWorldSessionTableHandle { - imp: self.imp.get_table::("custom_world_session"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct CustomWorldSessionInsertCallbackId(__sdk::CallbackId); -pub struct CustomWorldSessionDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for CustomWorldSessionTableHandle<'ctx> { - type Row = CustomWorldSession; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = CustomWorldSessionInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> CustomWorldSessionInsertCallbackId { - CustomWorldSessionInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: CustomWorldSessionInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = CustomWorldSessionDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> CustomWorldSessionDeleteCallbackId { - CustomWorldSessionDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: CustomWorldSessionDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct CustomWorldSessionUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for CustomWorldSessionTableHandle<'ctx> { - type UpdateCallbackId = CustomWorldSessionUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> CustomWorldSessionUpdateCallbackId { - CustomWorldSessionUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: CustomWorldSessionUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `session_id` unique index on the table `custom_world_session`, - /// which allows point queries on the field of the same name - /// via the [`CustomWorldSessionSessionIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.custom_world_session().session_id().find(...)`. - pub struct CustomWorldSessionSessionIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> CustomWorldSessionTableHandle<'ctx> { - /// Get a handle on the `session_id` unique index on the table `custom_world_session`. - pub fn session_id(&self) -> CustomWorldSessionSessionIdUnique<'ctx> { - CustomWorldSessionSessionIdUnique { - imp: self.imp.get_unique_constraint::("session_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> CustomWorldSessionSessionIdUnique<'ctx> { - /// Find the subscribed row whose `session_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("custom_world_session"); - _table.add_unique_constraint::("session_id", |row| &row.session_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `CustomWorldSession`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait custom_world_sessionQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `CustomWorldSession`. - fn custom_world_session(&self) -> __sdk::__query_builder::Table; - } - - impl custom_world_sessionQueryTableAccess for __sdk::QueryTableAccessor { - fn custom_world_session(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("custom_world_session") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/inventory_slot_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/inventory_slot_table.rs deleted file mode 100644 index da04ff99..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/inventory_slot_table.rs +++ /dev/null @@ -1,167 +0,0 @@ -// 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::inventory_slot_type::InventorySlot; -use super::inventory_item_rarity_type::InventoryItemRarity; -use super::inventory_equipment_slot_type::InventoryEquipmentSlot; -use super::inventory_item_source_kind_type::InventoryItemSourceKind; -use super::inventory_container_kind_type::InventoryContainerKind; - -/// Table handle for the table `inventory_slot`. -/// -/// Obtain a handle from the [`InventorySlotTableAccess::inventory_slot`] method on [`super::RemoteTables`], -/// like `ctx.db.inventory_slot()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.inventory_slot().on_insert(...)`. -pub struct InventorySlotTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `inventory_slot`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait InventorySlotTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`InventorySlotTableHandle`], which mediates access to the table `inventory_slot`. - fn inventory_slot(&self) -> InventorySlotTableHandle<'_>; -} - -impl InventorySlotTableAccess for super::RemoteTables { - fn inventory_slot(&self) -> InventorySlotTableHandle<'_> { - InventorySlotTableHandle { - imp: self.imp.get_table::("inventory_slot"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct InventorySlotInsertCallbackId(__sdk::CallbackId); -pub struct InventorySlotDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for InventorySlotTableHandle<'ctx> { - type Row = InventorySlot; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = InventorySlotInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> InventorySlotInsertCallbackId { - InventorySlotInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: InventorySlotInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = InventorySlotDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> InventorySlotDeleteCallbackId { - InventorySlotDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: InventorySlotDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct InventorySlotUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for InventorySlotTableHandle<'ctx> { - type UpdateCallbackId = InventorySlotUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> InventorySlotUpdateCallbackId { - InventorySlotUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: InventorySlotUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `slot_id` unique index on the table `inventory_slot`, - /// which allows point queries on the field of the same name - /// via the [`InventorySlotSlotIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.inventory_slot().slot_id().find(...)`. - pub struct InventorySlotSlotIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> InventorySlotTableHandle<'ctx> { - /// Get a handle on the `slot_id` unique index on the table `inventory_slot`. - pub fn slot_id(&self) -> InventorySlotSlotIdUnique<'ctx> { - InventorySlotSlotIdUnique { - imp: self.imp.get_unique_constraint::("slot_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> InventorySlotSlotIdUnique<'ctx> { - /// Find the subscribed row whose `slot_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("inventory_slot"); - _table.add_unique_constraint::("slot_id", |row| &row.slot_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `InventorySlot`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait inventory_slotQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `InventorySlot`. - fn inventory_slot(&self) -> __sdk::__query_builder::Table; - } - - impl inventory_slotQueryTableAccess for __sdk::QueryTableAccessor { - fn inventory_slot(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("inventory_slot") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/list_asset_history_and_return_procedure.rs b/server-rs/crates/spacetime-client/src/module_bindings/list_asset_history_and_return_procedure.rs new file mode 100644 index 00000000..28f04f52 --- /dev/null +++ b/server-rs/crates/spacetime-client/src/module_bindings/list_asset_history_and_return_procedure.rs @@ -0,0 +1,58 @@ +// 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::asset_history_list_input_type::AssetHistoryListInput; +use super::asset_history_list_result_type::AssetHistoryListResult; + +#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] +#[sats(crate = __lib)] + struct ListAssetHistoryAndReturnArgs { + pub input: AssetHistoryListInput, +} + + +impl __sdk::InModule for ListAssetHistoryAndReturnArgs { + type Module = super::RemoteModule; +} + +#[allow(non_camel_case_types)] +/// Extension trait for access to the procedure `list_asset_history_and_return`. +/// +/// Implemented for [`super::RemoteProcedures`]. +pub trait list_asset_history_and_return { + fn list_asset_history_and_return(&self, input: AssetHistoryListInput, +) { + self.list_asset_history_and_return_then(input, |_, _| {}); + } + + fn list_asset_history_and_return_then( + &self, + input: AssetHistoryListInput, + + __callback: impl FnOnce(&super::ProcedureEventContext, Result) + Send + 'static, + ); +} + +impl list_asset_history_and_return for super::RemoteProcedures { + fn list_asset_history_and_return_then( + &self, + input: AssetHistoryListInput, + + __callback: impl FnOnce(&super::ProcedureEventContext, Result) + Send + 'static, + ) { + self.imp.invoke_procedure_with_callback::<_, AssetHistoryListResult>( + "list_asset_history_and_return", + ListAssetHistoryAndReturnArgs { input, }, + __callback, + ); + } +} + diff --git a/server-rs/crates/spacetime-client/src/module_bindings/mod.rs b/server-rs/crates/spacetime-client/src/module_bindings/mod.rs index 10e41e4b..71391705 100644 --- a/server-rs/crates/spacetime-client/src/module_bindings/mod.rs +++ b/server-rs/crates/spacetime-client/src/module_bindings/mod.rs @@ -39,6 +39,9 @@ pub mod asset_entity_binding_type; pub mod asset_entity_binding_input_type; pub mod asset_entity_binding_procedure_result_type; pub mod asset_entity_binding_snapshot_type; +pub mod asset_history_entry_snapshot_type; +pub mod asset_history_list_input_type; +pub mod asset_history_list_result_type; pub mod asset_object_type; pub mod asset_object_access_policy_type; pub mod asset_object_procedure_result_type; @@ -367,52 +370,7 @@ pub mod unpublish_custom_world_profile_reducer; pub mod upsert_chapter_progression_reducer; pub mod upsert_custom_world_profile_reducer; pub mod upsert_npc_state_reducer; -pub mod ai_result_reference_table; -pub mod ai_task_table; -pub mod ai_task_stage_table; -pub mod ai_text_chunk_table; -pub mod asset_entity_binding_table; -pub mod asset_object_table; -pub mod auth_identity_table; -pub mod auth_store_snapshot_table; -pub mod battle_state_table; -pub mod big_fish_agent_message_table; -pub mod big_fish_asset_slot_table; -pub mod big_fish_creation_session_table; -pub mod big_fish_runtime_run_table; -pub mod chapter_progression_table; -pub mod custom_world_agent_message_table; -pub mod custom_world_agent_operation_table; -pub mod custom_world_agent_session_table; -pub mod custom_world_draft_card_table; pub mod custom_world_gallery_entry_table; -pub mod custom_world_profile_table; -pub mod custom_world_session_table; -pub mod inventory_slot_table; -pub mod npc_state_table; -pub mod player_progression_table; -pub mod profile_dashboard_state_table; -pub mod profile_invite_code_table; -pub mod profile_membership_table; -pub mod profile_played_world_table; -pub mod profile_recharge_order_table; -pub mod profile_referral_relation_table; -pub mod profile_save_archive_table; -pub mod profile_wallet_ledger_table; -pub mod puzzle_agent_message_table; -pub mod puzzle_agent_session_table; -pub mod puzzle_runtime_run_table; -pub mod puzzle_work_profile_table; -pub mod quest_log_table; -pub mod quest_record_table; -pub mod refresh_session_table; -pub mod runtime_setting_table; -pub mod runtime_snapshot_table; -pub mod story_event_table; -pub mod story_session_table; -pub mod treasure_record_table; -pub mod user_account_table; -pub mod user_browse_history_table; pub mod advance_puzzle_next_level_procedure; pub mod append_ai_text_chunk_and_return_procedure; pub mod apply_chapter_progression_ledger_entry_and_return_procedure; @@ -473,6 +431,7 @@ pub mod get_runtime_snapshot_procedure; pub mod get_story_session_state_procedure; pub mod grant_player_progression_experience_and_return_procedure; pub mod import_auth_store_snapshot_procedure; +pub mod list_asset_history_and_return_procedure; pub mod list_big_fish_works_procedure; pub mod list_custom_world_gallery_entries_procedure; pub mod list_custom_world_profiles_procedure; @@ -541,6 +500,9 @@ pub use asset_entity_binding_type::AssetEntityBinding; pub use asset_entity_binding_input_type::AssetEntityBindingInput; pub use asset_entity_binding_procedure_result_type::AssetEntityBindingProcedureResult; pub use asset_entity_binding_snapshot_type::AssetEntityBindingSnapshot; +pub use asset_history_entry_snapshot_type::AssetHistoryEntrySnapshot; +pub use asset_history_list_input_type::AssetHistoryListInput; +pub use asset_history_list_result_type::AssetHistoryListResult; pub use asset_object_type::AssetObject; pub use asset_object_access_policy_type::AssetObjectAccessPolicy; pub use asset_object_procedure_result_type::AssetObjectProcedureResult; @@ -845,52 +807,7 @@ pub use treasure_resolve_input_type::TreasureResolveInput; pub use unequip_inventory_item_input_type::UnequipInventoryItemInput; pub use user_account_type::UserAccount; pub use user_browse_history_type::UserBrowseHistory; -pub use ai_result_reference_table::*; -pub use ai_task_table::*; -pub use ai_task_stage_table::*; -pub use ai_text_chunk_table::*; -pub use asset_entity_binding_table::*; -pub use asset_object_table::*; -pub use auth_identity_table::*; -pub use auth_store_snapshot_table::*; -pub use battle_state_table::*; -pub use big_fish_agent_message_table::*; -pub use big_fish_asset_slot_table::*; -pub use big_fish_creation_session_table::*; -pub use big_fish_runtime_run_table::*; -pub use chapter_progression_table::*; -pub use custom_world_agent_message_table::*; -pub use custom_world_agent_operation_table::*; -pub use custom_world_agent_session_table::*; -pub use custom_world_draft_card_table::*; pub use custom_world_gallery_entry_table::*; -pub use custom_world_profile_table::*; -pub use custom_world_session_table::*; -pub use inventory_slot_table::*; -pub use npc_state_table::*; -pub use player_progression_table::*; -pub use profile_dashboard_state_table::*; -pub use profile_invite_code_table::*; -pub use profile_membership_table::*; -pub use profile_played_world_table::*; -pub use profile_recharge_order_table::*; -pub use profile_referral_relation_table::*; -pub use profile_save_archive_table::*; -pub use profile_wallet_ledger_table::*; -pub use puzzle_agent_message_table::*; -pub use puzzle_agent_session_table::*; -pub use puzzle_runtime_run_table::*; -pub use puzzle_work_profile_table::*; -pub use quest_log_table::*; -pub use quest_record_table::*; -pub use refresh_session_table::*; -pub use runtime_setting_table::*; -pub use runtime_snapshot_table::*; -pub use story_event_table::*; -pub use story_session_table::*; -pub use treasure_record_table::*; -pub use user_account_table::*; -pub use user_browse_history_table::*; pub use accept_quest_reducer::accept_quest; pub use acknowledge_quest_completion_reducer::acknowledge_quest_completion; pub use apply_chapter_progression_ledger_entry_reducer::apply_chapter_progression_ledger_entry; @@ -975,6 +892,7 @@ pub use get_runtime_snapshot_procedure::get_runtime_snapshot; pub use get_story_session_state_procedure::get_story_session_state; pub use grant_player_progression_experience_and_return_procedure::grant_player_progression_experience_and_return; pub use import_auth_store_snapshot_procedure::import_auth_store_snapshot; +pub use list_asset_history_and_return_procedure::list_asset_history_and_return; pub use list_big_fish_works_procedure::list_big_fish_works; pub use list_custom_world_gallery_entries_procedure::list_custom_world_gallery_entries; pub use list_custom_world_profiles_procedure::list_custom_world_profiles; @@ -1264,52 +1182,7 @@ fn args_bsatn(&self) -> Result, __sats::bsatn::EncodeError> { #[allow(non_snake_case)] #[doc(hidden)] pub struct DbUpdate { - ai_result_reference: __sdk::TableUpdate, - ai_task: __sdk::TableUpdate, - ai_task_stage: __sdk::TableUpdate, - ai_text_chunk: __sdk::TableUpdate, - asset_entity_binding: __sdk::TableUpdate, - asset_object: __sdk::TableUpdate, - auth_identity: __sdk::TableUpdate, - auth_store_snapshot: __sdk::TableUpdate, - battle_state: __sdk::TableUpdate, - big_fish_agent_message: __sdk::TableUpdate, - big_fish_asset_slot: __sdk::TableUpdate, - big_fish_creation_session: __sdk::TableUpdate, - big_fish_runtime_run: __sdk::TableUpdate, - chapter_progression: __sdk::TableUpdate, - custom_world_agent_message: __sdk::TableUpdate, - custom_world_agent_operation: __sdk::TableUpdate, - custom_world_agent_session: __sdk::TableUpdate, - custom_world_draft_card: __sdk::TableUpdate, - custom_world_gallery_entry: __sdk::TableUpdate, - custom_world_profile: __sdk::TableUpdate, - custom_world_session: __sdk::TableUpdate, - inventory_slot: __sdk::TableUpdate, - npc_state: __sdk::TableUpdate, - player_progression: __sdk::TableUpdate, - profile_dashboard_state: __sdk::TableUpdate, - profile_invite_code: __sdk::TableUpdate, - profile_membership: __sdk::TableUpdate, - profile_played_world: __sdk::TableUpdate, - profile_recharge_order: __sdk::TableUpdate, - profile_referral_relation: __sdk::TableUpdate, - profile_save_archive: __sdk::TableUpdate, - profile_wallet_ledger: __sdk::TableUpdate, - puzzle_agent_message: __sdk::TableUpdate, - puzzle_agent_session: __sdk::TableUpdate, - puzzle_runtime_run: __sdk::TableUpdate, - puzzle_work_profile: __sdk::TableUpdate, - quest_log: __sdk::TableUpdate, - quest_record: __sdk::TableUpdate, - refresh_session: __sdk::TableUpdate, - runtime_setting: __sdk::TableUpdate, - runtime_snapshot: __sdk::TableUpdate, - story_event: __sdk::TableUpdate, - story_session: __sdk::TableUpdate, - treasure_record: __sdk::TableUpdate, - user_account: __sdk::TableUpdate, - user_browse_history: __sdk::TableUpdate, + custom_world_gallery_entry: __sdk::TableUpdate, } @@ -1320,52 +1193,7 @@ impl TryFrom<__ws::v2::TransactionUpdate> for DbUpdate { for table_update in __sdk::transaction_update_iter_table_updates(raw) { match &table_update.table_name[..] { - "ai_result_reference" => db_update.ai_result_reference.append(ai_result_reference_table::parse_table_update(table_update)?), - "ai_task" => db_update.ai_task.append(ai_task_table::parse_table_update(table_update)?), - "ai_task_stage" => db_update.ai_task_stage.append(ai_task_stage_table::parse_table_update(table_update)?), - "ai_text_chunk" => db_update.ai_text_chunk.append(ai_text_chunk_table::parse_table_update(table_update)?), - "asset_entity_binding" => db_update.asset_entity_binding.append(asset_entity_binding_table::parse_table_update(table_update)?), - "asset_object" => db_update.asset_object.append(asset_object_table::parse_table_update(table_update)?), - "auth_identity" => db_update.auth_identity.append(auth_identity_table::parse_table_update(table_update)?), - "auth_store_snapshot" => db_update.auth_store_snapshot.append(auth_store_snapshot_table::parse_table_update(table_update)?), - "battle_state" => db_update.battle_state.append(battle_state_table::parse_table_update(table_update)?), - "big_fish_agent_message" => db_update.big_fish_agent_message.append(big_fish_agent_message_table::parse_table_update(table_update)?), - "big_fish_asset_slot" => db_update.big_fish_asset_slot.append(big_fish_asset_slot_table::parse_table_update(table_update)?), - "big_fish_creation_session" => db_update.big_fish_creation_session.append(big_fish_creation_session_table::parse_table_update(table_update)?), - "big_fish_runtime_run" => db_update.big_fish_runtime_run.append(big_fish_runtime_run_table::parse_table_update(table_update)?), - "chapter_progression" => db_update.chapter_progression.append(chapter_progression_table::parse_table_update(table_update)?), - "custom_world_agent_message" => db_update.custom_world_agent_message.append(custom_world_agent_message_table::parse_table_update(table_update)?), - "custom_world_agent_operation" => db_update.custom_world_agent_operation.append(custom_world_agent_operation_table::parse_table_update(table_update)?), - "custom_world_agent_session" => db_update.custom_world_agent_session.append(custom_world_agent_session_table::parse_table_update(table_update)?), - "custom_world_draft_card" => db_update.custom_world_draft_card.append(custom_world_draft_card_table::parse_table_update(table_update)?), - "custom_world_gallery_entry" => db_update.custom_world_gallery_entry.append(custom_world_gallery_entry_table::parse_table_update(table_update)?), - "custom_world_profile" => db_update.custom_world_profile.append(custom_world_profile_table::parse_table_update(table_update)?), - "custom_world_session" => db_update.custom_world_session.append(custom_world_session_table::parse_table_update(table_update)?), - "inventory_slot" => db_update.inventory_slot.append(inventory_slot_table::parse_table_update(table_update)?), - "npc_state" => db_update.npc_state.append(npc_state_table::parse_table_update(table_update)?), - "player_progression" => db_update.player_progression.append(player_progression_table::parse_table_update(table_update)?), - "profile_dashboard_state" => db_update.profile_dashboard_state.append(profile_dashboard_state_table::parse_table_update(table_update)?), - "profile_invite_code" => db_update.profile_invite_code.append(profile_invite_code_table::parse_table_update(table_update)?), - "profile_membership" => db_update.profile_membership.append(profile_membership_table::parse_table_update(table_update)?), - "profile_played_world" => db_update.profile_played_world.append(profile_played_world_table::parse_table_update(table_update)?), - "profile_recharge_order" => db_update.profile_recharge_order.append(profile_recharge_order_table::parse_table_update(table_update)?), - "profile_referral_relation" => db_update.profile_referral_relation.append(profile_referral_relation_table::parse_table_update(table_update)?), - "profile_save_archive" => db_update.profile_save_archive.append(profile_save_archive_table::parse_table_update(table_update)?), - "profile_wallet_ledger" => db_update.profile_wallet_ledger.append(profile_wallet_ledger_table::parse_table_update(table_update)?), - "puzzle_agent_message" => db_update.puzzle_agent_message.append(puzzle_agent_message_table::parse_table_update(table_update)?), - "puzzle_agent_session" => db_update.puzzle_agent_session.append(puzzle_agent_session_table::parse_table_update(table_update)?), - "puzzle_runtime_run" => db_update.puzzle_runtime_run.append(puzzle_runtime_run_table::parse_table_update(table_update)?), - "puzzle_work_profile" => db_update.puzzle_work_profile.append(puzzle_work_profile_table::parse_table_update(table_update)?), - "quest_log" => db_update.quest_log.append(quest_log_table::parse_table_update(table_update)?), - "quest_record" => db_update.quest_record.append(quest_record_table::parse_table_update(table_update)?), - "refresh_session" => db_update.refresh_session.append(refresh_session_table::parse_table_update(table_update)?), - "runtime_setting" => db_update.runtime_setting.append(runtime_setting_table::parse_table_update(table_update)?), - "runtime_snapshot" => db_update.runtime_snapshot.append(runtime_snapshot_table::parse_table_update(table_update)?), - "story_event" => db_update.story_event.append(story_event_table::parse_table_update(table_update)?), - "story_session" => db_update.story_session.append(story_session_table::parse_table_update(table_update)?), - "treasure_record" => db_update.treasure_record.append(treasure_record_table::parse_table_update(table_update)?), - "user_account" => db_update.user_account.append(user_account_table::parse_table_update(table_update)?), - "user_browse_history" => db_update.user_browse_history.append(user_browse_history_table::parse_table_update(table_update)?), + "custom_world_gallery_entry" => db_update.custom_world_gallery_entry.append(custom_world_gallery_entry_table::parse_table_update(table_update)?), unknown => { return Err(__sdk::InternalError::unknown_name( @@ -1388,52 +1216,7 @@ impl __sdk::DbUpdate for DbUpdate { fn apply_to_client_cache(&self, cache: &mut __sdk::ClientCache) -> AppliedDiff<'_> { let mut diff = AppliedDiff::default(); - diff.ai_result_reference = cache.apply_diff_to_table::("ai_result_reference", &self.ai_result_reference).with_updates_by_pk(|row| &row.result_reference_row_id); - diff.ai_task = cache.apply_diff_to_table::("ai_task", &self.ai_task).with_updates_by_pk(|row| &row.task_id); - diff.ai_task_stage = cache.apply_diff_to_table::("ai_task_stage", &self.ai_task_stage).with_updates_by_pk(|row| &row.task_stage_id); - diff.ai_text_chunk = cache.apply_diff_to_table::("ai_text_chunk", &self.ai_text_chunk).with_updates_by_pk(|row| &row.text_chunk_row_id); - diff.asset_entity_binding = cache.apply_diff_to_table::("asset_entity_binding", &self.asset_entity_binding).with_updates_by_pk(|row| &row.binding_id); - diff.asset_object = cache.apply_diff_to_table::("asset_object", &self.asset_object).with_updates_by_pk(|row| &row.asset_object_id); - diff.auth_identity = cache.apply_diff_to_table::("auth_identity", &self.auth_identity).with_updates_by_pk(|row| &row.identity_id); - diff.auth_store_snapshot = cache.apply_diff_to_table::("auth_store_snapshot", &self.auth_store_snapshot).with_updates_by_pk(|row| &row.snapshot_id); - diff.battle_state = cache.apply_diff_to_table::("battle_state", &self.battle_state).with_updates_by_pk(|row| &row.battle_state_id); - diff.big_fish_agent_message = cache.apply_diff_to_table::("big_fish_agent_message", &self.big_fish_agent_message).with_updates_by_pk(|row| &row.message_id); - diff.big_fish_asset_slot = cache.apply_diff_to_table::("big_fish_asset_slot", &self.big_fish_asset_slot).with_updates_by_pk(|row| &row.slot_id); - diff.big_fish_creation_session = cache.apply_diff_to_table::("big_fish_creation_session", &self.big_fish_creation_session).with_updates_by_pk(|row| &row.session_id); - diff.big_fish_runtime_run = cache.apply_diff_to_table::("big_fish_runtime_run", &self.big_fish_runtime_run).with_updates_by_pk(|row| &row.run_id); - diff.chapter_progression = cache.apply_diff_to_table::("chapter_progression", &self.chapter_progression).with_updates_by_pk(|row| &row.chapter_progression_id); - diff.custom_world_agent_message = cache.apply_diff_to_table::("custom_world_agent_message", &self.custom_world_agent_message).with_updates_by_pk(|row| &row.message_id); - diff.custom_world_agent_operation = cache.apply_diff_to_table::("custom_world_agent_operation", &self.custom_world_agent_operation).with_updates_by_pk(|row| &row.operation_id); - diff.custom_world_agent_session = cache.apply_diff_to_table::("custom_world_agent_session", &self.custom_world_agent_session).with_updates_by_pk(|row| &row.session_id); - diff.custom_world_draft_card = cache.apply_diff_to_table::("custom_world_draft_card", &self.custom_world_draft_card).with_updates_by_pk(|row| &row.card_id); - diff.custom_world_gallery_entry = cache.apply_diff_to_table::("custom_world_gallery_entry", &self.custom_world_gallery_entry).with_updates_by_pk(|row| &row.profile_id); - diff.custom_world_profile = cache.apply_diff_to_table::("custom_world_profile", &self.custom_world_profile).with_updates_by_pk(|row| &row.profile_id); - diff.custom_world_session = cache.apply_diff_to_table::("custom_world_session", &self.custom_world_session).with_updates_by_pk(|row| &row.session_id); - diff.inventory_slot = cache.apply_diff_to_table::("inventory_slot", &self.inventory_slot).with_updates_by_pk(|row| &row.slot_id); - diff.npc_state = cache.apply_diff_to_table::("npc_state", &self.npc_state).with_updates_by_pk(|row| &row.npc_state_id); - diff.player_progression = cache.apply_diff_to_table::("player_progression", &self.player_progression).with_updates_by_pk(|row| &row.user_id); - diff.profile_dashboard_state = cache.apply_diff_to_table::("profile_dashboard_state", &self.profile_dashboard_state).with_updates_by_pk(|row| &row.user_id); - diff.profile_invite_code = cache.apply_diff_to_table::("profile_invite_code", &self.profile_invite_code).with_updates_by_pk(|row| &row.user_id); - diff.profile_membership = cache.apply_diff_to_table::("profile_membership", &self.profile_membership).with_updates_by_pk(|row| &row.user_id); - diff.profile_played_world = cache.apply_diff_to_table::("profile_played_world", &self.profile_played_world).with_updates_by_pk(|row| &row.played_world_id); - diff.profile_recharge_order = cache.apply_diff_to_table::("profile_recharge_order", &self.profile_recharge_order).with_updates_by_pk(|row| &row.order_id); - diff.profile_referral_relation = cache.apply_diff_to_table::("profile_referral_relation", &self.profile_referral_relation).with_updates_by_pk(|row| &row.invitee_user_id); - diff.profile_save_archive = cache.apply_diff_to_table::("profile_save_archive", &self.profile_save_archive).with_updates_by_pk(|row| &row.archive_id); - diff.profile_wallet_ledger = cache.apply_diff_to_table::("profile_wallet_ledger", &self.profile_wallet_ledger).with_updates_by_pk(|row| &row.wallet_ledger_id); - diff.puzzle_agent_message = cache.apply_diff_to_table::("puzzle_agent_message", &self.puzzle_agent_message).with_updates_by_pk(|row| &row.message_id); - diff.puzzle_agent_session = cache.apply_diff_to_table::("puzzle_agent_session", &self.puzzle_agent_session).with_updates_by_pk(|row| &row.session_id); - diff.puzzle_runtime_run = cache.apply_diff_to_table::("puzzle_runtime_run", &self.puzzle_runtime_run).with_updates_by_pk(|row| &row.run_id); - diff.puzzle_work_profile = cache.apply_diff_to_table::("puzzle_work_profile", &self.puzzle_work_profile).with_updates_by_pk(|row| &row.profile_id); - diff.quest_log = cache.apply_diff_to_table::("quest_log", &self.quest_log).with_updates_by_pk(|row| &row.log_id); - diff.quest_record = cache.apply_diff_to_table::("quest_record", &self.quest_record).with_updates_by_pk(|row| &row.quest_id); - diff.refresh_session = cache.apply_diff_to_table::("refresh_session", &self.refresh_session).with_updates_by_pk(|row| &row.session_id); - diff.runtime_setting = cache.apply_diff_to_table::("runtime_setting", &self.runtime_setting).with_updates_by_pk(|row| &row.user_id); - diff.runtime_snapshot = cache.apply_diff_to_table::("runtime_snapshot", &self.runtime_snapshot).with_updates_by_pk(|row| &row.user_id); - diff.story_event = cache.apply_diff_to_table::("story_event", &self.story_event).with_updates_by_pk(|row| &row.event_id); - diff.story_session = cache.apply_diff_to_table::("story_session", &self.story_session).with_updates_by_pk(|row| &row.story_session_id); - diff.treasure_record = cache.apply_diff_to_table::("treasure_record", &self.treasure_record).with_updates_by_pk(|row| &row.treasure_record_id); - diff.user_account = cache.apply_diff_to_table::("user_account", &self.user_account).with_updates_by_pk(|row| &row.user_id); - diff.user_browse_history = cache.apply_diff_to_table::("user_browse_history", &self.user_browse_history).with_updates_by_pk(|row| &row.browse_history_id); + diff.custom_world_gallery_entry = cache.apply_diff_to_table::("custom_world_gallery_entry", &self.custom_world_gallery_entry).with_updates_by_pk(|row| &row.profile_id); diff } @@ -1441,52 +1224,7 @@ fn parse_initial_rows(raw: __ws::v2::QueryRows) -> __sdk::Result { let mut db_update = DbUpdate::default(); for table_rows in raw.tables { match &table_rows.table[..] { - "ai_result_reference" => db_update.ai_result_reference.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "ai_task" => db_update.ai_task.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "ai_task_stage" => db_update.ai_task_stage.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "ai_text_chunk" => db_update.ai_text_chunk.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "asset_entity_binding" => db_update.asset_entity_binding.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "asset_object" => db_update.asset_object.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "auth_identity" => db_update.auth_identity.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "auth_store_snapshot" => db_update.auth_store_snapshot.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "battle_state" => db_update.battle_state.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "big_fish_agent_message" => db_update.big_fish_agent_message.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "big_fish_asset_slot" => db_update.big_fish_asset_slot.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "big_fish_creation_session" => db_update.big_fish_creation_session.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "big_fish_runtime_run" => db_update.big_fish_runtime_run.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "chapter_progression" => db_update.chapter_progression.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "custom_world_agent_message" => db_update.custom_world_agent_message.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "custom_world_agent_operation" => db_update.custom_world_agent_operation.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "custom_world_agent_session" => db_update.custom_world_agent_session.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "custom_world_draft_card" => db_update.custom_world_draft_card.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "custom_world_gallery_entry" => db_update.custom_world_gallery_entry.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "custom_world_profile" => db_update.custom_world_profile.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "custom_world_session" => db_update.custom_world_session.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)?), - "npc_state" => db_update.npc_state.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "player_progression" => db_update.player_progression.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "profile_dashboard_state" => db_update.profile_dashboard_state.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "profile_invite_code" => db_update.profile_invite_code.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "profile_membership" => db_update.profile_membership.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "profile_played_world" => db_update.profile_played_world.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "profile_recharge_order" => db_update.profile_recharge_order.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "profile_referral_relation" => db_update.profile_referral_relation.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "profile_save_archive" => db_update.profile_save_archive.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "profile_wallet_ledger" => db_update.profile_wallet_ledger.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "puzzle_agent_message" => db_update.puzzle_agent_message.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "puzzle_agent_session" => db_update.puzzle_agent_session.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "puzzle_runtime_run" => db_update.puzzle_runtime_run.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "puzzle_work_profile" => db_update.puzzle_work_profile.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "quest_log" => db_update.quest_log.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "quest_record" => db_update.quest_record.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "refresh_session" => db_update.refresh_session.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "runtime_setting" => db_update.runtime_setting.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "runtime_snapshot" => db_update.runtime_snapshot.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "story_event" => db_update.story_event.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "story_session" => db_update.story_session.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "treasure_record" => db_update.treasure_record.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "user_account" => db_update.user_account.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), - "user_browse_history" => db_update.user_browse_history.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), + "custom_world_gallery_entry" => db_update.custom_world_gallery_entry.append(__sdk::parse_row_list_as_inserts(table_rows.rows)?), unknown => { return Err(__sdk::InternalError::unknown_name("table", unknown, "QueryRows").into()); } }} Ok(db_update) } @@ -1494,52 +1232,7 @@ fn parse_unsubscribe_rows(raw: __ws::v2::QueryRows) -> __sdk::Result { let mut db_update = DbUpdate::default(); for table_rows in raw.tables { match &table_rows.table[..] { - "ai_result_reference" => db_update.ai_result_reference.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "ai_task" => db_update.ai_task.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "ai_task_stage" => db_update.ai_task_stage.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "ai_text_chunk" => db_update.ai_text_chunk.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "asset_entity_binding" => db_update.asset_entity_binding.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "asset_object" => db_update.asset_object.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "auth_identity" => db_update.auth_identity.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "auth_store_snapshot" => db_update.auth_store_snapshot.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "battle_state" => db_update.battle_state.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "big_fish_agent_message" => db_update.big_fish_agent_message.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "big_fish_asset_slot" => db_update.big_fish_asset_slot.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "big_fish_creation_session" => db_update.big_fish_creation_session.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "big_fish_runtime_run" => db_update.big_fish_runtime_run.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "chapter_progression" => db_update.chapter_progression.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "custom_world_agent_message" => db_update.custom_world_agent_message.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "custom_world_agent_operation" => db_update.custom_world_agent_operation.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "custom_world_agent_session" => db_update.custom_world_agent_session.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "custom_world_draft_card" => db_update.custom_world_draft_card.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "custom_world_gallery_entry" => db_update.custom_world_gallery_entry.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "custom_world_profile" => db_update.custom_world_profile.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "custom_world_session" => db_update.custom_world_session.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)?), - "npc_state" => db_update.npc_state.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "player_progression" => db_update.player_progression.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "profile_dashboard_state" => db_update.profile_dashboard_state.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "profile_invite_code" => db_update.profile_invite_code.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "profile_membership" => db_update.profile_membership.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "profile_played_world" => db_update.profile_played_world.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "profile_recharge_order" => db_update.profile_recharge_order.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "profile_referral_relation" => db_update.profile_referral_relation.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "profile_save_archive" => db_update.profile_save_archive.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "profile_wallet_ledger" => db_update.profile_wallet_ledger.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "puzzle_agent_message" => db_update.puzzle_agent_message.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "puzzle_agent_session" => db_update.puzzle_agent_session.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "puzzle_runtime_run" => db_update.puzzle_runtime_run.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "puzzle_work_profile" => db_update.puzzle_work_profile.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "quest_log" => db_update.quest_log.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "quest_record" => db_update.quest_record.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "refresh_session" => db_update.refresh_session.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "runtime_setting" => db_update.runtime_setting.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "runtime_snapshot" => db_update.runtime_snapshot.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "story_event" => db_update.story_event.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "story_session" => db_update.story_session.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "treasure_record" => db_update.treasure_record.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "user_account" => db_update.user_account.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), - "user_browse_history" => db_update.user_browse_history.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), + "custom_world_gallery_entry" => db_update.custom_world_gallery_entry.append(__sdk::parse_row_list_as_deletes(table_rows.rows)?), unknown => { return Err(__sdk::InternalError::unknown_name("table", unknown, "QueryRows").into()); } }} Ok(db_update) } @@ -1549,52 +1242,7 @@ for table_rows in raw.tables { #[allow(non_snake_case)] #[doc(hidden)] pub struct AppliedDiff<'r> { - ai_result_reference: __sdk::TableAppliedDiff<'r, AiResultReference>, - ai_task: __sdk::TableAppliedDiff<'r, AiTask>, - ai_task_stage: __sdk::TableAppliedDiff<'r, AiTaskStage>, - ai_text_chunk: __sdk::TableAppliedDiff<'r, AiTextChunk>, - asset_entity_binding: __sdk::TableAppliedDiff<'r, AssetEntityBinding>, - asset_object: __sdk::TableAppliedDiff<'r, AssetObject>, - auth_identity: __sdk::TableAppliedDiff<'r, AuthIdentity>, - auth_store_snapshot: __sdk::TableAppliedDiff<'r, AuthStoreSnapshot>, - battle_state: __sdk::TableAppliedDiff<'r, BattleState>, - big_fish_agent_message: __sdk::TableAppliedDiff<'r, BigFishAgentMessage>, - big_fish_asset_slot: __sdk::TableAppliedDiff<'r, BigFishAssetSlot>, - big_fish_creation_session: __sdk::TableAppliedDiff<'r, BigFishCreationSession>, - big_fish_runtime_run: __sdk::TableAppliedDiff<'r, BigFishRuntimeRun>, - chapter_progression: __sdk::TableAppliedDiff<'r, ChapterProgression>, - custom_world_agent_message: __sdk::TableAppliedDiff<'r, CustomWorldAgentMessage>, - custom_world_agent_operation: __sdk::TableAppliedDiff<'r, CustomWorldAgentOperation>, - custom_world_agent_session: __sdk::TableAppliedDiff<'r, CustomWorldAgentSession>, - custom_world_draft_card: __sdk::TableAppliedDiff<'r, CustomWorldDraftCard>, - custom_world_gallery_entry: __sdk::TableAppliedDiff<'r, CustomWorldGalleryEntry>, - custom_world_profile: __sdk::TableAppliedDiff<'r, CustomWorldProfile>, - custom_world_session: __sdk::TableAppliedDiff<'r, CustomWorldSession>, - inventory_slot: __sdk::TableAppliedDiff<'r, InventorySlot>, - npc_state: __sdk::TableAppliedDiff<'r, NpcState>, - player_progression: __sdk::TableAppliedDiff<'r, PlayerProgression>, - profile_dashboard_state: __sdk::TableAppliedDiff<'r, ProfileDashboardState>, - profile_invite_code: __sdk::TableAppliedDiff<'r, ProfileInviteCode>, - profile_membership: __sdk::TableAppliedDiff<'r, ProfileMembership>, - profile_played_world: __sdk::TableAppliedDiff<'r, ProfilePlayedWorld>, - profile_recharge_order: __sdk::TableAppliedDiff<'r, ProfileRechargeOrder>, - profile_referral_relation: __sdk::TableAppliedDiff<'r, ProfileReferralRelation>, - profile_save_archive: __sdk::TableAppliedDiff<'r, ProfileSaveArchive>, - profile_wallet_ledger: __sdk::TableAppliedDiff<'r, ProfileWalletLedger>, - puzzle_agent_message: __sdk::TableAppliedDiff<'r, PuzzleAgentMessageRow>, - puzzle_agent_session: __sdk::TableAppliedDiff<'r, PuzzleAgentSessionRow>, - puzzle_runtime_run: __sdk::TableAppliedDiff<'r, PuzzleRuntimeRunRow>, - puzzle_work_profile: __sdk::TableAppliedDiff<'r, PuzzleWorkProfileRow>, - quest_log: __sdk::TableAppliedDiff<'r, QuestLog>, - quest_record: __sdk::TableAppliedDiff<'r, QuestRecord>, - refresh_session: __sdk::TableAppliedDiff<'r, RefreshSession>, - runtime_setting: __sdk::TableAppliedDiff<'r, RuntimeSetting>, - runtime_snapshot: __sdk::TableAppliedDiff<'r, RuntimeSnapshotRow>, - story_event: __sdk::TableAppliedDiff<'r, StoryEvent>, - story_session: __sdk::TableAppliedDiff<'r, StorySession>, - treasure_record: __sdk::TableAppliedDiff<'r, TreasureRecord>, - user_account: __sdk::TableAppliedDiff<'r, UserAccount>, - user_browse_history: __sdk::TableAppliedDiff<'r, UserBrowseHistory>, + custom_world_gallery_entry: __sdk::TableAppliedDiff<'r, CustomWorldGalleryEntry>, __unused: std::marker::PhantomData<&'r ()>, } @@ -1605,52 +1253,7 @@ impl __sdk::InModule for AppliedDiff<'_> { impl<'r> __sdk::AppliedDiff<'r> for AppliedDiff<'r> { fn invoke_row_callbacks(&self, event: &EventContext, callbacks: &mut __sdk::DbCallbacks) { - callbacks.invoke_table_row_callbacks::("ai_result_reference", &self.ai_result_reference, event); - callbacks.invoke_table_row_callbacks::("ai_task", &self.ai_task, event); - callbacks.invoke_table_row_callbacks::("ai_task_stage", &self.ai_task_stage, event); - callbacks.invoke_table_row_callbacks::("ai_text_chunk", &self.ai_text_chunk, event); - callbacks.invoke_table_row_callbacks::("asset_entity_binding", &self.asset_entity_binding, event); - callbacks.invoke_table_row_callbacks::("asset_object", &self.asset_object, event); - callbacks.invoke_table_row_callbacks::("auth_identity", &self.auth_identity, event); - callbacks.invoke_table_row_callbacks::("auth_store_snapshot", &self.auth_store_snapshot, event); - callbacks.invoke_table_row_callbacks::("battle_state", &self.battle_state, event); - callbacks.invoke_table_row_callbacks::("big_fish_agent_message", &self.big_fish_agent_message, event); - callbacks.invoke_table_row_callbacks::("big_fish_asset_slot", &self.big_fish_asset_slot, event); - callbacks.invoke_table_row_callbacks::("big_fish_creation_session", &self.big_fish_creation_session, event); - callbacks.invoke_table_row_callbacks::("big_fish_runtime_run", &self.big_fish_runtime_run, event); - callbacks.invoke_table_row_callbacks::("chapter_progression", &self.chapter_progression, event); - callbacks.invoke_table_row_callbacks::("custom_world_agent_message", &self.custom_world_agent_message, event); - callbacks.invoke_table_row_callbacks::("custom_world_agent_operation", &self.custom_world_agent_operation, event); - callbacks.invoke_table_row_callbacks::("custom_world_agent_session", &self.custom_world_agent_session, event); - callbacks.invoke_table_row_callbacks::("custom_world_draft_card", &self.custom_world_draft_card, event); - callbacks.invoke_table_row_callbacks::("custom_world_gallery_entry", &self.custom_world_gallery_entry, event); - callbacks.invoke_table_row_callbacks::("custom_world_profile", &self.custom_world_profile, event); - callbacks.invoke_table_row_callbacks::("custom_world_session", &self.custom_world_session, event); - callbacks.invoke_table_row_callbacks::("inventory_slot", &self.inventory_slot, event); - callbacks.invoke_table_row_callbacks::("npc_state", &self.npc_state, event); - callbacks.invoke_table_row_callbacks::("player_progression", &self.player_progression, event); - callbacks.invoke_table_row_callbacks::("profile_dashboard_state", &self.profile_dashboard_state, event); - callbacks.invoke_table_row_callbacks::("profile_invite_code", &self.profile_invite_code, event); - callbacks.invoke_table_row_callbacks::("profile_membership", &self.profile_membership, event); - callbacks.invoke_table_row_callbacks::("profile_played_world", &self.profile_played_world, event); - callbacks.invoke_table_row_callbacks::("profile_recharge_order", &self.profile_recharge_order, event); - callbacks.invoke_table_row_callbacks::("profile_referral_relation", &self.profile_referral_relation, event); - callbacks.invoke_table_row_callbacks::("profile_save_archive", &self.profile_save_archive, event); - callbacks.invoke_table_row_callbacks::("profile_wallet_ledger", &self.profile_wallet_ledger, event); - callbacks.invoke_table_row_callbacks::("puzzle_agent_message", &self.puzzle_agent_message, event); - callbacks.invoke_table_row_callbacks::("puzzle_agent_session", &self.puzzle_agent_session, event); - callbacks.invoke_table_row_callbacks::("puzzle_runtime_run", &self.puzzle_runtime_run, event); - callbacks.invoke_table_row_callbacks::("puzzle_work_profile", &self.puzzle_work_profile, event); - callbacks.invoke_table_row_callbacks::("quest_log", &self.quest_log, event); - callbacks.invoke_table_row_callbacks::("quest_record", &self.quest_record, event); - callbacks.invoke_table_row_callbacks::("refresh_session", &self.refresh_session, event); - callbacks.invoke_table_row_callbacks::("runtime_setting", &self.runtime_setting, event); - callbacks.invoke_table_row_callbacks::("runtime_snapshot", &self.runtime_snapshot, event); - callbacks.invoke_table_row_callbacks::("story_event", &self.story_event, event); - callbacks.invoke_table_row_callbacks::("story_session", &self.story_session, event); - callbacks.invoke_table_row_callbacks::("treasure_record", &self.treasure_record, event); - callbacks.invoke_table_row_callbacks::("user_account", &self.user_account, event); - callbacks.invoke_table_row_callbacks::("user_browse_history", &self.user_browse_history, event); + callbacks.invoke_table_row_callbacks::("custom_world_gallery_entry", &self.custom_world_gallery_entry, event); } } @@ -2302,99 +1905,9 @@ impl __sdk::SpacetimeModule for RemoteModule { type QueryBuilder = __sdk::QueryBuilder; fn register_tables(client_cache: &mut __sdk::ClientCache) { - ai_result_reference_table::register_table(client_cache); - ai_task_table::register_table(client_cache); - ai_task_stage_table::register_table(client_cache); - ai_text_chunk_table::register_table(client_cache); - asset_entity_binding_table::register_table(client_cache); - asset_object_table::register_table(client_cache); - auth_identity_table::register_table(client_cache); - auth_store_snapshot_table::register_table(client_cache); - battle_state_table::register_table(client_cache); - big_fish_agent_message_table::register_table(client_cache); - big_fish_asset_slot_table::register_table(client_cache); - big_fish_creation_session_table::register_table(client_cache); - big_fish_runtime_run_table::register_table(client_cache); - chapter_progression_table::register_table(client_cache); - custom_world_agent_message_table::register_table(client_cache); - custom_world_agent_operation_table::register_table(client_cache); - custom_world_agent_session_table::register_table(client_cache); - custom_world_draft_card_table::register_table(client_cache); - custom_world_gallery_entry_table::register_table(client_cache); - custom_world_profile_table::register_table(client_cache); - custom_world_session_table::register_table(client_cache); - inventory_slot_table::register_table(client_cache); - npc_state_table::register_table(client_cache); - player_progression_table::register_table(client_cache); - profile_dashboard_state_table::register_table(client_cache); - profile_invite_code_table::register_table(client_cache); - profile_membership_table::register_table(client_cache); - profile_played_world_table::register_table(client_cache); - profile_recharge_order_table::register_table(client_cache); - profile_referral_relation_table::register_table(client_cache); - profile_save_archive_table::register_table(client_cache); - profile_wallet_ledger_table::register_table(client_cache); - puzzle_agent_message_table::register_table(client_cache); - puzzle_agent_session_table::register_table(client_cache); - puzzle_runtime_run_table::register_table(client_cache); - puzzle_work_profile_table::register_table(client_cache); - quest_log_table::register_table(client_cache); - quest_record_table::register_table(client_cache); - refresh_session_table::register_table(client_cache); - runtime_setting_table::register_table(client_cache); - runtime_snapshot_table::register_table(client_cache); - story_event_table::register_table(client_cache); - story_session_table::register_table(client_cache); - treasure_record_table::register_table(client_cache); - user_account_table::register_table(client_cache); - user_browse_history_table::register_table(client_cache); + custom_world_gallery_entry_table::register_table(client_cache); } const ALL_TABLE_NAMES: &'static [&'static str] = &[ - "ai_result_reference", - "ai_task", - "ai_task_stage", - "ai_text_chunk", - "asset_entity_binding", - "asset_object", - "auth_identity", - "auth_store_snapshot", - "battle_state", - "big_fish_agent_message", - "big_fish_asset_slot", - "big_fish_creation_session", - "big_fish_runtime_run", - "chapter_progression", - "custom_world_agent_message", - "custom_world_agent_operation", - "custom_world_agent_session", - "custom_world_draft_card", - "custom_world_gallery_entry", - "custom_world_profile", - "custom_world_session", - "inventory_slot", - "npc_state", - "player_progression", - "profile_dashboard_state", - "profile_invite_code", - "profile_membership", - "profile_played_world", - "profile_recharge_order", - "profile_referral_relation", - "profile_save_archive", - "profile_wallet_ledger", - "puzzle_agent_message", - "puzzle_agent_session", - "puzzle_runtime_run", - "puzzle_work_profile", - "quest_log", - "quest_record", - "refresh_session", - "runtime_setting", - "runtime_snapshot", - "story_event", - "story_session", - "treasure_record", - "user_account", - "user_browse_history", + "custom_world_gallery_entry", ]; } diff --git a/server-rs/crates/spacetime-client/src/module_bindings/npc_state_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/npc_state_table.rs deleted file mode 100644 index 917742d6..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/npc_state_table.rs +++ /dev/null @@ -1,165 +0,0 @@ -// 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::npc_state_type::NpcState; -use super::npc_relation_state_type::NpcRelationState; -use super::npc_stance_profile_type::NpcStanceProfile; - -/// Table handle for the table `npc_state`. -/// -/// Obtain a handle from the [`NpcStateTableAccess::npc_state`] method on [`super::RemoteTables`], -/// like `ctx.db.npc_state()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.npc_state().on_insert(...)`. -pub struct NpcStateTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `npc_state`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait NpcStateTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`NpcStateTableHandle`], which mediates access to the table `npc_state`. - fn npc_state(&self) -> NpcStateTableHandle<'_>; -} - -impl NpcStateTableAccess for super::RemoteTables { - fn npc_state(&self) -> NpcStateTableHandle<'_> { - NpcStateTableHandle { - imp: self.imp.get_table::("npc_state"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct NpcStateInsertCallbackId(__sdk::CallbackId); -pub struct NpcStateDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for NpcStateTableHandle<'ctx> { - type Row = NpcState; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = NpcStateInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> NpcStateInsertCallbackId { - NpcStateInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: NpcStateInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = NpcStateDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> NpcStateDeleteCallbackId { - NpcStateDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: NpcStateDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct NpcStateUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for NpcStateTableHandle<'ctx> { - type UpdateCallbackId = NpcStateUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> NpcStateUpdateCallbackId { - NpcStateUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: NpcStateUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `npc_state_id` unique index on the table `npc_state`, - /// which allows point queries on the field of the same name - /// via the [`NpcStateNpcStateIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.npc_state().npc_state_id().find(...)`. - pub struct NpcStateNpcStateIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> NpcStateTableHandle<'ctx> { - /// Get a handle on the `npc_state_id` unique index on the table `npc_state`. - pub fn npc_state_id(&self) -> NpcStateNpcStateIdUnique<'ctx> { - NpcStateNpcStateIdUnique { - imp: self.imp.get_unique_constraint::("npc_state_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> NpcStateNpcStateIdUnique<'ctx> { - /// Find the subscribed row whose `npc_state_id` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &String) -> Option { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("npc_state"); - _table.add_unique_constraint::("npc_state_id", |row| &row.npc_state_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `NpcState`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait npc_stateQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `NpcState`. - fn npc_state(&self) -> __sdk::__query_builder::Table; - } - - impl npc_stateQueryTableAccess for __sdk::QueryTableAccessor { - fn npc_state(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("npc_state") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/player_progression_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/player_progression_table.rs deleted file mode 100644 index 27262e2f..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/player_progression_table.rs +++ /dev/null @@ -1,164 +0,0 @@ -// 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::player_progression_type::PlayerProgression; -use super::player_progression_grant_source_type::PlayerProgressionGrantSource; - -/// Table handle for the table `player_progression`. -/// -/// Obtain a handle from the [`PlayerProgressionTableAccess::player_progression`] method on [`super::RemoteTables`], -/// like `ctx.db.player_progression()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.player_progression().on_insert(...)`. -pub struct PlayerProgressionTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `player_progression`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait PlayerProgressionTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`PlayerProgressionTableHandle`], which mediates access to the table `player_progression`. - fn player_progression(&self) -> PlayerProgressionTableHandle<'_>; -} - -impl PlayerProgressionTableAccess for super::RemoteTables { - fn player_progression(&self) -> PlayerProgressionTableHandle<'_> { - PlayerProgressionTableHandle { - imp: self.imp.get_table::("player_progression"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct PlayerProgressionInsertCallbackId(__sdk::CallbackId); -pub struct PlayerProgressionDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for PlayerProgressionTableHandle<'ctx> { - type Row = PlayerProgression; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = PlayerProgressionInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> PlayerProgressionInsertCallbackId { - PlayerProgressionInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: PlayerProgressionInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = PlayerProgressionDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> PlayerProgressionDeleteCallbackId { - PlayerProgressionDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: PlayerProgressionDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct PlayerProgressionUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for PlayerProgressionTableHandle<'ctx> { - type UpdateCallbackId = PlayerProgressionUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> PlayerProgressionUpdateCallbackId { - PlayerProgressionUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: PlayerProgressionUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `user_id` unique index on the table `player_progression`, - /// which allows point queries on the field of the same name - /// via the [`PlayerProgressionUserIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.player_progression().user_id().find(...)`. - pub struct PlayerProgressionUserIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> PlayerProgressionTableHandle<'ctx> { - /// Get a handle on the `user_id` unique index on the table `player_progression`. - pub fn user_id(&self) -> PlayerProgressionUserIdUnique<'ctx> { - PlayerProgressionUserIdUnique { - imp: self.imp.get_unique_constraint::("user_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> PlayerProgressionUserIdUnique<'ctx> { - /// Find the subscribed row whose `user_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("player_progression"); - _table.add_unique_constraint::("user_id", |row| &row.user_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `PlayerProgression`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait player_progressionQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `PlayerProgression`. - fn player_progression(&self) -> __sdk::__query_builder::Table; - } - - impl player_progressionQueryTableAccess for __sdk::QueryTableAccessor { - fn player_progression(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("player_progression") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/profile_dashboard_state_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/profile_dashboard_state_table.rs deleted file mode 100644 index 4e1d2abd..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/profile_dashboard_state_table.rs +++ /dev/null @@ -1,163 +0,0 @@ -// 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::profile_dashboard_state_type::ProfileDashboardState; - -/// Table handle for the table `profile_dashboard_state`. -/// -/// Obtain a handle from the [`ProfileDashboardStateTableAccess::profile_dashboard_state`] method on [`super::RemoteTables`], -/// like `ctx.db.profile_dashboard_state()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.profile_dashboard_state().on_insert(...)`. -pub struct ProfileDashboardStateTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `profile_dashboard_state`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait ProfileDashboardStateTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`ProfileDashboardStateTableHandle`], which mediates access to the table `profile_dashboard_state`. - fn profile_dashboard_state(&self) -> ProfileDashboardStateTableHandle<'_>; -} - -impl ProfileDashboardStateTableAccess for super::RemoteTables { - fn profile_dashboard_state(&self) -> ProfileDashboardStateTableHandle<'_> { - ProfileDashboardStateTableHandle { - imp: self.imp.get_table::("profile_dashboard_state"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct ProfileDashboardStateInsertCallbackId(__sdk::CallbackId); -pub struct ProfileDashboardStateDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for ProfileDashboardStateTableHandle<'ctx> { - type Row = ProfileDashboardState; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = ProfileDashboardStateInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> ProfileDashboardStateInsertCallbackId { - ProfileDashboardStateInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: ProfileDashboardStateInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = ProfileDashboardStateDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> ProfileDashboardStateDeleteCallbackId { - ProfileDashboardStateDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: ProfileDashboardStateDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct ProfileDashboardStateUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for ProfileDashboardStateTableHandle<'ctx> { - type UpdateCallbackId = ProfileDashboardStateUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> ProfileDashboardStateUpdateCallbackId { - ProfileDashboardStateUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: ProfileDashboardStateUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `user_id` unique index on the table `profile_dashboard_state`, - /// which allows point queries on the field of the same name - /// via the [`ProfileDashboardStateUserIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.profile_dashboard_state().user_id().find(...)`. - pub struct ProfileDashboardStateUserIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> ProfileDashboardStateTableHandle<'ctx> { - /// Get a handle on the `user_id` unique index on the table `profile_dashboard_state`. - pub fn user_id(&self) -> ProfileDashboardStateUserIdUnique<'ctx> { - ProfileDashboardStateUserIdUnique { - imp: self.imp.get_unique_constraint::("user_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> ProfileDashboardStateUserIdUnique<'ctx> { - /// Find the subscribed row whose `user_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("profile_dashboard_state"); - _table.add_unique_constraint::("user_id", |row| &row.user_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `ProfileDashboardState`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait profile_dashboard_stateQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `ProfileDashboardState`. - fn profile_dashboard_state(&self) -> __sdk::__query_builder::Table; - } - - impl profile_dashboard_stateQueryTableAccess for __sdk::QueryTableAccessor { - fn profile_dashboard_state(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("profile_dashboard_state") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/profile_invite_code_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/profile_invite_code_table.rs deleted file mode 100644 index e1e342aa..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/profile_invite_code_table.rs +++ /dev/null @@ -1,194 +0,0 @@ -// 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::profile_invite_code_type::ProfileInviteCode; - -/// Table handle for the table `profile_invite_code`. -/// -/// Obtain a handle from the [`ProfileInviteCodeTableAccess::profile_invite_code`] method on [`super::RemoteTables`], -/// like `ctx.db.profile_invite_code()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.profile_invite_code().on_insert(...)`. -pub struct ProfileInviteCodeTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `profile_invite_code`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait ProfileInviteCodeTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`ProfileInviteCodeTableHandle`], which mediates access to the table `profile_invite_code`. - fn profile_invite_code(&self) -> ProfileInviteCodeTableHandle<'_>; -} - -impl ProfileInviteCodeTableAccess for super::RemoteTables { - fn profile_invite_code(&self) -> ProfileInviteCodeTableHandle<'_> { - ProfileInviteCodeTableHandle { - imp: self.imp.get_table::("profile_invite_code"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct ProfileInviteCodeInsertCallbackId(__sdk::CallbackId); -pub struct ProfileInviteCodeDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for ProfileInviteCodeTableHandle<'ctx> { - type Row = ProfileInviteCode; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = ProfileInviteCodeInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> ProfileInviteCodeInsertCallbackId { - ProfileInviteCodeInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: ProfileInviteCodeInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = ProfileInviteCodeDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> ProfileInviteCodeDeleteCallbackId { - ProfileInviteCodeDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: ProfileInviteCodeDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct ProfileInviteCodeUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for ProfileInviteCodeTableHandle<'ctx> { - type UpdateCallbackId = ProfileInviteCodeUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> ProfileInviteCodeUpdateCallbackId { - ProfileInviteCodeUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: ProfileInviteCodeUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `user_id` unique index on the table `profile_invite_code`, - /// which allows point queries on the field of the same name - /// via the [`ProfileInviteCodeUserIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.profile_invite_code().user_id().find(...)`. - pub struct ProfileInviteCodeUserIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> ProfileInviteCodeTableHandle<'ctx> { - /// Get a handle on the `user_id` unique index on the table `profile_invite_code`. - pub fn user_id(&self) -> ProfileInviteCodeUserIdUnique<'ctx> { - ProfileInviteCodeUserIdUnique { - imp: self.imp.get_unique_constraint::("user_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> ProfileInviteCodeUserIdUnique<'ctx> { - /// Find the subscribed row whose `user_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 { - self.imp.find(col_val) - } - } - - /// Access to the `invite_code` unique index on the table `profile_invite_code`, - /// which allows point queries on the field of the same name - /// via the [`ProfileInviteCodeInviteCodeUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.profile_invite_code().invite_code().find(...)`. - pub struct ProfileInviteCodeInviteCodeUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> ProfileInviteCodeTableHandle<'ctx> { - /// Get a handle on the `invite_code` unique index on the table `profile_invite_code`. - pub fn invite_code(&self) -> ProfileInviteCodeInviteCodeUnique<'ctx> { - ProfileInviteCodeInviteCodeUnique { - imp: self.imp.get_unique_constraint::("invite_code"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> ProfileInviteCodeInviteCodeUnique<'ctx> { - /// Find the subscribed row whose `invite_code` 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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("profile_invite_code"); - _table.add_unique_constraint::("user_id", |row| &row.user_id); - _table.add_unique_constraint::("invite_code", |row| &row.invite_code); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `ProfileInviteCode`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait profile_invite_codeQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `ProfileInviteCode`. - fn profile_invite_code(&self) -> __sdk::__query_builder::Table; - } - - impl profile_invite_codeQueryTableAccess for __sdk::QueryTableAccessor { - fn profile_invite_code(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("profile_invite_code") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/profile_membership_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/profile_membership_table.rs deleted file mode 100644 index c9b7cc23..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/profile_membership_table.rs +++ /dev/null @@ -1,165 +0,0 @@ -// 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::profile_membership_type::ProfileMembership; -use super::runtime_profile_membership_status_type::RuntimeProfileMembershipStatus; -use super::runtime_profile_membership_tier_type::RuntimeProfileMembershipTier; - -/// Table handle for the table `profile_membership`. -/// -/// Obtain a handle from the [`ProfileMembershipTableAccess::profile_membership`] method on [`super::RemoteTables`], -/// like `ctx.db.profile_membership()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.profile_membership().on_insert(...)`. -pub struct ProfileMembershipTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `profile_membership`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait ProfileMembershipTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`ProfileMembershipTableHandle`], which mediates access to the table `profile_membership`. - fn profile_membership(&self) -> ProfileMembershipTableHandle<'_>; -} - -impl ProfileMembershipTableAccess for super::RemoteTables { - fn profile_membership(&self) -> ProfileMembershipTableHandle<'_> { - ProfileMembershipTableHandle { - imp: self.imp.get_table::("profile_membership"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct ProfileMembershipInsertCallbackId(__sdk::CallbackId); -pub struct ProfileMembershipDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for ProfileMembershipTableHandle<'ctx> { - type Row = ProfileMembership; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = ProfileMembershipInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> ProfileMembershipInsertCallbackId { - ProfileMembershipInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: ProfileMembershipInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = ProfileMembershipDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> ProfileMembershipDeleteCallbackId { - ProfileMembershipDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: ProfileMembershipDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct ProfileMembershipUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for ProfileMembershipTableHandle<'ctx> { - type UpdateCallbackId = ProfileMembershipUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> ProfileMembershipUpdateCallbackId { - ProfileMembershipUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: ProfileMembershipUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `user_id` unique index on the table `profile_membership`, - /// which allows point queries on the field of the same name - /// via the [`ProfileMembershipUserIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.profile_membership().user_id().find(...)`. - pub struct ProfileMembershipUserIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> ProfileMembershipTableHandle<'ctx> { - /// Get a handle on the `user_id` unique index on the table `profile_membership`. - pub fn user_id(&self) -> ProfileMembershipUserIdUnique<'ctx> { - ProfileMembershipUserIdUnique { - imp: self.imp.get_unique_constraint::("user_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> ProfileMembershipUserIdUnique<'ctx> { - /// Find the subscribed row whose `user_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("profile_membership"); - _table.add_unique_constraint::("user_id", |row| &row.user_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `ProfileMembership`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait profile_membershipQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `ProfileMembership`. - fn profile_membership(&self) -> __sdk::__query_builder::Table; - } - - impl profile_membershipQueryTableAccess for __sdk::QueryTableAccessor { - fn profile_membership(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("profile_membership") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/profile_played_world_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/profile_played_world_table.rs deleted file mode 100644 index 944de27b..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/profile_played_world_table.rs +++ /dev/null @@ -1,163 +0,0 @@ -// 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::profile_played_world_type::ProfilePlayedWorld; - -/// Table handle for the table `profile_played_world`. -/// -/// Obtain a handle from the [`ProfilePlayedWorldTableAccess::profile_played_world`] method on [`super::RemoteTables`], -/// like `ctx.db.profile_played_world()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.profile_played_world().on_insert(...)`. -pub struct ProfilePlayedWorldTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `profile_played_world`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait ProfilePlayedWorldTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`ProfilePlayedWorldTableHandle`], which mediates access to the table `profile_played_world`. - fn profile_played_world(&self) -> ProfilePlayedWorldTableHandle<'_>; -} - -impl ProfilePlayedWorldTableAccess for super::RemoteTables { - fn profile_played_world(&self) -> ProfilePlayedWorldTableHandle<'_> { - ProfilePlayedWorldTableHandle { - imp: self.imp.get_table::("profile_played_world"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct ProfilePlayedWorldInsertCallbackId(__sdk::CallbackId); -pub struct ProfilePlayedWorldDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for ProfilePlayedWorldTableHandle<'ctx> { - type Row = ProfilePlayedWorld; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = ProfilePlayedWorldInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> ProfilePlayedWorldInsertCallbackId { - ProfilePlayedWorldInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: ProfilePlayedWorldInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = ProfilePlayedWorldDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> ProfilePlayedWorldDeleteCallbackId { - ProfilePlayedWorldDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: ProfilePlayedWorldDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct ProfilePlayedWorldUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for ProfilePlayedWorldTableHandle<'ctx> { - type UpdateCallbackId = ProfilePlayedWorldUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> ProfilePlayedWorldUpdateCallbackId { - ProfilePlayedWorldUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: ProfilePlayedWorldUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `played_world_id` unique index on the table `profile_played_world`, - /// which allows point queries on the field of the same name - /// via the [`ProfilePlayedWorldPlayedWorldIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.profile_played_world().played_world_id().find(...)`. - pub struct ProfilePlayedWorldPlayedWorldIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> ProfilePlayedWorldTableHandle<'ctx> { - /// Get a handle on the `played_world_id` unique index on the table `profile_played_world`. - pub fn played_world_id(&self) -> ProfilePlayedWorldPlayedWorldIdUnique<'ctx> { - ProfilePlayedWorldPlayedWorldIdUnique { - imp: self.imp.get_unique_constraint::("played_world_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> ProfilePlayedWorldPlayedWorldIdUnique<'ctx> { - /// Find the subscribed row whose `played_world_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("profile_played_world"); - _table.add_unique_constraint::("played_world_id", |row| &row.played_world_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `ProfilePlayedWorld`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait profile_played_worldQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `ProfilePlayedWorld`. - fn profile_played_world(&self) -> __sdk::__query_builder::Table; - } - - impl profile_played_worldQueryTableAccess for __sdk::QueryTableAccessor { - fn profile_played_world(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("profile_played_world") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/profile_recharge_order_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/profile_recharge_order_table.rs deleted file mode 100644 index 94cdd920..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/profile_recharge_order_table.rs +++ /dev/null @@ -1,165 +0,0 @@ -// 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::profile_recharge_order_type::ProfileRechargeOrder; -use super::runtime_profile_recharge_product_kind_type::RuntimeProfileRechargeProductKind; -use super::runtime_profile_recharge_order_status_type::RuntimeProfileRechargeOrderStatus; - -/// Table handle for the table `profile_recharge_order`. -/// -/// Obtain a handle from the [`ProfileRechargeOrderTableAccess::profile_recharge_order`] method on [`super::RemoteTables`], -/// like `ctx.db.profile_recharge_order()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.profile_recharge_order().on_insert(...)`. -pub struct ProfileRechargeOrderTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `profile_recharge_order`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait ProfileRechargeOrderTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`ProfileRechargeOrderTableHandle`], which mediates access to the table `profile_recharge_order`. - fn profile_recharge_order(&self) -> ProfileRechargeOrderTableHandle<'_>; -} - -impl ProfileRechargeOrderTableAccess for super::RemoteTables { - fn profile_recharge_order(&self) -> ProfileRechargeOrderTableHandle<'_> { - ProfileRechargeOrderTableHandle { - imp: self.imp.get_table::("profile_recharge_order"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct ProfileRechargeOrderInsertCallbackId(__sdk::CallbackId); -pub struct ProfileRechargeOrderDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for ProfileRechargeOrderTableHandle<'ctx> { - type Row = ProfileRechargeOrder; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = ProfileRechargeOrderInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> ProfileRechargeOrderInsertCallbackId { - ProfileRechargeOrderInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: ProfileRechargeOrderInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = ProfileRechargeOrderDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> ProfileRechargeOrderDeleteCallbackId { - ProfileRechargeOrderDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: ProfileRechargeOrderDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct ProfileRechargeOrderUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for ProfileRechargeOrderTableHandle<'ctx> { - type UpdateCallbackId = ProfileRechargeOrderUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> ProfileRechargeOrderUpdateCallbackId { - ProfileRechargeOrderUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: ProfileRechargeOrderUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `order_id` unique index on the table `profile_recharge_order`, - /// which allows point queries on the field of the same name - /// via the [`ProfileRechargeOrderOrderIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.profile_recharge_order().order_id().find(...)`. - pub struct ProfileRechargeOrderOrderIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> ProfileRechargeOrderTableHandle<'ctx> { - /// Get a handle on the `order_id` unique index on the table `profile_recharge_order`. - pub fn order_id(&self) -> ProfileRechargeOrderOrderIdUnique<'ctx> { - ProfileRechargeOrderOrderIdUnique { - imp: self.imp.get_unique_constraint::("order_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> ProfileRechargeOrderOrderIdUnique<'ctx> { - /// Find the subscribed row whose `order_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("profile_recharge_order"); - _table.add_unique_constraint::("order_id", |row| &row.order_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `ProfileRechargeOrder`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait profile_recharge_orderQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `ProfileRechargeOrder`. - fn profile_recharge_order(&self) -> __sdk::__query_builder::Table; - } - - impl profile_recharge_orderQueryTableAccess for __sdk::QueryTableAccessor { - fn profile_recharge_order(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("profile_recharge_order") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/profile_referral_relation_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/profile_referral_relation_table.rs deleted file mode 100644 index 0db9492c..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/profile_referral_relation_table.rs +++ /dev/null @@ -1,163 +0,0 @@ -// 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::profile_referral_relation_type::ProfileReferralRelation; - -/// Table handle for the table `profile_referral_relation`. -/// -/// Obtain a handle from the [`ProfileReferralRelationTableAccess::profile_referral_relation`] method on [`super::RemoteTables`], -/// like `ctx.db.profile_referral_relation()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.profile_referral_relation().on_insert(...)`. -pub struct ProfileReferralRelationTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `profile_referral_relation`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait ProfileReferralRelationTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`ProfileReferralRelationTableHandle`], which mediates access to the table `profile_referral_relation`. - fn profile_referral_relation(&self) -> ProfileReferralRelationTableHandle<'_>; -} - -impl ProfileReferralRelationTableAccess for super::RemoteTables { - fn profile_referral_relation(&self) -> ProfileReferralRelationTableHandle<'_> { - ProfileReferralRelationTableHandle { - imp: self.imp.get_table::("profile_referral_relation"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct ProfileReferralRelationInsertCallbackId(__sdk::CallbackId); -pub struct ProfileReferralRelationDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for ProfileReferralRelationTableHandle<'ctx> { - type Row = ProfileReferralRelation; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = ProfileReferralRelationInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> ProfileReferralRelationInsertCallbackId { - ProfileReferralRelationInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: ProfileReferralRelationInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = ProfileReferralRelationDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> ProfileReferralRelationDeleteCallbackId { - ProfileReferralRelationDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: ProfileReferralRelationDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct ProfileReferralRelationUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for ProfileReferralRelationTableHandle<'ctx> { - type UpdateCallbackId = ProfileReferralRelationUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> ProfileReferralRelationUpdateCallbackId { - ProfileReferralRelationUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: ProfileReferralRelationUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `invitee_user_id` unique index on the table `profile_referral_relation`, - /// which allows point queries on the field of the same name - /// via the [`ProfileReferralRelationInviteeUserIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.profile_referral_relation().invitee_user_id().find(...)`. - pub struct ProfileReferralRelationInviteeUserIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> ProfileReferralRelationTableHandle<'ctx> { - /// Get a handle on the `invitee_user_id` unique index on the table `profile_referral_relation`. - pub fn invitee_user_id(&self) -> ProfileReferralRelationInviteeUserIdUnique<'ctx> { - ProfileReferralRelationInviteeUserIdUnique { - imp: self.imp.get_unique_constraint::("invitee_user_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> ProfileReferralRelationInviteeUserIdUnique<'ctx> { - /// Find the subscribed row whose `invitee_user_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("profile_referral_relation"); - _table.add_unique_constraint::("invitee_user_id", |row| &row.invitee_user_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `ProfileReferralRelation`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait profile_referral_relationQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `ProfileReferralRelation`. - fn profile_referral_relation(&self) -> __sdk::__query_builder::Table; - } - - impl profile_referral_relationQueryTableAccess for __sdk::QueryTableAccessor { - fn profile_referral_relation(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("profile_referral_relation") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/profile_save_archive_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/profile_save_archive_table.rs deleted file mode 100644 index 4d503269..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/profile_save_archive_table.rs +++ /dev/null @@ -1,163 +0,0 @@ -// 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::profile_save_archive_type::ProfileSaveArchive; - -/// Table handle for the table `profile_save_archive`. -/// -/// Obtain a handle from the [`ProfileSaveArchiveTableAccess::profile_save_archive`] method on [`super::RemoteTables`], -/// like `ctx.db.profile_save_archive()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.profile_save_archive().on_insert(...)`. -pub struct ProfileSaveArchiveTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `profile_save_archive`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait ProfileSaveArchiveTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`ProfileSaveArchiveTableHandle`], which mediates access to the table `profile_save_archive`. - fn profile_save_archive(&self) -> ProfileSaveArchiveTableHandle<'_>; -} - -impl ProfileSaveArchiveTableAccess for super::RemoteTables { - fn profile_save_archive(&self) -> ProfileSaveArchiveTableHandle<'_> { - ProfileSaveArchiveTableHandle { - imp: self.imp.get_table::("profile_save_archive"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct ProfileSaveArchiveInsertCallbackId(__sdk::CallbackId); -pub struct ProfileSaveArchiveDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for ProfileSaveArchiveTableHandle<'ctx> { - type Row = ProfileSaveArchive; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = ProfileSaveArchiveInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> ProfileSaveArchiveInsertCallbackId { - ProfileSaveArchiveInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: ProfileSaveArchiveInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = ProfileSaveArchiveDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> ProfileSaveArchiveDeleteCallbackId { - ProfileSaveArchiveDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: ProfileSaveArchiveDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct ProfileSaveArchiveUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for ProfileSaveArchiveTableHandle<'ctx> { - type UpdateCallbackId = ProfileSaveArchiveUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> ProfileSaveArchiveUpdateCallbackId { - ProfileSaveArchiveUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: ProfileSaveArchiveUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `archive_id` unique index on the table `profile_save_archive`, - /// which allows point queries on the field of the same name - /// via the [`ProfileSaveArchiveArchiveIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.profile_save_archive().archive_id().find(...)`. - pub struct ProfileSaveArchiveArchiveIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> ProfileSaveArchiveTableHandle<'ctx> { - /// Get a handle on the `archive_id` unique index on the table `profile_save_archive`. - pub fn archive_id(&self) -> ProfileSaveArchiveArchiveIdUnique<'ctx> { - ProfileSaveArchiveArchiveIdUnique { - imp: self.imp.get_unique_constraint::("archive_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> ProfileSaveArchiveArchiveIdUnique<'ctx> { - /// Find the subscribed row whose `archive_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("profile_save_archive"); - _table.add_unique_constraint::("archive_id", |row| &row.archive_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `ProfileSaveArchive`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait profile_save_archiveQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `ProfileSaveArchive`. - fn profile_save_archive(&self) -> __sdk::__query_builder::Table; - } - - impl profile_save_archiveQueryTableAccess for __sdk::QueryTableAccessor { - fn profile_save_archive(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("profile_save_archive") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/profile_wallet_ledger_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/profile_wallet_ledger_table.rs deleted file mode 100644 index 1dab9684..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/profile_wallet_ledger_table.rs +++ /dev/null @@ -1,164 +0,0 @@ -// 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::profile_wallet_ledger_type::ProfileWalletLedger; -use super::runtime_profile_wallet_ledger_source_type_type::RuntimeProfileWalletLedgerSourceType; - -/// Table handle for the table `profile_wallet_ledger`. -/// -/// Obtain a handle from the [`ProfileWalletLedgerTableAccess::profile_wallet_ledger`] method on [`super::RemoteTables`], -/// like `ctx.db.profile_wallet_ledger()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.profile_wallet_ledger().on_insert(...)`. -pub struct ProfileWalletLedgerTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `profile_wallet_ledger`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait ProfileWalletLedgerTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`ProfileWalletLedgerTableHandle`], which mediates access to the table `profile_wallet_ledger`. - fn profile_wallet_ledger(&self) -> ProfileWalletLedgerTableHandle<'_>; -} - -impl ProfileWalletLedgerTableAccess for super::RemoteTables { - fn profile_wallet_ledger(&self) -> ProfileWalletLedgerTableHandle<'_> { - ProfileWalletLedgerTableHandle { - imp: self.imp.get_table::("profile_wallet_ledger"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct ProfileWalletLedgerInsertCallbackId(__sdk::CallbackId); -pub struct ProfileWalletLedgerDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for ProfileWalletLedgerTableHandle<'ctx> { - type Row = ProfileWalletLedger; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = ProfileWalletLedgerInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> ProfileWalletLedgerInsertCallbackId { - ProfileWalletLedgerInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: ProfileWalletLedgerInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = ProfileWalletLedgerDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> ProfileWalletLedgerDeleteCallbackId { - ProfileWalletLedgerDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: ProfileWalletLedgerDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct ProfileWalletLedgerUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for ProfileWalletLedgerTableHandle<'ctx> { - type UpdateCallbackId = ProfileWalletLedgerUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> ProfileWalletLedgerUpdateCallbackId { - ProfileWalletLedgerUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: ProfileWalletLedgerUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `wallet_ledger_id` unique index on the table `profile_wallet_ledger`, - /// which allows point queries on the field of the same name - /// via the [`ProfileWalletLedgerWalletLedgerIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.profile_wallet_ledger().wallet_ledger_id().find(...)`. - pub struct ProfileWalletLedgerWalletLedgerIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> ProfileWalletLedgerTableHandle<'ctx> { - /// Get a handle on the `wallet_ledger_id` unique index on the table `profile_wallet_ledger`. - pub fn wallet_ledger_id(&self) -> ProfileWalletLedgerWalletLedgerIdUnique<'ctx> { - ProfileWalletLedgerWalletLedgerIdUnique { - imp: self.imp.get_unique_constraint::("wallet_ledger_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> ProfileWalletLedgerWalletLedgerIdUnique<'ctx> { - /// Find the subscribed row whose `wallet_ledger_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("profile_wallet_ledger"); - _table.add_unique_constraint::("wallet_ledger_id", |row| &row.wallet_ledger_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `ProfileWalletLedger`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait profile_wallet_ledgerQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `ProfileWalletLedger`. - fn profile_wallet_ledger(&self) -> __sdk::__query_builder::Table; - } - - impl profile_wallet_ledgerQueryTableAccess for __sdk::QueryTableAccessor { - fn profile_wallet_ledger(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("profile_wallet_ledger") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/puzzle_agent_message_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/puzzle_agent_message_table.rs deleted file mode 100644 index e282d9e9..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/puzzle_agent_message_table.rs +++ /dev/null @@ -1,165 +0,0 @@ -// 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_message_row_type::PuzzleAgentMessageRow; -use super::puzzle_agent_message_role_type::PuzzleAgentMessageRole; -use super::puzzle_agent_message_kind_type::PuzzleAgentMessageKind; - -/// Table handle for the table `puzzle_agent_message`. -/// -/// Obtain a handle from the [`PuzzleAgentMessageTableAccess::puzzle_agent_message`] method on [`super::RemoteTables`], -/// like `ctx.db.puzzle_agent_message()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.puzzle_agent_message().on_insert(...)`. -pub struct PuzzleAgentMessageTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `puzzle_agent_message`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait PuzzleAgentMessageTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`PuzzleAgentMessageTableHandle`], which mediates access to the table `puzzle_agent_message`. - fn puzzle_agent_message(&self) -> PuzzleAgentMessageTableHandle<'_>; -} - -impl PuzzleAgentMessageTableAccess for super::RemoteTables { - fn puzzle_agent_message(&self) -> PuzzleAgentMessageTableHandle<'_> { - PuzzleAgentMessageTableHandle { - imp: self.imp.get_table::("puzzle_agent_message"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct PuzzleAgentMessageInsertCallbackId(__sdk::CallbackId); -pub struct PuzzleAgentMessageDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for PuzzleAgentMessageTableHandle<'ctx> { - type Row = PuzzleAgentMessageRow; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = PuzzleAgentMessageInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> PuzzleAgentMessageInsertCallbackId { - PuzzleAgentMessageInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: PuzzleAgentMessageInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = PuzzleAgentMessageDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> PuzzleAgentMessageDeleteCallbackId { - PuzzleAgentMessageDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: PuzzleAgentMessageDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct PuzzleAgentMessageUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for PuzzleAgentMessageTableHandle<'ctx> { - type UpdateCallbackId = PuzzleAgentMessageUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> PuzzleAgentMessageUpdateCallbackId { - PuzzleAgentMessageUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: PuzzleAgentMessageUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `message_id` unique index on the table `puzzle_agent_message`, - /// which allows point queries on the field of the same name - /// via the [`PuzzleAgentMessageMessageIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.puzzle_agent_message().message_id().find(...)`. - pub struct PuzzleAgentMessageMessageIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> PuzzleAgentMessageTableHandle<'ctx> { - /// Get a handle on the `message_id` unique index on the table `puzzle_agent_message`. - pub fn message_id(&self) -> PuzzleAgentMessageMessageIdUnique<'ctx> { - PuzzleAgentMessageMessageIdUnique { - imp: self.imp.get_unique_constraint::("message_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> PuzzleAgentMessageMessageIdUnique<'ctx> { - /// Find the subscribed row whose `message_id` column value is equal to `col_val`, - /// if such a row is present in the client cache. - pub fn find(&self, col_val: &String) -> Option { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("puzzle_agent_message"); - _table.add_unique_constraint::("message_id", |row| &row.message_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `PuzzleAgentMessageRow`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait puzzle_agent_messageQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `PuzzleAgentMessageRow`. - fn puzzle_agent_message(&self) -> __sdk::__query_builder::Table; - } - - impl puzzle_agent_messageQueryTableAccess for __sdk::QueryTableAccessor { - fn puzzle_agent_message(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("puzzle_agent_message") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/puzzle_agent_session_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/puzzle_agent_session_table.rs deleted file mode 100644 index 0272d915..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/puzzle_agent_session_table.rs +++ /dev/null @@ -1,164 +0,0 @@ -// 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_row_type::PuzzleAgentSessionRow; -use super::puzzle_agent_stage_type::PuzzleAgentStage; - -/// Table handle for the table `puzzle_agent_session`. -/// -/// Obtain a handle from the [`PuzzleAgentSessionTableAccess::puzzle_agent_session`] method on [`super::RemoteTables`], -/// like `ctx.db.puzzle_agent_session()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.puzzle_agent_session().on_insert(...)`. -pub struct PuzzleAgentSessionTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `puzzle_agent_session`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait PuzzleAgentSessionTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`PuzzleAgentSessionTableHandle`], which mediates access to the table `puzzle_agent_session`. - fn puzzle_agent_session(&self) -> PuzzleAgentSessionTableHandle<'_>; -} - -impl PuzzleAgentSessionTableAccess for super::RemoteTables { - fn puzzle_agent_session(&self) -> PuzzleAgentSessionTableHandle<'_> { - PuzzleAgentSessionTableHandle { - imp: self.imp.get_table::("puzzle_agent_session"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct PuzzleAgentSessionInsertCallbackId(__sdk::CallbackId); -pub struct PuzzleAgentSessionDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for PuzzleAgentSessionTableHandle<'ctx> { - type Row = PuzzleAgentSessionRow; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = PuzzleAgentSessionInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> PuzzleAgentSessionInsertCallbackId { - PuzzleAgentSessionInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: PuzzleAgentSessionInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = PuzzleAgentSessionDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> PuzzleAgentSessionDeleteCallbackId { - PuzzleAgentSessionDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: PuzzleAgentSessionDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct PuzzleAgentSessionUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for PuzzleAgentSessionTableHandle<'ctx> { - type UpdateCallbackId = PuzzleAgentSessionUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> PuzzleAgentSessionUpdateCallbackId { - PuzzleAgentSessionUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: PuzzleAgentSessionUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `session_id` unique index on the table `puzzle_agent_session`, - /// which allows point queries on the field of the same name - /// via the [`PuzzleAgentSessionSessionIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.puzzle_agent_session().session_id().find(...)`. - pub struct PuzzleAgentSessionSessionIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> PuzzleAgentSessionTableHandle<'ctx> { - /// Get a handle on the `session_id` unique index on the table `puzzle_agent_session`. - pub fn session_id(&self) -> PuzzleAgentSessionSessionIdUnique<'ctx> { - PuzzleAgentSessionSessionIdUnique { - imp: self.imp.get_unique_constraint::("session_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> PuzzleAgentSessionSessionIdUnique<'ctx> { - /// Find the subscribed row whose `session_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("puzzle_agent_session"); - _table.add_unique_constraint::("session_id", |row| &row.session_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `PuzzleAgentSessionRow`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait puzzle_agent_sessionQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `PuzzleAgentSessionRow`. - fn puzzle_agent_session(&self) -> __sdk::__query_builder::Table; - } - - impl puzzle_agent_sessionQueryTableAccess for __sdk::QueryTableAccessor { - fn puzzle_agent_session(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("puzzle_agent_session") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/puzzle_runtime_run_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/puzzle_runtime_run_table.rs deleted file mode 100644 index 5447392d..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/puzzle_runtime_run_table.rs +++ /dev/null @@ -1,163 +0,0 @@ -// 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_runtime_run_row_type::PuzzleRuntimeRunRow; - -/// Table handle for the table `puzzle_runtime_run`. -/// -/// Obtain a handle from the [`PuzzleRuntimeRunTableAccess::puzzle_runtime_run`] method on [`super::RemoteTables`], -/// like `ctx.db.puzzle_runtime_run()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.puzzle_runtime_run().on_insert(...)`. -pub struct PuzzleRuntimeRunTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `puzzle_runtime_run`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait PuzzleRuntimeRunTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`PuzzleRuntimeRunTableHandle`], which mediates access to the table `puzzle_runtime_run`. - fn puzzle_runtime_run(&self) -> PuzzleRuntimeRunTableHandle<'_>; -} - -impl PuzzleRuntimeRunTableAccess for super::RemoteTables { - fn puzzle_runtime_run(&self) -> PuzzleRuntimeRunTableHandle<'_> { - PuzzleRuntimeRunTableHandle { - imp: self.imp.get_table::("puzzle_runtime_run"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct PuzzleRuntimeRunInsertCallbackId(__sdk::CallbackId); -pub struct PuzzleRuntimeRunDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for PuzzleRuntimeRunTableHandle<'ctx> { - type Row = PuzzleRuntimeRunRow; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = PuzzleRuntimeRunInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> PuzzleRuntimeRunInsertCallbackId { - PuzzleRuntimeRunInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: PuzzleRuntimeRunInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = PuzzleRuntimeRunDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> PuzzleRuntimeRunDeleteCallbackId { - PuzzleRuntimeRunDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: PuzzleRuntimeRunDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct PuzzleRuntimeRunUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for PuzzleRuntimeRunTableHandle<'ctx> { - type UpdateCallbackId = PuzzleRuntimeRunUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> PuzzleRuntimeRunUpdateCallbackId { - PuzzleRuntimeRunUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: PuzzleRuntimeRunUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `run_id` unique index on the table `puzzle_runtime_run`, - /// which allows point queries on the field of the same name - /// via the [`PuzzleRuntimeRunRunIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.puzzle_runtime_run().run_id().find(...)`. - pub struct PuzzleRuntimeRunRunIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> PuzzleRuntimeRunTableHandle<'ctx> { - /// Get a handle on the `run_id` unique index on the table `puzzle_runtime_run`. - pub fn run_id(&self) -> PuzzleRuntimeRunRunIdUnique<'ctx> { - PuzzleRuntimeRunRunIdUnique { - imp: self.imp.get_unique_constraint::("run_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> PuzzleRuntimeRunRunIdUnique<'ctx> { - /// Find the subscribed row whose `run_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("puzzle_runtime_run"); - _table.add_unique_constraint::("run_id", |row| &row.run_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `PuzzleRuntimeRunRow`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait puzzle_runtime_runQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `PuzzleRuntimeRunRow`. - fn puzzle_runtime_run(&self) -> __sdk::__query_builder::Table; - } - - impl puzzle_runtime_runQueryTableAccess for __sdk::QueryTableAccessor { - fn puzzle_runtime_run(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("puzzle_runtime_run") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/puzzle_work_profile_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/puzzle_work_profile_table.rs deleted file mode 100644 index c5f14f0f..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/puzzle_work_profile_table.rs +++ /dev/null @@ -1,164 +0,0 @@ -// 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_work_profile_row_type::PuzzleWorkProfileRow; -use super::puzzle_publication_status_type::PuzzlePublicationStatus; - -/// Table handle for the table `puzzle_work_profile`. -/// -/// Obtain a handle from the [`PuzzleWorkProfileTableAccess::puzzle_work_profile`] method on [`super::RemoteTables`], -/// like `ctx.db.puzzle_work_profile()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.puzzle_work_profile().on_insert(...)`. -pub struct PuzzleWorkProfileTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `puzzle_work_profile`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait PuzzleWorkProfileTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`PuzzleWorkProfileTableHandle`], which mediates access to the table `puzzle_work_profile`. - fn puzzle_work_profile(&self) -> PuzzleWorkProfileTableHandle<'_>; -} - -impl PuzzleWorkProfileTableAccess for super::RemoteTables { - fn puzzle_work_profile(&self) -> PuzzleWorkProfileTableHandle<'_> { - PuzzleWorkProfileTableHandle { - imp: self.imp.get_table::("puzzle_work_profile"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct PuzzleWorkProfileInsertCallbackId(__sdk::CallbackId); -pub struct PuzzleWorkProfileDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for PuzzleWorkProfileTableHandle<'ctx> { - type Row = PuzzleWorkProfileRow; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = PuzzleWorkProfileInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> PuzzleWorkProfileInsertCallbackId { - PuzzleWorkProfileInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: PuzzleWorkProfileInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = PuzzleWorkProfileDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> PuzzleWorkProfileDeleteCallbackId { - PuzzleWorkProfileDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: PuzzleWorkProfileDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct PuzzleWorkProfileUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for PuzzleWorkProfileTableHandle<'ctx> { - type UpdateCallbackId = PuzzleWorkProfileUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> PuzzleWorkProfileUpdateCallbackId { - PuzzleWorkProfileUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: PuzzleWorkProfileUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `profile_id` unique index on the table `puzzle_work_profile`, - /// which allows point queries on the field of the same name - /// via the [`PuzzleWorkProfileProfileIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.puzzle_work_profile().profile_id().find(...)`. - pub struct PuzzleWorkProfileProfileIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> PuzzleWorkProfileTableHandle<'ctx> { - /// Get a handle on the `profile_id` unique index on the table `puzzle_work_profile`. - pub fn profile_id(&self) -> PuzzleWorkProfileProfileIdUnique<'ctx> { - PuzzleWorkProfileProfileIdUnique { - imp: self.imp.get_unique_constraint::("profile_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> PuzzleWorkProfileProfileIdUnique<'ctx> { - /// Find the subscribed row whose `profile_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("puzzle_work_profile"); - _table.add_unique_constraint::("profile_id", |row| &row.profile_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `PuzzleWorkProfileRow`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait puzzle_work_profileQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `PuzzleWorkProfileRow`. - fn puzzle_work_profile(&self) -> __sdk::__query_builder::Table; - } - - impl puzzle_work_profileQueryTableAccess for __sdk::QueryTableAccessor { - fn puzzle_work_profile(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("puzzle_work_profile") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/quest_log_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/quest_log_table.rs deleted file mode 100644 index 069f1084..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/quest_log_table.rs +++ /dev/null @@ -1,167 +0,0 @@ -// 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::quest_log_type::QuestLog; -use super::quest_status_type::QuestStatus; -use super::quest_progress_signal_type::QuestProgressSignal; -use super::quest_log_event_kind_type::QuestLogEventKind; -use super::quest_signal_kind_type::QuestSignalKind; - -/// Table handle for the table `quest_log`. -/// -/// Obtain a handle from the [`QuestLogTableAccess::quest_log`] method on [`super::RemoteTables`], -/// like `ctx.db.quest_log()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.quest_log().on_insert(...)`. -pub struct QuestLogTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `quest_log`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait QuestLogTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`QuestLogTableHandle`], which mediates access to the table `quest_log`. - fn quest_log(&self) -> QuestLogTableHandle<'_>; -} - -impl QuestLogTableAccess for super::RemoteTables { - fn quest_log(&self) -> QuestLogTableHandle<'_> { - QuestLogTableHandle { - imp: self.imp.get_table::("quest_log"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct QuestLogInsertCallbackId(__sdk::CallbackId); -pub struct QuestLogDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for QuestLogTableHandle<'ctx> { - type Row = QuestLog; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = QuestLogInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> QuestLogInsertCallbackId { - QuestLogInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: QuestLogInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = QuestLogDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> QuestLogDeleteCallbackId { - QuestLogDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: QuestLogDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct QuestLogUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for QuestLogTableHandle<'ctx> { - type UpdateCallbackId = QuestLogUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> QuestLogUpdateCallbackId { - QuestLogUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: QuestLogUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `log_id` unique index on the table `quest_log`, - /// which allows point queries on the field of the same name - /// via the [`QuestLogLogIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.quest_log().log_id().find(...)`. - pub struct QuestLogLogIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> QuestLogTableHandle<'ctx> { - /// Get a handle on the `log_id` unique index on the table `quest_log`. - pub fn log_id(&self) -> QuestLogLogIdUnique<'ctx> { - QuestLogLogIdUnique { - imp: self.imp.get_unique_constraint::("log_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> QuestLogLogIdUnique<'ctx> { - /// Find the subscribed row whose `log_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("quest_log"); - _table.add_unique_constraint::("log_id", |row| &row.log_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `QuestLog`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait quest_logQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `QuestLog`. - fn quest_log(&self) -> __sdk::__query_builder::Table; - } - - impl quest_logQueryTableAccess for __sdk::QueryTableAccessor { - fn quest_log(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("quest_log") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/quest_record_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/quest_record_table.rs deleted file mode 100644 index 3ccd7a81..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/quest_record_table.rs +++ /dev/null @@ -1,168 +0,0 @@ -// 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::quest_record_type::QuestRecord; -use super::quest_status_type::QuestStatus; -use super::quest_reward_snapshot_type::QuestRewardSnapshot; -use super::quest_narrative_binding_snapshot_type::QuestNarrativeBindingSnapshot; -use super::quest_step_snapshot_type::QuestStepSnapshot; -use super::quest_objective_snapshot_type::QuestObjectiveSnapshot; - -/// Table handle for the table `quest_record`. -/// -/// Obtain a handle from the [`QuestRecordTableAccess::quest_record`] method on [`super::RemoteTables`], -/// like `ctx.db.quest_record()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.quest_record().on_insert(...)`. -pub struct QuestRecordTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `quest_record`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait QuestRecordTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`QuestRecordTableHandle`], which mediates access to the table `quest_record`. - fn quest_record(&self) -> QuestRecordTableHandle<'_>; -} - -impl QuestRecordTableAccess for super::RemoteTables { - fn quest_record(&self) -> QuestRecordTableHandle<'_> { - QuestRecordTableHandle { - imp: self.imp.get_table::("quest_record"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct QuestRecordInsertCallbackId(__sdk::CallbackId); -pub struct QuestRecordDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for QuestRecordTableHandle<'ctx> { - type Row = QuestRecord; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = QuestRecordInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> QuestRecordInsertCallbackId { - QuestRecordInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: QuestRecordInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = QuestRecordDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> QuestRecordDeleteCallbackId { - QuestRecordDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: QuestRecordDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct QuestRecordUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for QuestRecordTableHandle<'ctx> { - type UpdateCallbackId = QuestRecordUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> QuestRecordUpdateCallbackId { - QuestRecordUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: QuestRecordUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `quest_id` unique index on the table `quest_record`, - /// which allows point queries on the field of the same name - /// via the [`QuestRecordQuestIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.quest_record().quest_id().find(...)`. - pub struct QuestRecordQuestIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> QuestRecordTableHandle<'ctx> { - /// Get a handle on the `quest_id` unique index on the table `quest_record`. - pub fn quest_id(&self) -> QuestRecordQuestIdUnique<'ctx> { - QuestRecordQuestIdUnique { - imp: self.imp.get_unique_constraint::("quest_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> QuestRecordQuestIdUnique<'ctx> { - /// Find the subscribed row whose `quest_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("quest_record"); - _table.add_unique_constraint::("quest_id", |row| &row.quest_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `QuestRecord`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait quest_recordQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `QuestRecord`. - fn quest_record(&self) -> __sdk::__query_builder::Table; - } - - impl quest_recordQueryTableAccess for __sdk::QueryTableAccessor { - fn quest_record(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("quest_record") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/refresh_session_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/refresh_session_table.rs deleted file mode 100644 index 6c92ecfb..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/refresh_session_table.rs +++ /dev/null @@ -1,163 +0,0 @@ -// 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::refresh_session_type::RefreshSession; - -/// Table handle for the table `refresh_session`. -/// -/// Obtain a handle from the [`RefreshSessionTableAccess::refresh_session`] method on [`super::RemoteTables`], -/// like `ctx.db.refresh_session()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.refresh_session().on_insert(...)`. -pub struct RefreshSessionTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `refresh_session`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait RefreshSessionTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`RefreshSessionTableHandle`], which mediates access to the table `refresh_session`. - fn refresh_session(&self) -> RefreshSessionTableHandle<'_>; -} - -impl RefreshSessionTableAccess for super::RemoteTables { - fn refresh_session(&self) -> RefreshSessionTableHandle<'_> { - RefreshSessionTableHandle { - imp: self.imp.get_table::("refresh_session"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct RefreshSessionInsertCallbackId(__sdk::CallbackId); -pub struct RefreshSessionDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for RefreshSessionTableHandle<'ctx> { - type Row = RefreshSession; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = RefreshSessionInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> RefreshSessionInsertCallbackId { - RefreshSessionInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: RefreshSessionInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = RefreshSessionDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> RefreshSessionDeleteCallbackId { - RefreshSessionDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: RefreshSessionDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct RefreshSessionUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for RefreshSessionTableHandle<'ctx> { - type UpdateCallbackId = RefreshSessionUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> RefreshSessionUpdateCallbackId { - RefreshSessionUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: RefreshSessionUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `session_id` unique index on the table `refresh_session`, - /// which allows point queries on the field of the same name - /// via the [`RefreshSessionSessionIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.refresh_session().session_id().find(...)`. - pub struct RefreshSessionSessionIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> RefreshSessionTableHandle<'ctx> { - /// Get a handle on the `session_id` unique index on the table `refresh_session`. - pub fn session_id(&self) -> RefreshSessionSessionIdUnique<'ctx> { - RefreshSessionSessionIdUnique { - imp: self.imp.get_unique_constraint::("session_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> RefreshSessionSessionIdUnique<'ctx> { - /// Find the subscribed row whose `session_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("refresh_session"); - _table.add_unique_constraint::("session_id", |row| &row.session_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `RefreshSession`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait refresh_sessionQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `RefreshSession`. - fn refresh_session(&self) -> __sdk::__query_builder::Table; - } - - impl refresh_sessionQueryTableAccess for __sdk::QueryTableAccessor { - fn refresh_session(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("refresh_session") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/runtime_setting_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/runtime_setting_table.rs deleted file mode 100644 index cc7fac56..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/runtime_setting_table.rs +++ /dev/null @@ -1,164 +0,0 @@ -// 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::runtime_setting_type::RuntimeSetting; -use super::runtime_platform_theme_type::RuntimePlatformTheme; - -/// Table handle for the table `runtime_setting`. -/// -/// Obtain a handle from the [`RuntimeSettingTableAccess::runtime_setting`] method on [`super::RemoteTables`], -/// like `ctx.db.runtime_setting()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.runtime_setting().on_insert(...)`. -pub struct RuntimeSettingTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `runtime_setting`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait RuntimeSettingTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`RuntimeSettingTableHandle`], which mediates access to the table `runtime_setting`. - fn runtime_setting(&self) -> RuntimeSettingTableHandle<'_>; -} - -impl RuntimeSettingTableAccess for super::RemoteTables { - fn runtime_setting(&self) -> RuntimeSettingTableHandle<'_> { - RuntimeSettingTableHandle { - imp: self.imp.get_table::("runtime_setting"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct RuntimeSettingInsertCallbackId(__sdk::CallbackId); -pub struct RuntimeSettingDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for RuntimeSettingTableHandle<'ctx> { - type Row = RuntimeSetting; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = RuntimeSettingInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> RuntimeSettingInsertCallbackId { - RuntimeSettingInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: RuntimeSettingInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = RuntimeSettingDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> RuntimeSettingDeleteCallbackId { - RuntimeSettingDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: RuntimeSettingDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct RuntimeSettingUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for RuntimeSettingTableHandle<'ctx> { - type UpdateCallbackId = RuntimeSettingUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> RuntimeSettingUpdateCallbackId { - RuntimeSettingUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: RuntimeSettingUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `user_id` unique index on the table `runtime_setting`, - /// which allows point queries on the field of the same name - /// via the [`RuntimeSettingUserIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.runtime_setting().user_id().find(...)`. - pub struct RuntimeSettingUserIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> RuntimeSettingTableHandle<'ctx> { - /// Get a handle on the `user_id` unique index on the table `runtime_setting`. - pub fn user_id(&self) -> RuntimeSettingUserIdUnique<'ctx> { - RuntimeSettingUserIdUnique { - imp: self.imp.get_unique_constraint::("user_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> RuntimeSettingUserIdUnique<'ctx> { - /// Find the subscribed row whose `user_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("runtime_setting"); - _table.add_unique_constraint::("user_id", |row| &row.user_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `RuntimeSetting`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait runtime_settingQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `RuntimeSetting`. - fn runtime_setting(&self) -> __sdk::__query_builder::Table; - } - - impl runtime_settingQueryTableAccess for __sdk::QueryTableAccessor { - fn runtime_setting(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("runtime_setting") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/runtime_snapshot_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/runtime_snapshot_table.rs deleted file mode 100644 index ea6106d1..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/runtime_snapshot_table.rs +++ /dev/null @@ -1,163 +0,0 @@ -// 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::runtime_snapshot_row_type::RuntimeSnapshotRow; - -/// Table handle for the table `runtime_snapshot`. -/// -/// Obtain a handle from the [`RuntimeSnapshotTableAccess::runtime_snapshot`] method on [`super::RemoteTables`], -/// like `ctx.db.runtime_snapshot()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.runtime_snapshot().on_insert(...)`. -pub struct RuntimeSnapshotTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `runtime_snapshot`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait RuntimeSnapshotTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`RuntimeSnapshotTableHandle`], which mediates access to the table `runtime_snapshot`. - fn runtime_snapshot(&self) -> RuntimeSnapshotTableHandle<'_>; -} - -impl RuntimeSnapshotTableAccess for super::RemoteTables { - fn runtime_snapshot(&self) -> RuntimeSnapshotTableHandle<'_> { - RuntimeSnapshotTableHandle { - imp: self.imp.get_table::("runtime_snapshot"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct RuntimeSnapshotInsertCallbackId(__sdk::CallbackId); -pub struct RuntimeSnapshotDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for RuntimeSnapshotTableHandle<'ctx> { - type Row = RuntimeSnapshotRow; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = RuntimeSnapshotInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> RuntimeSnapshotInsertCallbackId { - RuntimeSnapshotInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: RuntimeSnapshotInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = RuntimeSnapshotDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> RuntimeSnapshotDeleteCallbackId { - RuntimeSnapshotDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: RuntimeSnapshotDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct RuntimeSnapshotUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for RuntimeSnapshotTableHandle<'ctx> { - type UpdateCallbackId = RuntimeSnapshotUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> RuntimeSnapshotUpdateCallbackId { - RuntimeSnapshotUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: RuntimeSnapshotUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `user_id` unique index on the table `runtime_snapshot`, - /// which allows point queries on the field of the same name - /// via the [`RuntimeSnapshotUserIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.runtime_snapshot().user_id().find(...)`. - pub struct RuntimeSnapshotUserIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> RuntimeSnapshotTableHandle<'ctx> { - /// Get a handle on the `user_id` unique index on the table `runtime_snapshot`. - pub fn user_id(&self) -> RuntimeSnapshotUserIdUnique<'ctx> { - RuntimeSnapshotUserIdUnique { - imp: self.imp.get_unique_constraint::("user_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> RuntimeSnapshotUserIdUnique<'ctx> { - /// Find the subscribed row whose `user_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("runtime_snapshot"); - _table.add_unique_constraint::("user_id", |row| &row.user_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `RuntimeSnapshotRow`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait runtime_snapshotQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `RuntimeSnapshotRow`. - fn runtime_snapshot(&self) -> __sdk::__query_builder::Table; - } - - impl runtime_snapshotQueryTableAccess for __sdk::QueryTableAccessor { - fn runtime_snapshot(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("runtime_snapshot") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/story_event_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/story_event_table.rs deleted file mode 100644 index b702797b..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/story_event_table.rs +++ /dev/null @@ -1,164 +0,0 @@ -// 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::story_event_type::StoryEvent; -use super::story_event_kind_type::StoryEventKind; - -/// Table handle for the table `story_event`. -/// -/// Obtain a handle from the [`StoryEventTableAccess::story_event`] method on [`super::RemoteTables`], -/// like `ctx.db.story_event()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.story_event().on_insert(...)`. -pub struct StoryEventTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `story_event`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait StoryEventTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`StoryEventTableHandle`], which mediates access to the table `story_event`. - fn story_event(&self) -> StoryEventTableHandle<'_>; -} - -impl StoryEventTableAccess for super::RemoteTables { - fn story_event(&self) -> StoryEventTableHandle<'_> { - StoryEventTableHandle { - imp: self.imp.get_table::("story_event"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct StoryEventInsertCallbackId(__sdk::CallbackId); -pub struct StoryEventDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for StoryEventTableHandle<'ctx> { - type Row = StoryEvent; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = StoryEventInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> StoryEventInsertCallbackId { - StoryEventInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: StoryEventInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = StoryEventDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> StoryEventDeleteCallbackId { - StoryEventDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: StoryEventDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct StoryEventUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for StoryEventTableHandle<'ctx> { - type UpdateCallbackId = StoryEventUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> StoryEventUpdateCallbackId { - StoryEventUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: StoryEventUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `event_id` unique index on the table `story_event`, - /// which allows point queries on the field of the same name - /// via the [`StoryEventEventIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.story_event().event_id().find(...)`. - pub struct StoryEventEventIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> StoryEventTableHandle<'ctx> { - /// Get a handle on the `event_id` unique index on the table `story_event`. - pub fn event_id(&self) -> StoryEventEventIdUnique<'ctx> { - StoryEventEventIdUnique { - imp: self.imp.get_unique_constraint::("event_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> StoryEventEventIdUnique<'ctx> { - /// Find the subscribed row whose `event_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("story_event"); - _table.add_unique_constraint::("event_id", |row| &row.event_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `StoryEvent`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait story_eventQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `StoryEvent`. - fn story_event(&self) -> __sdk::__query_builder::Table; - } - - impl story_eventQueryTableAccess for __sdk::QueryTableAccessor { - fn story_event(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("story_event") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/story_session_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/story_session_table.rs deleted file mode 100644 index d3b4dd67..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/story_session_table.rs +++ /dev/null @@ -1,164 +0,0 @@ -// 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::story_session_type::StorySession; -use super::story_session_status_type::StorySessionStatus; - -/// Table handle for the table `story_session`. -/// -/// Obtain a handle from the [`StorySessionTableAccess::story_session`] method on [`super::RemoteTables`], -/// like `ctx.db.story_session()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.story_session().on_insert(...)`. -pub struct StorySessionTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `story_session`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait StorySessionTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`StorySessionTableHandle`], which mediates access to the table `story_session`. - fn story_session(&self) -> StorySessionTableHandle<'_>; -} - -impl StorySessionTableAccess for super::RemoteTables { - fn story_session(&self) -> StorySessionTableHandle<'_> { - StorySessionTableHandle { - imp: self.imp.get_table::("story_session"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct StorySessionInsertCallbackId(__sdk::CallbackId); -pub struct StorySessionDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for StorySessionTableHandle<'ctx> { - type Row = StorySession; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = StorySessionInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> StorySessionInsertCallbackId { - StorySessionInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: StorySessionInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = StorySessionDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> StorySessionDeleteCallbackId { - StorySessionDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: StorySessionDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct StorySessionUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for StorySessionTableHandle<'ctx> { - type UpdateCallbackId = StorySessionUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> StorySessionUpdateCallbackId { - StorySessionUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: StorySessionUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `story_session_id` unique index on the table `story_session`, - /// which allows point queries on the field of the same name - /// via the [`StorySessionStorySessionIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.story_session().story_session_id().find(...)`. - pub struct StorySessionStorySessionIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> StorySessionTableHandle<'ctx> { - /// Get a handle on the `story_session_id` unique index on the table `story_session`. - pub fn story_session_id(&self) -> StorySessionStorySessionIdUnique<'ctx> { - StorySessionStorySessionIdUnique { - imp: self.imp.get_unique_constraint::("story_session_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> StorySessionStorySessionIdUnique<'ctx> { - /// Find the subscribed row whose `story_session_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("story_session"); - _table.add_unique_constraint::("story_session_id", |row| &row.story_session_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `StorySession`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait story_sessionQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `StorySession`. - fn story_session(&self) -> __sdk::__query_builder::Table; - } - - impl story_sessionQueryTableAccess for __sdk::QueryTableAccessor { - fn story_session(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("story_session") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/treasure_record_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/treasure_record_table.rs deleted file mode 100644 index c4e7b6cd..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/treasure_record_table.rs +++ /dev/null @@ -1,165 +0,0 @@ -// 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::treasure_record_type::TreasureRecord; -use super::runtime_item_reward_item_snapshot_type::RuntimeItemRewardItemSnapshot; -use super::treasure_interaction_action_type::TreasureInteractionAction; - -/// Table handle for the table `treasure_record`. -/// -/// Obtain a handle from the [`TreasureRecordTableAccess::treasure_record`] method on [`super::RemoteTables`], -/// like `ctx.db.treasure_record()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.treasure_record().on_insert(...)`. -pub struct TreasureRecordTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `treasure_record`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait TreasureRecordTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`TreasureRecordTableHandle`], which mediates access to the table `treasure_record`. - fn treasure_record(&self) -> TreasureRecordTableHandle<'_>; -} - -impl TreasureRecordTableAccess for super::RemoteTables { - fn treasure_record(&self) -> TreasureRecordTableHandle<'_> { - TreasureRecordTableHandle { - imp: self.imp.get_table::("treasure_record"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct TreasureRecordInsertCallbackId(__sdk::CallbackId); -pub struct TreasureRecordDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for TreasureRecordTableHandle<'ctx> { - type Row = TreasureRecord; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = TreasureRecordInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> TreasureRecordInsertCallbackId { - TreasureRecordInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: TreasureRecordInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = TreasureRecordDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> TreasureRecordDeleteCallbackId { - TreasureRecordDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: TreasureRecordDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct TreasureRecordUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for TreasureRecordTableHandle<'ctx> { - type UpdateCallbackId = TreasureRecordUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> TreasureRecordUpdateCallbackId { - TreasureRecordUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: TreasureRecordUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `treasure_record_id` unique index on the table `treasure_record`, - /// which allows point queries on the field of the same name - /// via the [`TreasureRecordTreasureRecordIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.treasure_record().treasure_record_id().find(...)`. - pub struct TreasureRecordTreasureRecordIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> TreasureRecordTableHandle<'ctx> { - /// Get a handle on the `treasure_record_id` unique index on the table `treasure_record`. - pub fn treasure_record_id(&self) -> TreasureRecordTreasureRecordIdUnique<'ctx> { - TreasureRecordTreasureRecordIdUnique { - imp: self.imp.get_unique_constraint::("treasure_record_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> TreasureRecordTreasureRecordIdUnique<'ctx> { - /// Find the subscribed row whose `treasure_record_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("treasure_record"); - _table.add_unique_constraint::("treasure_record_id", |row| &row.treasure_record_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `TreasureRecord`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait treasure_recordQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `TreasureRecord`. - fn treasure_record(&self) -> __sdk::__query_builder::Table; - } - - impl treasure_recordQueryTableAccess for __sdk::QueryTableAccessor { - fn treasure_record(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("treasure_record") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/user_account_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/user_account_table.rs deleted file mode 100644 index 082d5303..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/user_account_table.rs +++ /dev/null @@ -1,163 +0,0 @@ -// 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::user_account_type::UserAccount; - -/// Table handle for the table `user_account`. -/// -/// Obtain a handle from the [`UserAccountTableAccess::user_account`] method on [`super::RemoteTables`], -/// like `ctx.db.user_account()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.user_account().on_insert(...)`. -pub struct UserAccountTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `user_account`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait UserAccountTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`UserAccountTableHandle`], which mediates access to the table `user_account`. - fn user_account(&self) -> UserAccountTableHandle<'_>; -} - -impl UserAccountTableAccess for super::RemoteTables { - fn user_account(&self) -> UserAccountTableHandle<'_> { - UserAccountTableHandle { - imp: self.imp.get_table::("user_account"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct UserAccountInsertCallbackId(__sdk::CallbackId); -pub struct UserAccountDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for UserAccountTableHandle<'ctx> { - type Row = UserAccount; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = UserAccountInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> UserAccountInsertCallbackId { - UserAccountInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: UserAccountInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = UserAccountDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> UserAccountDeleteCallbackId { - UserAccountDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: UserAccountDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct UserAccountUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for UserAccountTableHandle<'ctx> { - type UpdateCallbackId = UserAccountUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> UserAccountUpdateCallbackId { - UserAccountUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: UserAccountUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `user_id` unique index on the table `user_account`, - /// which allows point queries on the field of the same name - /// via the [`UserAccountUserIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.user_account().user_id().find(...)`. - pub struct UserAccountUserIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> UserAccountTableHandle<'ctx> { - /// Get a handle on the `user_id` unique index on the table `user_account`. - pub fn user_id(&self) -> UserAccountUserIdUnique<'ctx> { - UserAccountUserIdUnique { - imp: self.imp.get_unique_constraint::("user_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> UserAccountUserIdUnique<'ctx> { - /// Find the subscribed row whose `user_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("user_account"); - _table.add_unique_constraint::("user_id", |row| &row.user_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `UserAccount`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait user_accountQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `UserAccount`. - fn user_account(&self) -> __sdk::__query_builder::Table; - } - - impl user_accountQueryTableAccess for __sdk::QueryTableAccessor { - fn user_account(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("user_account") - } - } - diff --git a/server-rs/crates/spacetime-client/src/module_bindings/user_browse_history_table.rs b/server-rs/crates/spacetime-client/src/module_bindings/user_browse_history_table.rs deleted file mode 100644 index 933556ca..00000000 --- a/server-rs/crates/spacetime-client/src/module_bindings/user_browse_history_table.rs +++ /dev/null @@ -1,164 +0,0 @@ -// 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::user_browse_history_type::UserBrowseHistory; -use super::runtime_browse_history_theme_mode_type::RuntimeBrowseHistoryThemeMode; - -/// Table handle for the table `user_browse_history`. -/// -/// Obtain a handle from the [`UserBrowseHistoryTableAccess::user_browse_history`] method on [`super::RemoteTables`], -/// like `ctx.db.user_browse_history()`. -/// -/// Users are encouraged not to explicitly reference this type, -/// but to directly chain method calls, -/// like `ctx.db.user_browse_history().on_insert(...)`. -pub struct UserBrowseHistoryTableHandle<'ctx> { - imp: __sdk::TableHandle, - ctx: std::marker::PhantomData<&'ctx super::RemoteTables>, -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the table `user_browse_history`. -/// -/// Implemented for [`super::RemoteTables`]. -pub trait UserBrowseHistoryTableAccess { - #[allow(non_snake_case)] - /// Obtain a [`UserBrowseHistoryTableHandle`], which mediates access to the table `user_browse_history`. - fn user_browse_history(&self) -> UserBrowseHistoryTableHandle<'_>; -} - -impl UserBrowseHistoryTableAccess for super::RemoteTables { - fn user_browse_history(&self) -> UserBrowseHistoryTableHandle<'_> { - UserBrowseHistoryTableHandle { - imp: self.imp.get_table::("user_browse_history"), - ctx: std::marker::PhantomData, - } - } -} - -pub struct UserBrowseHistoryInsertCallbackId(__sdk::CallbackId); -pub struct UserBrowseHistoryDeleteCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::Table for UserBrowseHistoryTableHandle<'ctx> { - type Row = UserBrowseHistory; - type EventContext = super::EventContext; - - fn count(&self) -> u64 { self.imp.count() } - fn iter(&self) -> impl Iterator + '_ { self.imp.iter() } - - type InsertCallbackId = UserBrowseHistoryInsertCallbackId; - - fn on_insert( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> UserBrowseHistoryInsertCallbackId { - UserBrowseHistoryInsertCallbackId(self.imp.on_insert(Box::new(callback))) - } - - fn remove_on_insert(&self, callback: UserBrowseHistoryInsertCallbackId) { - self.imp.remove_on_insert(callback.0) - } - - type DeleteCallbackId = UserBrowseHistoryDeleteCallbackId; - - fn on_delete( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static, - ) -> UserBrowseHistoryDeleteCallbackId { - UserBrowseHistoryDeleteCallbackId(self.imp.on_delete(Box::new(callback))) - } - - fn remove_on_delete(&self, callback: UserBrowseHistoryDeleteCallbackId) { - self.imp.remove_on_delete(callback.0) - } -} - -pub struct UserBrowseHistoryUpdateCallbackId(__sdk::CallbackId); - -impl<'ctx> __sdk::TableWithPrimaryKey for UserBrowseHistoryTableHandle<'ctx> { - type UpdateCallbackId = UserBrowseHistoryUpdateCallbackId; - - fn on_update( - &self, - callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static, - ) -> UserBrowseHistoryUpdateCallbackId { - UserBrowseHistoryUpdateCallbackId(self.imp.on_update(Box::new(callback))) - } - - fn remove_on_update(&self, callback: UserBrowseHistoryUpdateCallbackId) { - self.imp.remove_on_update(callback.0) - } -} - - /// Access to the `browse_history_id` unique index on the table `user_browse_history`, - /// which allows point queries on the field of the same name - /// via the [`UserBrowseHistoryBrowseHistoryIdUnique::find`] method. - /// - /// Users are encouraged not to explicitly reference this type, - /// but to directly chain method calls, - /// like `ctx.db.user_browse_history().browse_history_id().find(...)`. - pub struct UserBrowseHistoryBrowseHistoryIdUnique<'ctx> { - imp: __sdk::UniqueConstraintHandle, - phantom: std::marker::PhantomData<&'ctx super::RemoteTables>, - } - - impl<'ctx> UserBrowseHistoryTableHandle<'ctx> { - /// Get a handle on the `browse_history_id` unique index on the table `user_browse_history`. - pub fn browse_history_id(&self) -> UserBrowseHistoryBrowseHistoryIdUnique<'ctx> { - UserBrowseHistoryBrowseHistoryIdUnique { - imp: self.imp.get_unique_constraint::("browse_history_id"), - phantom: std::marker::PhantomData, - } - } - } - - impl<'ctx> UserBrowseHistoryBrowseHistoryIdUnique<'ctx> { - /// Find the subscribed row whose `browse_history_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 { - self.imp.find(col_val) - } - } - -#[doc(hidden)] -pub(super) fn register_table(client_cache: &mut __sdk::ClientCache) { - - let _table = client_cache.get_or_make_table::("user_browse_history"); - _table.add_unique_constraint::("browse_history_id", |row| &row.browse_history_id); -} - -#[doc(hidden)] -pub(super) fn parse_table_update( - raw_updates: __ws::v2::TableUpdate, -) -> __sdk::Result<__sdk::TableUpdate> { - __sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| { - __sdk::InternalError::failed_parse( - "TableUpdate", - "TableUpdate", - ).with_cause(e).into() - }) -} - - #[allow(non_camel_case_types)] - /// Extension trait for query builder access to the table `UserBrowseHistory`. - /// - /// Implemented for [`__sdk::QueryTableAccessor`]. - pub trait user_browse_historyQueryTableAccess { - #[allow(non_snake_case)] - /// Get a query builder for the table `UserBrowseHistory`. - fn user_browse_history(&self) -> __sdk::__query_builder::Table; - } - - impl user_browse_historyQueryTableAccess for __sdk::QueryTableAccessor { - fn user_browse_history(&self) -> __sdk::__query_builder::Table { - __sdk::__query_builder::Table::new("user_browse_history") - } - } - diff --git a/server-rs/crates/spacetime-module/src/asset_metadata/objects.rs b/server-rs/crates/spacetime-module/src/asset_metadata/objects.rs index a294915a..5da67eca 100644 --- a/server-rs/crates/spacetime-module/src/asset_metadata/objects.rs +++ b/server-rs/crates/spacetime-module/src/asset_metadata/objects.rs @@ -1,5 +1,9 @@ use crate::*; +const ASSET_HISTORY_MAX_LIMIT: usize = 120; +const ASSET_HISTORY_CHARACTER_VISUAL_KIND: &str = "character_visual"; +const ASSET_HISTORY_SCENE_IMAGE_KIND: &str = "scene_image"; + #[spacetimedb::table( accessor = asset_object, index(accessor = by_bucket_object_key, btree(columns = [bucket, object_key])) @@ -54,6 +58,26 @@ pub fn confirm_asset_object_and_return( } } +// 历史素材只返回编辑器复用所需的脱敏字段,asset_object 本表继续保持 private。 +#[spacetimedb::procedure] +pub fn list_asset_history_and_return( + ctx: &mut ProcedureContext, + input: AssetHistoryListInput, +) -> AssetHistoryListResult { + match ctx.try_with_tx(|tx| list_asset_history(tx, input.clone())) { + Ok(entries) => AssetHistoryListResult { + ok: true, + entries, + error_message: None, + }, + Err(message) => AssetHistoryListResult { + ok: false, + entries: Vec::new(), + error_message: Some(message), + }, + } +} + pub(crate) fn upsert_asset_object( ctx: &ReducerContext, input: AssetObjectUpsertInput, @@ -167,3 +191,52 @@ pub(crate) fn has_asset_object(ctx: &ReducerContext, asset_object_id: &str) -> b .iter() .any(|row| row.asset_object_id == asset_object_id) } + +fn list_asset_history( + ctx: &ReducerContext, + input: AssetHistoryListInput, +) -> Result, String> { + let asset_kind = input.asset_kind.trim(); + if asset_kind != ASSET_HISTORY_CHARACTER_VISUAL_KIND + && asset_kind != ASSET_HISTORY_SCENE_IMAGE_KIND + { + return Err("历史素材类型只支持 character_visual 或 scene_image".to_string()); + } + + let limit = usize::try_from(input.limit) + .unwrap_or(ASSET_HISTORY_MAX_LIMIT) + .clamp(1, ASSET_HISTORY_MAX_LIMIT); + let mut entries = ctx + .db + .asset_object() + .iter() + .filter(|row| row.asset_kind == asset_kind) + .map(|row| AssetHistoryEntrySnapshot { + asset_object_id: row.asset_object_id, + asset_kind: row.asset_kind, + image_src: object_key_to_legacy_image_src(row.object_key.as_str()), + owner_user_id: row.owner_user_id, + profile_id: row.profile_id, + entity_id: row.entity_id, + created_at_micros: row.created_at.to_micros_since_unix_epoch(), + updated_at_micros: row.updated_at.to_micros_since_unix_epoch(), + }) + .collect::>(); + + entries.sort_by(|left, right| { + right + .created_at_micros + .cmp(&left.created_at_micros) + .then_with(|| right.asset_object_id.cmp(&left.asset_object_id)) + }); + entries.truncate(limit); + Ok(entries) +} + +fn object_key_to_legacy_image_src(object_key: &str) -> String { + let normalized = object_key.trim().trim_start_matches('/'); + if normalized.is_empty() { + return String::new(); + } + format!("/{normalized}") +} diff --git a/src/components/CustomWorldEntityCatalog.tsx b/src/components/CustomWorldEntityCatalog.tsx index de1a967b..9551a707 100644 --- a/src/components/CustomWorldEntityCatalog.tsx +++ b/src/components/CustomWorldEntityCatalog.tsx @@ -68,15 +68,19 @@ function Section({ badge, actions, children, + className = '', }: { title: string; subtitle?: string; badge?: ReactNode; actions?: ReactNode; children: ReactNode; + className?: string; }) { return ( -
+
@@ -220,9 +224,7 @@ function PendingEntityCard({
{title}
-
- {phaseLabel} -
+
{phaseLabel}
{Math.round(progress)}% @@ -286,9 +288,11 @@ function buildSceneChapterSearchText( } function buildSceneTaskDescriptionText(sceneChapters: SceneChapterBlueprint[]) { - return compactTextList( - sceneChapters.map((chapter) => chapter.sceneTaskDescription), - )[0] ?? ''; + return ( + compactTextList( + sceneChapters.map((chapter) => chapter.sceneTaskDescription), + )[0] ?? '' + ); } function SceneActPreviewStrip({ @@ -364,9 +368,7 @@ function CatalogCard({ onClick={disabled ? undefined : onClick} aria-disabled={disabled} className={`w-full rounded-[1.3rem] border p-2.5 text-left transition-colors xl:p-3 ${ - isSelected - ? 'border-rose-300/35 bg-rose-500/10' - : 'platform-subpanel' + isSelected ? 'border-rose-300/35 bg-rose-500/10' : 'platform-subpanel' }`} >
@@ -388,7 +390,9 @@ function CatalogCard({
{description || '暂无描述'}
- {actions ?
{actions}
: null} + {actions ? ( +
{actions}
+ ) : null}
@@ -402,9 +406,7 @@ function CatalogCard({ onClick={disabled ? undefined : onClick} aria-disabled={disabled} className={`w-full rounded-[1.4rem] border p-3 text-left transition-colors ${ - isSelected - ? 'border-rose-300/35 bg-rose-500/10' - : 'platform-subpanel' + isSelected ? 'border-rose-300/35 bg-rose-500/10' : 'platform-subpanel' }`} >
@@ -816,17 +818,19 @@ export function CustomWorldEntityCatalog({ return (
-
+
世界档案
-
- {profile.name} -
-
- {profile.subtitle} +
+
+ {profile.name} +
+
+ {profile.subtitle} +
@@ -898,7 +902,7 @@ export function CustomWorldEntityCatalog({
{activeTab === 'world' ? ( -
+
@@ -926,7 +930,7 @@ export function CustomWorldEntityCatalog({ title="角色维度" subtitle={profile.attributeSchema?.schemaName} > -
+
{attributeSlots.map((slot) => (
-
-

{profile.summary}

-
- 主线目标:{profile.playerGoal} -
-
- 世界基调:{profile.tone} -
+
+

{profile.summary}

+
+ 主线目标:{profile.playerGoal}
+
+ 世界基调:{profile.tone} +
+
{entry.value ? (
- {parseFoundationTagText(entry.value).map((tag, index) => ( - - {tag} - - ))} + {parseFoundationTagText(entry.value).map( + (tag, index) => ( + + {tag} + + ), + )}
) : (
@@ -1029,7 +1036,7 @@ export function CustomWorldEntityCatalog({ ) : null} {activeTab === 'playable' ? ( -
+
{pendingGeneratedEntity?.kind === 'playable' ? ( : null} + badge={ + recentPlayableIdSet.has(role.id) ? : null + } isSelectionMode={false} isSelected={false} layout="compact" @@ -1093,9 +1102,9 @@ export function CustomWorldEntityCatalog({ className="h-full w-full object-cover object-top" /> ) : ( -
- {role.name.slice(0, 4) || '角色'} -
+
+ {role.name.slice(0, 4) || '角色'} +
) } /> @@ -1140,7 +1149,7 @@ export function CustomWorldEntityCatalog({ ) : null} {activeTab === 'story' ? ( -
+
{pendingGeneratedEntity?.kind === 'story' ? ( +
{pendingGeneratedEntity?.kind === 'landmark' ? ( ) : null } @@ -1270,4 +1278,3 @@ export function CustomWorldEntityCatalog({
); } - diff --git a/src/components/CustomWorldEntityEditorModal.test.tsx b/src/components/CustomWorldEntityEditorModal.test.tsx index 02b43651..4493dc2a 100644 --- a/src/components/CustomWorldEntityEditorModal.test.tsx +++ b/src/components/CustomWorldEntityEditorModal.test.tsx @@ -1,6 +1,13 @@ /* @vitest-environment jsdom */ -import { cleanup, render, screen, waitFor, within } from '@testing-library/react'; +import { + cleanup, + fireEvent, + render, + screen, + waitFor, + within, +} from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { useState } from 'react'; import { afterEach, expect, test, vi } from 'vitest'; @@ -191,6 +198,7 @@ function createProfile(): CustomWorldProfile { attributeSchema: { id: 'schema-1', worldId: 'world-1', + schemaName: '潮雾六维', schemaVersion: 1, generatedFrom: { worldType: 'WUXIA', @@ -199,7 +207,68 @@ function createProfile(): CustomWorldProfile { tone: '压抑、潮湿、带着未解旧伤。', conflictCore: '旧航道归属', }, - slots: [], + slots: [ + { + slotId: 'axis_a', + name: '骨势', + definition: '扛住压力并正面推进的底子。', + positiveSignals: ['硬顶'], + negativeSignals: ['畏缩'], + combatUseText: '正面承压与破阵。', + socialUseText: '在谈判里稳住立场。', + explorationUseText: '穿过危险地形。', + }, + { + slotId: 'axis_b', + name: '身法', + definition: '抢位、转场与把握节奏的能力。', + positiveSignals: ['灵动'], + negativeSignals: ['迟滞'], + combatUseText: '移动换位。', + socialUseText: '捕捉话锋。', + explorationUseText: '快速穿行。', + }, + { + slotId: 'axis_c', + name: '眼脉', + definition: '看破破绽、拆解局势的能力。', + positiveSignals: ['洞察'], + negativeSignals: ['误判'], + combatUseText: '识破招式。', + socialUseText: '辨别谎言。', + explorationUseText: '发现线索。', + }, + { + slotId: 'axis_d', + name: '心焰', + definition: '决断、压迫与坚持意志的能力。', + positiveSignals: ['果断'], + negativeSignals: ['犹疑'], + combatUseText: '强行压制。', + socialUseText: '立威推进。', + explorationUseText: '面对险境不退。', + }, + { + slotId: 'axis_e', + name: '尘缘', + definition: '处理人情、承诺和关系牵引的能力。', + positiveSignals: ['守信'], + negativeSignals: ['冷漠'], + combatUseText: '协作配合。', + socialUseText: '建立信任。', + explorationUseText: '借助人脉。', + }, + { + slotId: 'axis_f', + name: '玄息', + definition: '调息、稳态和久战的能力。', + positiveSignals: ['沉稳'], + negativeSignals: ['浮躁'], + combatUseText: '续战恢复。', + socialUseText: '保持耐心。', + explorationUseText: '长线跋涉。', + }, + ], }, playableNpcs: [createPlayableRole('playable-1', '沈砺')], storyNpcs: [createStoryRole('story-1', '顾潮音')], @@ -684,6 +753,57 @@ test('基本设定目标打开独立编辑面板', () => { expect(screen.queryByText('编辑世界信息')).toBeNull(); }); +test('世界信息面板可以编辑六个角色维度信息', async () => { + const user = userEvent.setup(); + const savedProfileRef: { current: CustomWorldProfile | null } = { + current: null, + }; + + render( + {}} + onProfileChange={(profile) => { + savedProfileRef.current = profile; + }} + />, + ); + + expect(screen.getByText('角色维度')).toBeTruthy(); + const nameInputs = screen.getAllByLabelText('维度名称'); + await user.clear(nameInputs[0]!); + await user.type(nameInputs[0]!, '潮骨'); + + const definitionFields = screen.getAllByLabelText('定义'); + await user.clear(definitionFields[0]!); + await user.type(definitionFields[0]!, '顶住潮压并正面推进的角色底色。'); + + const positiveSignalFields = screen.getAllByLabelText('正向信号'); + fireEvent.change(positiveSignalFields[0]!, { + target: { value: '硬顶, 护阵' }, + }); + + const combatFields = screen.getAllByLabelText('战斗体现'); + await user.clear(combatFields[0]!); + await user.type(combatFields[0]!, '正面压线与护住阵脚。'); + + await user.click(screen.getByRole('button', { name: /保存修改/u })); + + expect(savedProfileRef.current?.attributeSchema.slots[0]?.name).toBe( + '潮骨', + ); + expect(savedProfileRef.current?.attributeSchema.slots[0]?.definition).toBe( + '顶住潮压并正面推进的角色底色。', + ); + expect( + savedProfileRef.current?.attributeSchema.slots[0]?.positiveSignals, + ).toEqual(['硬顶', '护阵']); + expect(savedProfileRef.current?.attributeSchema.slots[0]?.combatUseText).toBe( + '正面压线与护住阵脚。', + ); +}); + test('可扮演角色列表使用缩略卡片并点击进入编辑', async () => { const user = userEvent.setup(); const handleEditTarget = vi.fn(); @@ -821,11 +941,15 @@ test('场景图片保存后会同步更新编辑页和场景列表', async () => const savedSceneChapter = savedProfile.sceneChapterBlueprints?.find( (entry) => entry.sceneId === 'landmark-1', ); - expect( - savedSceneChapter?.acts.every( - (act) => act.backgroundImageSrc === '/generated-custom-world-scenes/updated-scene.png', - ), - ).toBe(true); + expect(savedSceneChapter?.acts[0]?.backgroundImageSrc).toBe( + '/generated-custom-world-scenes/updated-scene.png', + ); + expect(savedSceneChapter?.acts[1]?.backgroundImageSrc).not.toBe( + '/generated-custom-world-scenes/updated-scene.png', + ); + expect(savedSceneChapter?.acts[2]?.backgroundImageSrc).not.toBe( + '/generated-custom-world-scenes/updated-scene.png', + ); }); test('开局场景图片保存后会同步更新编辑页和场景列表', async () => { @@ -899,11 +1023,15 @@ test('开局场景图片保存后会同步更新编辑页和场景列表', async const savedSceneChapter = savedProfile.sceneChapterBlueprints?.find( (entry) => entry.sceneId === 'custom-scene-camp', ); - expect( - savedSceneChapter?.acts.every( - (act) => act.backgroundImageSrc === '/generated-custom-world-scenes/updated-camp.png', - ), - ).toBe(true); + expect(savedSceneChapter?.acts[0]?.backgroundImageSrc).toBe( + '/generated-custom-world-scenes/updated-camp.png', + ); + expect(savedSceneChapter?.acts[1]?.backgroundImageSrc).not.toBe( + '/generated-custom-world-scenes/updated-camp.png', + ); + expect(savedSceneChapter?.acts[2]?.backgroundImageSrc).not.toBe( + '/generated-custom-world-scenes/updated-camp.png', + ); }); test('开局场景在场景配置面板中与普通场景使用同级参数并可保存', async () => { @@ -960,6 +1088,8 @@ test('开局场景在场景配置面板中与普通场景使用同级参数并 test('开局场景列表与详情幕预览复用同一套幕级图片', async () => { const profile = createProfileWithSceneChapters(); + profile.sceneChapterBlueprints![0]!.acts[1]!.backgroundPromptText = + '第二幕专属背景提示'; const user = userEvent.setup(); render( @@ -1003,6 +1133,53 @@ test('开局场景列表与详情幕预览复用同一套幕级图片', async () ); }); +test('开局场景幕背景智能生成复用当前幕图片和幕级提示词', async () => { + mockedRpgCreationAssetClient.generateSceneImage.mockClear(); + mockedRpgCreationAssetClient.generateSceneImage.mockResolvedValue({ + imageSrc: '/generated-custom-world-scenes/camp-act-2-ai.png', + assetId: 'asset-camp-act-2', + model: 'wan2.2-t2i-flash', + size: '1280*720', + taskId: 'task-camp-act-2', + prompt: '第二幕专属背景提示', + }); + const profile = createProfileWithSceneChapters(); + profile.sceneChapterBlueprints![0]!.acts[1]!.backgroundPromptText = + '第二幕专属背景提示'; + const user = userEvent.setup(); + + render( + {}} + onProfileChange={() => {}} + />, + ); + + await user.click(within(getSceneActCard(1)).getByRole('button', { name: '配置背景' })); + await waitFor(() => { + expect(screen.getByText('配置幕背景:第2幕')).toBeTruthy(); + }); + + await user.click(screen.getByRole('button', { name: 'AI生成' })); + await waitFor(() => { + expect(screen.getByText('智能生成:潮灯居')).toBeTruthy(); + }); + + expect(screen.getByRole('img', { name: '潮灯居' }).getAttribute('src')).toBe( + '/generated-custom-world-scenes/camp-act-2.png', + ); + + await user.click(screen.getByRole('button', { name: '开始生成' })); + await waitFor(() => { + expect(mockedRpgCreationAssetClient.generateSceneImage).toHaveBeenCalledTimes(1); + }); + + const payload = mockedRpgCreationAssetClient.generateSceneImage.mock.calls[0]?.[0]; + expect(payload?.userPrompt).toBe('第二幕专属背景提示'); +}); + test('普通场景世界地图会包含开局场景并高亮当前场景', async () => { const user = userEvent.setup(); diff --git a/src/components/game-canvas/GameCanvasEntityLayer.tsx b/src/components/game-canvas/GameCanvasEntityLayer.tsx index 65ce1784..d94ad171 100644 --- a/src/components/game-canvas/GameCanvasEntityLayer.tsx +++ b/src/components/game-canvas/GameCanvasEntityLayer.tsx @@ -1,4 +1,5 @@ import {motion} from 'motion/react'; +import {type ReactNode, useEffect, useMemo, useRef, useState} from 'react'; import {getCharacterById} from '../../data/characterPresets'; import {getFacingTowardPlayer, MONSTERS_BY_WORLD} from '../../data/hostileNpcs'; @@ -16,20 +17,24 @@ import {HostileNpcAnimator} from '../HostileNpcAnimator'; import {MedievalNpcAnimator} from '../MedievalNpcAnimator'; import {getRenderableNpcFacing} from '../npcRenderUtils'; import {ResolvedAssetImage} from '../ResolvedAssetImage'; -import {NpcAffinityEffectBadge} from './NpcAffinityEffectBadge'; import { + buildCombatFeedbackEvents, + type CombatFeedbackEvent, + type CombatFeedbackHealthSample, +} from './combatFeedback'; +import { + CHARACTER_COMBAT_HP_TOP_PX, DialogueBubbleIcon, type GameCanvasEntitySelection, GENERIC_NPC_SCENE_SCALE, - CHARACTER_COMBAT_HP_TOP_PX, getCompanionSlotOffset, getEncounterCharacterBottomOffsetPx, getEncounterCharacterOpponentBottom, getHostileNpcSceneBottomOffsetPx, getMonsterWorldLeft, getNpcCombatHpTop, - getSceneNpcVisualBottomOffsetPx, getSceneEntityZIndex, + getSceneNpcVisualBottomOffsetPx, HpBar, mapHostileNpcAnimationToCharacterState, MONSTER_RENDER_OFFSETS, @@ -40,6 +45,7 @@ import { SceneEncounterNpcSprite, SceneEntityButton, } from './GameCanvasShared'; +import {NpcAffinityEffectBadge} from './NpcAffinityEffectBadge'; type MonsterSpriteConfig = (typeof MONSTERS_BY_WORLD)[WorldType.WUXIA][number]; @@ -87,6 +93,88 @@ interface GameCanvasEntityLayerProps { playerX: number; } +function CombatFloatingNumber({ + event, + onDone, +}: { + event: CombatFeedbackEvent; + onDone: (eventId: string) => void; +}) { + const isHealing = event.delta > 0; + const deltaText = `${isHealing ? '+' : ''}${event.delta}`; + const colorClass = isHealing ? 'text-emerald-200' : 'text-rose-200'; + const glowClass = isHealing + ? 'drop-shadow-[0_0_8px_rgba(52,211,153,0.9)]' + : 'drop-shadow-[0_0_8px_rgba(248,113,113,0.9)]'; + + return ( + onDone(event.id)} + className={`pointer-events-none absolute -top-16 left-1/2 z-[14] -translate-x-1/2 text-lg font-black leading-none ${colorClass} ${glowClass}`} + data-testid={`combat-feedback-${event.targetKey}`} + aria-label={`战斗数值 ${deltaText}`} + > + + {deltaText} + + + ); +} + +function CombatFeedbackNumbers({ + events, + onDone, +}: { + events: CombatFeedbackEvent[]; + onDone: (eventId: string) => void; +}) { + return ( + <> + {events.map(event => ( + + ))} + + ); +} + +function getLatestDamageFeedback(events: CombatFeedbackEvent[]) { + for (let index = events.length - 1; index >= 0; index -= 1) { + const event = events[index]; + if (event?.delta && event.delta < 0) return event; + } + + return null; +} + +function CombatReactiveSpriteFrame({ + events, + facing, + className = ROLE_CHARACTER_FRAME_CLASS, + children, +}: { + events: CombatFeedbackEvent[]; + facing: 'left' | 'right'; + className?: string; + children: ReactNode; +}) { + const latestDamage = getLatestDamageFeedback(events); + const retreatX = facing === 'right' ? -12 : 12; + + return ( + + {children} + + ); +} + export function GameCanvasEntityLayer({ companions, currentScenePreset, @@ -122,13 +210,79 @@ export function GameCanvasEntityLayer({ monsterAnchorMeters, playerX, }: GameCanvasEntityLayerProps) { + const [combatFeedbackEvents, setCombatFeedbackEvents] = useState([]); + const previousCombatSamplesRef = useRef | null>(null); + const combatFeedbackSequenceRef = useRef(0); const shouldRenderPeacefulEncounter = Boolean(encounter) && (!inBattle || sceneCombatants.length === 0); + const combatHealthSamples = useMemo( + () => { + if (!inBattle) return []; + + return [ + {key: 'player', kind: 'player', hp: playerHp}, + ...companions.map(companion => ({ + key: `companion:${companion.npcId}`, + kind: 'companion' as const, + hp: companion.hp, + })), + ...sceneCombatants.map(hostileNpc => ({ + key: `hostile:${hostileNpc.id}`, + kind: 'hostile' as const, + hp: hostileNpc.hp, + })), + ]; + }, + [companions, inBattle, playerHp, sceneCombatants], + ); + const combatFeedbackByTarget = useMemo(() => { + const feedbackByTarget = new Map(); + combatFeedbackEvents.forEach(event => { + feedbackByTarget.set(event.targetKey, [ + ...(feedbackByTarget.get(event.targetKey) ?? []), + event, + ]); + }); + return feedbackByTarget; + }, [combatFeedbackEvents]); + const removeCombatFeedbackEvent = (eventId: string) => { + setCombatFeedbackEvents(events => events.filter(event => event.id !== eventId)); + }; + + useEffect(() => { + if (!inBattle) { + previousCombatSamplesRef.current = null; + setCombatFeedbackEvents([]); + return; + } + + const previousSamples = previousCombatSamplesRef.current; + if (previousSamples) { + const result = buildCombatFeedbackEvents( + previousSamples, + combatHealthSamples, + combatFeedbackSequenceRef.current, + ); + + if (result.events.length > 0) { + setCombatFeedbackEvents(events => [...events.slice(-8), ...result.events]); + } + + combatFeedbackSequenceRef.current = result.nextSequence; + } + + previousCombatSamplesRef.current = new Map( + combatHealthSamples.map(sample => [sample.key, sample]), + ); + }, [combatHealthSamples, inBattle]); return ( <> {companions.map(companion => { const slotOffset = getCompanionSlotOffset(companion.slot); + const feedbackTargetKey = `companion:${companion.npcId}`; + const feedbackEvents = combatFeedbackByTarget.get(feedbackTargetKey) ?? []; + const companionFacing = companion.facing ?? 'right'; return ( + {inBattle && (
)} -
+
-
+
@@ -217,6 +372,10 @@ export function GameCanvasEntityLayer({ }} >
+ {inBattle && (
-
+ {playerCharacter && ( )} -
+
{shouldShowPlayerDialogueIcon && (
@@ -270,6 +432,8 @@ export function GameCanvasEntityLayer({ npcCharacter ? npcEncounter?.characterId : null, npcCharacter ? null : npcEncounter?.monsterPresetId, ); + const feedbackTargetKey = `hostile:${hostileNpc.id}`; + const feedbackEvents = combatFeedbackByTarget.get(feedbackTargetKey) ?? []; const hostileNpcBottomOffsetPx = npcMonsterConfig ? getHostileNpcSceneBottomOffsetPx(npcMonsterConfig) @@ -303,6 +467,7 @@ export function GameCanvasEntityLayer({ ariaLabel={`查看${hostileNpc.name}详情`} className="relative flex w-28 flex-col items-center" > + {inBattle && (
)} -
+ {npcCharacter ? ( )} -
+ {dialogueIndicator?.showEncounter && hostileNpc.animation !== 'move' && (
{ + it('creates red damage and green healing deltas from committed hp changes', () => { + const previous = new Map([ + ['player', toSample('player', 20)], + ['hostile:npc-liu', toSample('hostile:npc-liu', 8)], + ]); + + const result = buildCombatFeedbackEvents( + previous, + [ + toSample('player', 11), + toSample('hostile:npc-liu', 9), + ], + 4, + ); + + expect(result.events).toEqual([ + { + id: 'player:5', + targetKey: 'player', + kind: 'player', + delta: -9, + }, + { + id: 'hostile:npc-liu:6', + targetKey: 'hostile:npc-liu', + kind: 'hostile', + delta: 1, + }, + ]); + expect(result.nextSequence).toBe(6); + }); + + it('ignores first render samples and unchanged hp', () => { + const result = buildCombatFeedbackEvents( + new Map([['player', toSample('player', 20)]]), + [ + toSample('player', 20), + toSample('companion:npc-chen', 6), + ], + 0, + ); + + expect(result.events).toEqual([]); + expect(result.nextSequence).toBe(0); + }); +}); diff --git a/src/components/game-canvas/combatFeedback.ts b/src/components/game-canvas/combatFeedback.ts new file mode 100644 index 00000000..10b9a618 --- /dev/null +++ b/src/components/game-canvas/combatFeedback.ts @@ -0,0 +1,44 @@ +export type CombatFeedbackTargetKind = 'player' | 'companion' | 'hostile'; + +export interface CombatFeedbackHealthSample { + key: string; + kind: CombatFeedbackTargetKind; + hp: number; +} + +export interface CombatFeedbackEvent { + id: string; + targetKey: string; + kind: CombatFeedbackTargetKind; + delta: number; +} + +export function buildCombatFeedbackEvents( + previousSamples: Map, + currentSamples: CombatFeedbackHealthSample[], + sequence: number, +) { + let nextSequence = sequence; + const events: CombatFeedbackEvent[] = []; + + currentSamples.forEach(sample => { + const previous = previousSamples.get(sample.key); + if (!previous) return; + + const delta = sample.hp - previous.hp; + if (delta === 0) return; + + nextSequence += 1; + events.push({ + id: `${sample.key}:${nextSequence}`, + targetKey: sample.key, + kind: sample.kind, + delta, + }); + }); + + return { + events, + nextSequence, + }; +} diff --git a/src/components/rpg-creation-editor/RpgCreationEntityEditorShared.tsx b/src/components/rpg-creation-editor/RpgCreationEntityEditorShared.tsx index 7958613d..3ce0357f 100644 --- a/src/components/rpg-creation-editor/RpgCreationEntityEditorShared.tsx +++ b/src/components/rpg-creation-editor/RpgCreationEntityEditorShared.tsx @@ -26,10 +26,10 @@ import { RESOLVED_ENTITY_X_METERS } from '../../data/sceneEncounterPreviews'; import { buildEncounterFromSceneNpc } from '../../data/scenePresets'; import { EDITOR_ITEM_CATALOG_API_PATH } from '../../editor/shared/editorApiClient'; import { fetchJson } from '../../editor/shared/jsonClient'; -import { useCombatFlow } from '../../hooks/useCombatFlow'; -import { useNpcInteractionFlow } from '../../hooks/useNpcInteractionFlow'; import { useRpgRuntimeStory } from '../../hooks/rpg-runtime-story/useRpgRuntimeStory'; import { useRpgSessionBootstrap } from '../../hooks/rpg-session/useRpgSessionBootstrap'; +import { useCombatFlow } from '../../hooks/useCombatFlow'; +import { useNpcInteractionFlow } from '../../hooks/useNpcInteractionFlow'; import { buildSkillActionPrompt } from '../../prompts/customWorldEntityActionPrompts'; import type { CustomWorldSceneImageResult } from '../../services/aiTypes'; import { resolveCustomWorldCampScene } from '../../services/customWorldCamp'; @@ -37,18 +37,22 @@ import { buildDefaultCustomWorldCoverProfile, resolveCustomWorldCoverPresentation, } from '../../services/customWorldCover'; -import { - getCustomWorldFoundationAnchorContent, - parseFoundationTagText, - type CustomWorldFoundationEntryId, -} from '../../services/customWorldFoundationEntries'; -import { createEmptyCustomWorldCreatorIntent } from '../../services/customWorldCreatorIntent'; import { type CustomWorldCoverAssetResult, generateCustomWorldCoverImage, uploadCustomWorldCoverImage, } from '../../services/customWorldCoverAssetService'; -import { rpgCreationAssetClient } from '../../services/rpg-creation/rpgCreationAssetClient'; +import { createEmptyCustomWorldCreatorIntent } from '../../services/customWorldCreatorIntent'; +import { + type CustomWorldFoundationEntryId, + getCustomWorldFoundationAnchorContent, + parseFoundationTagText, +} from '../../services/customWorldFoundationEntries'; +import { + rpgCreationAssetClient, + type RpgCreationHistoryAsset, + type RpgCreationHistoryAssetKind, +} from '../../services/rpg-creation/rpgCreationAssetClient'; import { createEmptyStoryEngineMemoryState } from '../../services/storyEngine/visibilityEngine'; import { AnimationState, @@ -81,23 +85,16 @@ import { import { useAuthUi } from '../auth/AuthUiContext'; import { CharacterAnimator } from '../CharacterAnimator'; import { CustomWorldCoverArtwork } from '../CustomWorldCoverArtwork'; -import { buildDefaultCustomWorldNpcVisual } from '../customWorldNpcVisualDefaults'; -import { - CustomWorldNpcPortrait, - CustomWorldNpcVisualEditor, -} from '../CustomWorldNpcVisualEditor'; -import { RpgCreationRoleAssetStudioModal } from '../rpg-creation-asset-studio/RpgCreationRoleAssetStudioModal'; +import { CustomWorldNpcPortrait } from '../CustomWorldNpcVisualEditor'; import { RoleCharacterSprite, SceneEncounterNpcSprite, } from '../game-canvas/GameCanvasShared'; import { PixelIcon } from '../PixelIcon'; import { ResolvedAssetImage } from '../ResolvedAssetImage'; +import { RpgCreationRoleAssetStudioModal } from '../rpg-creation-asset-studio/RpgCreationRoleAssetStudioModal'; import { RpgRuntimeShell } from '../rpg-runtime-shell'; import { - createLandmarkDraft, - createPlayableNpcDraft, - createStoryNpcDraft, resolveEditableLandmark, resolveEditablePlayableNpc, resolveEditableStoryNpc, @@ -135,9 +132,9 @@ function getAnimationPreviewFrameStyle( } const [ - BACKSTORY_UNLOCK_AFFINITY_EASED, - BACKSTORY_UNLOCK_AFFINITY_FRIENDLY, - BACKSTORY_UNLOCK_AFFINITY_TRUSTED, + , + , + , BACKSTORY_UNLOCK_AFFINITY_CLOSE, ] = AFFINITY_BACKSTORY_CHAPTER_THRESHOLDS; @@ -211,10 +208,6 @@ function dedupeTextValues(values: Array) { ]; } -function compactTextList(values: Array) { - return values.map((value) => value?.trim() ?? '').filter(Boolean); -} - function moveArrayItem(values: T[], fromIndex: number, toIndex: number) { if ( fromIndex < 0 || @@ -572,6 +565,8 @@ function sanitizeSceneChapterBlueprint(params: { actGoal: currentAct?.actGoal?.trim() || fallbackAct.actGoal, transitionHook: currentAct?.transitionHook?.trim() || fallbackAct.transitionHook, + backgroundAssetId: + currentAct?.backgroundAssetId?.trim() || fallbackAct.backgroundAssetId, } satisfies SceneActBlueprint; }); @@ -618,7 +613,7 @@ function resolveSceneCompatibilityImageSrc(params: { const firstActImageSrc = params.chapter.acts[0]?.backgroundImageSrc?.trim() || ''; - // 中文注释:创作侧只暴露一张场景显示图,列表、幕卡片和背景配置弹层都从这里取图,避免同一场景在不同层级显示不同图片。 + // 中文注释:场景卡片只读取当前幕已保存图片;场景主图只给没有幕图的旧草稿兜底,不能反向覆盖每一幕。 return firstActImageSrc || currentImageSrc || resolvedImageSrc || undefined; } @@ -1047,7 +1042,7 @@ function ModalShell({ } >
event.stopPropagation()} >
@@ -1372,50 +1367,6 @@ function ImagePreview({ ); } -function ImageField({ - label, - value, - onChange, - fallbackLabel, - tone = 'square', - showInput = true, - previewOverlay, - footer, -}: { - label: string; - value?: string; - onChange: (value: string) => void; - fallbackLabel: string; - tone?: 'square' | 'landscape'; - showInput?: boolean; - previewOverlay?: ReactNode; - footer?: ReactNode; -}) { - return ( -
-
- {label} -
- - {previewOverlay} - - {showInput ? ( - - ) : null} - {footer} -
- ); -} - function ActionButton({ label, onClick, @@ -1457,6 +1408,128 @@ function ActionButton({ ); } +function formatHistoryAssetDate(value: string) { + const date = new Date(value); + if (Number.isNaN(date.getTime())) { + return value || ''; + } + return date.toLocaleString('zh-CN', { + month: '2-digit', + day: '2-digit', + hour: '2-digit', + minute: '2-digit', + }); +} + +function HistoryAssetPickerModal({ + title, + kind, + tone, + onSelect, + onClose, +}: { + title: string; + kind: RpgCreationHistoryAssetKind; + tone: 'square' | 'landscape'; + onSelect: (asset: RpgCreationHistoryAsset) => void; + onClose: () => void; +}) { + const [assets, setAssets] = useState([]); + const [isLoading, setIsLoading] = useState(true); + const [error, setError] = useState(null); + + useEffect(() => { + let isCancelled = false; + setIsLoading(true); + setError(null); + rpgCreationAssetClient + .listHistoryAssets({ kind, limit: 120 }) + .then((nextAssets) => { + if (!isCancelled) { + setAssets(nextAssets); + } + }) + .catch((loadError) => { + if (!isCancelled) { + setError( + loadError instanceof Error ? loadError.message : '历史素材读取失败。', + ); + } + }) + .finally(() => { + if (!isCancelled) { + setIsLoading(false); + } + }); + + return () => { + isCancelled = true; + }; + }, [kind]); + + return ( + +
+ {error ? ( +
+ {error} +
+ ) : null} + {isLoading ? ( +
+ 读取中... +
+ ) : assets.length === 0 && !error ? ( +
+ 暂无历史素材 +
+ ) : ( +
+ {assets.map((asset) => ( +
+ +
+
+ {asset.ownerLabel || '未记录账号'} +
+
+ {formatHistoryAssetDate(asset.createdAt)} +
+ onSelect(asset)} + tone="sky" + className="w-full" + /> +
+
+ ))} +
+ )} +
+
+ ); +} + const SCENE_ACT_SLOT_LAYOUTS = [ { left: '77%', @@ -2681,12 +2754,14 @@ function SceneImageGenerationModal({ profile, landmark, initialPromptText, + initialPreviewImageSrc, onApply, onClose, }: { profile: CustomWorldProfile; landmark: CustomWorldLandmark; initialPromptText?: string; + initialPreviewImageSrc?: string | null; onApply: (result: CustomWorldSceneImageResult) => void; onClose: () => void; }) { @@ -2704,6 +2779,10 @@ function SceneImageGenerationModal({ const [isExitConfirmOpen, setIsExitConfirmOpen] = useState(false); const originalImageSrc = useMemo(() => { + const initialPreview = initialPreviewImageSrc?.trim() || ''; + if (initialPreview) { + return initialPreview; + } const landmarkIndex = profile.landmarks.findIndex( (entry) => entry.id === landmark.id, ); @@ -2717,7 +2796,7 @@ function SceneImageGenerationModal({ .map((entry) => entry.imageSrc) .filter((imageSrc): imageSrc is string => Boolean(imageSrc)), ); - }, [landmark, profile]); + }, [initialPreviewImageSrc, landmark, profile]); const previewImageSrc = latestResult?.imageSrc || originalImageSrc; @@ -2944,14 +3023,18 @@ function SceneActBackgroundModal({ actLabel: string; currentImageSrc?: string | null; fallbackImageSrc?: string | null; - onApply: (imageSrc?: string | null) => void; + onApply: (imageSrc?: string | null, assetId?: string | null) => void; onClose: () => void; }) { const presetImages = useMemo(() => getAllCustomWorldSceneImages(), []); const [draftImageSrc, setDraftImageSrc] = useDraft( currentImageSrc?.trim() || '', ); + const [draftAssetId, setDraftAssetId] = useDraft( + act.backgroundAssetId?.trim() || '', + ); const [isAiGenerateOpen, setIsAiGenerateOpen] = useState(false); + const [isHistoryPickerOpen, setIsHistoryPickerOpen] = useState(false); const previewImageSrc = draftImageSrc || fallbackImageSrc || ''; return ( @@ -2972,13 +3055,20 @@ function SceneActBackgroundModal({
setDraftImageSrc('')} + onClick={() => { + setDraftImageSrc(''); + setDraftAssetId(''); + }} tone="sky" /> setIsAiGenerateOpen(true)} /> + setIsHistoryPickerOpen(true)} + />
@@ -3023,7 +3113,7 @@ function SceneActBackgroundModal({ { - onApply(draftImageSrc || fallbackImageSrc || undefined); + onApply(draftImageSrc || undefined, draftAssetId); onClose(); }} tone="sky" @@ -3038,14 +3128,31 @@ function SceneActBackgroundModal({ landmark={landmark} initialPromptText={ act.backgroundPromptText?.trim() || - compactTextList([act.title, act.summary, act.actGoal]).join(';') + landmark.visualDescription?.trim() || + landmark.description.trim() || + landmark.name.trim() } + initialPreviewImageSrc={previewImageSrc} onApply={(result) => { setDraftImageSrc(result.imageSrc); + setDraftAssetId(result.assetId); }} onClose={() => setIsAiGenerateOpen(false)} /> ) : null} + {isHistoryPickerOpen ? ( + { + setDraftImageSrc(asset.imageSrc); + setDraftAssetId(asset.assetObjectId); + setIsHistoryPickerOpen(false); + }} + onClose={() => setIsHistoryPickerOpen(false)} + /> + ) : null} ); } @@ -4704,45 +4811,6 @@ function InitialItemsEditor({ ); } -function StoryNpcVisualEditorModal({ - npc, - visual, - onChange, - onOpenAiStudio, - onClose, -}: { - npc: CustomWorldNpc; - visual: NonNullable; - onChange: (visual: NonNullable) => void; - onOpenAiStudio?: () => void; - onClose: () => void; -}) { - return ( - - { - onClose(); - onOpenAiStudio?.(); - }} - /> - - ); -} - export function WorldEditor({ profile, onSave, @@ -4759,6 +4827,7 @@ export function WorldEditor({ title="编辑世界信息" subtitle="修改后的内容会直接反映在结果页,并会作为进入世界前的最终档案。" onClose={onClose} + panelClassName="sm:max-w-4xl xl:max-w-6xl 2xl:max-w-7xl" >
@@ -4822,6 +4891,24 @@ export function WorldEditor({ rows={4} /> + + setDraft((current) => ({ + ...current, + attributeSchema, + ownedSettingLayers: current.ownedSettingLayers + ? { + ...current.ownedSettingLayers, + ruleProfile: { + ...current.ownedSettingLayers.ruleProfile, + attributeSchema, + }, + } + : current.ownedSettingLayers, + })) + } + /> { @@ -4932,6 +5019,110 @@ function applyFoundationDraftToProfile( }; } +function WorldAttributeSchemaEditor({ + value, + onChange, +}: { + value: CustomWorldProfile['attributeSchema']; + onChange: (value: CustomWorldProfile['attributeSchema']) => void; +}) { + const updateSlot = ( + slotId: string, + patch: Partial, + ) => { + onChange({ + ...value, + slots: value.slots.map((slot) => + slot.slotId === slotId ? { ...slot, ...patch } : slot, + ), + }); + }; + + return ( + +
+ {value.slots.map((slot) => ( +
+
+ + updateSlot(slot.slotId, { name })} + /> + + +