新增图片画布编辑器

新增 /editor 图片画布入口与 Lovart 风格画布交互

新增图片画布工程和资源持久化的 SpacetimeDB 表、绑定与 api-server BFF

接入图片生成和修改的 VectorEngine gpt-image-2 后端通道

完善素材库文件夹、重命名、上传删除、图层和元数据交互

补充图片画布技术方案、领域词、执行跟踪和浏览器 smoke 截图
This commit is contained in:
2026-06-13 16:22:18 +08:00
parent f8a80cd795
commit 747473024d
53 changed files with 6694 additions and 29 deletions

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,15 @@
// 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 EditorProjectGetRecentInput {
pub owner_user_id: String,
}
impl __sdk::InModule for EditorProjectGetRecentInput {
type Module = super::RemoteModule;
}

View File

@@ -0,0 +1,21 @@
// 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::editor_project_viewport_snapshot_type::EditorProjectViewportSnapshot;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct EditorProjectLayoutSaveInput {
pub project_id: String,
pub owner_user_id: String,
pub viewport: EditorProjectViewportSnapshot,
pub layers_json: String,
pub updated_at_micros: i64,
}
impl __sdk::InModule for EditorProjectLayoutSaveInput {
type Module = super::RemoteModule;
}

View File

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

View File

@@ -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 EditorProjectResourceCreateInput {
pub resource_id: String,
pub project_id: String,
pub owner_user_id: String,
pub asset_object_id: Option<String>,
pub image_src: String,
pub object_key: Option<String>,
pub width: u32,
pub height: u32,
pub source_type: String,
pub prompt: Option<String>,
pub actual_prompt: Option<String>,
pub model: Option<String>,
pub provider: Option<String>,
pub task_id: Option<String>,
pub source_resource_id: Option<String>,
pub updated_at_micros: i64,
}
impl __sdk::InModule for EditorProjectResourceCreateInput {
type Module = super::RemoteModule;
}

View File

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

View File

@@ -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 EditorProjectResourceSnapshot {
pub resource_id: String,
pub project_id: String,
pub asset_object_id: Option<String>,
pub image_src: String,
pub object_key: Option<String>,
pub width: u32,
pub height: u32,
pub source_type: String,
pub prompt: Option<String>,
pub actual_prompt: Option<String>,
pub model: Option<String>,
pub provider: Option<String>,
pub task_id: Option<String>,
pub source_resource_id: Option<String>,
pub created_at_micros: i64,
pub updated_at_micros: i64,
}
impl __sdk::InModule for EditorProjectResourceSnapshot {
type Module = super::RemoteModule;
}

View File

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

View File

