diff --git a/crates/bindings-sys/src/lib.rs b/crates/bindings-sys/src/lib.rs index dfbef0c6c55..50c0ccf13d0 100644 --- a/crates/bindings-sys/src/lib.rs +++ b/crates/bindings-sys/src/lib.rs @@ -924,7 +924,7 @@ pub mod raw { /// would be where you would initialize the interepreter and load the user module into it. fn __setup__() -> Result; /// Required. Runs after `__setup__`; returns all the exports for the module. - fn __describe_module__() -> Encoded; + fn __describe_module_v10__() -> Encoded; /// Required. id is an index into the `ModuleDef.reducers` returned from `__describe_module__`. /// args is a bsatn-encoded product value defined by the schema at `reducers[id]`. fn __call_reducer__( diff --git a/crates/bindings/src/rt.rs b/crates/bindings/src/rt.rs index cc2943f66c3..cea7adfbbec 100644 --- a/crates/bindings/src/rt.rs +++ b/crates/bindings/src/rt.rs @@ -4,8 +4,9 @@ use crate::query_builder::Query; use crate::table::IndexAlgo; use crate::{sys, AnonymousViewContext, IterBuf, ReducerContext, ReducerResult, SpacetimeType, Table, ViewContext}; use spacetimedb_lib::bsatn::EncodeError; +use spacetimedb_lib::db::raw_def::v10::RawModuleDefV10Builder; pub use spacetimedb_lib::db::raw_def::v9::Lifecycle as LifecycleReducer; -use spacetimedb_lib::db::raw_def::v9::{RawIndexAlgorithm, RawModuleDefV9Builder, TableType, ViewResultHeader}; +use spacetimedb_lib::db::raw_def::v9::{RawIndexAlgorithm, TableType, ViewResultHeader}; use spacetimedb_lib::de::{self, Deserialize, DeserializeOwned, Error as _, SeqProductAccess}; use spacetimedb_lib::sats::typespace::TypespaceBuilder; use spacetimedb_lib::sats::{impl_deserialize, impl_serialize, ProductTypeElement}; @@ -677,7 +678,7 @@ pub trait RowLevelSecurityInfo { } /// A function which will be registered by [`register_describer`] into [`DESCRIBERS`], -/// which will be called by [`__describe_module__`] to construct a module definition. +/// which will be called by [`__describe_module_v10__`] to construct a module definition. /// /// May be a closure over static data, so that e.g. /// [`register_row_level_security`] doesn't need to take a type parameter. @@ -703,6 +704,13 @@ pub fn register_reftype() { pub fn register_table() { register_describer(|module| { let product_type_ref = *T::Row::make_type(&mut module.inner).as_ref().unwrap(); + if let Some(schedule) = T::SCHEDULE { + module.inner.add_schedule( + T::TABLE_NAME, + schedule.scheduled_at_column, + schedule.reducer_or_procedure_name, + ); + } let mut table = module .inner @@ -722,10 +730,6 @@ pub fn register_table() { for &col in T::SEQUENCES { table = table.with_column_sequence(col); } - if let Some(schedule) = T::SCHEDULE { - table = table.with_schedule(schedule.reducer_or_procedure_name, schedule.scheduled_at_column); - } - for col in T::get_default_col_values().iter_mut() { table = table.with_default_column_value(col.col_id, col.value.clone()) } @@ -752,7 +756,11 @@ impl From> for RawIndexAlgorithm { pub fn register_reducer<'a, A: Args<'a>, I: FnInfo>(_: impl Reducer<'a, A>) { register_describer(|module| { let params = A::schema::(&mut module.inner); - module.inner.add_reducer(I::NAME, params, I::LIFECYCLE); + if let Some(lifecycle) = I::LIFECYCLE { + module.inner.add_lifecycle_reducer(lifecycle, I::NAME, params); + } else { + module.inner.add_reducer(I::NAME, params); + } module.reducers.push(I::INVOKE); }) } @@ -817,7 +825,7 @@ pub fn register_row_level_security(sql: &'static str) { #[derive(Default)] pub struct ModuleBuilder { /// The module definition. - inner: RawModuleDefV9Builder, + inner: RawModuleDefV10Builder, /// The reducers of the module. reducers: Vec, /// The procedures of the module. @@ -866,7 +874,7 @@ static ANONYMOUS_VIEWS: OnceLock> = OnceLock::new(); /// including when modules are updated (re-publishing). /// After initialization, the module cannot alter the schema. #[no_mangle] -extern "C" fn __describe_module__(description: BytesSink) { +extern "C" fn __describe_module_v10__(description: BytesSink) { // Collect the `module`. let mut module = ModuleBuilder::default(); for describer in &mut *DESCRIBERS.lock().unwrap() { @@ -875,7 +883,7 @@ extern "C" fn __describe_module__(description: BytesSink) { // Serialize the module to bsatn. let module_def = module.inner.finish(); - let module_def = RawModuleDef::V9(module_def); + let module_def = RawModuleDef::V10(module_def); let bytes = bsatn::to_vec(&module_def).expect("unable to serialize typespace"); // Write the sets of reducers, procedures and views. diff --git a/crates/codegen/tests/snapshots/codegen__codegen_csharp.snap b/crates/codegen/tests/snapshots/codegen__codegen_csharp.snap index 426cc4093bf..626a43853f6 100644 --- a/crates/codegen/tests/snapshots/codegen__codegen_csharp.snap +++ b/crates/codegen/tests/snapshots/codegen__codegen_csharp.snap @@ -1,6 +1,5 @@ --- source: crates/codegen/tests/codegen.rs -assertion_line: 37 expression: outfiles --- "Procedures/GetMySchemaViaHttp.g.cs" = ''' @@ -570,56 +569,6 @@ namespace SpacetimeDB } } ''' -"Reducers/ClientConnected.g.cs" = ''' -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#nullable enable - -using System; -using SpacetimeDB.ClientApi; -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace SpacetimeDB -{ - public sealed partial class RemoteReducers : RemoteBase - { - public delegate void ClientConnectedHandler(ReducerEventContext ctx); - public event ClientConnectedHandler? OnClientConnected; - - public bool InvokeClientConnected(ReducerEventContext ctx, Reducer.ClientConnected args) - { - if (OnClientConnected == null) - { - if (InternalOnUnhandledReducerError != null) - { - switch(ctx.Event.Status) - { - case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; - case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; - } - } - return false; - } - OnClientConnected( - ctx - ); - return true; - } - } - - public abstract partial class Reducer - { - [SpacetimeDB.Type] - [DataContract] - public sealed partial class ClientConnected : Reducer, IReducerArgs - { - string IReducerArgs.ReducerName => "client_connected"; - } - } -} -''' "Reducers/DeletePlayer.g.cs" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. @@ -965,81 +914,6 @@ namespace SpacetimeDB } } ''' -"Reducers/RepeatingTest.g.cs" = ''' -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#nullable enable - -using System; -using SpacetimeDB.ClientApi; -using System.Collections.Generic; -using System.Runtime.Serialization; - -namespace SpacetimeDB -{ - public sealed partial class RemoteReducers : RemoteBase - { - public delegate void RepeatingTestHandler(ReducerEventContext ctx, SpacetimeDB.RepeatingTestArg arg); - public event RepeatingTestHandler? OnRepeatingTest; - - public void RepeatingTest(SpacetimeDB.RepeatingTestArg arg) - { - conn.InternalCallReducer(new Reducer.RepeatingTest(arg), this.SetCallReducerFlags.RepeatingTestFlags); - } - - public bool InvokeRepeatingTest(ReducerEventContext ctx, Reducer.RepeatingTest args) - { - if (OnRepeatingTest == null) - { - if (InternalOnUnhandledReducerError != null) - { - switch(ctx.Event.Status) - { - case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; - case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; - } - } - return false; - } - OnRepeatingTest( - ctx, - args.Arg - ); - return true; - } - } - - public abstract partial class Reducer - { - [SpacetimeDB.Type] - [DataContract] - public sealed partial class RepeatingTest : Reducer, IReducerArgs - { - [DataMember(Name = "arg")] - public RepeatingTestArg Arg; - - public RepeatingTest(RepeatingTestArg Arg) - { - this.Arg = Arg; - } - - public RepeatingTest() - { - this.Arg = new(); - } - - string IReducerArgs.ReducerName => "repeating_test"; - } - } - - public sealed partial class SetReducerFlags - { - internal CallReducerFlags RepeatingTestFlags; - public void RepeatingTest(CallReducerFlags flags) => RepeatingTestFlags = flags; - } -} -''' "Reducers/SayHello.g.cs" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. @@ -1923,13 +1797,11 @@ namespace SpacetimeDB "add_player" => BSATNHelpers.Decode(encodedArgs), "add_private" => BSATNHelpers.Decode(encodedArgs), "assert_caller_identity_is_module_identity" => BSATNHelpers.Decode(encodedArgs), - "client_connected" => BSATNHelpers.Decode(encodedArgs), "delete_player" => BSATNHelpers.Decode(encodedArgs), "delete_players_by_name" => BSATNHelpers.Decode(encodedArgs), "list_over_age" => BSATNHelpers.Decode(encodedArgs), "log_module_identity" => BSATNHelpers.Decode(encodedArgs), "query_private" => BSATNHelpers.Decode(encodedArgs), - "repeating_test" => BSATNHelpers.Decode(encodedArgs), "say_hello" => BSATNHelpers.Decode(encodedArgs), "test" => BSATNHelpers.Decode(encodedArgs), "test_btree_index_args" => BSATNHelpers.Decode(encodedArgs), @@ -1961,13 +1833,11 @@ namespace SpacetimeDB Reducer.AddPlayer args => Reducers.InvokeAddPlayer(eventContext, args), Reducer.AddPrivate args => Reducers.InvokeAddPrivate(eventContext, args), Reducer.AssertCallerIdentityIsModuleIdentity args => Reducers.InvokeAssertCallerIdentityIsModuleIdentity(eventContext, args), - Reducer.ClientConnected args => Reducers.InvokeClientConnected(eventContext, args), Reducer.DeletePlayer args => Reducers.InvokeDeletePlayer(eventContext, args), Reducer.DeletePlayersByName args => Reducers.InvokeDeletePlayersByName(eventContext, args), Reducer.ListOverAge args => Reducers.InvokeListOverAge(eventContext, args), Reducer.LogModuleIdentity args => Reducers.InvokeLogModuleIdentity(eventContext, args), Reducer.QueryPrivate args => Reducers.InvokeQueryPrivate(eventContext, args), - Reducer.RepeatingTest args => Reducers.InvokeRepeatingTest(eventContext, args), Reducer.SayHello args => Reducers.InvokeSayHello(eventContext, args), Reducer.Test args => Reducers.InvokeTest(eventContext, args), Reducer.TestBtreeIndexArgs args => Reducers.InvokeTestBtreeIndexArgs(eventContext, args), diff --git a/crates/codegen/tests/snapshots/codegen__codegen_rust.snap b/crates/codegen/tests/snapshots/codegen__codegen_rust.snap index c53d06879eb..58508d40a4a 100644 --- a/crates/codegen/tests/snapshots/codegen__codegen_rust.snap +++ b/crates/codegen/tests/snapshots/codegen__codegen_rust.snap @@ -1,6 +1,5 @@ --- source: crates/codegen/tests/codegen.rs -assertion_line: 37 expression: outfiles --- "add_player_reducer.rs" = ''' @@ -466,111 +465,6 @@ impl __sdk::InModule for Baz { type Module = super::RemoteModule; } -''' -"client_connected_reducer.rs" = ''' -// 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(super) struct ClientConnectedArgs { - } - -impl From for super::Reducer { - fn from(args: ClientConnectedArgs) -> Self { - Self::ClientConnected -} -} - -impl __sdk::InModule for ClientConnectedArgs { - type Module = super::RemoteModule; -} - -pub struct ClientConnectedCallbackId(__sdk::CallbackId); - -#[allow(non_camel_case_types)] -/// Extension trait for access to the reducer `client_connected`. -/// -/// Implemented for [`super::RemoteReducers`]. -pub trait client_connected { - /// Request that the remote module invoke the reducer `client_connected` to run as soon as possible. - /// - /// This method returns immediately, and errors only if we are unable to send the request. - /// The reducer will run asynchronously in the future, - /// and its status can be observed by listening for [`Self::on_client_connected`] callbacks. - fn client_connected(&self, ) -> __sdk::Result<()>; - /// Register a callback to run whenever we are notified of an invocation of the reducer `client_connected`. - /// - /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] - /// to determine the reducer's status. - /// - /// The returned [`ClientConnectedCallbackId`] can be passed to [`Self::remove_on_client_connected`] - /// to cancel the callback. - fn on_client_connected(&self, callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static) -> ClientConnectedCallbackId; - /// Cancel a callback previously registered by [`Self::on_client_connected`], - /// causing it not to run in the future. - fn remove_on_client_connected(&self, callback: ClientConnectedCallbackId); -} - -impl client_connected for super::RemoteReducers { - fn client_connected(&self, ) -> __sdk::Result<()> { - self.imp.call_reducer("client_connected", ClientConnectedArgs { }) - } - fn on_client_connected( - &self, - mut callback: impl FnMut(&super::ReducerEventContext, ) + Send + 'static, - ) -> ClientConnectedCallbackId { - ClientConnectedCallbackId(self.imp.on_reducer( - "client_connected", - Box::new(move |ctx: &super::ReducerEventContext| { - #[allow(irrefutable_let_patterns)] - let super::ReducerEventContext { - event: __sdk::ReducerEvent { - reducer: super::Reducer::ClientConnected { - - }, - .. - }, - .. - } = ctx else { unreachable!() }; - callback(ctx, ) - }), - )) - } - fn remove_on_client_connected(&self, callback: ClientConnectedCallbackId) { - self.imp.remove_on_reducer("client_connected", callback.0) - } -} - -#[allow(non_camel_case_types)] -#[doc(hidden)] -/// Extension trait for setting the call-flags for the reducer `client_connected`. -/// -/// Implemented for [`super::SetReducerFlags`]. -/// -/// This type is currently unstable and may be removed without a major version bump. -pub trait set_flags_for_client_connected { - /// Set the call-reducer flags for the reducer `client_connected` to `flags`. - /// - /// This type is currently unstable and may be removed without a major version bump. - fn client_connected(&self, flags: __ws::CallReducerFlags); -} - -impl set_flags_for_client_connected for super::SetReducerFlags { - fn client_connected(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("client_connected", flags); - } -} - ''' "delete_player_reducer.rs" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE @@ -1533,13 +1427,11 @@ pub mod add_reducer; pub mod add_player_reducer; pub mod add_private_reducer; pub mod assert_caller_identity_is_module_identity_reducer; -pub mod client_connected_reducer; pub mod delete_player_reducer; pub mod delete_players_by_name_reducer; pub mod list_over_age_reducer; pub mod log_module_identity_reducer; pub mod query_private_reducer; -pub mod repeating_test_reducer; pub mod say_hello_reducer; pub mod test_reducer; pub mod test_btree_index_args_reducer; @@ -1597,13 +1489,11 @@ pub use add_reducer::{add, set_flags_for_add, AddCallbackId}; pub use add_player_reducer::{add_player, set_flags_for_add_player, AddPlayerCallbackId}; pub use add_private_reducer::{add_private, set_flags_for_add_private, AddPrivateCallbackId}; pub use assert_caller_identity_is_module_identity_reducer::{assert_caller_identity_is_module_identity, set_flags_for_assert_caller_identity_is_module_identity, AssertCallerIdentityIsModuleIdentityCallbackId}; -pub use client_connected_reducer::{client_connected, set_flags_for_client_connected, ClientConnectedCallbackId}; pub use delete_player_reducer::{delete_player, set_flags_for_delete_player, DeletePlayerCallbackId}; pub use delete_players_by_name_reducer::{delete_players_by_name, set_flags_for_delete_players_by_name, DeletePlayersByNameCallbackId}; pub use list_over_age_reducer::{list_over_age, set_flags_for_list_over_age, ListOverAgeCallbackId}; pub use log_module_identity_reducer::{log_module_identity, set_flags_for_log_module_identity, LogModuleIdentityCallbackId}; pub use query_private_reducer::{query_private, set_flags_for_query_private, QueryPrivateCallbackId}; -pub use repeating_test_reducer::{repeating_test, set_flags_for_repeating_test, RepeatingTestCallbackId}; pub use say_hello_reducer::{say_hello, set_flags_for_say_hello, SayHelloCallbackId}; pub use test_reducer::{test, set_flags_for_test, TestCallbackId}; pub use test_btree_index_args_reducer::{test_btree_index_args, set_flags_for_test_btree_index_args, TestBtreeIndexArgsCallbackId}; @@ -1631,7 +1521,6 @@ pub enum Reducer { name: String, } , AssertCallerIdentityIsModuleIdentity , - ClientConnected , DeletePlayer { id: u64, } , @@ -1643,9 +1532,6 @@ pub enum Reducer { } , LogModuleIdentity , QueryPrivate , - RepeatingTest { - arg: RepeatingTestArg, -} , SayHello , Test { arg: TestA, @@ -1668,13 +1554,11 @@ impl __sdk::Reducer for Reducer { Reducer::AddPlayer { .. } => "add_player", Reducer::AddPrivate { .. } => "add_private", Reducer::AssertCallerIdentityIsModuleIdentity => "assert_caller_identity_is_module_identity", - Reducer::ClientConnected => "client_connected", Reducer::DeletePlayer { .. } => "delete_player", Reducer::DeletePlayersByName { .. } => "delete_players_by_name", Reducer::ListOverAge { .. } => "list_over_age", Reducer::LogModuleIdentity => "log_module_identity", Reducer::QueryPrivate => "query_private", - Reducer::RepeatingTest { .. } => "repeating_test", Reducer::SayHello => "say_hello", Reducer::Test { .. } => "test", Reducer::TestBtreeIndexArgs => "test_btree_index_args", @@ -1690,13 +1574,11 @@ fn try_from(value: __ws::ReducerCallInfo<__ws::BsatnFormat>) -> __sdk::Result Ok(__sdk::parse_reducer_args::("add_player", &value.args)?.into()), "add_private" => Ok(__sdk::parse_reducer_args::("add_private", &value.args)?.into()), "assert_caller_identity_is_module_identity" => Ok(__sdk::parse_reducer_args::("assert_caller_identity_is_module_identity", &value.args)?.into()), - "client_connected" => Ok(__sdk::parse_reducer_args::("client_connected", &value.args)?.into()), "delete_player" => Ok(__sdk::parse_reducer_args::("delete_player", &value.args)?.into()), "delete_players_by_name" => Ok(__sdk::parse_reducer_args::("delete_players_by_name", &value.args)?.into()), "list_over_age" => Ok(__sdk::parse_reducer_args::("list_over_age", &value.args)?.into()), "log_module_identity" => Ok(__sdk::parse_reducer_args::("log_module_identity", &value.args)?.into()), "query_private" => Ok(__sdk::parse_reducer_args::("query_private", &value.args)?.into()), - "repeating_test" => Ok(__sdk::parse_reducer_args::("repeating_test", &value.args)?.into()), "say_hello" => Ok(__sdk::parse_reducer_args::("say_hello", &value.args)?.into()), "test" => Ok(__sdk::parse_reducer_args::("test", &value.args)?.into()), "test_btree_index_args" => Ok(__sdk::parse_reducer_args::("test_btree_index_args", &value.args)?.into()), @@ -4278,117 +4160,6 @@ impl __sdk::__query_builder::HasIxCols for RepeatingTestArg { } } -''' -"repeating_test_reducer.rs" = ''' -// 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::repeating_test_arg_type::RepeatingTestArg; - -#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] -#[sats(crate = __lib)] -pub(super) struct RepeatingTestArgs { - pub arg: RepeatingTestArg, -} - -impl From for super::Reducer { - fn from(args: RepeatingTestArgs) -> Self { - Self::RepeatingTest { - arg: args.arg, -} -} -} - -impl __sdk::InModule for RepeatingTestArgs { - type Module = super::RemoteModule; -} - -pub struct RepeatingTestCallbackId(__sdk::CallbackId); - -#[allow(non_camel_case_types)] -/// Extension trait for access to the reducer `repeating_test`. -/// -/// Implemented for [`super::RemoteReducers`]. -pub trait repeating_test { - /// Request that the remote module invoke the reducer `repeating_test` to run as soon as possible. - /// - /// This method returns immediately, and errors only if we are unable to send the request. - /// The reducer will run asynchronously in the future, - /// and its status can be observed by listening for [`Self::on_repeating_test`] callbacks. - fn repeating_test(&self, arg: RepeatingTestArg, -) -> __sdk::Result<()>; - /// Register a callback to run whenever we are notified of an invocation of the reducer `repeating_test`. - /// - /// Callbacks should inspect the [`__sdk::ReducerEvent`] contained in the [`super::ReducerEventContext`] - /// to determine the reducer's status. - /// - /// The returned [`RepeatingTestCallbackId`] can be passed to [`Self::remove_on_repeating_test`] - /// to cancel the callback. - fn on_repeating_test(&self, callback: impl FnMut(&super::ReducerEventContext, &RepeatingTestArg, ) + Send + 'static) -> RepeatingTestCallbackId; - /// Cancel a callback previously registered by [`Self::on_repeating_test`], - /// causing it not to run in the future. - fn remove_on_repeating_test(&self, callback: RepeatingTestCallbackId); -} - -impl repeating_test for super::RemoteReducers { - fn repeating_test(&self, arg: RepeatingTestArg, -) -> __sdk::Result<()> { - self.imp.call_reducer("repeating_test", RepeatingTestArgs { arg, }) - } - fn on_repeating_test( - &self, - mut callback: impl FnMut(&super::ReducerEventContext, &RepeatingTestArg, ) + Send + 'static, - ) -> RepeatingTestCallbackId { - RepeatingTestCallbackId(self.imp.on_reducer( - "repeating_test", - Box::new(move |ctx: &super::ReducerEventContext| { - #[allow(irrefutable_let_patterns)] - let super::ReducerEventContext { - event: __sdk::ReducerEvent { - reducer: super::Reducer::RepeatingTest { - arg, - }, - .. - }, - .. - } = ctx else { unreachable!() }; - callback(ctx, arg, ) - }), - )) - } - fn remove_on_repeating_test(&self, callback: RepeatingTestCallbackId) { - self.imp.remove_on_reducer("repeating_test", callback.0) - } -} - -#[allow(non_camel_case_types)] -#[doc(hidden)] -/// Extension trait for setting the call-flags for the reducer `repeating_test`. -/// -/// Implemented for [`super::SetReducerFlags`]. -/// -/// This type is currently unstable and may be removed without a major version bump. -pub trait set_flags_for_repeating_test { - /// Set the call-reducer flags for the reducer `repeating_test` to `flags`. - /// - /// This type is currently unstable and may be removed without a major version bump. - fn repeating_test(&self, flags: __ws::CallReducerFlags); -} - -impl set_flags_for_repeating_test for super::SetReducerFlags { - fn repeating_test(&self, flags: __ws::CallReducerFlags) { - self.imp.set_call_reducer_flags("repeating_test", flags); - } -} - ''' "return_value_procedure.rs" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE diff --git a/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap b/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap index c2dee2a19b0..d3df905c700 100644 --- a/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap +++ b/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap @@ -87,21 +87,6 @@ export default __t.object("Baz", { }); -''' -"client_connected_reducer.ts" = ''' -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -/* eslint-disable */ -/* tslint:disable */ -import { - TypeBuilder as __TypeBuilder, - t as __t, - type AlgebraicTypeType as __AlgebraicTypeType, - type Infer as __Infer, -} from "spacetimedb"; - -export default {}; ''' "delete_player_reducer.ts" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE @@ -263,8 +248,6 @@ import AddPrivateReducer from "./add_private_reducer"; export { AddPrivateReducer }; import AssertCallerIdentityIsModuleIdentityReducer from "./assert_caller_identity_is_module_identity_reducer"; export { AssertCallerIdentityIsModuleIdentityReducer }; -import ClientConnectedReducer from "./client_connected_reducer"; -export { ClientConnectedReducer }; import DeletePlayerReducer from "./delete_player_reducer"; export { DeletePlayerReducer }; import DeletePlayersByNameReducer from "./delete_players_by_name_reducer"; @@ -275,8 +258,6 @@ import LogModuleIdentityReducer from "./log_module_identity_reducer"; export { LogModuleIdentityReducer }; import QueryPrivateReducer from "./query_private_reducer"; export { QueryPrivateReducer }; -import RepeatingTestReducer from "./repeating_test_reducer"; -export { RepeatingTestReducer }; import SayHelloReducer from "./say_hello_reducer"; export { SayHelloReducer }; import TestReducer from "./test_reducer"; @@ -530,7 +511,6 @@ const reducersSchema = __reducers( __reducerSchema("list_over_age", ListOverAgeReducer), __reducerSchema("log_module_identity", LogModuleIdentityReducer), __reducerSchema("query_private", QueryPrivateReducer), - __reducerSchema("repeating_test", RepeatingTestReducer), __reducerSchema("say_hello", SayHelloReducer), __reducerSchema("test", TestReducer), __reducerSchema("test_btree_index_args", TestBtreeIndexArgsReducer), @@ -978,27 +958,6 @@ export default __t.object("RepeatingTestArg", { }); -''' -"repeating_test_reducer.ts" = ''' -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -/* eslint-disable */ -/* tslint:disable */ -import { - TypeBuilder as __TypeBuilder, - t as __t, - type AlgebraicTypeType as __AlgebraicTypeType, - type Infer as __Infer, -} from "spacetimedb"; - -import RepeatingTestArg from "./repeating_test_arg_type"; - -export default { - get arg() { - return RepeatingTestArg; - }, -}; ''' "return_value_procedure.ts" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE