完善图片画布素材库持久化

新增账号级素材文件夹和素材表,并接入 SpacetimeDB procedure、spacetime-client facade 与 api-server BFF。

编辑器素材栏支持文件夹新建、折叠、重命名、删除、多文件上传、拖拽定向上传、框选和批量删除。

画布支持拖拽上传落点创建图层、图层打组、小地图拖拽、普通滚轮纵向滚动和 Ctrl 滚轮缩放。

更新图片画布技术方案、后端数据契约、TRACKING 和团队决策记录。
This commit is contained in:
2026-06-14 14:29:13 +08:00
parent 6bc2f11d04
commit a6025365f7
43 changed files with 4459 additions and 125 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_asset_create_input_type::EditorAssetCreateInput;
use super::editor_asset_procedure_result_type::EditorAssetProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct CreateEditorAssetAndReturnArgs {
pub input: EditorAssetCreateInput,
}
impl __sdk::InModule for CreateEditorAssetAndReturnArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `create_editor_asset_and_return`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait create_editor_asset_and_return {
fn create_editor_asset_and_return(&self, input: EditorAssetCreateInput) {
self.create_editor_asset_and_return_then(input, |_, _| {});
}
fn create_editor_asset_and_return_then(
&self,
input: EditorAssetCreateInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<EditorAssetProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl create_editor_asset_and_return for super::RemoteProcedures {
fn create_editor_asset_and_return_then(
&self,
input: EditorAssetCreateInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<EditorAssetProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, EditorAssetProcedureResult>(
"create_editor_asset_and_return",
CreateEditorAssetAndReturnArgs { 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_asset_folder_create_input_type::EditorAssetFolderCreateInput;
use super::editor_asset_folder_procedure_result_type::EditorAssetFolderProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct CreateEditorAssetFolderAndReturnArgs {
pub input: EditorAssetFolderCreateInput,
}
impl __sdk::InModule for CreateEditorAssetFolderAndReturnArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `create_editor_asset_folder_and_return`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait create_editor_asset_folder_and_return {
fn create_editor_asset_folder_and_return(&self, input: EditorAssetFolderCreateInput) {
self.create_editor_asset_folder_and_return_then(input, |_, _| {});
}
fn create_editor_asset_folder_and_return_then(
&self,
input: EditorAssetFolderCreateInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<EditorAssetFolderProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl create_editor_asset_folder_and_return for super::RemoteProcedures {
fn create_editor_asset_folder_and_return_then(
&self,
input: EditorAssetFolderCreateInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<EditorAssetFolderProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, EditorAssetFolderProcedureResult>(
"create_editor_asset_folder_and_return",
CreateEditorAssetFolderAndReturnArgs { 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_asset_delete_input_type::EditorAssetDeleteInput;
use super::editor_asset_procedure_result_type::EditorAssetProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct DeleteEditorAssetAndReturnArgs {
pub input: EditorAssetDeleteInput,
}
impl __sdk::InModule for DeleteEditorAssetAndReturnArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `delete_editor_asset_and_return`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait delete_editor_asset_and_return {
fn delete_editor_asset_and_return(&self, input: EditorAssetDeleteInput) {
self.delete_editor_asset_and_return_then(input, |_, _| {});
}
fn delete_editor_asset_and_return_then(
&self,
input: EditorAssetDeleteInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<EditorAssetProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl delete_editor_asset_and_return for super::RemoteProcedures {
fn delete_editor_asset_and_return_then(
&self,
input: EditorAssetDeleteInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<EditorAssetProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, EditorAssetProcedureResult>(
"delete_editor_asset_and_return",
DeleteEditorAssetAndReturnArgs { 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_asset_folder_delete_input_type::EditorAssetFolderDeleteInput;
use super::editor_asset_folder_procedure_result_type::EditorAssetFolderProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct DeleteEditorAssetFolderAndReturnArgs {
pub input: EditorAssetFolderDeleteInput,
}
impl __sdk::InModule for DeleteEditorAssetFolderAndReturnArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `delete_editor_asset_folder_and_return`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait delete_editor_asset_folder_and_return {
fn delete_editor_asset_folder_and_return(&self, input: EditorAssetFolderDeleteInput) {
self.delete_editor_asset_folder_and_return_then(input, |_, _| {});
}
fn delete_editor_asset_folder_and_return_then(
&self,
input: EditorAssetFolderDeleteInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<EditorAssetFolderProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl delete_editor_asset_folder_and_return for super::RemoteProcedures {
fn delete_editor_asset_folder_and_return_then(
&self,
input: EditorAssetFolderDeleteInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<EditorAssetFolderProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, EditorAssetFolderProcedureResult>(
"delete_editor_asset_folder_and_return",
DeleteEditorAssetFolderAndReturnArgs { input },
__callback,
);
}
}

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 EditorAssetCreateInput {
pub asset_id: String,
pub owner_user_id: String,
pub folder_id: String,
pub label: 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 now_micros: i64,
}
impl __sdk::InModule for EditorAssetCreateInput {
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 EditorAssetDeleteInput {
pub asset_id: String,
pub owner_user_id: String,
}
impl __sdk::InModule for EditorAssetDeleteInput {
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};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct EditorAssetFolderCreateInput {
pub folder_id: String,
pub owner_user_id: String,
pub label: String,
pub sort_order: u32,
pub now_micros: i64,
}
impl __sdk::InModule for EditorAssetFolderCreateInput {
type Module = super::RemoteModule;
}

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 EditorAssetFolderDeleteInput {
pub folder_id: String,
pub owner_user_id: String,
pub updated_at_micros: i64,
}
impl __sdk::InModule for EditorAssetFolderDeleteInput {
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_asset_folder_snapshot_type::EditorAssetFolderSnapshot;
use super::editor_asset_library_snapshot_type::EditorAssetLibrarySnapshot;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct EditorAssetFolderProcedureResult {
pub ok: bool,
pub folder: Option<EditorAssetFolderSnapshot>,
pub library: Option<EditorAssetLibrarySnapshot>,
pub error_message: Option<String>,
}
impl __sdk::InModule for EditorAssetFolderProcedureResult {
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};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct EditorAssetFolderSnapshot {
pub folder_id: String,
pub label: String,
pub sort_order: u32,
pub collapsed: bool,
pub system_default: bool,
pub created_at_micros: i64,
pub updated_at_micros: i64,
}
impl __sdk::InModule for EditorAssetFolderSnapshot {
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_asset_folder_type::EditorAssetFolder;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
/// Table handle for the table `editor_asset_folder`.
///
/// Obtain a handle from the [`EditorAssetFolderTableAccess::editor_asset_folder`] method on [`super::RemoteTables`],
/// like `ctx.db.editor_asset_folder()`.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.editor_asset_folder().on_insert(...)`.
pub struct EditorAssetFolderTableHandle<'ctx> {
imp: __sdk::TableHandle<EditorAssetFolder>,
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the table `editor_asset_folder`.
///
/// Implemented for [`super::RemoteTables`].
pub trait EditorAssetFolderTableAccess {
#[allow(non_snake_case)]
/// Obtain a [`EditorAssetFolderTableHandle`], which mediates access to the table `editor_asset_folder`.
fn editor_asset_folder(&self) -> EditorAssetFolderTableHandle<'_>;
}
impl EditorAssetFolderTableAccess for super::RemoteTables {
fn editor_asset_folder(&self) -> EditorAssetFolderTableHandle<'_> {
EditorAssetFolderTableHandle {
imp: self
.imp
.get_table::<EditorAssetFolder>("editor_asset_folder"),
ctx: std::marker::PhantomData,
}
}
}
pub struct EditorAssetFolderInsertCallbackId(__sdk::CallbackId);
pub struct EditorAssetFolderDeleteCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::Table for EditorAssetFolderTableHandle<'ctx> {
type Row = EditorAssetFolder;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = EditorAssetFolder> + '_ {
self.imp.iter()
}
type InsertCallbackId = EditorAssetFolderInsertCallbackId;
fn on_insert(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> EditorAssetFolderInsertCallbackId {
EditorAssetFolderInsertCallbackId(self.imp.on_insert(Box::new(callback)))
}
fn remove_on_insert(&self, callback: EditorAssetFolderInsertCallbackId) {
self.imp.remove_on_insert(callback.0)
}
type DeleteCallbackId = EditorAssetFolderDeleteCallbackId;
fn on_delete(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> EditorAssetFolderDeleteCallbackId {
EditorAssetFolderDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
}
fn remove_on_delete(&self, callback: EditorAssetFolderDeleteCallbackId) {
self.imp.remove_on_delete(callback.0)
}
}
pub struct EditorAssetFolderUpdateCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::TableWithPrimaryKey for EditorAssetFolderTableHandle<'ctx> {
type UpdateCallbackId = EditorAssetFolderUpdateCallbackId;
fn on_update(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
) -> EditorAssetFolderUpdateCallbackId {
EditorAssetFolderUpdateCallbackId(self.imp.on_update(Box::new(callback)))
}
fn remove_on_update(&self, callback: EditorAssetFolderUpdateCallbackId) {
self.imp.remove_on_update(callback.0)
}
}
/// Access to the `folder_id` unique index on the table `editor_asset_folder`,
/// which allows point queries on the field of the same name
/// via the [`EditorAssetFolderFolderIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.editor_asset_folder().folder_id().find(...)`.
pub struct EditorAssetFolderFolderIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<EditorAssetFolder, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> EditorAssetFolderTableHandle<'ctx> {
/// Get a handle on the `folder_id` unique index on the table `editor_asset_folder`.
pub fn folder_id(&self) -> EditorAssetFolderFolderIdUnique<'ctx> {
EditorAssetFolderFolderIdUnique {
imp: self.imp.get_unique_constraint::<String>("folder_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> EditorAssetFolderFolderIdUnique<'ctx> {
/// Find the subscribed row whose `folder_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<EditorAssetFolder> {
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::<EditorAssetFolder>("editor_asset_folder");
_table.add_unique_constraint::<String>("folder_id", |row| &row.folder_id);
}
#[doc(hidden)]
pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<EditorAssetFolder>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<EditorAssetFolder>", "TableUpdate")
.with_cause(e)
.into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `EditorAssetFolder`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait editor_asset_folderQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `EditorAssetFolder`.
fn editor_asset_folder(&self) -> __sdk::__query_builder::Table<EditorAssetFolder>;
}
impl editor_asset_folderQueryTableAccess for __sdk::QueryTableAccessor {
fn editor_asset_folder(&self) -> __sdk::__query_builder::Table<EditorAssetFolder> {
__sdk::__query_builder::Table::new("editor_asset_folder")
}
}

View File

@@ -0,0 +1,72 @@
// 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 EditorAssetFolder {
pub folder_id: String,
pub owner_user_id: String,
pub label: String,
pub sort_order: u32,
pub collapsed: bool,
pub system_default: bool,
pub created_at: __sdk::Timestamp,
pub updated_at: __sdk::Timestamp,
}
impl __sdk::InModule for EditorAssetFolder {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `EditorAssetFolder`.
///
/// Provides typed access to columns for query building.
pub struct EditorAssetFolderCols {
pub folder_id: __sdk::__query_builder::Col<EditorAssetFolder, String>,
pub owner_user_id: __sdk::__query_builder::Col<EditorAssetFolder, String>,
pub label: __sdk::__query_builder::Col<EditorAssetFolder, String>,
pub sort_order: __sdk::__query_builder::Col<EditorAssetFolder, u32>,
pub collapsed: __sdk::__query_builder::Col<EditorAssetFolder, bool>,
pub system_default: __sdk::__query_builder::Col<EditorAssetFolder, bool>,
pub created_at: __sdk::__query_builder::Col<EditorAssetFolder, __sdk::Timestamp>,
pub updated_at: __sdk::__query_builder::Col<EditorAssetFolder, __sdk::Timestamp>,
}
impl __sdk::__query_builder::HasCols for EditorAssetFolder {
type Cols = EditorAssetFolderCols;
fn cols(table_name: &'static str) -> Self::Cols {
EditorAssetFolderCols {
folder_id: __sdk::__query_builder::Col::new(table_name, "folder_id"),
owner_user_id: __sdk::__query_builder::Col::new(table_name, "owner_user_id"),
label: __sdk::__query_builder::Col::new(table_name, "label"),
sort_order: __sdk::__query_builder::Col::new(table_name, "sort_order"),
collapsed: __sdk::__query_builder::Col::new(table_name, "collapsed"),
system_default: __sdk::__query_builder::Col::new(table_name, "system_default"),
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 `EditorAssetFolder`.
///
/// Provides typed access to indexed columns for query building.
pub struct EditorAssetFolderIxCols {
pub folder_id: __sdk::__query_builder::IxCol<EditorAssetFolder, String>,
pub owner_user_id: __sdk::__query_builder::IxCol<EditorAssetFolder, String>,
}
impl __sdk::__query_builder::HasIxCols for EditorAssetFolder {
type IxCols = EditorAssetFolderIxCols;
fn ix_cols(table_name: &'static str) -> Self::IxCols {
EditorAssetFolderIxCols {
folder_id: __sdk::__query_builder::IxCol::new(table_name, "folder_id"),
owner_user_id: __sdk::__query_builder::IxCol::new(table_name, "owner_user_id"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for EditorAssetFolder {}

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};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct EditorAssetFolderUpdateInput {
pub folder_id: String,
pub owner_user_id: String,
pub label: Option<String>,
pub collapsed: Option<bool>,
pub updated_at_micros: i64,
}
impl __sdk::InModule for EditorAssetFolderUpdateInput {
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 EditorAssetLibraryGetInput {
pub owner_user_id: String,
pub now_micros: i64,
}
impl __sdk::InModule for EditorAssetLibraryGetInput {
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_asset_library_snapshot_type::EditorAssetLibrarySnapshot;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct EditorAssetLibraryProcedureResult {
pub ok: bool,
pub library: Option<EditorAssetLibrarySnapshot>,
pub error_message: Option<String>,
}
impl __sdk::InModule for EditorAssetLibraryProcedureResult {
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_asset_folder_snapshot_type::EditorAssetFolderSnapshot;
use super::editor_asset_snapshot_type::EditorAssetSnapshot;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct EditorAssetLibrarySnapshot {
pub folders: Vec<EditorAssetFolderSnapshot>,
pub assets: Vec<EditorAssetSnapshot>,
}
impl __sdk::InModule for EditorAssetLibrarySnapshot {
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_asset_snapshot_type::EditorAssetSnapshot;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct EditorAssetProcedureResult {
pub ok: bool,
pub asset: Option<EditorAssetSnapshot>,
pub error_message: Option<String>,
}
impl __sdk::InModule for EditorAssetProcedureResult {
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 EditorAssetSnapshot {
pub asset_id: String,
pub folder_id: String,
pub label: 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 created_at_micros: i64,
pub updated_at_micros: i64,
}
impl __sdk::InModule for EditorAssetSnapshot {
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_asset_type::EditorAsset;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
/// Table handle for the table `editor_asset`.
///
/// Obtain a handle from the [`EditorAssetTableAccess::editor_asset`] method on [`super::RemoteTables`],
/// like `ctx.db.editor_asset()`.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.editor_asset().on_insert(...)`.
pub struct EditorAssetTableHandle<'ctx> {
imp: __sdk::TableHandle<EditorAsset>,
ctx: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the table `editor_asset`.
///
/// Implemented for [`super::RemoteTables`].
pub trait EditorAssetTableAccess {
#[allow(non_snake_case)]
/// Obtain a [`EditorAssetTableHandle`], which mediates access to the table `editor_asset`.
fn editor_asset(&self) -> EditorAssetTableHandle<'_>;
}
impl EditorAssetTableAccess for super::RemoteTables {
fn editor_asset(&self) -> EditorAssetTableHandle<'_> {
EditorAssetTableHandle {
imp: self.imp.get_table::<EditorAsset>("editor_asset"),
ctx: std::marker::PhantomData,
}
}
}
pub struct EditorAssetInsertCallbackId(__sdk::CallbackId);
pub struct EditorAssetDeleteCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::Table for EditorAssetTableHandle<'ctx> {
type Row = EditorAsset;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = EditorAsset> + '_ {
self.imp.iter()
}
type InsertCallbackId = EditorAssetInsertCallbackId;
fn on_insert(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> EditorAssetInsertCallbackId {
EditorAssetInsertCallbackId(self.imp.on_insert(Box::new(callback)))
}
fn remove_on_insert(&self, callback: EditorAssetInsertCallbackId) {
self.imp.remove_on_insert(callback.0)
}
type DeleteCallbackId = EditorAssetDeleteCallbackId;
fn on_delete(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row) + Send + 'static,
) -> EditorAssetDeleteCallbackId {
EditorAssetDeleteCallbackId(self.imp.on_delete(Box::new(callback)))
}
fn remove_on_delete(&self, callback: EditorAssetDeleteCallbackId) {
self.imp.remove_on_delete(callback.0)
}
}
pub struct EditorAssetUpdateCallbackId(__sdk::CallbackId);
impl<'ctx> __sdk::TableWithPrimaryKey for EditorAssetTableHandle<'ctx> {
type UpdateCallbackId = EditorAssetUpdateCallbackId;
fn on_update(
&self,
callback: impl FnMut(&Self::EventContext, &Self::Row, &Self::Row) + Send + 'static,
) -> EditorAssetUpdateCallbackId {
EditorAssetUpdateCallbackId(self.imp.on_update(Box::new(callback)))
}
fn remove_on_update(&self, callback: EditorAssetUpdateCallbackId) {
self.imp.remove_on_update(callback.0)
}
}
/// Access to the `asset_id` unique index on the table `editor_asset`,
/// which allows point queries on the field of the same name
/// via the [`EditorAssetAssetIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.editor_asset().asset_id().find(...)`.
pub struct EditorAssetAssetIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<EditorAsset, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> EditorAssetTableHandle<'ctx> {
/// Get a handle on the `asset_id` unique index on the table `editor_asset`.
pub fn asset_id(&self) -> EditorAssetAssetIdUnique<'ctx> {
EditorAssetAssetIdUnique {
imp: self.imp.get_unique_constraint::<String>("asset_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> EditorAssetAssetIdUnique<'ctx> {
/// Find the subscribed row whose `asset_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<EditorAsset> {
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::<EditorAsset>("editor_asset");
_table.add_unique_constraint::<String>("asset_id", |row| &row.asset_id);
}
#[doc(hidden)]
pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<EditorAsset>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<EditorAsset>", "TableUpdate")
.with_cause(e)
.into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `EditorAsset`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait editor_assetQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `EditorAsset`.
fn editor_asset(&self) -> __sdk::__query_builder::Table<EditorAsset>;
}
impl editor_assetQueryTableAccess for __sdk::QueryTableAccessor {
fn editor_asset(&self) -> __sdk::__query_builder::Table<EditorAsset> {
__sdk::__query_builder::Table::new("editor_asset")
}
}

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

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};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
pub struct EditorAssetUpdateInput {
pub asset_id: String,
pub owner_user_id: String,
pub label: Option<String>,
pub folder_id: Option<String>,
pub updated_at_micros: i64,
}
impl __sdk::InModule for EditorAssetUpdateInput {
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_asset_library_get_input_type::EditorAssetLibraryGetInput;
use super::editor_asset_library_procedure_result_type::EditorAssetLibraryProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct GetEditorAssetLibraryAndReturnArgs {
pub input: EditorAssetLibraryGetInput,
}
impl __sdk::InModule for GetEditorAssetLibraryAndReturnArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `get_editor_asset_library_and_return`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait get_editor_asset_library_and_return {
fn get_editor_asset_library_and_return(&self, input: EditorAssetLibraryGetInput) {
self.get_editor_asset_library_and_return_then(input, |_, _| {});
}
fn get_editor_asset_library_and_return_then(
&self,
input: EditorAssetLibraryGetInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<EditorAssetLibraryProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl get_editor_asset_library_and_return for super::RemoteProcedures {
fn get_editor_asset_library_and_return_then(
&self,
input: EditorAssetLibraryGetInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<EditorAssetLibraryProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, EditorAssetLibraryProcedureResult>(
"get_editor_asset_library_and_return",
GetEditorAssetLibraryAndReturnArgs { 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_asset_procedure_result_type::EditorAssetProcedureResult;
use super::editor_asset_update_input_type::EditorAssetUpdateInput;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct UpdateEditorAssetAndReturnArgs {
pub input: EditorAssetUpdateInput,
}
impl __sdk::InModule for UpdateEditorAssetAndReturnArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `update_editor_asset_and_return`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait update_editor_asset_and_return {
fn update_editor_asset_and_return(&self, input: EditorAssetUpdateInput) {
self.update_editor_asset_and_return_then(input, |_, _| {});
}
fn update_editor_asset_and_return_then(
&self,
input: EditorAssetUpdateInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<EditorAssetProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl update_editor_asset_and_return for super::RemoteProcedures {
fn update_editor_asset_and_return_then(
&self,
input: EditorAssetUpdateInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<EditorAssetProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, EditorAssetProcedureResult>(
"update_editor_asset_and_return",
UpdateEditorAssetAndReturnArgs { 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_asset_folder_procedure_result_type::EditorAssetFolderProcedureResult;
use super::editor_asset_folder_update_input_type::EditorAssetFolderUpdateInput;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct UpdateEditorAssetFolderAndReturnArgs {
pub input: EditorAssetFolderUpdateInput,
}
impl __sdk::InModule for UpdateEditorAssetFolderAndReturnArgs {
type Module = super::RemoteModule;
}
#[allow(non_camel_case_types)]
/// Extension trait for access to the procedure `update_editor_asset_folder_and_return`.
///
/// Implemented for [`super::RemoteProcedures`].
pub trait update_editor_asset_folder_and_return {
fn update_editor_asset_folder_and_return(&self, input: EditorAssetFolderUpdateInput) {
self.update_editor_asset_folder_and_return_then(input, |_, _| {});
}
fn update_editor_asset_folder_and_return_then(
&self,
input: EditorAssetFolderUpdateInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<EditorAssetFolderProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
);
}
impl update_editor_asset_folder_and_return for super::RemoteProcedures {
fn update_editor_asset_folder_and_return_then(
&self,
input: EditorAssetFolderUpdateInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<EditorAssetFolderProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, EditorAssetFolderProcedureResult>(
"update_editor_asset_folder_and_return",
UpdateEditorAssetFolderAndReturnArgs { input },
__callback,
);
}
}