@@ -0,0 +1,101 @@
// 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 EditorProjectResource {
pub resource_id: String,
pub project_id: String,
pub owner_user_id: String,
pub asset_object_id: Option<String>,
pub image_src: String,
pub object_key: Option<String>,
pub width: u32,
pub height: u32,
pub source_type: String,
pub prompt: Option<String>,
pub actual_prompt: Option<String>,
pub model: Option<String>,
pub provider: Option<String>,
pub task_id: Option<String>,
pub source_resource_id: Option<String>,
pub created_at: __sdk::Timestamp,
pub updated_at: __sdk::Timestamp,
}
impl __sdk::InModule for EditorProjectResource {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `EditorProjectResource`.
///
/// Provides typed access to columns for query building.
pub struct EditorProjectResourceCols {
pub resource_id: __sdk::__query_builder::Col<EditorProjectResource, String>,
pub project_id: __sdk::__query_builder::Col<EditorProjectResource, String>,
pub owner_user_id: __sdk::__query_builder::Col<EditorProjectResource, String>,
pub asset_object_id: __sdk::__query_builder::Col<EditorProjectResource, Option<String>>,
pub image_src: __sdk::__query_builder::Col<EditorProjectResource, String>,
pub object_key: __sdk::__query_builder::Col<EditorProjectResource, Option<String>>,
pub width: __sdk::__query_builder::Col<EditorProjectResource, u32>,
pub height: __sdk::__query_builder::Col<EditorProjectResource, u32>,
pub source_type: __sdk::__query_builder::Col<EditorProjectResource, String>,
pub prompt: __sdk::__query_builder::Col<EditorProjectResource, Option<String>>,
pub actual_prompt: __sdk::__query_builder::Col<EditorProjectResource, Option<String>>,
pub model: __sdk::__query_builder::Col<EditorProjectResource, Option<String>>,
pub provider: __sdk::__query_builder::Col<EditorProjectResource, Option<String>>,
pub task_id: __sdk::__query_builder::Col<EditorProjectResource, Option<String>>,
pub source_resource_id: __sdk::__query_builder::Col<EditorProjectResource, Option<String>>,
pub created_at: __sdk::__query_builder::Col<EditorProjectResource, __sdk::Timestamp>,
pub updated_at: __sdk::__query_builder::Col<EditorProjectResource, __sdk::Timestamp>,
}
impl __sdk::__query_builder::HasCols for EditorProjectResource {
type Cols = EditorProjectResourceCols;
fn cols(table_name: &'static str) -> Self::Cols {
EditorProjectResourceCols {
resource_id: __sdk::__query_builder::Col::new(table_name, "resource_id"),
project_id: __sdk::__query_builder::Col::new(table_name, "project_id"),
owner_user_id: __sdk::__query_builder::Col::new(table_name, "owner_user_id"),
asset_object_id: __sdk::__query_builder::Col::new(table_name, "asset_object_id"),
image_src: __sdk::__query_builder::Col::new(table_name, "image_src"),
object_key: __sdk::__query_builder::Col::new(table_name, "object_key"),
width: __sdk::__query_builder::Col::new(table_name, "width"),
height: __sdk::__query_builder::Col::new(table_name, "height"),
source_type: __sdk::__query_builder::Col::new(table_name, "source_type"),
prompt: __sdk::__query_builder::Col::new(table_name, "prompt"),
actual_prompt: __sdk::__query_builder::Col::new(table_name, "actual_prompt"),
model: __sdk::__query_builder::Col::new(table_name, "model"),
provider: __sdk::__query_builder::Col::new(table_name, "provider"),
task_id: __sdk::__query_builder::Col::new(table_name, "task_id"),
source_resource_id: __sdk::__query_builder::Col::new(table_name, "source_resource_id"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
updated_at: __sdk::__query_builder::Col::new(table_name, "updated_at"),
}
}
}
/// Indexed column accessor struct for the table `EditorProjectResource`.
///
/// Provides typed access to indexed columns for query building.
pub struct EditorProjectResourceIxCols {
pub owner_user_id: __sdk::__query_builder::IxCol<EditorProjectResource, String>,
pub project_id: __sdk::__query_builder::IxCol<EditorProjectResource, String>,
pub resource_id: __sdk::__query_builder::IxCol<EditorProjectResource, String>,
}
impl __sdk::__query_builder::HasIxCols for EditorProjectResource {
type IxCols = EditorProjectResourceIxCols;
fn ix_cols(table_name: &'static str) -> Self::IxCols {
EditorProjectResourceIxCols {
owner_user_id: __sdk::__query_builder::IxCol::new(table_name, "owner_user_id"),
project_id: __sdk::__query_builder::IxCol::new(table_name, "project_id"),
resource_id: __sdk::__query_builder::IxCol::new(table_name, "resource_id"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for EditorProjectResource {}

View File

@@ -0,0 +1,25 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::editor_project_resource_snapshot_type::EditorProjectResourceSnapshot;
use super::editor_project_viewport_snapshot_type::EditorProjectViewportSnapshot;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct EditorProjectSnapshot {
pub project_id: String,
pub owner_user_id: String,
pub title: String,
pub viewport: EditorProjectViewportSnapshot,
pub layers_json: String,
pub resources: Vec<EditorProjectResourceSnapshot>,
pub created_at_micros: i64,
pub updated_at_micros: i64,
}
impl __sdk::InModule for EditorProjectSnapshot {
type Module = super::RemoteModule;
}

View File

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

View File

@@ -0,0 +1,75 @@
// 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 EditorProject {
pub project_id: String,
pub owner_user_id: String,
pub title: String,
pub viewport_x: f64,
pub viewport_y: f64,
pub viewport_scale: f64,
pub layers_json: String,
pub created_at: __sdk::Timestamp,
pub updated_at: __sdk::Timestamp,
}
impl __sdk::InModule for EditorProject {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `EditorProject`.
///
/// Provides typed access to columns for query building.
pub struct EditorProjectCols {
pub project_id: __sdk::__query_builder::Col<EditorProject, String>,
pub owner_user_id: __sdk::__query_builder::Col<EditorProject, String>,
pub title: __sdk::__query_builder::Col<EditorProject, String>,
pub viewport_x: __sdk::__query_builder::Col<EditorProject, f64>,
pub viewport_y: __sdk::__query_builder::Col<EditorProject, f64>,
pub viewport_scale: __sdk::__query_builder::Col<EditorProject, f64>,
pub layers_json: __sdk::__query_builder::Col<EditorProject, String>,
pub created_at: __sdk::__query_builder::Col<EditorProject, __sdk::Timestamp>,
pub updated_at: __sdk::__query_builder::Col<EditorProject, __sdk::Timestamp>,
}
impl __sdk::__query_builder::HasCols for EditorProject {
type Cols = EditorProjectCols;
fn cols(table_name: &'static str) -> Self::Cols {
EditorProjectCols {
project_id: __sdk::__query_builder::Col::new(table_name, "project_id"),
owner_user_id: __sdk::__query_builder::Col::new(table_name, "owner_user_id"),
title: __sdk::__query_builder::Col::new(table_name, "title"),
viewport_x: __sdk::__query_builder::Col::new(table_name, "viewport_x"),
viewport_y: __sdk::__query_builder::Col::new(table_name, "viewport_y"),
viewport_scale: __sdk::__query_builder::Col::new(table_name, "viewport_scale"),
layers_json: __sdk::__query_builder::Col::new(table_name, "layers_json"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
updated_at: __sdk::__query_builder::Col::new(table_name, "updated_at"),
}
}
}
/// Indexed column accessor struct for the table `EditorProject`.
///
/// Provides typed access to indexed columns for query building.
pub struct EditorProjectIxCols {
pub owner_user_id: __sdk::__query_builder::IxCol<EditorProject, String>,
pub project_id: __sdk::__query_builder::IxCol<EditorProject, String>,
}
impl __sdk::__query_builder::HasIxCols for EditorProject {
type IxCols = EditorProjectIxCols;
fn ix_cols(table_name: &'static str) -> Self::IxCols {
EditorProjectIxCols {
owner_user_id: __sdk::__query_builder::IxCol::new(table_name, "owner_user_id"),
project_id: __sdk::__query_builder::IxCol::new(table_name, "project_id"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for EditorProject {}

View File

@@ -0,0 +1,17 @@
// 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 EditorProjectViewportSnapshot {
pub x: f64,
pub y: f64,
pub scale: f64,
}
impl __sdk::InModule for EditorProjectViewportSnapshot {
type Module = super::RemoteModule;
}

View File

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

View File

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

View File

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