From 907c4c4196a38fb0ea5e038850ba7b0fad4da32a Mon Sep 17 00:00:00 2001 From: Jeffrey Dallatezza Date: Fri, 23 Jan 2026 09:53:34 -0800 Subject: [PATCH 01/16] WIP with some codegen changes for ts --- crates/codegen/src/typescript.rs | 186 ++++++++++++++++++++++++++++--- 1 file changed, 171 insertions(+), 15 deletions(-) diff --git a/crates/codegen/src/typescript.rs b/crates/codegen/src/typescript.rs index 5059330882a..8cc9db961e8 100644 --- a/crates/codegen/src/typescript.rs +++ b/crates/codegen/src/typescript.rs @@ -209,44 +209,42 @@ impl Lang for TypeScript { print_file_header(out, true, false); writeln!(out); - writeln!(out, "// Import and reexport all reducer arg types"); + writeln!(out, "// Import all reducer arg schemas"); for reducer in iter_reducers(module) { let reducer_name = &reducer.name; let reducer_module_name = reducer_module_name(reducer_name); let args_type = reducer_args_type_name(&reducer.name); writeln!(out, "import {args_type} from \"./{reducer_module_name}\";"); - writeln!(out, "export {{ {args_type} }};"); } writeln!(out); - writeln!(out, "// Import and reexport all procedure arg types"); + writeln!(out, "// Import all procedure arg schemas"); for procedure in iter_procedures(module) { let procedure_name = &procedure.name; let procedure_module_name = procedure_module_name(procedure_name); let args_type = procedure_args_type_name(&procedure.name); writeln!(out, "import * as {args_type} from \"./{procedure_module_name}\";"); - writeln!(out, "export {{ {args_type} }};"); } writeln!(out); - writeln!(out, "// Import and reexport all table handle types"); + writeln!(out, "// Import all table schema definitions"); for (table_name, _) in iter_table_names_and_types(module) { let table_module_name = table_module_name(table_name); let table_name_pascalcase = table_name.deref().to_case(Case::Pascal); // TODO: This really shouldn't be necessary. We could also have `table()` accept // `__t.object(...)`s. writeln!(out, "import {table_name_pascalcase}Row from \"./{table_module_name}\";"); - writeln!(out, "export {{ {table_name_pascalcase}Row }};"); } writeln!(out); - writeln!(out, "// Import and reexport all types"); - for ty in iter_types(module) { - let type_name = collect_case(Case::Pascal, ty.name.name_segments()); - let type_module_name = type_module_name(&ty.name); - writeln!(out, "import {type_name} from \"./{type_module_name}\";"); - writeln!(out, "export {{ {type_name} }};"); - } + writeln!( + out, + "/** Type-only namespace exports for generated type groups. */" + ); + writeln!(out, "export type * as Rows from \"./rows\";"); + writeln!(out, "export type * as Reducers from \"./reducers\";"); + writeln!(out, "export type * as Procedures from \"./procedures\";"); + writeln!(out, "export type * as Types from \"./types\";"); writeln!(out); writeln!(out, "/** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */"); @@ -445,10 +443,168 @@ impl Lang for TypeScript { writeln!(out, "}}"); out.newline(); - vec![OutputFile { + let index_file = OutputFile { filename: "index.ts".to_string(), code: output.into_inner(), - }] + }; + + let rows_file = generate_rows_file(module); + let reducers_file = generate_reducers_file(module); + let procedures_file = generate_procedures_file(module); + let types_file = generate_types_file(module); + + vec![index_file, rows_file, reducers_file, procedures_file, types_file] + } +} + +fn generate_rows_file(module: &ModuleDef) -> OutputFile { + let mut output = CodeIndenter::new(String::new(), INDENT); + let out = &mut output; + + print_auto_generated_file_comment(out); + print_lint_suppression(out); + writeln!(out, "import {{ type Infer as __Infer }} from \"spacetimedb\";"); + + writeln!(out); + writeln!(out, "// Import all table schema definitions"); + for (table_name, _) in iter_table_names_and_types(module) { + let table_module_name = table_module_name(table_name); + let table_name_pascalcase = table_name.deref().to_case(Case::Pascal); + writeln!(out, "import {table_name_pascalcase}Row from \"./{table_module_name}\";"); + } + + writeln!(out); + for table in iter_tables(module) { + let table_name_pascalcase = table.name.deref().to_case(Case::Pascal); + writeln!( + out, + "export type {table_name_pascalcase} = __Infer;" + ); + } + for view in iter_views(module) { + let view_name_pascalcase = view.name.deref().to_case(Case::Pascal); + writeln!( + out, + "export type {view_name_pascalcase} = __Infer;" + ); + } + out.newline(); + + OutputFile { + filename: "rows.ts".to_string(), + code: output.into_inner(), + } +} + +fn generate_reducers_file(module: &ModuleDef) -> OutputFile { + let mut output = CodeIndenter::new(String::new(), INDENT); + let out = &mut output; + + print_auto_generated_file_comment(out); + print_lint_suppression(out); + writeln!(out, "import {{ type Infer as __Infer }} from \"spacetimedb\";"); + + writeln!(out); + writeln!(out, "// Import all reducer arg schemas"); + for reducer in iter_reducers(module) { + let reducer_name = &reducer.name; + let reducer_module_name = reducer_module_name(reducer_name); + let args_type = reducer_args_type_name(&reducer.name); + writeln!(out, "import {args_type} from \"./{reducer_module_name}\";"); + } + + writeln!(out); + for reducer in iter_reducers(module) { + let reducer_name_pascalcase = reducer.name.deref().to_case(Case::Pascal); + let args_type = reducer_args_type_name(&reducer.name); + writeln!( + out, + "export type {reducer_name_pascalcase} = __Infer;" + ); + } + out.newline(); + + OutputFile { + filename: "reducers.ts".to_string(), + code: output.into_inner(), + } +} + +fn generate_procedures_file(module: &ModuleDef) -> OutputFile { + let mut output = CodeIndenter::new(String::new(), INDENT); + let out = &mut output; + + print_auto_generated_file_comment(out); + print_lint_suppression(out); + writeln!(out, "import {{ type Infer as __Infer }} from \"spacetimedb\";"); + + writeln!(out); + writeln!(out, "// Import all procedure arg schemas"); + for procedure in iter_procedures(module) { + let procedure_name = &procedure.name; + let procedure_module_name = procedure_module_name(procedure_name); + let args_type = procedure_args_type_name(&procedure.name); + writeln!(out, "import * as {args_type} from \"./{procedure_module_name}\";"); + } + + writeln!(out); + for procedure in iter_procedures(module) { + let procedure_name_pascalcase = procedure.name.deref().to_case(Case::Pascal); + let args_type = procedure_args_type_name(&procedure.name); + writeln!( + out, + "export type {procedure_name_pascalcase} = __Infer;" + ); + writeln!( + out, + "export type {procedure_name_pascalcase}Result = __Infer;" + ); + } + out.newline(); + + OutputFile { + filename: "procedures.ts".to_string(), + code: output.into_inner(), + } +} + +fn generate_types_file(module: &ModuleDef) -> OutputFile { + let mut output = CodeIndenter::new(String::new(), INDENT); + let out = &mut output; + + print_auto_generated_file_comment(out); + print_lint_suppression(out); + writeln!(out, "import {{ type Infer as __Infer }} from \"spacetimedb\";"); + + let reducer_type_names = module + .reducers() + .map(|reducer| reducer.name.deref().to_case(Case::Pascal)) + .collect::>(); + + writeln!(out); + writeln!(out, "// Import all non-reducer types"); + for ty in iter_types(module) { + let type_name = collect_case(Case::Pascal, ty.name.name_segments()); + if reducer_type_names.contains(&type_name) { + continue; + } + let type_module_name = type_module_name(&ty.name); + writeln!(out, "import {type_name} from \"./{type_module_name}\";"); + } + + writeln!(out); + for ty in iter_types(module) { + let type_name = collect_case(Case::Pascal, ty.name.name_segments()); + if reducer_type_names.contains(&type_name) { + continue; + } + writeln!(out, "export type {type_name} = __Infer;"); + } + out.newline(); + + OutputFile { + filename: "types.ts".to_string(), + code: output.into_inner(), } } From 617ef675e98b819808c64dfffbfb44943fd2b612 Mon Sep 17 00:00:00 2001 From: Jeffrey Dallatezza Date: Mon, 26 Jan 2026 10:32:38 -0800 Subject: [PATCH 02/16] Add Args suffix for reducers --- crates/codegen/src/typescript.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/codegen/src/typescript.rs b/crates/codegen/src/typescript.rs index 8cc9db961e8..aa0f6f339f2 100644 --- a/crates/codegen/src/typescript.rs +++ b/crates/codegen/src/typescript.rs @@ -519,7 +519,7 @@ fn generate_reducers_file(module: &ModuleDef) -> OutputFile { let args_type = reducer_args_type_name(&reducer.name); writeln!( out, - "export type {reducer_name_pascalcase} = __Infer;" + "export type {reducer_name_pascalcase}Args = __Infer;" ); } out.newline(); From 7a665e275b3a31eb6874290c64f6f4de216e90ff Mon Sep 17 00:00:00 2001 From: Jeffrey Dallatezza Date: Mon, 26 Jan 2026 11:02:55 -0800 Subject: [PATCH 03/16] Only import reducer args that are callable --- crates/codegen/src/typescript.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/codegen/src/typescript.rs b/crates/codegen/src/typescript.rs index aa0f6f339f2..7ad1d920870 100644 --- a/crates/codegen/src/typescript.rs +++ b/crates/codegen/src/typescript.rs @@ -211,6 +211,10 @@ impl Lang for TypeScript { writeln!(out); writeln!(out, "// Import all reducer arg schemas"); for reducer in iter_reducers(module) { + if !is_reducer_invokable(reducer) { + // Skip system-defined reducers + continue; + } let reducer_name = &reducer.name; let reducer_module_name = reducer_module_name(reducer_name); let args_type = reducer_args_type_name(&reducer.name); @@ -553,7 +557,7 @@ fn generate_procedures_file(module: &ModuleDef) -> OutputFile { let args_type = procedure_args_type_name(&procedure.name); writeln!( out, - "export type {procedure_name_pascalcase} = __Infer;" + "export type {procedure_name_pascalcase}Args = __Infer;" ); writeln!( out, From a38b6e39ebd113123972675399cfcb2197c62246 Mon Sep 17 00:00:00 2001 From: Jeffrey Dallatezza Date: Mon, 26 Jan 2026 11:07:54 -0800 Subject: [PATCH 04/16] Add regenerated stuff --- .../src/lib/autogen/procedures.ts | 8 ++ .../src/lib/autogen/reducers.ts | 8 ++ .../src/lib/autogen/rows.ts | 8 ++ .../src/lib/autogen/types.ts | 101 ++++++++++++++++++ .../src/sdk/client_api/index.ts | 88 +++------------ .../src/sdk/client_api/procedures.ts | 8 ++ .../src/sdk/client_api/reducers.ts | 8 ++ .../src/sdk/client_api/rows.ts | 8 ++ .../src/sdk/client_api/types.ts | 77 +++++++++++++ .../test-app/src/module_bindings/index.ts | 28 ++--- .../src/module_bindings/procedures.ts | 8 ++ .../test-app/src/module_bindings/reducers.ts | 11 ++ .../test-app/src/module_bindings/rows.ts | 15 +++ .../test-app/src/module_bindings/types.ts | 17 +++ .../src/module_bindings/custom_type_type.ts | 15 +++ .../basic-react/src/module_bindings/index.ts | 35 ++---- .../src/module_bindings/procedures.ts | 8 ++ .../src/module_bindings/reducers.ts | 17 +++ .../basic-react/src/module_bindings/rows.ts | 11 ++ .../src/module_bindings/testtable_type.ts | 18 ++++ .../basic-react/src/module_bindings/types.ts | 11 ++ .../src/module_bindings/index.ts | 35 ++---- .../src/module_bindings/procedures.ts | 8 ++ .../src/module_bindings/reducers.ts | 17 +++ .../src/module_bindings/rows.ts | 11 ++ .../src/module_bindings/types.ts | 11 ++ .../quickstart-chat-typescript/src/App.tsx | 8 +- .../src/module_bindings/index.ts | 38 ++----- .../src/module_bindings/procedures.ts | 8 ++ .../src/module_bindings/reducers.ts | 17 +++ .../src/module_bindings/rows.ts | 13 +++ .../src/module_bindings/types.ts | 13 +++ 32 files changed, 510 insertions(+), 177 deletions(-) create mode 100644 crates/bindings-typescript/src/lib/autogen/procedures.ts create mode 100644 crates/bindings-typescript/src/lib/autogen/reducers.ts create mode 100644 crates/bindings-typescript/src/lib/autogen/rows.ts create mode 100644 crates/bindings-typescript/src/lib/autogen/types.ts create mode 100644 crates/bindings-typescript/src/sdk/client_api/procedures.ts create mode 100644 crates/bindings-typescript/src/sdk/client_api/reducers.ts create mode 100644 crates/bindings-typescript/src/sdk/client_api/rows.ts create mode 100644 crates/bindings-typescript/src/sdk/client_api/types.ts create mode 100644 crates/bindings-typescript/test-app/src/module_bindings/procedures.ts create mode 100644 crates/bindings-typescript/test-app/src/module_bindings/reducers.ts create mode 100644 crates/bindings-typescript/test-app/src/module_bindings/rows.ts create mode 100644 crates/bindings-typescript/test-app/src/module_bindings/types.ts create mode 100644 templates/basic-react/src/module_bindings/custom_type_type.ts create mode 100644 templates/basic-react/src/module_bindings/procedures.ts create mode 100644 templates/basic-react/src/module_bindings/reducers.ts create mode 100644 templates/basic-react/src/module_bindings/rows.ts create mode 100644 templates/basic-react/src/module_bindings/testtable_type.ts create mode 100644 templates/basic-react/src/module_bindings/types.ts create mode 100644 templates/basic-typescript/src/module_bindings/procedures.ts create mode 100644 templates/basic-typescript/src/module_bindings/reducers.ts create mode 100644 templates/basic-typescript/src/module_bindings/rows.ts create mode 100644 templates/basic-typescript/src/module_bindings/types.ts create mode 100644 templates/quickstart-chat-typescript/src/module_bindings/procedures.ts create mode 100644 templates/quickstart-chat-typescript/src/module_bindings/reducers.ts create mode 100644 templates/quickstart-chat-typescript/src/module_bindings/rows.ts create mode 100644 templates/quickstart-chat-typescript/src/module_bindings/types.ts diff --git a/crates/bindings-typescript/src/lib/autogen/procedures.ts b/crates/bindings-typescript/src/lib/autogen/procedures.ts new file mode 100644 index 00000000000..6625edb1b2e --- /dev/null +++ b/crates/bindings-typescript/src/lib/autogen/procedures.ts @@ -0,0 +1,8 @@ +// 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 { type Infer as __Infer } from '../../lib/type_builders'; + +// Import all procedure arg schemas diff --git a/crates/bindings-typescript/src/lib/autogen/reducers.ts b/crates/bindings-typescript/src/lib/autogen/reducers.ts new file mode 100644 index 00000000000..69fa905ce4f --- /dev/null +++ b/crates/bindings-typescript/src/lib/autogen/reducers.ts @@ -0,0 +1,8 @@ +// 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 { type Infer as __Infer } from '../../lib/type_builders'; + +// Import all reducer arg schemas diff --git a/crates/bindings-typescript/src/lib/autogen/rows.ts b/crates/bindings-typescript/src/lib/autogen/rows.ts new file mode 100644 index 00000000000..693f6effe27 --- /dev/null +++ b/crates/bindings-typescript/src/lib/autogen/rows.ts @@ -0,0 +1,8 @@ +// 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 { type Infer as __Infer } from '../../lib/type_builders'; + +// Import all table schema definitions diff --git a/crates/bindings-typescript/src/lib/autogen/types.ts b/crates/bindings-typescript/src/lib/autogen/types.ts new file mode 100644 index 00000000000..673f4a67b2b --- /dev/null +++ b/crates/bindings-typescript/src/lib/autogen/types.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { type Infer as __Infer } from '../../lib/type_builders'; + +// Import all non-reducer types +import AlgebraicType from './algebraic_type_type'; +import HttpHeaderPair from './http_header_pair_type'; +import HttpHeaders from './http_headers_type'; +import HttpMethod from './http_method_type'; +import HttpRequest from './http_request_type'; +import HttpResponse from './http_response_type'; +import HttpVersion from './http_version_type'; +import IndexType from './index_type_type'; +import Lifecycle from './lifecycle_type'; +import MiscModuleExport from './misc_module_export_type'; +import ProductType from './product_type_type'; +import ProductTypeElement from './product_type_element_type'; +import RawColumnDefV8 from './raw_column_def_v_8_type'; +import RawColumnDefaultValueV9 from './raw_column_default_value_v_9_type'; +import RawConstraintDataV9 from './raw_constraint_data_v_9_type'; +import RawConstraintDefV8 from './raw_constraint_def_v_8_type'; +import RawConstraintDefV9 from './raw_constraint_def_v_9_type'; +import RawIndexAlgorithm from './raw_index_algorithm_type'; +import RawIndexDefV8 from './raw_index_def_v_8_type'; +import RawIndexDefV9 from './raw_index_def_v_9_type'; +import RawMiscModuleExportV9 from './raw_misc_module_export_v_9_type'; +import RawModuleDef from './raw_module_def_type'; +import RawModuleDefV8 from './raw_module_def_v_8_type'; +import RawModuleDefV9 from './raw_module_def_v_9_type'; +import RawProcedureDefV9 from './raw_procedure_def_v_9_type'; +import RawReducerDefV9 from './raw_reducer_def_v_9_type'; +import RawRowLevelSecurityDefV9 from './raw_row_level_security_def_v_9_type'; +import RawScheduleDefV9 from './raw_schedule_def_v_9_type'; +import RawScopedTypeNameV9 from './raw_scoped_type_name_v_9_type'; +import RawSequenceDefV8 from './raw_sequence_def_v_8_type'; +import RawSequenceDefV9 from './raw_sequence_def_v_9_type'; +import RawTableDefV8 from './raw_table_def_v_8_type'; +import RawTableDefV9 from './raw_table_def_v_9_type'; +import RawTypeDefV9 from './raw_type_def_v_9_type'; +import RawUniqueConstraintDataV9 from './raw_unique_constraint_data_v_9_type'; +import RawViewDefV9 from './raw_view_def_v_9_type'; +import ReducerDef from './reducer_def_type'; +import SumType from './sum_type_type'; +import SumTypeVariant from './sum_type_variant_type'; +import TableAccess from './table_access_type'; +import TableDesc from './table_desc_type'; +import TableType from './table_type_type'; +import TypeAlias from './type_alias_type'; +import Typespace from './typespace_type'; +import ViewResultHeader from './view_result_header_type'; + +export type AlgebraicType = __Infer; +export type HttpHeaderPair = __Infer; +export type HttpHeaders = __Infer; +export type HttpMethod = __Infer; +export type HttpRequest = __Infer; +export type HttpResponse = __Infer; +export type HttpVersion = __Infer; +export type IndexType = __Infer; +export type Lifecycle = __Infer; +export type MiscModuleExport = __Infer; +export type ProductType = __Infer; +export type ProductTypeElement = __Infer; +export type RawColumnDefV8 = __Infer; +export type RawColumnDefaultValueV9 = __Infer; +export type RawConstraintDataV9 = __Infer; +export type RawConstraintDefV8 = __Infer; +export type RawConstraintDefV9 = __Infer; +export type RawIndexAlgorithm = __Infer; +export type RawIndexDefV8 = __Infer; +export type RawIndexDefV9 = __Infer; +export type RawMiscModuleExportV9 = __Infer; +export type RawModuleDef = __Infer; +export type RawModuleDefV8 = __Infer; +export type RawModuleDefV9 = __Infer; +export type RawProcedureDefV9 = __Infer; +export type RawReducerDefV9 = __Infer; +export type RawRowLevelSecurityDefV9 = __Infer; +export type RawScheduleDefV9 = __Infer; +export type RawScopedTypeNameV9 = __Infer; +export type RawSequenceDefV8 = __Infer; +export type RawSequenceDefV9 = __Infer; +export type RawTableDefV8 = __Infer; +export type RawTableDefV9 = __Infer; +export type RawTypeDefV9 = __Infer; +export type RawUniqueConstraintDataV9 = __Infer< + typeof RawUniqueConstraintDataV9 +>; +export type RawViewDefV9 = __Infer; +export type ReducerDef = __Infer; +export type SumType = __Infer; +export type SumTypeVariant = __Infer; +export type TableAccess = __Infer; +export type TableDesc = __Infer; +export type TableType = __Infer; +export type TypeAlias = __Infer; +export type Typespace = __Infer; +export type ViewResultHeader = __Infer; diff --git a/crates/bindings-typescript/src/sdk/client_api/index.ts b/crates/bindings-typescript/src/sdk/client_api/index.ts index 5b7fa1a1f21..77a0cd4f89b 100644 --- a/crates/bindings-typescript/src/sdk/client_api/index.ts +++ b/crates/bindings-typescript/src/sdk/client_api/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.3 (commit f9bca6a8df856d950360b40cbce744fcbffc9a63). +// This was generated using spacetimedb cli version 1.11.3 (commit b5a7b37660b6cb7ce327f409456329e1142466e6). /* eslint-disable */ /* tslint:disable */ @@ -33,81 +33,17 @@ import { type SubscriptionHandleImpl as __SubscriptionHandleImpl, } from '../../index'; -// Import and reexport all reducer arg types - -// Import and reexport all procedure arg types - -// Import and reexport all table handle types - -// Import and reexport all types -import BsatnRowList from './bsatn_row_list_type'; -export { BsatnRowList }; -import CallProcedure from './call_procedure_type'; -export { CallProcedure }; -import CallReducer from './call_reducer_type'; -export { CallReducer }; -import ClientMessage from './client_message_type'; -export { ClientMessage }; -import CompressableQueryUpdate from './compressable_query_update_type'; -export { CompressableQueryUpdate }; -import DatabaseUpdate from './database_update_type'; -export { DatabaseUpdate }; -import EnergyQuanta from './energy_quanta_type'; -export { EnergyQuanta }; -import IdentityToken from './identity_token_type'; -export { IdentityToken }; -import InitialSubscription from './initial_subscription_type'; -export { InitialSubscription }; -import OneOffQuery from './one_off_query_type'; -export { OneOffQuery }; -import OneOffQueryResponse from './one_off_query_response_type'; -export { OneOffQueryResponse }; -import OneOffTable from './one_off_table_type'; -export { OneOffTable }; -import ProcedureResult from './procedure_result_type'; -export { ProcedureResult }; -import ProcedureStatus from './procedure_status_type'; -export { ProcedureStatus }; -import QueryId from './query_id_type'; -export { QueryId }; -import QueryUpdate from './query_update_type'; -export { QueryUpdate }; -import ReducerCallInfo from './reducer_call_info_type'; -export { ReducerCallInfo }; -import RowSizeHint from './row_size_hint_type'; -export { RowSizeHint }; -import ServerMessage from './server_message_type'; -export { ServerMessage }; -import Subscribe from './subscribe_type'; -export { Subscribe }; -import SubscribeApplied from './subscribe_applied_type'; -export { SubscribeApplied }; -import SubscribeMulti from './subscribe_multi_type'; -export { SubscribeMulti }; -import SubscribeMultiApplied from './subscribe_multi_applied_type'; -export { SubscribeMultiApplied }; -import SubscribeRows from './subscribe_rows_type'; -export { SubscribeRows }; -import SubscribeSingle from './subscribe_single_type'; -export { SubscribeSingle }; -import SubscriptionError from './subscription_error_type'; -export { SubscriptionError }; -import TableUpdate from './table_update_type'; -export { TableUpdate }; -import TransactionUpdate from './transaction_update_type'; -export { TransactionUpdate }; -import TransactionUpdateLight from './transaction_update_light_type'; -export { TransactionUpdateLight }; -import Unsubscribe from './unsubscribe_type'; -export { Unsubscribe }; -import UnsubscribeApplied from './unsubscribe_applied_type'; -export { UnsubscribeApplied }; -import UnsubscribeMulti from './unsubscribe_multi_type'; -export { UnsubscribeMulti }; -import UnsubscribeMultiApplied from './unsubscribe_multi_applied_type'; -export { UnsubscribeMultiApplied }; -import UpdateStatus from './update_status_type'; -export { UpdateStatus }; +// Import all reducer arg schemas + +// Import all procedure arg schemas + +// Import all table schema definitions + +/** Type-only namespace exports for generated type groups. */ +export type * as Rows from './rows'; +export type * as Reducers from './reducers'; +export type * as Procedures from './procedures'; +export type * as Types from './types'; /** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */ const tablesSchema = __schema(); diff --git a/crates/bindings-typescript/src/sdk/client_api/procedures.ts b/crates/bindings-typescript/src/sdk/client_api/procedures.ts new file mode 100644 index 00000000000..6625edb1b2e --- /dev/null +++ b/crates/bindings-typescript/src/sdk/client_api/procedures.ts @@ -0,0 +1,8 @@ +// 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 { type Infer as __Infer } from '../../lib/type_builders'; + +// Import all procedure arg schemas diff --git a/crates/bindings-typescript/src/sdk/client_api/reducers.ts b/crates/bindings-typescript/src/sdk/client_api/reducers.ts new file mode 100644 index 00000000000..69fa905ce4f --- /dev/null +++ b/crates/bindings-typescript/src/sdk/client_api/reducers.ts @@ -0,0 +1,8 @@ +// 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 { type Infer as __Infer } from '../../lib/type_builders'; + +// Import all reducer arg schemas diff --git a/crates/bindings-typescript/src/sdk/client_api/rows.ts b/crates/bindings-typescript/src/sdk/client_api/rows.ts new file mode 100644 index 00000000000..693f6effe27 --- /dev/null +++ b/crates/bindings-typescript/src/sdk/client_api/rows.ts @@ -0,0 +1,8 @@ +// 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 { type Infer as __Infer } from '../../lib/type_builders'; + +// Import all table schema definitions diff --git a/crates/bindings-typescript/src/sdk/client_api/types.ts b/crates/bindings-typescript/src/sdk/client_api/types.ts new file mode 100644 index 00000000000..70dcff626c4 --- /dev/null +++ b/crates/bindings-typescript/src/sdk/client_api/types.ts @@ -0,0 +1,77 @@ +// 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 { type Infer as __Infer } from '../../lib/type_builders'; + +// Import all non-reducer types +import BsatnRowList from './bsatn_row_list_type'; +import CallProcedure from './call_procedure_type'; +import CallReducer from './call_reducer_type'; +import ClientMessage from './client_message_type'; +import CompressableQueryUpdate from './compressable_query_update_type'; +import DatabaseUpdate from './database_update_type'; +import EnergyQuanta from './energy_quanta_type'; +import IdentityToken from './identity_token_type'; +import InitialSubscription from './initial_subscription_type'; +import OneOffQuery from './one_off_query_type'; +import OneOffQueryResponse from './one_off_query_response_type'; +import OneOffTable from './one_off_table_type'; +import ProcedureResult from './procedure_result_type'; +import ProcedureStatus from './procedure_status_type'; +import QueryId from './query_id_type'; +import QueryUpdate from './query_update_type'; +import ReducerCallInfo from './reducer_call_info_type'; +import RowSizeHint from './row_size_hint_type'; +import ServerMessage from './server_message_type'; +import Subscribe from './subscribe_type'; +import SubscribeApplied from './subscribe_applied_type'; +import SubscribeMulti from './subscribe_multi_type'; +import SubscribeMultiApplied from './subscribe_multi_applied_type'; +import SubscribeRows from './subscribe_rows_type'; +import SubscribeSingle from './subscribe_single_type'; +import SubscriptionError from './subscription_error_type'; +import TableUpdate from './table_update_type'; +import TransactionUpdate from './transaction_update_type'; +import TransactionUpdateLight from './transaction_update_light_type'; +import Unsubscribe from './unsubscribe_type'; +import UnsubscribeApplied from './unsubscribe_applied_type'; +import UnsubscribeMulti from './unsubscribe_multi_type'; +import UnsubscribeMultiApplied from './unsubscribe_multi_applied_type'; +import UpdateStatus from './update_status_type'; + +export type BsatnRowList = __Infer; +export type CallProcedure = __Infer; +export type CallReducer = __Infer; +export type ClientMessage = __Infer; +export type CompressableQueryUpdate = __Infer; +export type DatabaseUpdate = __Infer; +export type EnergyQuanta = __Infer; +export type IdentityToken = __Infer; +export type InitialSubscription = __Infer; +export type OneOffQuery = __Infer; +export type OneOffQueryResponse = __Infer; +export type OneOffTable = __Infer; +export type ProcedureResult = __Infer; +export type ProcedureStatus = __Infer; +export type QueryId = __Infer; +export type QueryUpdate = __Infer; +export type ReducerCallInfo = __Infer; +export type RowSizeHint = __Infer; +export type ServerMessage = __Infer; +export type Subscribe = __Infer; +export type SubscribeApplied = __Infer; +export type SubscribeMulti = __Infer; +export type SubscribeMultiApplied = __Infer; +export type SubscribeRows = __Infer; +export type SubscribeSingle = __Infer; +export type SubscriptionError = __Infer; +export type TableUpdate = __Infer; +export type TransactionUpdate = __Infer; +export type TransactionUpdateLight = __Infer; +export type Unsubscribe = __Infer; +export type UnsubscribeApplied = __Infer; +export type UnsubscribeMulti = __Infer; +export type UnsubscribeMultiApplied = __Infer; +export type UpdateStatus = __Infer; diff --git a/crates/bindings-typescript/test-app/src/module_bindings/index.ts b/crates/bindings-typescript/test-app/src/module_bindings/index.ts index 22483e31050..41be99e7b37 100644 --- a/crates/bindings-typescript/test-app/src/module_bindings/index.ts +++ b/crates/bindings-typescript/test-app/src/module_bindings/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.3 (commit f9bca6a8df856d950360b40cbce744fcbffc9a63). +// This was generated using spacetimedb cli version 1.11.3 (commit b5a7b37660b6cb7ce327f409456329e1142466e6). /* eslint-disable */ /* tslint:disable */ @@ -33,29 +33,21 @@ import { type SubscriptionHandleImpl as __SubscriptionHandleImpl, } from '../../../src/index'; -// Import and reexport all reducer arg types +// Import all reducer arg schemas import CreatePlayerReducer from './create_player_reducer'; -export { CreatePlayerReducer }; -// Import and reexport all procedure arg types +// Import all procedure arg schemas -// Import and reexport all table handle types +// Import all table schema definitions import PlayerRow from './player_table'; -export { PlayerRow }; import UnindexedPlayerRow from './unindexed_player_table'; -export { UnindexedPlayerRow }; import UserRow from './user_table'; -export { UserRow }; - -// Import and reexport all types -import Player from './player_type'; -export { Player }; -import Point from './point_type'; -export { Point }; -import UnindexedPlayer from './unindexed_player_type'; -export { UnindexedPlayer }; -import User from './user_type'; -export { User }; + +/** Type-only namespace exports for generated type groups. */ +export type * as Rows from './rows'; +export type * as Reducers from './reducers'; +export type * as Procedures from './procedures'; +export type * as Types from './types'; /** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */ const tablesSchema = __schema( diff --git a/crates/bindings-typescript/test-app/src/module_bindings/procedures.ts b/crates/bindings-typescript/test-app/src/module_bindings/procedures.ts new file mode 100644 index 00000000000..b0921721821 --- /dev/null +++ b/crates/bindings-typescript/test-app/src/module_bindings/procedures.ts @@ -0,0 +1,8 @@ +// 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 { type Infer as __Infer } from '../../../src/index'; + +// Import all procedure arg schemas diff --git a/crates/bindings-typescript/test-app/src/module_bindings/reducers.ts b/crates/bindings-typescript/test-app/src/module_bindings/reducers.ts new file mode 100644 index 00000000000..7008968ffef --- /dev/null +++ b/crates/bindings-typescript/test-app/src/module_bindings/reducers.ts @@ -0,0 +1,11 @@ +// 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 { type Infer as __Infer } from '../../../src/index'; + +// Import all reducer arg schemas +import CreatePlayerReducer from './create_player_reducer'; + +export type CreatePlayerArgs = __Infer; diff --git a/crates/bindings-typescript/test-app/src/module_bindings/rows.ts b/crates/bindings-typescript/test-app/src/module_bindings/rows.ts new file mode 100644 index 00000000000..904ba9a3f12 --- /dev/null +++ b/crates/bindings-typescript/test-app/src/module_bindings/rows.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { type Infer as __Infer } from '../../../src/index'; + +// Import all table schema definitions +import PlayerRow from './player_table'; +import UnindexedPlayerRow from './unindexed_player_table'; +import UserRow from './user_table'; + +export type Player = __Infer; +export type UnindexedPlayer = __Infer; +export type User = __Infer; diff --git a/crates/bindings-typescript/test-app/src/module_bindings/types.ts b/crates/bindings-typescript/test-app/src/module_bindings/types.ts new file mode 100644 index 00000000000..3d8eb202900 --- /dev/null +++ b/crates/bindings-typescript/test-app/src/module_bindings/types.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { type Infer as __Infer } from '../../../src/index'; + +// Import all non-reducer types +import Player from './player_type'; +import Point from './point_type'; +import UnindexedPlayer from './unindexed_player_type'; +import User from './user_type'; + +export type Player = __Infer; +export type Point = __Infer; +export type UnindexedPlayer = __Infer; +export type User = __Infer; diff --git a/templates/basic-react/src/module_bindings/custom_type_type.ts b/templates/basic-react/src/module_bindings/custom_type_type.ts new file mode 100644 index 00000000000..1c9dcb38596 --- /dev/null +++ b/templates/basic-react/src/module_bindings/custom_type_type.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { + TypeBuilder as __TypeBuilder, + t as __t, + type AlgebraicTypeType as __AlgebraicTypeType, + type Infer as __Infer, +} from 'spacetimedb'; + +export default __t.object('CustomType', { + name: __t.string(), +}); diff --git a/templates/basic-react/src/module_bindings/index.ts b/templates/basic-react/src/module_bindings/index.ts index 23ea2b9deb3..44ba6d56704 100644 --- a/templates/basic-react/src/module_bindings/index.ts +++ b/templates/basic-react/src/module_bindings/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.3 (commit f9bca6a8df856d950360b40cbce744fcbffc9a63). +// This was generated using spacetimedb cli version 1.11.3 (commit b5a7b37660b6cb7ce327f409456329e1142466e6). /* eslint-disable */ /* tslint:disable */ @@ -33,35 +33,20 @@ import { type SubscriptionHandleImpl as __SubscriptionHandleImpl, } from 'spacetimedb'; -// Import and reexport all reducer arg types -import OnConnectReducer from './on_connect_reducer'; -export { OnConnectReducer }; -import OnDisconnectReducer from './on_disconnect_reducer'; -export { OnDisconnectReducer }; +// Import all reducer arg schemas import AddReducer from './add_reducer'; -export { AddReducer }; import SayHelloReducer from './say_hello_reducer'; -export { SayHelloReducer }; -// Import and reexport all procedure arg types +// Import all procedure arg schemas -// Import and reexport all table handle types +// Import all table schema definitions import PersonRow from './person_table'; -export { PersonRow }; - -// Import and reexport all types -import Add from './add_type'; -export { Add }; -import Init from './init_type'; -export { Init }; -import OnConnect from './on_connect_type'; -export { OnConnect }; -import OnDisconnect from './on_disconnect_type'; -export { OnDisconnect }; -import Person from './person_type'; -export { Person }; -import SayHello from './say_hello_type'; -export { SayHello }; + +/** Type-only namespace exports for generated type groups. */ +export type * as Rows from './rows'; +export type * as Reducers from './reducers'; +export type * as Procedures from './procedures'; +export type * as Types from './types'; /** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */ const tablesSchema = __schema( diff --git a/templates/basic-react/src/module_bindings/procedures.ts b/templates/basic-react/src/module_bindings/procedures.ts new file mode 100644 index 00000000000..b2102264f4d --- /dev/null +++ b/templates/basic-react/src/module_bindings/procedures.ts @@ -0,0 +1,8 @@ +// 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 { type Infer as __Infer } from 'spacetimedb'; + +// Import all procedure arg schemas diff --git a/templates/basic-react/src/module_bindings/reducers.ts b/templates/basic-react/src/module_bindings/reducers.ts new file mode 100644 index 00000000000..0259dbf4b1a --- /dev/null +++ b/templates/basic-react/src/module_bindings/reducers.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { type Infer as __Infer } from 'spacetimedb'; + +// Import all reducer arg schemas +import OnConnectReducer from './on_connect_reducer'; +import OnDisconnectReducer from './on_disconnect_reducer'; +import AddReducer from './add_reducer'; +import SayHelloReducer from './say_hello_reducer'; + +export type OnConnectArgs = __Infer; +export type OnDisconnectArgs = __Infer; +export type AddArgs = __Infer; +export type SayHelloArgs = __Infer; diff --git a/templates/basic-react/src/module_bindings/rows.ts b/templates/basic-react/src/module_bindings/rows.ts new file mode 100644 index 00000000000..8fad581583d --- /dev/null +++ b/templates/basic-react/src/module_bindings/rows.ts @@ -0,0 +1,11 @@ +// 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 { type Infer as __Infer } from 'spacetimedb'; + +// Import all table schema definitions +import PersonRow from './person_table'; + +export type Person = __Infer; diff --git a/templates/basic-react/src/module_bindings/testtable_type.ts b/templates/basic-react/src/module_bindings/testtable_type.ts new file mode 100644 index 00000000000..5d0a364a28b --- /dev/null +++ b/templates/basic-react/src/module_bindings/testtable_type.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { + TypeBuilder as __TypeBuilder, + t as __t, + type AlgebraicTypeType as __AlgebraicTypeType, + type Infer as __Infer, +} from 'spacetimedb'; +import CustomType from './custom_type_type'; + +export default __t.object('Testtable', { + get idk() { + return CustomType; + }, +}); diff --git a/templates/basic-react/src/module_bindings/types.ts b/templates/basic-react/src/module_bindings/types.ts new file mode 100644 index 00000000000..8f2d578255a --- /dev/null +++ b/templates/basic-react/src/module_bindings/types.ts @@ -0,0 +1,11 @@ +// 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 { type Infer as __Infer } from 'spacetimedb'; + +// Import all non-reducer types +import Person from './person_type'; + +export type Person = __Infer; diff --git a/templates/basic-typescript/src/module_bindings/index.ts b/templates/basic-typescript/src/module_bindings/index.ts index 23ea2b9deb3..44ba6d56704 100644 --- a/templates/basic-typescript/src/module_bindings/index.ts +++ b/templates/basic-typescript/src/module_bindings/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.3 (commit f9bca6a8df856d950360b40cbce744fcbffc9a63). +// This was generated using spacetimedb cli version 1.11.3 (commit b5a7b37660b6cb7ce327f409456329e1142466e6). /* eslint-disable */ /* tslint:disable */ @@ -33,35 +33,20 @@ import { type SubscriptionHandleImpl as __SubscriptionHandleImpl, } from 'spacetimedb'; -// Import and reexport all reducer arg types -import OnConnectReducer from './on_connect_reducer'; -export { OnConnectReducer }; -import OnDisconnectReducer from './on_disconnect_reducer'; -export { OnDisconnectReducer }; +// Import all reducer arg schemas import AddReducer from './add_reducer'; -export { AddReducer }; import SayHelloReducer from './say_hello_reducer'; -export { SayHelloReducer }; -// Import and reexport all procedure arg types +// Import all procedure arg schemas -// Import and reexport all table handle types +// Import all table schema definitions import PersonRow from './person_table'; -export { PersonRow }; - -// Import and reexport all types -import Add from './add_type'; -export { Add }; -import Init from './init_type'; -export { Init }; -import OnConnect from './on_connect_type'; -export { OnConnect }; -import OnDisconnect from './on_disconnect_type'; -export { OnDisconnect }; -import Person from './person_type'; -export { Person }; -import SayHello from './say_hello_type'; -export { SayHello }; + +/** Type-only namespace exports for generated type groups. */ +export type * as Rows from './rows'; +export type * as Reducers from './reducers'; +export type * as Procedures from './procedures'; +export type * as Types from './types'; /** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */ const tablesSchema = __schema( diff --git a/templates/basic-typescript/src/module_bindings/procedures.ts b/templates/basic-typescript/src/module_bindings/procedures.ts new file mode 100644 index 00000000000..b2102264f4d --- /dev/null +++ b/templates/basic-typescript/src/module_bindings/procedures.ts @@ -0,0 +1,8 @@ +// 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 { type Infer as __Infer } from 'spacetimedb'; + +// Import all procedure arg schemas diff --git a/templates/basic-typescript/src/module_bindings/reducers.ts b/templates/basic-typescript/src/module_bindings/reducers.ts new file mode 100644 index 00000000000..0259dbf4b1a --- /dev/null +++ b/templates/basic-typescript/src/module_bindings/reducers.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { type Infer as __Infer } from 'spacetimedb'; + +// Import all reducer arg schemas +import OnConnectReducer from './on_connect_reducer'; +import OnDisconnectReducer from './on_disconnect_reducer'; +import AddReducer from './add_reducer'; +import SayHelloReducer from './say_hello_reducer'; + +export type OnConnectArgs = __Infer; +export type OnDisconnectArgs = __Infer; +export type AddArgs = __Infer; +export type SayHelloArgs = __Infer; diff --git a/templates/basic-typescript/src/module_bindings/rows.ts b/templates/basic-typescript/src/module_bindings/rows.ts new file mode 100644 index 00000000000..8fad581583d --- /dev/null +++ b/templates/basic-typescript/src/module_bindings/rows.ts @@ -0,0 +1,11 @@ +// 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 { type Infer as __Infer } from 'spacetimedb'; + +// Import all table schema definitions +import PersonRow from './person_table'; + +export type Person = __Infer; diff --git a/templates/basic-typescript/src/module_bindings/types.ts b/templates/basic-typescript/src/module_bindings/types.ts new file mode 100644 index 00000000000..8f2d578255a --- /dev/null +++ b/templates/basic-typescript/src/module_bindings/types.ts @@ -0,0 +1,11 @@ +// 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 { type Infer as __Infer } from 'spacetimedb'; + +// Import all non-reducer types +import Person from './person_type'; + +export type Person = __Infer; diff --git a/templates/quickstart-chat-typescript/src/App.tsx b/templates/quickstart-chat-typescript/src/App.tsx index 1da2737cd82..e7025f3712c 100644 --- a/templates/quickstart-chat-typescript/src/App.tsx +++ b/templates/quickstart-chat-typescript/src/App.tsx @@ -1,6 +1,6 @@ import React, { useState } from 'react'; import './App.css'; -import { tables, reducers, Message } from './module_bindings'; +import { tables, reducers, Rows } from './module_bindings'; import { useSpacetimeDB, useTable, @@ -8,7 +8,7 @@ import { eq, useReducer, } from 'spacetimedb/react'; -import { Identity, Infer, Timestamp } from 'spacetimedb'; +import { Identity, Timestamp } from 'spacetimedb'; export type PrettyMessage = { senderName: string; @@ -20,9 +20,7 @@ export type PrettyMessage = { function App() { const [newName, setNewName] = useState(''); const [settingName, setSettingName] = useState(false); - const [systemMessages, setSystemMessages] = useState( - [] as Infer[] - ); + const [systemMessages, setSystemMessages] = useState([] as Rows.Message[]); const [newMessage, setNewMessage] = useState(''); const { identity, isActive: connected } = useSpacetimeDB(); diff --git a/templates/quickstart-chat-typescript/src/module_bindings/index.ts b/templates/quickstart-chat-typescript/src/module_bindings/index.ts index 5dc82db57f6..4f0c30b1657 100644 --- a/templates/quickstart-chat-typescript/src/module_bindings/index.ts +++ b/templates/quickstart-chat-typescript/src/module_bindings/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.3 (commit f9bca6a8df856d950360b40cbce744fcbffc9a63). +// This was generated using spacetimedb cli version 1.11.3 (commit b5a7b37660b6cb7ce327f409456329e1142466e6). /* eslint-disable */ /* tslint:disable */ @@ -33,39 +33,21 @@ import { type SubscriptionHandleImpl as __SubscriptionHandleImpl, } from 'spacetimedb'; -// Import and reexport all reducer arg types +// Import all reducer arg schemas import SetNameReducer from './set_name_reducer'; -export { SetNameReducer }; import SendMessageReducer from './send_message_reducer'; -export { SendMessageReducer }; -import OnConnectReducer from './on_connect_reducer'; -export { OnConnectReducer }; -import OnDisconnectReducer from './on_disconnect_reducer'; -export { OnDisconnectReducer }; -// Import and reexport all procedure arg types +// Import all procedure arg schemas -// Import and reexport all table handle types +// Import all table schema definitions import MessageRow from './message_table'; -export { MessageRow }; import UserRow from './user_table'; -export { UserRow }; - -// Import and reexport all types -import Init from './init_type'; -export { Init }; -import Message from './message_type'; -export { Message }; -import OnConnect from './on_connect_type'; -export { OnConnect }; -import OnDisconnect from './on_disconnect_type'; -export { OnDisconnect }; -import SendMessage from './send_message_type'; -export { SendMessage }; -import SetName from './set_name_type'; -export { SetName }; -import User from './user_type'; -export { User }; + +/** Type-only namespace exports for generated type groups. */ +export type * as Rows from './rows'; +export type * as Reducers from './reducers'; +export type * as Procedures from './procedures'; +export type * as Types from './types'; /** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */ const tablesSchema = __schema( diff --git a/templates/quickstart-chat-typescript/src/module_bindings/procedures.ts b/templates/quickstart-chat-typescript/src/module_bindings/procedures.ts new file mode 100644 index 00000000000..b2102264f4d --- /dev/null +++ b/templates/quickstart-chat-typescript/src/module_bindings/procedures.ts @@ -0,0 +1,8 @@ +// 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 { type Infer as __Infer } from 'spacetimedb'; + +// Import all procedure arg schemas diff --git a/templates/quickstart-chat-typescript/src/module_bindings/reducers.ts b/templates/quickstart-chat-typescript/src/module_bindings/reducers.ts new file mode 100644 index 00000000000..f6189b8f46b --- /dev/null +++ b/templates/quickstart-chat-typescript/src/module_bindings/reducers.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { type Infer as __Infer } from 'spacetimedb'; + +// Import all reducer arg schemas +import SetNameReducer from './set_name_reducer'; +import SendMessageReducer from './send_message_reducer'; +import OnConnectReducer from './on_connect_reducer'; +import OnDisconnectReducer from './on_disconnect_reducer'; + +export type SetNameArgs = __Infer; +export type SendMessageArgs = __Infer; +export type OnConnectArgs = __Infer; +export type OnDisconnectArgs = __Infer; diff --git a/templates/quickstart-chat-typescript/src/module_bindings/rows.ts b/templates/quickstart-chat-typescript/src/module_bindings/rows.ts new file mode 100644 index 00000000000..4ca40647ec6 --- /dev/null +++ b/templates/quickstart-chat-typescript/src/module_bindings/rows.ts @@ -0,0 +1,13 @@ +// 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 { type Infer as __Infer } from 'spacetimedb'; + +// Import all table schema definitions +import MessageRow from './message_table'; +import UserRow from './user_table'; + +export type Message = __Infer; +export type User = __Infer; diff --git a/templates/quickstart-chat-typescript/src/module_bindings/types.ts b/templates/quickstart-chat-typescript/src/module_bindings/types.ts new file mode 100644 index 00000000000..50bbdd264ea --- /dev/null +++ b/templates/quickstart-chat-typescript/src/module_bindings/types.ts @@ -0,0 +1,13 @@ +// 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 { type Infer as __Infer } from 'spacetimedb'; + +// Import all non-reducer types +import Message from './message_type'; +import User from './user_type'; + +export type Message = __Infer; +export type User = __Infer; From 36bf624fed8949e753c863d300eca167a90a78d3 Mon Sep 17 00:00:00 2001 From: Jeffrey Dallatezza Date: Mon, 26 Jan 2026 11:28:27 -0800 Subject: [PATCH 05/16] regen a template --- templates/basic-ts/src/module_bindings/index.ts | 2 +- .../basic-ts/src/module_bindings/procedures.ts | 8 ++++++++ .../basic-ts/src/module_bindings/reducers.ts | 17 +++++++++++++++++ templates/basic-ts/src/module_bindings/rows.ts | 11 +++++++++++ templates/basic-ts/src/module_bindings/types.ts | 11 +++++++++++ 5 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 templates/basic-ts/src/module_bindings/procedures.ts create mode 100644 templates/basic-ts/src/module_bindings/reducers.ts create mode 100644 templates/basic-ts/src/module_bindings/rows.ts create mode 100644 templates/basic-ts/src/module_bindings/types.ts diff --git a/templates/basic-ts/src/module_bindings/index.ts b/templates/basic-ts/src/module_bindings/index.ts index 44ba6d56704..dea9b5470e0 100644 --- a/templates/basic-ts/src/module_bindings/index.ts +++ b/templates/basic-ts/src/module_bindings/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.3 (commit b5a7b37660b6cb7ce327f409456329e1142466e6). +// This was generated using spacetimedb cli version 1.11.3 (commit c06bf8b59468ce56b6731c98302ad4fe4b7cc931). /* eslint-disable */ /* tslint:disable */ diff --git a/templates/basic-ts/src/module_bindings/procedures.ts b/templates/basic-ts/src/module_bindings/procedures.ts new file mode 100644 index 00000000000..b2102264f4d --- /dev/null +++ b/templates/basic-ts/src/module_bindings/procedures.ts @@ -0,0 +1,8 @@ +// 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 { type Infer as __Infer } from 'spacetimedb'; + +// Import all procedure arg schemas diff --git a/templates/basic-ts/src/module_bindings/reducers.ts b/templates/basic-ts/src/module_bindings/reducers.ts new file mode 100644 index 00000000000..0259dbf4b1a --- /dev/null +++ b/templates/basic-ts/src/module_bindings/reducers.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { type Infer as __Infer } from 'spacetimedb'; + +// Import all reducer arg schemas +import OnConnectReducer from './on_connect_reducer'; +import OnDisconnectReducer from './on_disconnect_reducer'; +import AddReducer from './add_reducer'; +import SayHelloReducer from './say_hello_reducer'; + +export type OnConnectArgs = __Infer; +export type OnDisconnectArgs = __Infer; +export type AddArgs = __Infer; +export type SayHelloArgs = __Infer; diff --git a/templates/basic-ts/src/module_bindings/rows.ts b/templates/basic-ts/src/module_bindings/rows.ts new file mode 100644 index 00000000000..8fad581583d --- /dev/null +++ b/templates/basic-ts/src/module_bindings/rows.ts @@ -0,0 +1,11 @@ +// 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 { type Infer as __Infer } from 'spacetimedb'; + +// Import all table schema definitions +import PersonRow from './person_table'; + +export type Person = __Infer; diff --git a/templates/basic-ts/src/module_bindings/types.ts b/templates/basic-ts/src/module_bindings/types.ts new file mode 100644 index 00000000000..8f2d578255a --- /dev/null +++ b/templates/basic-ts/src/module_bindings/types.ts @@ -0,0 +1,11 @@ +// 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 { type Infer as __Infer } from 'spacetimedb'; + +// Import all non-reducer types +import Person from './person_type'; + +export type Person = __Infer; From 55f1fe331241e1f80b3af7b7dbb093ba3db1b4f4 Mon Sep 17 00:00:00 2001 From: Jeffrey Dallatezza Date: Mon, 26 Jan 2026 11:31:17 -0800 Subject: [PATCH 06/16] Regen --- .../src/module_bindings/index.ts | 2 +- .../react-ts/src/module_bindings/index.ts | 2 +- templates/vue-ts/src/module_bindings/index.ts | 43 ++++++++----------- 3 files changed, 19 insertions(+), 28 deletions(-) diff --git a/templates/chat-react-ts/src/module_bindings/index.ts b/templates/chat-react-ts/src/module_bindings/index.ts index 4f0c30b1657..be96c277b6e 100644 --- a/templates/chat-react-ts/src/module_bindings/index.ts +++ b/templates/chat-react-ts/src/module_bindings/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.3 (commit b5a7b37660b6cb7ce327f409456329e1142466e6). +// This was generated using spacetimedb cli version 1.11.3 (commit c06bf8b59468ce56b6731c98302ad4fe4b7cc931). /* eslint-disable */ /* tslint:disable */ diff --git a/templates/react-ts/src/module_bindings/index.ts b/templates/react-ts/src/module_bindings/index.ts index 44ba6d56704..dea9b5470e0 100644 --- a/templates/react-ts/src/module_bindings/index.ts +++ b/templates/react-ts/src/module_bindings/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.3 (commit b5a7b37660b6cb7ce327f409456329e1142466e6). +// This was generated using spacetimedb cli version 1.11.3 (commit c06bf8b59468ce56b6731c98302ad4fe4b7cc931). /* eslint-disable */ /* tslint:disable */ diff --git a/templates/vue-ts/src/module_bindings/index.ts b/templates/vue-ts/src/module_bindings/index.ts index 3c2919c1917..dea9b5470e0 100644 --- a/templates/vue-ts/src/module_bindings/index.ts +++ b/templates/vue-ts/src/module_bindings/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.2 (commit 5508f620e2fd5a4d8a3b7aaf5303776d127f5cbd). +// This was generated using spacetimedb cli version 1.11.3 (commit c06bf8b59468ce56b6731c98302ad4fe4b7cc931). /* eslint-disable */ /* tslint:disable */ @@ -12,6 +12,7 @@ import { TypeBuilder as __TypeBuilder, Uuid as __Uuid, convertToAccessorMap as __convertToAccessorMap, + makeQueryBuilder as __makeQueryBuilder, procedureSchema as __procedureSchema, procedures as __procedures, reducerSchema as __reducerSchema, @@ -25,41 +26,27 @@ import { type Event as __Event, type EventContextInterface as __EventContextInterface, type Infer as __Infer, + type QueryBuilder as __QueryBuilder, type ReducerEventContextInterface as __ReducerEventContextInterface, type RemoteModule as __RemoteModule, type SubscriptionEventContextInterface as __SubscriptionEventContextInterface, type SubscriptionHandleImpl as __SubscriptionHandleImpl, } from 'spacetimedb'; -// Import and reexport all reducer arg types -import OnConnectReducer from './on_connect_reducer'; -export { OnConnectReducer }; -import OnDisconnectReducer from './on_disconnect_reducer'; -export { OnDisconnectReducer }; +// Import all reducer arg schemas import AddReducer from './add_reducer'; -export { AddReducer }; import SayHelloReducer from './say_hello_reducer'; -export { SayHelloReducer }; -// Import and reexport all procedure arg types +// Import all procedure arg schemas -// Import and reexport all table handle types +// Import all table schema definitions import PersonRow from './person_table'; -export { PersonRow }; - -// Import and reexport all types -import Add from './add_type'; -export { Add }; -import Init from './init_type'; -export { Init }; -import OnConnect from './on_connect_type'; -export { OnConnect }; -import OnDisconnect from './on_disconnect_type'; -export { OnDisconnect }; -import Person from './person_type'; -export { Person }; -import SayHello from './say_hello_type'; -export { SayHello }; + +/** Type-only namespace exports for generated type groups. */ +export type * as Rows from './rows'; +export type * as Reducers from './reducers'; +export type * as Procedures from './procedures'; +export type * as Types from './types'; /** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */ const tablesSchema = __schema( @@ -85,7 +72,7 @@ const proceduresSchema = __procedures(); /** The remote SpacetimeDB module schema, both runtime and type information. */ const REMOTE_MODULE = { versionInfo: { - cliVersion: '1.11.2' as const, + cliVersion: '1.11.3' as const, }, tables: tablesSchema.schemaType.tables, reducers: reducersSchema.reducersType.reducers, @@ -99,6 +86,10 @@ const REMOTE_MODULE = { /** The tables available in this remote SpacetimeDB module. */ export const tables = __convertToAccessorMap(tablesSchema.schemaType.tables); +/** A typed query builder for this remote SpacetimeDB module. */ +export const query: __QueryBuilder = + __makeQueryBuilder(tablesSchema.schemaType); + /** The reducers available in this remote SpacetimeDB module. */ export const reducers = __convertToAccessorMap( reducersSchema.reducersType.reducers From 7eb7feed0ab242e3d848cd11c0cbd44a8cbe4e10 Mon Sep 17 00:00:00 2001 From: Jeffrey Dallatezza Date: Tue, 27 Jan 2026 10:01:00 -0800 Subject: [PATCH 07/16] Update codegen snap --- .../codegen__codegen_typescript.snap | 229 ++++++++++++------ 1 file changed, 158 insertions(+), 71 deletions(-) diff --git a/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap b/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap index c4fbcde807f..7a8828d893e 100644 --- a/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap +++ b/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap @@ -254,111 +254,48 @@ import { type SubscriptionHandleImpl as __SubscriptionHandleImpl, } from "spacetimedb"; -// Import and reexport all reducer arg types +// Import all reducer arg schemas import AddReducer from "./add_reducer"; -export { AddReducer }; import AddPlayerReducer from "./add_player_reducer"; -export { AddPlayerReducer }; 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"; -export { DeletePlayersByNameReducer }; import ListOverAgeReducer from "./list_over_age_reducer"; -export { ListOverAgeReducer }; 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"; -export { TestReducer }; import TestBtreeIndexArgsReducer from "./test_btree_index_args_reducer"; -export { TestBtreeIndexArgsReducer }; -// Import and reexport all procedure arg types +// Import all procedure arg schemas import * as GetMySchemaViaHttpProcedure from "./get_my_schema_via_http_procedure"; -export { GetMySchemaViaHttpProcedure }; import * as ReturnValueProcedure from "./return_value_procedure"; -export { ReturnValueProcedure }; import * as SleepOneSecondProcedure from "./sleep_one_second_procedure"; -export { SleepOneSecondProcedure }; import * as WithTxProcedure from "./with_tx_procedure"; -export { WithTxProcedure }; -// Import and reexport all table handle types +// Import all table schema definitions import HasSpecialStuffRow from "./has_special_stuff_table"; -export { HasSpecialStuffRow }; import LoggedOutPlayerRow from "./logged_out_player_table"; -export { LoggedOutPlayerRow }; import MyPlayerRow from "./my_player_table"; -export { MyPlayerRow }; import PersonRow from "./person_table"; -export { PersonRow }; import PkMultiIdentityRow from "./pk_multi_identity_table"; -export { PkMultiIdentityRow }; import PlayerRow from "./player_table"; -export { PlayerRow }; import PointsRow from "./points_table"; -export { PointsRow }; import PrivateTableRow from "./private_table_table"; -export { PrivateTableRow }; import RepeatingTestArgRow from "./repeating_test_arg_table"; -export { RepeatingTestArgRow }; import TableToRemoveRow from "./table_to_remove_table"; -export { TableToRemoveRow }; import TestARow from "./test_a_table"; -export { TestARow }; import TestDRow from "./test_d_table"; -export { TestDRow }; import TestERow from "./test_e_table"; -export { TestERow }; import TestFRow from "./test_f_table"; -export { TestFRow }; -// Import and reexport all types -import Baz from "./baz_type"; -export { Baz }; -import Foobar from "./foobar_type"; -export { Foobar }; -import HasSpecialStuff from "./has_special_stuff_type"; -export { HasSpecialStuff }; -import Person from "./person_type"; -export { Person }; -import PkMultiIdentity from "./pk_multi_identity_type"; -export { PkMultiIdentity }; -import Player from "./player_type"; -export { Player }; -import Point from "./point_type"; -export { Point }; -import PrivateTable from "./private_table_type"; -export { PrivateTable }; -import RemoveTable from "./remove_table_type"; -export { RemoveTable }; -import RepeatingTestArg from "./repeating_test_arg_type"; -export { RepeatingTestArg }; -import TestA from "./test_a_type"; -export { TestA }; -import TestB from "./test_b_type"; -export { TestB }; -import TestD from "./test_d_type"; -export { TestD }; -import TestE from "./test_e_type"; -export { TestE }; -import TestFoobar from "./test_foobar_type"; -export { TestFoobar }; -import NamespaceTestC from "./namespace_test_c_type"; -export { NamespaceTestC }; -import NamespaceTestF from "./namespace_test_f_type"; -export { NamespaceTestF }; +/** Type-only namespace exports for generated type groups. */ +export type * as Rows from "./rows"; +export type * as Reducers from "./reducers"; +export type * as Procedures from "./procedures"; +export type * as Types from "./types"; /** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */ const tablesSchema = __schema( @@ -904,6 +841,30 @@ export default __t.object("PrivateTable", { }); +''' +"procedures.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 { type Infer as __Infer } from "spacetimedb"; + +// Import all procedure arg schemas +import * as GetMySchemaViaHttpProcedure from "./get_my_schema_via_http_procedure"; +import * as ReturnValueProcedure from "./return_value_procedure"; +import * as SleepOneSecondProcedure from "./sleep_one_second_procedure"; +import * as WithTxProcedure from "./with_tx_procedure"; + +export type GetMySchemaViaHttpArgs = __Infer; +export type GetMySchemaViaHttpResult = __Infer; +export type ReturnValueArgs = __Infer; +export type ReturnValueResult = __Infer; +export type SleepOneSecondArgs = __Infer; +export type SleepOneSecondResult = __Infer; +export type WithTxArgs = __Infer; +export type WithTxResult = __Infer; + ''' "query_private_reducer.ts" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE @@ -919,6 +880,46 @@ import { } from "spacetimedb"; export default {}; +''' +"reducers.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 { type Infer as __Infer } from "spacetimedb"; + +// Import all reducer arg schemas +import AddReducer from "./add_reducer"; +import AddPlayerReducer from "./add_player_reducer"; +import AddPrivateReducer from "./add_private_reducer"; +import AssertCallerIdentityIsModuleIdentityReducer from "./assert_caller_identity_is_module_identity_reducer"; +import ClientConnectedReducer from "./client_connected_reducer"; +import DeletePlayerReducer from "./delete_player_reducer"; +import DeletePlayersByNameReducer from "./delete_players_by_name_reducer"; +import ListOverAgeReducer from "./list_over_age_reducer"; +import LogModuleIdentityReducer from "./log_module_identity_reducer"; +import QueryPrivateReducer from "./query_private_reducer"; +import RepeatingTestReducer from "./repeating_test_reducer"; +import SayHelloReducer from "./say_hello_reducer"; +import TestReducer from "./test_reducer"; +import TestBtreeIndexArgsReducer from "./test_btree_index_args_reducer"; + +export type AddArgs = __Infer; +export type AddPlayerArgs = __Infer; +export type AddPrivateArgs = __Infer; +export type AssertCallerIdentityIsModuleIdentityArgs = __Infer; +export type ClientConnectedArgs = __Infer; +export type DeletePlayerArgs = __Infer; +export type DeletePlayersByNameArgs = __Infer; +export type ListOverAgeArgs = __Infer; +export type LogModuleIdentityArgs = __Infer; +export type QueryPrivateArgs = __Infer; +export type RepeatingTestArgs = __Infer; +export type SayHelloArgs = __Infer; +export type TestArgs = __Infer; +export type TestBtreeIndexArgsArgs = __Infer; + ''' "remove_table_type.ts" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE @@ -1019,6 +1020,46 @@ export const params = { foo: __t.u64(), }; export const returnType = Baz''' +"rows.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 { type Infer as __Infer } from "spacetimedb"; + +// Import all table schema definitions +import HasSpecialStuffRow from "./has_special_stuff_table"; +import LoggedOutPlayerRow from "./logged_out_player_table"; +import MyPlayerRow from "./my_player_table"; +import PersonRow from "./person_table"; +import PkMultiIdentityRow from "./pk_multi_identity_table"; +import PlayerRow from "./player_table"; +import PointsRow from "./points_table"; +import PrivateTableRow from "./private_table_table"; +import RepeatingTestArgRow from "./repeating_test_arg_table"; +import TableToRemoveRow from "./table_to_remove_table"; +import TestARow from "./test_a_table"; +import TestDRow from "./test_d_table"; +import TestERow from "./test_e_table"; +import TestFRow from "./test_f_table"; + +export type HasSpecialStuff = __Infer; +export type LoggedOutPlayer = __Infer; +export type Person = __Infer; +export type PkMultiIdentity = __Infer; +export type Player = __Infer; +export type Points = __Infer; +export type PrivateTable = __Infer; +export type RepeatingTestArg = __Infer; +export type TableToRemove = __Infer; +export type TestA = __Infer; +export type TestD = __Infer; +export type TestE = __Infer; +export type TestF = __Infer; +export type MyPlayer = __Infer; + +''' "say_hello_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. @@ -1299,6 +1340,52 @@ export default { return NamespaceTestF; }, }; +''' +"types.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 { type Infer as __Infer } from "spacetimedb"; + +// Import all non-reducer types +import Baz from "./baz_type"; +import Foobar from "./foobar_type"; +import HasSpecialStuff from "./has_special_stuff_type"; +import Person from "./person_type"; +import PkMultiIdentity from "./pk_multi_identity_type"; +import Player from "./player_type"; +import Point from "./point_type"; +import PrivateTable from "./private_table_type"; +import RemoveTable from "./remove_table_type"; +import RepeatingTestArg from "./repeating_test_arg_type"; +import TestA from "./test_a_type"; +import TestB from "./test_b_type"; +import TestD from "./test_d_type"; +import TestE from "./test_e_type"; +import TestFoobar from "./test_foobar_type"; +import NamespaceTestC from "./namespace_test_c_type"; +import NamespaceTestF from "./namespace_test_f_type"; + +export type Baz = __Infer; +export type Foobar = __Infer; +export type HasSpecialStuff = __Infer; +export type Person = __Infer; +export type PkMultiIdentity = __Infer; +export type Player = __Infer; +export type Point = __Infer; +export type PrivateTable = __Infer; +export type RemoveTable = __Infer; +export type RepeatingTestArg = __Infer; +export type TestA = __Infer; +export type TestB = __Infer; +export type TestD = __Infer; +export type TestE = __Infer; +export type TestFoobar = __Infer; +export type NamespaceTestC = __Infer; +export type NamespaceTestF = __Infer; + ''' "with_tx_procedure.ts" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE From c0fc9956fa45c153a8637cdec172de2f57b1e3a8 Mon Sep 17 00:00:00 2001 From: Jeffrey Dallatezza Date: Tue, 27 Jan 2026 10:03:58 -0800 Subject: [PATCH 08/16] fmt --- crates/codegen/src/typescript.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/crates/codegen/src/typescript.rs b/crates/codegen/src/typescript.rs index 7ad1d920870..c873c0d867d 100644 --- a/crates/codegen/src/typescript.rs +++ b/crates/codegen/src/typescript.rs @@ -241,10 +241,7 @@ impl Lang for TypeScript { } writeln!(out); - writeln!( - out, - "/** Type-only namespace exports for generated type groups. */" - ); + writeln!(out, "/** Type-only namespace exports for generated type groups. */"); writeln!(out, "export type * as Rows from \"./rows\";"); writeln!(out, "export type * as Reducers from \"./reducers\";"); writeln!(out, "export type * as Procedures from \"./procedures\";"); From dbe8a0dff3bfe776501978389e28b0fdfaf53eed Mon Sep 17 00:00:00 2001 From: Jeffrey Dallatezza Date: Wed, 28 Jan 2026 09:58:04 -0800 Subject: [PATCH 09/16] fix some tests --- .../tests/db_connection.test.ts | 95 ++++++++++--------- crates/bindings-typescript/tests/utils.ts | 13 ++- 2 files changed, 56 insertions(+), 52 deletions(-) diff --git a/crates/bindings-typescript/tests/db_connection.test.ts b/crates/bindings-typescript/tests/db_connection.test.ts index 5589e2a1202..1f380349653 100644 --- a/crates/bindings-typescript/tests/db_connection.test.ts +++ b/crates/bindings-typescript/tests/db_connection.test.ts @@ -1,14 +1,15 @@ -import { - CreatePlayerReducer, - DbConnection, - Player, - User, -} from '../test-app/src/module_bindings'; +import { DbConnection, type Rows } from '../test-app/src/module_bindings'; +import CreatePlayerReducer from '../test-app/src/module_bindings/create_player_reducer'; +import Player from '../test-app/src/module_bindings/player_table'; +import User from '../test-app/src/module_bindings/user_table'; import { beforeEach, describe, expect, test } from 'vitest'; import { ConnectionId, type Infer } from '../src'; import { Timestamp } from '../src'; import { TimeDuration } from '../src'; -import * as ws from '../src/sdk/client_api'; +import CompressableQueryUpdate from '../src/sdk/client_api/compressable_query_update_type'; +import RowSizeHint from '../src/sdk/client_api/row_size_hint_type'; +import ServerMessage from '../src/sdk/client_api/server_message_type'; +import UpdateStatus from '../src/sdk/client_api/update_status_type'; import type { ReducerEvent } from '../src/sdk/db_connection_impl'; import { Identity } from '../src'; import WebsocketTestAdapter from '../src/sdk/websocket_test_adapter'; @@ -109,7 +110,7 @@ describe('DbConnection', () => { await client['wsPromise']; wsAdapter.acceptConnection(); - const tokenMessage = ws.ServerMessage.IdentityToken({ + const tokenMessage = ServerMessage.IdentityToken({ identity: anIdentity, token: 'a-token', connectionId: ConnectionId.random(), @@ -138,7 +139,7 @@ describe('DbConnection', () => { ]); wsAdapter.acceptConnection(); - const tokenMessage = ws.ServerMessage.IdentityToken({ + const tokenMessage = ServerMessage.IdentityToken({ identity: anIdentity, token: 'a-token', connectionId: ConnectionId.random(), @@ -152,7 +153,7 @@ describe('DbConnection', () => { args: Infer; }> | undefined; - player: Infer; + player: Rows.Player; }[] = []; const insert1Promise = new Deferred(); @@ -190,8 +191,8 @@ describe('DbConnection', () => { } ); - const subscriptionMessage: Infer = - ws.ServerMessage.InitialSubscription({ + const subscriptionMessage: Infer = + ServerMessage.InitialSubscription({ databaseUpdate: { tables: [ { @@ -199,13 +200,13 @@ describe('DbConnection', () => { tableName: 'player', numRows: BigInt(1), updates: [ - ws.CompressableQueryUpdate.Uncompressed({ + CompressableQueryUpdate.Uncompressed({ deletes: { - sizeHint: ws.RowSizeHint.FixedSize(0), // not used + sizeHint: RowSizeHint.FixedSize(0), // not used rowsData: new Uint8Array(), }, inserts: { - sizeHint: ws.RowSizeHint.FixedSize(0), // not used + sizeHint: RowSizeHint.FixedSize(0), // not used rowsData: encodePlayer({ id: 1, userId: anIdentity, @@ -235,21 +236,21 @@ describe('DbConnection', () => { expect(inserts[0].player.id).toEqual(1); expect(inserts[0].reducerEvent).toEqual(undefined); - const transactionUpdate = ws.ServerMessage.TransactionUpdate({ - status: ws.UpdateStatus.Committed({ + const transactionUpdate = ServerMessage.TransactionUpdate({ + status: UpdateStatus.Committed({ tables: [ { tableId: 35, tableName: 'player', numRows: BigInt(2), updates: [ - ws.CompressableQueryUpdate.Uncompressed({ + CompressableQueryUpdate.Uncompressed({ deletes: { - sizeHint: ws.RowSizeHint.FixedSize(0), // not used + sizeHint: RowSizeHint.FixedSize(0), // not used rowsData: new Uint8Array(), }, inserts: { - sizeHint: ws.RowSizeHint.FixedSize(0), // not used + sizeHint: RowSizeHint.FixedSize(0), // not used rowsData: encodePlayer({ id: 2, userId: anIdentity, @@ -321,22 +322,22 @@ describe('DbConnection', () => { updatePromise.resolve(); }); - const transactionUpdate = ws.ServerMessage.TransactionUpdate({ - status: ws.UpdateStatus.Committed({ + const transactionUpdate = ServerMessage.TransactionUpdate({ + status: UpdateStatus.Committed({ tables: [ { tableId: 35, tableName: 'player', numRows: BigInt(1), updates: [ - ws.CompressableQueryUpdate.Uncompressed({ + CompressableQueryUpdate.Uncompressed({ deletes: { - sizeHint: ws.RowSizeHint.FixedSize(0), // not used + sizeHint: RowSizeHint.FixedSize(0), // not used rowsData: new Uint8Array(), }, // FIXME: this test is evil: an initial subscription can never contain deletes or updates. inserts: { - sizeHint: ws.RowSizeHint.FixedSize(0), // not used + sizeHint: RowSizeHint.FixedSize(0), // not used rowsData: new Uint8Array([ ...encodePlayer({ id: 1, @@ -397,22 +398,22 @@ describe('DbConnection', () => { updatePromise.resolve(); }); - const transactionUpdate = ws.ServerMessage.TransactionUpdate({ - status: ws.UpdateStatus.Committed({ + const transactionUpdate = ServerMessage.TransactionUpdate({ + status: UpdateStatus.Committed({ tables: [ { tableId: 35, tableName: 'player', numRows: BigInt(1), updates: [ - ws.CompressableQueryUpdate.Uncompressed({ + CompressableQueryUpdate.Uncompressed({ deletes: { - sizeHint: ws.RowSizeHint.FixedSize(0), // not used + sizeHint: RowSizeHint.FixedSize(0), // not used rowsData: new Uint8Array(), }, // FIXME: this test is evil: an initial subscription can never contain deletes or updates. inserts: { - sizeHint: ws.RowSizeHint.FixedSize(0), // not used + sizeHint: RowSizeHint.FixedSize(0), // not used rowsData: new Uint8Array([ ...encodePlayer({ id: 2, @@ -458,7 +459,7 @@ describe('DbConnection', () => { await client['wsPromise']; wsAdapter.acceptConnection(); - const tokenMessage = ws.ServerMessage.IdentityToken({ + const tokenMessage = ServerMessage.IdentityToken({ identity: Identity.fromString( '0000000000000000000000000000000000000000000000000000000000000069' ), @@ -473,11 +474,11 @@ describe('DbConnection', () => { '41db74c20cdda916dd2637e5a11b9f31eb1672249aa7172f7e22b4043a6a9008' ); - const initialUser: Infer = { + const initialUser: Rows.User = { identity: userIdentity, username: 'originalName', }; - const updatedUser: Infer = { + const updatedUser: Rows.User = { identity: userIdentity, username: 'newName', }; @@ -498,7 +499,7 @@ describe('DbConnection', () => { update1Promise.resolve(); }); - const subscriptionMessage = ws.ServerMessage.InitialSubscription({ + const subscriptionMessage = ServerMessage.InitialSubscription({ databaseUpdate: { tables: [ { @@ -507,13 +508,13 @@ describe('DbConnection', () => { numRows: BigInt(1), updates: [ // pgoldman 2024-06-25: This is weird, `InitialSubscription`s aren't supposed to contain deletes or updates. - ws.CompressableQueryUpdate.Uncompressed({ + CompressableQueryUpdate.Uncompressed({ deletes: { - sizeHint: ws.RowSizeHint.FixedSize(0), // not used + sizeHint: RowSizeHint.FixedSize(0), // not used rowsData: new Uint8Array([]), }, inserts: { - sizeHint: ws.RowSizeHint.FixedSize(0), // not used + sizeHint: RowSizeHint.FixedSize(0), // not used rowsData: new Uint8Array([...encodeUser(initialUser)]), }, }), @@ -531,22 +532,22 @@ describe('DbConnection', () => { await initialInsertPromise.promise; console.log('First insert is done'); - const transactionUpdate = ws.ServerMessage.TransactionUpdate({ - status: ws.UpdateStatus.Committed({ + const transactionUpdate = ServerMessage.TransactionUpdate({ + status: UpdateStatus.Committed({ tables: [ { tableId: 35, tableName: 'user', numRows: BigInt(1), updates: [ - ws.CompressableQueryUpdate.Uncompressed({ + CompressableQueryUpdate.Uncompressed({ deletes: { - sizeHint: ws.RowSizeHint.FixedSize(0), // not used + sizeHint: RowSizeHint.FixedSize(0), // not used rowsData: new Uint8Array([...encodeUser(initialUser)]), }, // FIXME: this test is evil: an initial subscription can never contain deletes or updates. inserts: { - sizeHint: ws.RowSizeHint.FixedSize(0), // not used + sizeHint: RowSizeHint.FixedSize(0), // not used rowsData: new Uint8Array([...encodeUser(updatedUser)]), }, }), @@ -594,22 +595,22 @@ describe('DbConnection', () => { username: 'sally', }; const binary = [...encodeUser(user1)].concat([...encodeUser(user2)]); - const transactionUpdate = ws.ServerMessage.TransactionUpdate({ - status: ws.UpdateStatus.Committed({ + const transactionUpdate = ServerMessage.TransactionUpdate({ + status: UpdateStatus.Committed({ tables: [ { tableId: 35, tableName: 'user', numRows: BigInt(1), updates: [ - ws.CompressableQueryUpdate.Uncompressed({ + CompressableQueryUpdate.Uncompressed({ deletes: { - sizeHint: ws.RowSizeHint.FixedSize(0), // not used + sizeHint: RowSizeHint.FixedSize(0), // not used rowsData: new Uint8Array([]), }, // FIXME: this test is evil: an initial subscription can never contain deletes or updates. inserts: { - sizeHint: ws.RowSizeHint.FixedSize(0), // not used + sizeHint: RowSizeHint.FixedSize(0), // not used rowsData: new Uint8Array(binary), }, }), diff --git a/crates/bindings-typescript/tests/utils.ts b/crates/bindings-typescript/tests/utils.ts index 4ed63d7e2ed..e00ece3a001 100644 --- a/crates/bindings-typescript/tests/utils.ts +++ b/crates/bindings-typescript/tests/utils.ts @@ -2,7 +2,10 @@ import { AlgebraicType } from '../src/lib/algebraic_type'; import BinaryWriter from '../src/lib/binary_writer'; import { Identity } from '../src/lib/identity'; import type { Infer } from '../src/lib/type_builders'; -import { Player, Point, User } from '../test-app/src/module_bindings'; +import { type Rows } from '../test-app/src/module_bindings'; +import PlayerRow from '../test-app/src/module_bindings/player_table'; +import UserRow from '../test-app/src/module_bindings/user_table'; +import Point from '../test-app/src/module_bindings/point_type'; export const anIdentity = Identity.fromString( '0000000000000000000000000000000000000000000000000000000000000069' @@ -14,15 +17,15 @@ export const sallyIdentity = Identity.fromString( '000000000000000000000000000000000000000000000000000000000006a111' ); -export function encodePlayer(value: Infer): Uint8Array { +export function encodePlayer(value: Rows.Player): Uint8Array { const writer = new BinaryWriter(1024); - Player.serialize(writer, value); + PlayerRow.serialize(writer, value); return writer.getBuffer(); } -export function encodeUser(value: Infer): Uint8Array { +export function encodeUser(value: Rows.User): Uint8Array { const writer = new BinaryWriter(1024); - User.serialize(writer, value); + UserRow.serialize(writer, value); return writer.getBuffer(); } From a41319d12f7ee4290ffc3ca054955762486e1fb6 Mon Sep 17 00:00:00 2001 From: Jeffrey Dallatezza Date: Fri, 30 Jan 2026 08:49:50 -0800 Subject: [PATCH 10/16] Import from Types instead of Rows --- templates/chat-react-ts/src/App.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/chat-react-ts/src/App.tsx b/templates/chat-react-ts/src/App.tsx index e7025f3712c..2fa203a449a 100644 --- a/templates/chat-react-ts/src/App.tsx +++ b/templates/chat-react-ts/src/App.tsx @@ -1,6 +1,6 @@ import React, { useState } from 'react'; import './App.css'; -import { tables, reducers, Rows } from './module_bindings'; +import { tables, reducers, type Types } from './module_bindings'; import { useSpacetimeDB, useTable, @@ -20,7 +20,7 @@ export type PrettyMessage = { function App() { const [newName, setNewName] = useState(''); const [settingName, setSettingName] = useState(false); - const [systemMessages, setSystemMessages] = useState([] as Rows.Message[]); + const [systemMessages, setSystemMessages] = useState([] as Types.Message[]); const [newMessage, setNewMessage] = useState(''); const { identity, isActive: connected } = useSpacetimeDB(); From 1e22ef27d147e64668582eb64d420ff326c7c333 Mon Sep 17 00:00:00 2001 From: Jeffrey Dallatezza Date: Fri, 30 Jan 2026 10:46:22 -0800 Subject: [PATCH 11/16] Put ts generated type files in a subdirectory --- .../src/lib/autogen/types.ts | 101 --------- .../src/sdk/client_api/index.ts | 6 +- .../src/sdk/client_api/types/index.ts | 77 +++++++ .../client_api/types/procedures.ts} | 4 +- .../client_api/types}/reducers.ts | 2 +- .../test-app/src/module_bindings/index.ts | 6 +- .../test-app/src/module_bindings/rows.ts | 15 -- .../src/module_bindings/types/index.ts | 17 ++ .../src/module_bindings/types}/procedures.ts | 2 +- .../src/module_bindings/types/reducers.ts | 11 + .../tests/db_connection.test.ts | 8 +- crates/bindings-typescript/tests/utils.ts | 5 +- crates/cli/src/subcommands/generate.rs | 2 + .../examples/regen-typescript-moduledef.rs | 4 + crates/codegen/src/typescript.rs | 58 +---- .../codegen__codegen_typescript.snap | 210 +++++++----------- .../basic-ts/src/module_bindings/index.ts | 6 +- .../src/module_bindings/types/index.ts} | 6 +- .../src/module_bindings/types/procedures.ts | 8 + .../src/module_bindings/types/reducers.ts | 17 ++ templates/chat-react-ts/src/App.tsx | 3 +- .../src/module_bindings/index.ts | 6 +- .../{rows.ts => types/index.ts} | 10 +- .../src/module_bindings/types/procedures.ts | 8 + .../src/module_bindings/types/reducers.ts | 17 ++ .../react-ts/src/module_bindings/index.ts | 6 +- .../src/module_bindings/types/index.ts} | 6 +- .../src/module_bindings/types/procedures.ts | 8 + .../src/module_bindings/types/reducers.ts | 17 ++ templates/vue-ts/src/module_bindings/index.ts | 6 +- .../src/module_bindings/types/index.ts} | 6 +- .../src/module_bindings/types/procedures.ts | 8 + .../src/module_bindings/types/reducers.ts | 17 ++ tools/replace-spacetimedb/src/lib.rs | 14 +- 34 files changed, 347 insertions(+), 350 deletions(-) delete mode 100644 crates/bindings-typescript/src/lib/autogen/types.ts create mode 100644 crates/bindings-typescript/src/sdk/client_api/types/index.ts rename crates/bindings-typescript/src/{lib/autogen/rows.ts => sdk/client_api/types/procedures.ts} (64%) rename crates/bindings-typescript/src/{lib/autogen => sdk/client_api/types}/reducers.ts (76%) delete mode 100644 crates/bindings-typescript/test-app/src/module_bindings/rows.ts create mode 100644 crates/bindings-typescript/test-app/src/module_bindings/types/index.ts rename crates/bindings-typescript/{src/lib/autogen => test-app/src/module_bindings/types}/procedures.ts (77%) create mode 100644 crates/bindings-typescript/test-app/src/module_bindings/types/reducers.ts rename templates/{react-ts/src/module_bindings/rows.ts => basic-ts/src/module_bindings/types/index.ts} (65%) create mode 100644 templates/basic-ts/src/module_bindings/types/procedures.ts create mode 100644 templates/basic-ts/src/module_bindings/types/reducers.ts rename templates/chat-react-ts/src/module_bindings/{rows.ts => types/index.ts} (53%) create mode 100644 templates/chat-react-ts/src/module_bindings/types/procedures.ts create mode 100644 templates/chat-react-ts/src/module_bindings/types/reducers.ts rename templates/{vue-ts/src/module_bindings/rows.ts => react-ts/src/module_bindings/types/index.ts} (65%) create mode 100644 templates/react-ts/src/module_bindings/types/procedures.ts create mode 100644 templates/react-ts/src/module_bindings/types/reducers.ts rename templates/{basic-ts/src/module_bindings/rows.ts => vue-ts/src/module_bindings/types/index.ts} (65%) create mode 100644 templates/vue-ts/src/module_bindings/types/procedures.ts create mode 100644 templates/vue-ts/src/module_bindings/types/reducers.ts diff --git a/crates/bindings-typescript/src/lib/autogen/types.ts b/crates/bindings-typescript/src/lib/autogen/types.ts deleted file mode 100644 index 673f4a67b2b..00000000000 --- a/crates/bindings-typescript/src/lib/autogen/types.ts +++ /dev/null @@ -1,101 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -/* eslint-disable */ -/* tslint:disable */ -import { type Infer as __Infer } from '../../lib/type_builders'; - -// Import all non-reducer types -import AlgebraicType from './algebraic_type_type'; -import HttpHeaderPair from './http_header_pair_type'; -import HttpHeaders from './http_headers_type'; -import HttpMethod from './http_method_type'; -import HttpRequest from './http_request_type'; -import HttpResponse from './http_response_type'; -import HttpVersion from './http_version_type'; -import IndexType from './index_type_type'; -import Lifecycle from './lifecycle_type'; -import MiscModuleExport from './misc_module_export_type'; -import ProductType from './product_type_type'; -import ProductTypeElement from './product_type_element_type'; -import RawColumnDefV8 from './raw_column_def_v_8_type'; -import RawColumnDefaultValueV9 from './raw_column_default_value_v_9_type'; -import RawConstraintDataV9 from './raw_constraint_data_v_9_type'; -import RawConstraintDefV8 from './raw_constraint_def_v_8_type'; -import RawConstraintDefV9 from './raw_constraint_def_v_9_type'; -import RawIndexAlgorithm from './raw_index_algorithm_type'; -import RawIndexDefV8 from './raw_index_def_v_8_type'; -import RawIndexDefV9 from './raw_index_def_v_9_type'; -import RawMiscModuleExportV9 from './raw_misc_module_export_v_9_type'; -import RawModuleDef from './raw_module_def_type'; -import RawModuleDefV8 from './raw_module_def_v_8_type'; -import RawModuleDefV9 from './raw_module_def_v_9_type'; -import RawProcedureDefV9 from './raw_procedure_def_v_9_type'; -import RawReducerDefV9 from './raw_reducer_def_v_9_type'; -import RawRowLevelSecurityDefV9 from './raw_row_level_security_def_v_9_type'; -import RawScheduleDefV9 from './raw_schedule_def_v_9_type'; -import RawScopedTypeNameV9 from './raw_scoped_type_name_v_9_type'; -import RawSequenceDefV8 from './raw_sequence_def_v_8_type'; -import RawSequenceDefV9 from './raw_sequence_def_v_9_type'; -import RawTableDefV8 from './raw_table_def_v_8_type'; -import RawTableDefV9 from './raw_table_def_v_9_type'; -import RawTypeDefV9 from './raw_type_def_v_9_type'; -import RawUniqueConstraintDataV9 from './raw_unique_constraint_data_v_9_type'; -import RawViewDefV9 from './raw_view_def_v_9_type'; -import ReducerDef from './reducer_def_type'; -import SumType from './sum_type_type'; -import SumTypeVariant from './sum_type_variant_type'; -import TableAccess from './table_access_type'; -import TableDesc from './table_desc_type'; -import TableType from './table_type_type'; -import TypeAlias from './type_alias_type'; -import Typespace from './typespace_type'; -import ViewResultHeader from './view_result_header_type'; - -export type AlgebraicType = __Infer; -export type HttpHeaderPair = __Infer; -export type HttpHeaders = __Infer; -export type HttpMethod = __Infer; -export type HttpRequest = __Infer; -export type HttpResponse = __Infer; -export type HttpVersion = __Infer; -export type IndexType = __Infer; -export type Lifecycle = __Infer; -export type MiscModuleExport = __Infer; -export type ProductType = __Infer; -export type ProductTypeElement = __Infer; -export type RawColumnDefV8 = __Infer; -export type RawColumnDefaultValueV9 = __Infer; -export type RawConstraintDataV9 = __Infer; -export type RawConstraintDefV8 = __Infer; -export type RawConstraintDefV9 = __Infer; -export type RawIndexAlgorithm = __Infer; -export type RawIndexDefV8 = __Infer; -export type RawIndexDefV9 = __Infer; -export type RawMiscModuleExportV9 = __Infer; -export type RawModuleDef = __Infer; -export type RawModuleDefV8 = __Infer; -export type RawModuleDefV9 = __Infer; -export type RawProcedureDefV9 = __Infer; -export type RawReducerDefV9 = __Infer; -export type RawRowLevelSecurityDefV9 = __Infer; -export type RawScheduleDefV9 = __Infer; -export type RawScopedTypeNameV9 = __Infer; -export type RawSequenceDefV8 = __Infer; -export type RawSequenceDefV9 = __Infer; -export type RawTableDefV8 = __Infer; -export type RawTableDefV9 = __Infer; -export type RawTypeDefV9 = __Infer; -export type RawUniqueConstraintDataV9 = __Infer< - typeof RawUniqueConstraintDataV9 ->; -export type RawViewDefV9 = __Infer; -export type ReducerDef = __Infer; -export type SumType = __Infer; -export type SumTypeVariant = __Infer; -export type TableAccess = __Infer; -export type TableDesc = __Infer; -export type TableType = __Infer; -export type TypeAlias = __Infer; -export type Typespace = __Infer; -export type ViewResultHeader = __Infer; diff --git a/crates/bindings-typescript/src/sdk/client_api/index.ts b/crates/bindings-typescript/src/sdk/client_api/index.ts index 77a0cd4f89b..c437f74400e 100644 --- a/crates/bindings-typescript/src/sdk/client_api/index.ts +++ b/crates/bindings-typescript/src/sdk/client_api/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.3 (commit b5a7b37660b6cb7ce327f409456329e1142466e6). +// This was generated using spacetimedb cli version 1.11.3 (commit dbe8a0dff3bfe776501978389e28b0fdfaf53eed). /* eslint-disable */ /* tslint:disable */ @@ -40,10 +40,6 @@ import { // Import all table schema definitions /** Type-only namespace exports for generated type groups. */ -export type * as Rows from './rows'; -export type * as Reducers from './reducers'; -export type * as Procedures from './procedures'; -export type * as Types from './types'; /** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */ const tablesSchema = __schema(); diff --git a/crates/bindings-typescript/src/sdk/client_api/types/index.ts b/crates/bindings-typescript/src/sdk/client_api/types/index.ts new file mode 100644 index 00000000000..e031a8e7a51 --- /dev/null +++ b/crates/bindings-typescript/src/sdk/client_api/types/index.ts @@ -0,0 +1,77 @@ +// 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 { type Infer as __Infer } from '../../../lib/type_builders'; + +// Import all non-reducer types +import BsatnRowList from '../bsatn_row_list_type'; +import CallProcedure from '../call_procedure_type'; +import CallReducer from '../call_reducer_type'; +import ClientMessage from '../client_message_type'; +import CompressableQueryUpdate from '../compressable_query_update_type'; +import DatabaseUpdate from '../database_update_type'; +import EnergyQuanta from '../energy_quanta_type'; +import IdentityToken from '../identity_token_type'; +import InitialSubscription from '../initial_subscription_type'; +import OneOffQuery from '../one_off_query_type'; +import OneOffQueryResponse from '../one_off_query_response_type'; +import OneOffTable from '../one_off_table_type'; +import ProcedureResult from '../procedure_result_type'; +import ProcedureStatus from '../procedure_status_type'; +import QueryId from '../query_id_type'; +import QueryUpdate from '../query_update_type'; +import ReducerCallInfo from '../reducer_call_info_type'; +import RowSizeHint from '../row_size_hint_type'; +import ServerMessage from '../server_message_type'; +import Subscribe from '../subscribe_type'; +import SubscribeApplied from '../subscribe_applied_type'; +import SubscribeMulti from '../subscribe_multi_type'; +import SubscribeMultiApplied from '../subscribe_multi_applied_type'; +import SubscribeRows from '../subscribe_rows_type'; +import SubscribeSingle from '../subscribe_single_type'; +import SubscriptionError from '../subscription_error_type'; +import TableUpdate from '../table_update_type'; +import TransactionUpdate from '../transaction_update_type'; +import TransactionUpdateLight from '../transaction_update_light_type'; +import Unsubscribe from '../unsubscribe_type'; +import UnsubscribeApplied from '../unsubscribe_applied_type'; +import UnsubscribeMulti from '../unsubscribe_multi_type'; +import UnsubscribeMultiApplied from '../unsubscribe_multi_applied_type'; +import UpdateStatus from '../update_status_type'; + +export type BsatnRowList = __Infer; +export type CallProcedure = __Infer; +export type CallReducer = __Infer; +export type ClientMessage = __Infer; +export type CompressableQueryUpdate = __Infer; +export type DatabaseUpdate = __Infer; +export type EnergyQuanta = __Infer; +export type IdentityToken = __Infer; +export type InitialSubscription = __Infer; +export type OneOffQuery = __Infer; +export type OneOffQueryResponse = __Infer; +export type OneOffTable = __Infer; +export type ProcedureResult = __Infer; +export type ProcedureStatus = __Infer; +export type QueryId = __Infer; +export type QueryUpdate = __Infer; +export type ReducerCallInfo = __Infer; +export type RowSizeHint = __Infer; +export type ServerMessage = __Infer; +export type Subscribe = __Infer; +export type SubscribeApplied = __Infer; +export type SubscribeMulti = __Infer; +export type SubscribeMultiApplied = __Infer; +export type SubscribeRows = __Infer; +export type SubscribeSingle = __Infer; +export type SubscriptionError = __Infer; +export type TableUpdate = __Infer; +export type TransactionUpdate = __Infer; +export type TransactionUpdateLight = __Infer; +export type Unsubscribe = __Infer; +export type UnsubscribeApplied = __Infer; +export type UnsubscribeMulti = __Infer; +export type UnsubscribeMultiApplied = __Infer; +export type UpdateStatus = __Infer; diff --git a/crates/bindings-typescript/src/lib/autogen/rows.ts b/crates/bindings-typescript/src/sdk/client_api/types/procedures.ts similarity index 64% rename from crates/bindings-typescript/src/lib/autogen/rows.ts rename to crates/bindings-typescript/src/sdk/client_api/types/procedures.ts index 693f6effe27..8726cd8baf0 100644 --- a/crates/bindings-typescript/src/lib/autogen/rows.ts +++ b/crates/bindings-typescript/src/sdk/client_api/types/procedures.ts @@ -3,6 +3,6 @@ /* eslint-disable */ /* tslint:disable */ -import { type Infer as __Infer } from '../../lib/type_builders'; +import { type Infer as __Infer } from '../../../lib/type_builders'; -// Import all table schema definitions +// Import all procedure arg schemas diff --git a/crates/bindings-typescript/src/lib/autogen/reducers.ts b/crates/bindings-typescript/src/sdk/client_api/types/reducers.ts similarity index 76% rename from crates/bindings-typescript/src/lib/autogen/reducers.ts rename to crates/bindings-typescript/src/sdk/client_api/types/reducers.ts index 69fa905ce4f..183aff65fa7 100644 --- a/crates/bindings-typescript/src/lib/autogen/reducers.ts +++ b/crates/bindings-typescript/src/sdk/client_api/types/reducers.ts @@ -3,6 +3,6 @@ /* eslint-disable */ /* tslint:disable */ -import { type Infer as __Infer } from '../../lib/type_builders'; +import { type Infer as __Infer } from '../../../lib/type_builders'; // Import all reducer arg schemas diff --git a/crates/bindings-typescript/test-app/src/module_bindings/index.ts b/crates/bindings-typescript/test-app/src/module_bindings/index.ts index 41be99e7b37..8ccbd096d65 100644 --- a/crates/bindings-typescript/test-app/src/module_bindings/index.ts +++ b/crates/bindings-typescript/test-app/src/module_bindings/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.3 (commit b5a7b37660b6cb7ce327f409456329e1142466e6). +// This was generated using spacetimedb cli version 1.11.3 (commit dbe8a0dff3bfe776501978389e28b0fdfaf53eed). /* eslint-disable */ /* tslint:disable */ @@ -44,10 +44,6 @@ import UnindexedPlayerRow from './unindexed_player_table'; import UserRow from './user_table'; /** Type-only namespace exports for generated type groups. */ -export type * as Rows from './rows'; -export type * as Reducers from './reducers'; -export type * as Procedures from './procedures'; -export type * as Types from './types'; /** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */ const tablesSchema = __schema( diff --git a/crates/bindings-typescript/test-app/src/module_bindings/rows.ts b/crates/bindings-typescript/test-app/src/module_bindings/rows.ts deleted file mode 100644 index 904ba9a3f12..00000000000 --- a/crates/bindings-typescript/test-app/src/module_bindings/rows.ts +++ /dev/null @@ -1,15 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -/* eslint-disable */ -/* tslint:disable */ -import { type Infer as __Infer } from '../../../src/index'; - -// Import all table schema definitions -import PlayerRow from './player_table'; -import UnindexedPlayerRow from './unindexed_player_table'; -import UserRow from './user_table'; - -export type Player = __Infer; -export type UnindexedPlayer = __Infer; -export type User = __Infer; diff --git a/crates/bindings-typescript/test-app/src/module_bindings/types/index.ts b/crates/bindings-typescript/test-app/src/module_bindings/types/index.ts new file mode 100644 index 00000000000..c16e6c5e5b3 --- /dev/null +++ b/crates/bindings-typescript/test-app/src/module_bindings/types/index.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { type Infer as __Infer } from '../../../../src/index'; + +// Import all non-reducer types +import Player from '../player_type'; +import Point from '../point_type'; +import UnindexedPlayer from '../unindexed_player_type'; +import User from '../user_type'; + +export type Player = __Infer; +export type Point = __Infer; +export type UnindexedPlayer = __Infer; +export type User = __Infer; diff --git a/crates/bindings-typescript/src/lib/autogen/procedures.ts b/crates/bindings-typescript/test-app/src/module_bindings/types/procedures.ts similarity index 77% rename from crates/bindings-typescript/src/lib/autogen/procedures.ts rename to crates/bindings-typescript/test-app/src/module_bindings/types/procedures.ts index 6625edb1b2e..a39363a990e 100644 --- a/crates/bindings-typescript/src/lib/autogen/procedures.ts +++ b/crates/bindings-typescript/test-app/src/module_bindings/types/procedures.ts @@ -3,6 +3,6 @@ /* eslint-disable */ /* tslint:disable */ -import { type Infer as __Infer } from '../../lib/type_builders'; +import { type Infer as __Infer } from '../../../../src/index'; // Import all procedure arg schemas diff --git a/crates/bindings-typescript/test-app/src/module_bindings/types/reducers.ts b/crates/bindings-typescript/test-app/src/module_bindings/types/reducers.ts new file mode 100644 index 00000000000..086e5bc5a2d --- /dev/null +++ b/crates/bindings-typescript/test-app/src/module_bindings/types/reducers.ts @@ -0,0 +1,11 @@ +// 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 { type Infer as __Infer } from '../../../../src/index'; + +// Import all reducer arg schemas +import CreatePlayerReducer from '../create_player_reducer'; + +export type CreatePlayerArgs = __Infer; diff --git a/crates/bindings-typescript/tests/db_connection.test.ts b/crates/bindings-typescript/tests/db_connection.test.ts index 1f380349653..897e228e40b 100644 --- a/crates/bindings-typescript/tests/db_connection.test.ts +++ b/crates/bindings-typescript/tests/db_connection.test.ts @@ -1,4 +1,4 @@ -import { DbConnection, type Rows } from '../test-app/src/module_bindings'; +import { DbConnection } from '../test-app/src/module_bindings'; import CreatePlayerReducer from '../test-app/src/module_bindings/create_player_reducer'; import Player from '../test-app/src/module_bindings/player_table'; import User from '../test-app/src/module_bindings/user_table'; @@ -153,7 +153,7 @@ describe('DbConnection', () => { args: Infer; }> | undefined; - player: Rows.Player; + player: Infer; }[] = []; const insert1Promise = new Deferred(); @@ -474,11 +474,11 @@ describe('DbConnection', () => { '41db74c20cdda916dd2637e5a11b9f31eb1672249aa7172f7e22b4043a6a9008' ); - const initialUser: Rows.User = { + const initialUser: Infer = { identity: userIdentity, username: 'originalName', }; - const updatedUser: Rows.User = { + const updatedUser: Infer = { identity: userIdentity, username: 'newName', }; diff --git a/crates/bindings-typescript/tests/utils.ts b/crates/bindings-typescript/tests/utils.ts index e00ece3a001..a0164fdbd35 100644 --- a/crates/bindings-typescript/tests/utils.ts +++ b/crates/bindings-typescript/tests/utils.ts @@ -2,7 +2,6 @@ import { AlgebraicType } from '../src/lib/algebraic_type'; import BinaryWriter from '../src/lib/binary_writer'; import { Identity } from '../src/lib/identity'; import type { Infer } from '../src/lib/type_builders'; -import { type Rows } from '../test-app/src/module_bindings'; import PlayerRow from '../test-app/src/module_bindings/player_table'; import UserRow from '../test-app/src/module_bindings/user_table'; import Point from '../test-app/src/module_bindings/point_type'; @@ -17,13 +16,13 @@ export const sallyIdentity = Identity.fromString( '000000000000000000000000000000000000000000000000000000000006a111' ); -export function encodePlayer(value: Rows.Player): Uint8Array { +export function encodePlayer(value: Infer): Uint8Array { const writer = new BinaryWriter(1024); PlayerRow.serialize(writer, value); return writer.getBuffer(); } -export function encodeUser(value: Rows.User): Uint8Array { +export function encodeUser(value: Infer): Uint8Array { const writer = new BinaryWriter(1024); UserRow.serialize(writer, value); return writer.getBuffer(); diff --git a/crates/cli/src/subcommands/generate.rs b/crates/cli/src/subcommands/generate.rs index 4e6fb5ec124..48e70c25aaf 100644 --- a/crates/cli/src/subcommands/generate.rs +++ b/crates/cli/src/subcommands/generate.rs @@ -197,10 +197,12 @@ pub async fn exec_ex( let fname = Path::new(&filename); // If a generator asks for a file in a subdirectory, create the subdirectory first. if let Some(parent) = fname.parent().filter(|p| !p.as_os_str().is_empty()) { + println!("Creating directory {}", out_dir.join(parent).display()); fs::create_dir_all(out_dir.join(parent))?; } let path = out_dir.join(fname); if !path.exists() || fs::read_to_string(&path)? != code { + println!("Writing file {}", path.display()); fs::write(&path, code)?; } paths.insert(path); diff --git a/crates/codegen/examples/regen-typescript-moduledef.rs b/crates/codegen/examples/regen-typescript-moduledef.rs index 47ecb692863..3c7e511da0d 100644 --- a/crates/codegen/examples/regen-typescript-moduledef.rs +++ b/crates/codegen/examples/regen-typescript-moduledef.rs @@ -45,6 +45,10 @@ fn main() -> anyhow::Result<()> { if filename == "index.ts" { return Ok(()); } + // We don't need the convenience types. + if filename.starts_with("types/") { + return Ok(()); + } let code = regex_replace!(&code, r#"from "spacetimedb";"#, r#"from "../../lib/type_builders";"#); // Elide types which are related to client-side only things diff --git a/crates/codegen/src/typescript.rs b/crates/codegen/src/typescript.rs index c873c0d867d..8f0e07303c7 100644 --- a/crates/codegen/src/typescript.rs +++ b/crates/codegen/src/typescript.rs @@ -242,10 +242,6 @@ impl Lang for TypeScript { writeln!(out); writeln!(out, "/** Type-only namespace exports for generated type groups. */"); - writeln!(out, "export type * as Rows from \"./rows\";"); - writeln!(out, "export type * as Reducers from \"./reducers\";"); - writeln!(out, "export type * as Procedures from \"./procedures\";"); - writeln!(out, "export type * as Types from \"./types\";"); writeln!(out); writeln!(out, "/** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */"); @@ -449,51 +445,11 @@ impl Lang for TypeScript { code: output.into_inner(), }; - let rows_file = generate_rows_file(module); let reducers_file = generate_reducers_file(module); let procedures_file = generate_procedures_file(module); let types_file = generate_types_file(module); - vec![index_file, rows_file, reducers_file, procedures_file, types_file] - } -} - -fn generate_rows_file(module: &ModuleDef) -> OutputFile { - let mut output = CodeIndenter::new(String::new(), INDENT); - let out = &mut output; - - print_auto_generated_file_comment(out); - print_lint_suppression(out); - writeln!(out, "import {{ type Infer as __Infer }} from \"spacetimedb\";"); - - writeln!(out); - writeln!(out, "// Import all table schema definitions"); - for (table_name, _) in iter_table_names_and_types(module) { - let table_module_name = table_module_name(table_name); - let table_name_pascalcase = table_name.deref().to_case(Case::Pascal); - writeln!(out, "import {table_name_pascalcase}Row from \"./{table_module_name}\";"); - } - - writeln!(out); - for table in iter_tables(module) { - let table_name_pascalcase = table.name.deref().to_case(Case::Pascal); - writeln!( - out, - "export type {table_name_pascalcase} = __Infer;" - ); - } - for view in iter_views(module) { - let view_name_pascalcase = view.name.deref().to_case(Case::Pascal); - writeln!( - out, - "export type {view_name_pascalcase} = __Infer;" - ); - } - out.newline(); - - OutputFile { - filename: "rows.ts".to_string(), - code: output.into_inner(), + vec![index_file, reducers_file, procedures_file, types_file] } } @@ -511,7 +467,7 @@ fn generate_reducers_file(module: &ModuleDef) -> OutputFile { let reducer_name = &reducer.name; let reducer_module_name = reducer_module_name(reducer_name); let args_type = reducer_args_type_name(&reducer.name); - writeln!(out, "import {args_type} from \"./{reducer_module_name}\";"); + writeln!(out, "import {args_type} from \"../{reducer_module_name}\";"); } writeln!(out); @@ -526,7 +482,7 @@ fn generate_reducers_file(module: &ModuleDef) -> OutputFile { out.newline(); OutputFile { - filename: "reducers.ts".to_string(), + filename: "types/reducers.ts".to_string(), code: output.into_inner(), } } @@ -545,7 +501,7 @@ fn generate_procedures_file(module: &ModuleDef) -> OutputFile { let procedure_name = &procedure.name; let procedure_module_name = procedure_module_name(procedure_name); let args_type = procedure_args_type_name(&procedure.name); - writeln!(out, "import * as {args_type} from \"./{procedure_module_name}\";"); + writeln!(out, "import * as {args_type} from \"../{procedure_module_name}\";"); } writeln!(out); @@ -564,7 +520,7 @@ fn generate_procedures_file(module: &ModuleDef) -> OutputFile { out.newline(); OutputFile { - filename: "procedures.ts".to_string(), + filename: "types/procedures.ts".to_string(), code: output.into_inner(), } } @@ -590,7 +546,7 @@ fn generate_types_file(module: &ModuleDef) -> OutputFile { continue; } let type_module_name = type_module_name(&ty.name); - writeln!(out, "import {type_name} from \"./{type_module_name}\";"); + writeln!(out, "import {type_name} from \"../{type_module_name}\";"); } writeln!(out); @@ -604,7 +560,7 @@ fn generate_types_file(module: &ModuleDef) -> OutputFile { out.newline(); OutputFile { - filename: "types.ts".to_string(), + filename: "types/index.ts".to_string(), code: output.into_inner(), } } diff --git a/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap b/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap index 7a8828d893e..514228c2e03 100644 --- a/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap +++ b/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap @@ -292,10 +292,8 @@ import TestERow from "./test_e_table"; import TestFRow from "./test_f_table"; /** Type-only namespace exports for generated type groups. */ -export type * as Rows from "./rows"; -export type * as Reducers from "./reducers"; -export type * as Procedures from "./procedures"; -export type * as Types from "./types"; +export type * as Reducers from "./types/reducers"; +export type * as Procedures from "./types/procedures"; /** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */ const tablesSchema = __schema( @@ -841,30 +839,6 @@ export default __t.object("PrivateTable", { }); -''' -"procedures.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 { type Infer as __Infer } from "spacetimedb"; - -// Import all procedure arg schemas -import * as GetMySchemaViaHttpProcedure from "./get_my_schema_via_http_procedure"; -import * as ReturnValueProcedure from "./return_value_procedure"; -import * as SleepOneSecondProcedure from "./sleep_one_second_procedure"; -import * as WithTxProcedure from "./with_tx_procedure"; - -export type GetMySchemaViaHttpArgs = __Infer; -export type GetMySchemaViaHttpResult = __Infer; -export type ReturnValueArgs = __Infer; -export type ReturnValueResult = __Infer; -export type SleepOneSecondArgs = __Infer; -export type SleepOneSecondResult = __Infer; -export type WithTxArgs = __Infer; -export type WithTxResult = __Infer; - ''' "query_private_reducer.ts" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE @@ -880,46 +854,6 @@ import { } from "spacetimedb"; export default {}; -''' -"reducers.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 { type Infer as __Infer } from "spacetimedb"; - -// Import all reducer arg schemas -import AddReducer from "./add_reducer"; -import AddPlayerReducer from "./add_player_reducer"; -import AddPrivateReducer from "./add_private_reducer"; -import AssertCallerIdentityIsModuleIdentityReducer from "./assert_caller_identity_is_module_identity_reducer"; -import ClientConnectedReducer from "./client_connected_reducer"; -import DeletePlayerReducer from "./delete_player_reducer"; -import DeletePlayersByNameReducer from "./delete_players_by_name_reducer"; -import ListOverAgeReducer from "./list_over_age_reducer"; -import LogModuleIdentityReducer from "./log_module_identity_reducer"; -import QueryPrivateReducer from "./query_private_reducer"; -import RepeatingTestReducer from "./repeating_test_reducer"; -import SayHelloReducer from "./say_hello_reducer"; -import TestReducer from "./test_reducer"; -import TestBtreeIndexArgsReducer from "./test_btree_index_args_reducer"; - -export type AddArgs = __Infer; -export type AddPlayerArgs = __Infer; -export type AddPrivateArgs = __Infer; -export type AssertCallerIdentityIsModuleIdentityArgs = __Infer; -export type ClientConnectedArgs = __Infer; -export type DeletePlayerArgs = __Infer; -export type DeletePlayersByNameArgs = __Infer; -export type ListOverAgeArgs = __Infer; -export type LogModuleIdentityArgs = __Infer; -export type QueryPrivateArgs = __Infer; -export type RepeatingTestArgs = __Infer; -export type SayHelloArgs = __Infer; -export type TestArgs = __Infer; -export type TestBtreeIndexArgsArgs = __Infer; - ''' "remove_table_type.ts" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE @@ -1020,46 +954,6 @@ export const params = { foo: __t.u64(), }; export const returnType = Baz''' -"rows.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 { type Infer as __Infer } from "spacetimedb"; - -// Import all table schema definitions -import HasSpecialStuffRow from "./has_special_stuff_table"; -import LoggedOutPlayerRow from "./logged_out_player_table"; -import MyPlayerRow from "./my_player_table"; -import PersonRow from "./person_table"; -import PkMultiIdentityRow from "./pk_multi_identity_table"; -import PlayerRow from "./player_table"; -import PointsRow from "./points_table"; -import PrivateTableRow from "./private_table_table"; -import RepeatingTestArgRow from "./repeating_test_arg_table"; -import TableToRemoveRow from "./table_to_remove_table"; -import TestARow from "./test_a_table"; -import TestDRow from "./test_d_table"; -import TestERow from "./test_e_table"; -import TestFRow from "./test_f_table"; - -export type HasSpecialStuff = __Infer; -export type LoggedOutPlayer = __Infer; -export type Person = __Infer; -export type PkMultiIdentity = __Infer; -export type Player = __Infer; -export type Points = __Infer; -export type PrivateTable = __Infer; -export type RepeatingTestArg = __Infer; -export type TableToRemove = __Infer; -export type TestA = __Infer; -export type TestD = __Infer; -export type TestE = __Infer; -export type TestF = __Infer; -export type MyPlayer = __Infer; - -''' "say_hello_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. @@ -1341,7 +1235,7 @@ export default { }, }; ''' -"types.ts" = ''' +"types/index.ts" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. @@ -1350,23 +1244,23 @@ export default { import { type Infer as __Infer } from "spacetimedb"; // Import all non-reducer types -import Baz from "./baz_type"; -import Foobar from "./foobar_type"; -import HasSpecialStuff from "./has_special_stuff_type"; -import Person from "./person_type"; -import PkMultiIdentity from "./pk_multi_identity_type"; -import Player from "./player_type"; -import Point from "./point_type"; -import PrivateTable from "./private_table_type"; -import RemoveTable from "./remove_table_type"; -import RepeatingTestArg from "./repeating_test_arg_type"; -import TestA from "./test_a_type"; -import TestB from "./test_b_type"; -import TestD from "./test_d_type"; -import TestE from "./test_e_type"; -import TestFoobar from "./test_foobar_type"; -import NamespaceTestC from "./namespace_test_c_type"; -import NamespaceTestF from "./namespace_test_f_type"; +import Baz from "../baz_type"; +import Foobar from "../foobar_type"; +import HasSpecialStuff from "../has_special_stuff_type"; +import Person from "../person_type"; +import PkMultiIdentity from "../pk_multi_identity_type"; +import Player from "../player_type"; +import Point from "../point_type"; +import PrivateTable from "../private_table_type"; +import RemoveTable from "../remove_table_type"; +import RepeatingTestArg from "../repeating_test_arg_type"; +import TestA from "../test_a_type"; +import TestB from "../test_b_type"; +import TestD from "../test_d_type"; +import TestE from "../test_e_type"; +import TestFoobar from "../test_foobar_type"; +import NamespaceTestC from "../namespace_test_c_type"; +import NamespaceTestF from "../namespace_test_f_type"; export type Baz = __Infer; export type Foobar = __Infer; @@ -1386,6 +1280,70 @@ export type TestFoobar = __Infer; export type NamespaceTestC = __Infer; export type NamespaceTestF = __Infer; +''' +"types/procedures.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 { type Infer as __Infer } from "spacetimedb"; + +// Import all procedure arg schemas +import * as GetMySchemaViaHttpProcedure from "../get_my_schema_via_http_procedure"; +import * as ReturnValueProcedure from "../return_value_procedure"; +import * as SleepOneSecondProcedure from "../sleep_one_second_procedure"; +import * as WithTxProcedure from "../with_tx_procedure"; + +export type GetMySchemaViaHttpArgs = __Infer; +export type GetMySchemaViaHttpResult = __Infer; +export type ReturnValueArgs = __Infer; +export type ReturnValueResult = __Infer; +export type SleepOneSecondArgs = __Infer; +export type SleepOneSecondResult = __Infer; +export type WithTxArgs = __Infer; +export type WithTxResult = __Infer; + +''' +"types/reducers.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 { type Infer as __Infer } from "spacetimedb"; + +// Import all reducer arg schemas +import AddReducer from "../add_reducer"; +import AddPlayerReducer from "../add_player_reducer"; +import AddPrivateReducer from "../add_private_reducer"; +import AssertCallerIdentityIsModuleIdentityReducer from "../assert_caller_identity_is_module_identity_reducer"; +import ClientConnectedReducer from "../client_connected_reducer"; +import DeletePlayerReducer from "../delete_player_reducer"; +import DeletePlayersByNameReducer from "../delete_players_by_name_reducer"; +import ListOverAgeReducer from "../list_over_age_reducer"; +import LogModuleIdentityReducer from "../log_module_identity_reducer"; +import QueryPrivateReducer from "../query_private_reducer"; +import RepeatingTestReducer from "../repeating_test_reducer"; +import SayHelloReducer from "../say_hello_reducer"; +import TestReducer from "../test_reducer"; +import TestBtreeIndexArgsReducer from "../test_btree_index_args_reducer"; + +export type AddArgs = __Infer; +export type AddPlayerArgs = __Infer; +export type AddPrivateArgs = __Infer; +export type AssertCallerIdentityIsModuleIdentityArgs = __Infer; +export type ClientConnectedArgs = __Infer; +export type DeletePlayerArgs = __Infer; +export type DeletePlayersByNameArgs = __Infer; +export type ListOverAgeArgs = __Infer; +export type LogModuleIdentityArgs = __Infer; +export type QueryPrivateArgs = __Infer; +export type RepeatingTestArgs = __Infer; +export type SayHelloArgs = __Infer; +export type TestArgs = __Infer; +export type TestBtreeIndexArgsArgs = __Infer; + ''' "with_tx_procedure.ts" = ''' // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE diff --git a/templates/basic-ts/src/module_bindings/index.ts b/templates/basic-ts/src/module_bindings/index.ts index dea9b5470e0..003de49a6cb 100644 --- a/templates/basic-ts/src/module_bindings/index.ts +++ b/templates/basic-ts/src/module_bindings/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.3 (commit c06bf8b59468ce56b6731c98302ad4fe4b7cc931). +// This was generated using spacetimedb cli version 1.11.3 (commit dbe8a0dff3bfe776501978389e28b0fdfaf53eed). /* eslint-disable */ /* tslint:disable */ @@ -43,10 +43,6 @@ import SayHelloReducer from './say_hello_reducer'; import PersonRow from './person_table'; /** Type-only namespace exports for generated type groups. */ -export type * as Rows from './rows'; -export type * as Reducers from './reducers'; -export type * as Procedures from './procedures'; -export type * as Types from './types'; /** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */ const tablesSchema = __schema( diff --git a/templates/react-ts/src/module_bindings/rows.ts b/templates/basic-ts/src/module_bindings/types/index.ts similarity index 65% rename from templates/react-ts/src/module_bindings/rows.ts rename to templates/basic-ts/src/module_bindings/types/index.ts index 8fad581583d..06296d8bf15 100644 --- a/templates/react-ts/src/module_bindings/rows.ts +++ b/templates/basic-ts/src/module_bindings/types/index.ts @@ -5,7 +5,7 @@ /* tslint:disable */ import { type Infer as __Infer } from 'spacetimedb'; -// Import all table schema definitions -import PersonRow from './person_table'; +// Import all non-reducer types +import Person from '../person_type'; -export type Person = __Infer; +export type Person = __Infer; diff --git a/templates/basic-ts/src/module_bindings/types/procedures.ts b/templates/basic-ts/src/module_bindings/types/procedures.ts new file mode 100644 index 00000000000..b2102264f4d --- /dev/null +++ b/templates/basic-ts/src/module_bindings/types/procedures.ts @@ -0,0 +1,8 @@ +// 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 { type Infer as __Infer } from 'spacetimedb'; + +// Import all procedure arg schemas diff --git a/templates/basic-ts/src/module_bindings/types/reducers.ts b/templates/basic-ts/src/module_bindings/types/reducers.ts new file mode 100644 index 00000000000..9f40b85850c --- /dev/null +++ b/templates/basic-ts/src/module_bindings/types/reducers.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { type Infer as __Infer } from 'spacetimedb'; + +// Import all reducer arg schemas +import OnConnectReducer from '../on_connect_reducer'; +import OnDisconnectReducer from '../on_disconnect_reducer'; +import AddReducer from '../add_reducer'; +import SayHelloReducer from '../say_hello_reducer'; + +export type OnConnectArgs = __Infer; +export type OnDisconnectArgs = __Infer; +export type AddArgs = __Infer; +export type SayHelloArgs = __Infer; diff --git a/templates/chat-react-ts/src/App.tsx b/templates/chat-react-ts/src/App.tsx index 2fa203a449a..0b91e48ecd1 100644 --- a/templates/chat-react-ts/src/App.tsx +++ b/templates/chat-react-ts/src/App.tsx @@ -1,6 +1,7 @@ import React, { useState } from 'react'; import './App.css'; -import { tables, reducers, type Types } from './module_bindings'; +import { tables, reducers } from './module_bindings'; +import type * as Types from './module_bindings/types'; import { useSpacetimeDB, useTable, diff --git a/templates/chat-react-ts/src/module_bindings/index.ts b/templates/chat-react-ts/src/module_bindings/index.ts index be96c277b6e..90c95e8c179 100644 --- a/templates/chat-react-ts/src/module_bindings/index.ts +++ b/templates/chat-react-ts/src/module_bindings/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.3 (commit c06bf8b59468ce56b6731c98302ad4fe4b7cc931). +// This was generated using spacetimedb cli version 1.11.3 (commit dbe8a0dff3bfe776501978389e28b0fdfaf53eed). /* eslint-disable */ /* tslint:disable */ @@ -44,10 +44,6 @@ import MessageRow from './message_table'; import UserRow from './user_table'; /** Type-only namespace exports for generated type groups. */ -export type * as Rows from './rows'; -export type * as Reducers from './reducers'; -export type * as Procedures from './procedures'; -export type * as Types from './types'; /** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */ const tablesSchema = __schema( diff --git a/templates/chat-react-ts/src/module_bindings/rows.ts b/templates/chat-react-ts/src/module_bindings/types/index.ts similarity index 53% rename from templates/chat-react-ts/src/module_bindings/rows.ts rename to templates/chat-react-ts/src/module_bindings/types/index.ts index 4ca40647ec6..b1c4f33f07a 100644 --- a/templates/chat-react-ts/src/module_bindings/rows.ts +++ b/templates/chat-react-ts/src/module_bindings/types/index.ts @@ -5,9 +5,9 @@ /* tslint:disable */ import { type Infer as __Infer } from 'spacetimedb'; -// Import all table schema definitions -import MessageRow from './message_table'; -import UserRow from './user_table'; +// Import all non-reducer types +import Message from '../message_type'; +import User from '../user_type'; -export type Message = __Infer; -export type User = __Infer; +export type Message = __Infer; +export type User = __Infer; diff --git a/templates/chat-react-ts/src/module_bindings/types/procedures.ts b/templates/chat-react-ts/src/module_bindings/types/procedures.ts new file mode 100644 index 00000000000..b2102264f4d --- /dev/null +++ b/templates/chat-react-ts/src/module_bindings/types/procedures.ts @@ -0,0 +1,8 @@ +// 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 { type Infer as __Infer } from 'spacetimedb'; + +// Import all procedure arg schemas diff --git a/templates/chat-react-ts/src/module_bindings/types/reducers.ts b/templates/chat-react-ts/src/module_bindings/types/reducers.ts new file mode 100644 index 00000000000..8f6f02eb73d --- /dev/null +++ b/templates/chat-react-ts/src/module_bindings/types/reducers.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { type Infer as __Infer } from 'spacetimedb'; + +// Import all reducer arg schemas +import SetNameReducer from '../set_name_reducer'; +import SendMessageReducer from '../send_message_reducer'; +import OnConnectReducer from '../on_connect_reducer'; +import OnDisconnectReducer from '../on_disconnect_reducer'; + +export type SetNameArgs = __Infer; +export type SendMessageArgs = __Infer; +export type OnConnectArgs = __Infer; +export type OnDisconnectArgs = __Infer; diff --git a/templates/react-ts/src/module_bindings/index.ts b/templates/react-ts/src/module_bindings/index.ts index dea9b5470e0..003de49a6cb 100644 --- a/templates/react-ts/src/module_bindings/index.ts +++ b/templates/react-ts/src/module_bindings/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.3 (commit c06bf8b59468ce56b6731c98302ad4fe4b7cc931). +// This was generated using spacetimedb cli version 1.11.3 (commit dbe8a0dff3bfe776501978389e28b0fdfaf53eed). /* eslint-disable */ /* tslint:disable */ @@ -43,10 +43,6 @@ import SayHelloReducer from './say_hello_reducer'; import PersonRow from './person_table'; /** Type-only namespace exports for generated type groups. */ -export type * as Rows from './rows'; -export type * as Reducers from './reducers'; -export type * as Procedures from './procedures'; -export type * as Types from './types'; /** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */ const tablesSchema = __schema( diff --git a/templates/vue-ts/src/module_bindings/rows.ts b/templates/react-ts/src/module_bindings/types/index.ts similarity index 65% rename from templates/vue-ts/src/module_bindings/rows.ts rename to templates/react-ts/src/module_bindings/types/index.ts index 8fad581583d..06296d8bf15 100644 --- a/templates/vue-ts/src/module_bindings/rows.ts +++ b/templates/react-ts/src/module_bindings/types/index.ts @@ -5,7 +5,7 @@ /* tslint:disable */ import { type Infer as __Infer } from 'spacetimedb'; -// Import all table schema definitions -import PersonRow from './person_table'; +// Import all non-reducer types +import Person from '../person_type'; -export type Person = __Infer; +export type Person = __Infer; diff --git a/templates/react-ts/src/module_bindings/types/procedures.ts b/templates/react-ts/src/module_bindings/types/procedures.ts new file mode 100644 index 00000000000..b2102264f4d --- /dev/null +++ b/templates/react-ts/src/module_bindings/types/procedures.ts @@ -0,0 +1,8 @@ +// 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 { type Infer as __Infer } from 'spacetimedb'; + +// Import all procedure arg schemas diff --git a/templates/react-ts/src/module_bindings/types/reducers.ts b/templates/react-ts/src/module_bindings/types/reducers.ts new file mode 100644 index 00000000000..9f40b85850c --- /dev/null +++ b/templates/react-ts/src/module_bindings/types/reducers.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { type Infer as __Infer } from 'spacetimedb'; + +// Import all reducer arg schemas +import OnConnectReducer from '../on_connect_reducer'; +import OnDisconnectReducer from '../on_disconnect_reducer'; +import AddReducer from '../add_reducer'; +import SayHelloReducer from '../say_hello_reducer'; + +export type OnConnectArgs = __Infer; +export type OnDisconnectArgs = __Infer; +export type AddArgs = __Infer; +export type SayHelloArgs = __Infer; diff --git a/templates/vue-ts/src/module_bindings/index.ts b/templates/vue-ts/src/module_bindings/index.ts index dea9b5470e0..003de49a6cb 100644 --- a/templates/vue-ts/src/module_bindings/index.ts +++ b/templates/vue-ts/src/module_bindings/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.3 (commit c06bf8b59468ce56b6731c98302ad4fe4b7cc931). +// This was generated using spacetimedb cli version 1.11.3 (commit dbe8a0dff3bfe776501978389e28b0fdfaf53eed). /* eslint-disable */ /* tslint:disable */ @@ -43,10 +43,6 @@ import SayHelloReducer from './say_hello_reducer'; import PersonRow from './person_table'; /** Type-only namespace exports for generated type groups. */ -export type * as Rows from './rows'; -export type * as Reducers from './reducers'; -export type * as Procedures from './procedures'; -export type * as Types from './types'; /** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */ const tablesSchema = __schema( diff --git a/templates/basic-ts/src/module_bindings/rows.ts b/templates/vue-ts/src/module_bindings/types/index.ts similarity index 65% rename from templates/basic-ts/src/module_bindings/rows.ts rename to templates/vue-ts/src/module_bindings/types/index.ts index 8fad581583d..06296d8bf15 100644 --- a/templates/basic-ts/src/module_bindings/rows.ts +++ b/templates/vue-ts/src/module_bindings/types/index.ts @@ -5,7 +5,7 @@ /* tslint:disable */ import { type Infer as __Infer } from 'spacetimedb'; -// Import all table schema definitions -import PersonRow from './person_table'; +// Import all non-reducer types +import Person from '../person_type'; -export type Person = __Infer; +export type Person = __Infer; diff --git a/templates/vue-ts/src/module_bindings/types/procedures.ts b/templates/vue-ts/src/module_bindings/types/procedures.ts new file mode 100644 index 00000000000..b2102264f4d --- /dev/null +++ b/templates/vue-ts/src/module_bindings/types/procedures.ts @@ -0,0 +1,8 @@ +// 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 { type Infer as __Infer } from 'spacetimedb'; + +// Import all procedure arg schemas diff --git a/templates/vue-ts/src/module_bindings/types/reducers.ts b/templates/vue-ts/src/module_bindings/types/reducers.ts new file mode 100644 index 00000000000..9f40b85850c --- /dev/null +++ b/templates/vue-ts/src/module_bindings/types/reducers.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { type Infer as __Infer } from 'spacetimedb'; + +// Import all reducer arg schemas +import OnConnectReducer from '../on_connect_reducer'; +import OnDisconnectReducer from '../on_disconnect_reducer'; +import AddReducer from '../add_reducer'; +import SayHelloReducer from '../say_hello_reducer'; + +export type OnConnectArgs = __Infer; +export type OnDisconnectArgs = __Infer; +export type AddArgs = __Infer; +export type SayHelloArgs = __Infer; diff --git a/tools/replace-spacetimedb/src/lib.rs b/tools/replace-spacetimedb/src/lib.rs index ff91bda9cfd..8037af72e64 100644 --- a/tools/replace-spacetimedb/src/lib.rs +++ b/tools/replace-spacetimedb/src/lib.rs @@ -94,13 +94,25 @@ pub fn replace_in_tree( continue; } + // Determine depth relative to root, in case we need to add ../ + let rel_parent = path + .parent() + .and_then(|p| p.strip_prefix(&root).ok()) + .unwrap_or_else(|| Path::new("")); + let depth = rel_parent.components().count(); + // Decide which replacement to use for this file - let is_index_ts = path.file_name().and_then(|n| n.to_str()) == Some("index.ts"); + let is_index_ts = depth == 0 && path.file_name().and_then(|n| n.to_str()) == Some("index.ts"); let repl = if is_index_ts { replacement_index_ts } else { replacement_other_ts }; + let repl = if depth > 0 { + format!("{}{}", "../".repeat(depth), repl) + } else { + repl.to_string() + }; let bytes = match fs::read(path) { Ok(b) => b, From a71f0f51727952e773070354117191efe2f8dc28 Mon Sep 17 00:00:00 2001 From: Jeffrey Dallatezza Date: Fri, 30 Jan 2026 13:25:10 -0800 Subject: [PATCH 12/16] Update snap --- crates/codegen/tests/snapshots/codegen__codegen_typescript.snap | 2 -- 1 file changed, 2 deletions(-) diff --git a/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap b/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap index 514228c2e03..db4ead76caa 100644 --- a/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap +++ b/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap @@ -292,8 +292,6 @@ import TestERow from "./test_e_table"; import TestFRow from "./test_f_table"; /** Type-only namespace exports for generated type groups. */ -export type * as Reducers from "./types/reducers"; -export type * as Procedures from "./types/procedures"; /** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */ const tablesSchema = __schema( From 005dd1532a0e5d9eeb4db72e51ac671f076b40a9 Mon Sep 17 00:00:00 2001 From: Jeffrey Dallatezza Date: Sun, 1 Feb 2026 16:30:38 -0800 Subject: [PATCH 13/16] Change args to params --- .../src/module_bindings/types/reducers.ts | 2 +- crates/codegen/src/typescript.rs | 2 +- .../codegen__codegen_typescript.snap | 28 +++++++++---------- .../src/module_bindings/types/reducers.ts | 8 +++--- .../src/module_bindings/types/reducers.ts | 8 +++--- .../src/module_bindings/types/reducers.ts | 8 +++--- .../src/module_bindings/types/reducers.ts | 8 +++--- 7 files changed, 32 insertions(+), 32 deletions(-) diff --git a/crates/bindings-typescript/test-app/src/module_bindings/types/reducers.ts b/crates/bindings-typescript/test-app/src/module_bindings/types/reducers.ts index 086e5bc5a2d..1d7e61f99ef 100644 --- a/crates/bindings-typescript/test-app/src/module_bindings/types/reducers.ts +++ b/crates/bindings-typescript/test-app/src/module_bindings/types/reducers.ts @@ -8,4 +8,4 @@ import { type Infer as __Infer } from '../../../../src/index'; // Import all reducer arg schemas import CreatePlayerReducer from '../create_player_reducer'; -export type CreatePlayerArgs = __Infer; +export type CreatePlayerParams = __Infer; diff --git a/crates/codegen/src/typescript.rs b/crates/codegen/src/typescript.rs index 8f0e07303c7..5d976a1916d 100644 --- a/crates/codegen/src/typescript.rs +++ b/crates/codegen/src/typescript.rs @@ -476,7 +476,7 @@ fn generate_reducers_file(module: &ModuleDef) -> OutputFile { let args_type = reducer_args_type_name(&reducer.name); writeln!( out, - "export type {reducer_name_pascalcase}Args = __Infer;" + "export type {reducer_name_pascalcase}Params = __Infer;" ); } out.newline(); diff --git a/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap b/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap index db4ead76caa..ecd9779e53f 100644 --- a/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap +++ b/crates/codegen/tests/snapshots/codegen__codegen_typescript.snap @@ -1327,20 +1327,20 @@ import SayHelloReducer from "../say_hello_reducer"; import TestReducer from "../test_reducer"; import TestBtreeIndexArgsReducer from "../test_btree_index_args_reducer"; -export type AddArgs = __Infer; -export type AddPlayerArgs = __Infer; -export type AddPrivateArgs = __Infer; -export type AssertCallerIdentityIsModuleIdentityArgs = __Infer; -export type ClientConnectedArgs = __Infer; -export type DeletePlayerArgs = __Infer; -export type DeletePlayersByNameArgs = __Infer; -export type ListOverAgeArgs = __Infer; -export type LogModuleIdentityArgs = __Infer; -export type QueryPrivateArgs = __Infer; -export type RepeatingTestArgs = __Infer; -export type SayHelloArgs = __Infer; -export type TestArgs = __Infer; -export type TestBtreeIndexArgsArgs = __Infer; +export type AddParams = __Infer; +export type AddPlayerParams = __Infer; +export type AddPrivateParams = __Infer; +export type AssertCallerIdentityIsModuleIdentityParams = __Infer; +export type ClientConnectedParams = __Infer; +export type DeletePlayerParams = __Infer; +export type DeletePlayersByNameParams = __Infer; +export type ListOverAgeParams = __Infer; +export type LogModuleIdentityParams = __Infer; +export type QueryPrivateParams = __Infer; +export type RepeatingTestParams = __Infer; +export type SayHelloParams = __Infer; +export type TestParams = __Infer; +export type TestBtreeIndexArgsParams = __Infer; ''' "with_tx_procedure.ts" = ''' diff --git a/templates/basic-ts/src/module_bindings/types/reducers.ts b/templates/basic-ts/src/module_bindings/types/reducers.ts index 9f40b85850c..de9884fd999 100644 --- a/templates/basic-ts/src/module_bindings/types/reducers.ts +++ b/templates/basic-ts/src/module_bindings/types/reducers.ts @@ -11,7 +11,7 @@ import OnDisconnectReducer from '../on_disconnect_reducer'; import AddReducer from '../add_reducer'; import SayHelloReducer from '../say_hello_reducer'; -export type OnConnectArgs = __Infer; -export type OnDisconnectArgs = __Infer; -export type AddArgs = __Infer; -export type SayHelloArgs = __Infer; +export type OnConnectParams = __Infer; +export type OnDisconnectParams = __Infer; +export type AddParams = __Infer; +export type SayHelloParams = __Infer; diff --git a/templates/chat-react-ts/src/module_bindings/types/reducers.ts b/templates/chat-react-ts/src/module_bindings/types/reducers.ts index 8f6f02eb73d..e0d53afb748 100644 --- a/templates/chat-react-ts/src/module_bindings/types/reducers.ts +++ b/templates/chat-react-ts/src/module_bindings/types/reducers.ts @@ -11,7 +11,7 @@ import SendMessageReducer from '../send_message_reducer'; import OnConnectReducer from '../on_connect_reducer'; import OnDisconnectReducer from '../on_disconnect_reducer'; -export type SetNameArgs = __Infer; -export type SendMessageArgs = __Infer; -export type OnConnectArgs = __Infer; -export type OnDisconnectArgs = __Infer; +export type SetNameParams = __Infer; +export type SendMessageParams = __Infer; +export type OnConnectParams = __Infer; +export type OnDisconnectParams = __Infer; diff --git a/templates/react-ts/src/module_bindings/types/reducers.ts b/templates/react-ts/src/module_bindings/types/reducers.ts index 9f40b85850c..de9884fd999 100644 --- a/templates/react-ts/src/module_bindings/types/reducers.ts +++ b/templates/react-ts/src/module_bindings/types/reducers.ts @@ -11,7 +11,7 @@ import OnDisconnectReducer from '../on_disconnect_reducer'; import AddReducer from '../add_reducer'; import SayHelloReducer from '../say_hello_reducer'; -export type OnConnectArgs = __Infer; -export type OnDisconnectArgs = __Infer; -export type AddArgs = __Infer; -export type SayHelloArgs = __Infer; +export type OnConnectParams = __Infer; +export type OnDisconnectParams = __Infer; +export type AddParams = __Infer; +export type SayHelloParams = __Infer; diff --git a/templates/vue-ts/src/module_bindings/types/reducers.ts b/templates/vue-ts/src/module_bindings/types/reducers.ts index 9f40b85850c..de9884fd999 100644 --- a/templates/vue-ts/src/module_bindings/types/reducers.ts +++ b/templates/vue-ts/src/module_bindings/types/reducers.ts @@ -11,7 +11,7 @@ import OnDisconnectReducer from '../on_disconnect_reducer'; import AddReducer from '../add_reducer'; import SayHelloReducer from '../say_hello_reducer'; -export type OnConnectArgs = __Infer; -export type OnDisconnectArgs = __Infer; -export type AddArgs = __Infer; -export type SayHelloArgs = __Infer; +export type OnConnectParams = __Infer; +export type OnDisconnectParams = __Infer; +export type AddParams = __Infer; +export type SayHelloParams = __Infer; From e2920b5e361495b16bd50e2899024ca680d52e8b Mon Sep 17 00:00:00 2001 From: Jeffrey Dallatezza Date: Sun, 1 Feb 2026 16:59:36 -0800 Subject: [PATCH 14/16] Regen --- .../lib/autogen/function_visibility_type.ts | 19 +++++++ .../raw_column_default_value_v_10_type.ts | 16 ++++++ .../autogen/raw_constraint_def_v_10_type.ts | 19 +++++++ .../lib/autogen/raw_index_def_v_10_type.ts | 20 +++++++ .../raw_life_cycle_reducer_def_v_10_type.ts | 19 +++++++ .../src/lib/autogen/raw_module_def_type.ts | 4 ++ .../raw_module_def_v_10_section_type.ts | 53 +++++++++++++++++++ .../lib/autogen/raw_module_def_v_10_type.ts | 18 +++++++ .../autogen/raw_procedure_def_v_10_type.ts | 27 ++++++++++ .../lib/autogen/raw_reducer_def_v_10_type.ts | 30 +++++++++++ .../lib/autogen/raw_schedule_def_v_10_type.ts | 18 +++++++ .../autogen/raw_scoped_type_name_v_10_type.ts | 16 ++++++ .../lib/autogen/raw_sequence_def_v_10_type.ts | 20 +++++++ .../lib/autogen/raw_table_def_v_10_type.ts | 41 ++++++++++++++ .../src/lib/autogen/raw_type_def_v_10_type.ts | 20 +++++++ .../src/lib/autogen/raw_view_def_v_10_type.ts | 26 +++++++++ .../src/sdk/client_api/index.ts | 2 +- .../test-app/src/module_bindings/index.ts | 2 +- .../basic-ts/src/module_bindings/index.ts | 2 +- .../src/module_bindings/index.ts | 2 +- .../react-ts/src/module_bindings/index.ts | 2 +- .../svelte-ts/src/module_bindings/index.ts | 37 +++++-------- .../src/module_bindings/types/index.ts | 11 ++++ .../src/module_bindings/types/procedures.ts | 8 +++ .../src/module_bindings/types/reducers.ts | 17 ++++++ templates/vue-ts/src/module_bindings/index.ts | 2 +- 26 files changed, 420 insertions(+), 31 deletions(-) create mode 100644 crates/bindings-typescript/src/lib/autogen/function_visibility_type.ts create mode 100644 crates/bindings-typescript/src/lib/autogen/raw_column_default_value_v_10_type.ts create mode 100644 crates/bindings-typescript/src/lib/autogen/raw_constraint_def_v_10_type.ts create mode 100644 crates/bindings-typescript/src/lib/autogen/raw_index_def_v_10_type.ts create mode 100644 crates/bindings-typescript/src/lib/autogen/raw_life_cycle_reducer_def_v_10_type.ts create mode 100644 crates/bindings-typescript/src/lib/autogen/raw_module_def_v_10_section_type.ts create mode 100644 crates/bindings-typescript/src/lib/autogen/raw_module_def_v_10_type.ts create mode 100644 crates/bindings-typescript/src/lib/autogen/raw_procedure_def_v_10_type.ts create mode 100644 crates/bindings-typescript/src/lib/autogen/raw_reducer_def_v_10_type.ts create mode 100644 crates/bindings-typescript/src/lib/autogen/raw_schedule_def_v_10_type.ts create mode 100644 crates/bindings-typescript/src/lib/autogen/raw_scoped_type_name_v_10_type.ts create mode 100644 crates/bindings-typescript/src/lib/autogen/raw_sequence_def_v_10_type.ts create mode 100644 crates/bindings-typescript/src/lib/autogen/raw_table_def_v_10_type.ts create mode 100644 crates/bindings-typescript/src/lib/autogen/raw_type_def_v_10_type.ts create mode 100644 crates/bindings-typescript/src/lib/autogen/raw_view_def_v_10_type.ts create mode 100644 templates/svelte-ts/src/module_bindings/types/index.ts create mode 100644 templates/svelte-ts/src/module_bindings/types/procedures.ts create mode 100644 templates/svelte-ts/src/module_bindings/types/reducers.ts diff --git a/crates/bindings-typescript/src/lib/autogen/function_visibility_type.ts b/crates/bindings-typescript/src/lib/autogen/function_visibility_type.ts new file mode 100644 index 00000000000..0b94830a87d --- /dev/null +++ b/crates/bindings-typescript/src/lib/autogen/function_visibility_type.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { + TypeBuilder as __TypeBuilder, + t as __t, + type AlgebraicTypeType as __AlgebraicTypeType, + type Infer as __Infer, +} from '../../lib/type_builders'; + +// The tagged union or sum type for the algebraic type `FunctionVisibility`. +const FunctionVisibility = __t.enum('FunctionVisibility', { + Internal: __t.unit(), + ClientCallable: __t.unit(), +}); + +export default FunctionVisibility; diff --git a/crates/bindings-typescript/src/lib/autogen/raw_column_default_value_v_10_type.ts b/crates/bindings-typescript/src/lib/autogen/raw_column_default_value_v_10_type.ts new file mode 100644 index 00000000000..5f37afa4604 --- /dev/null +++ b/crates/bindings-typescript/src/lib/autogen/raw_column_default_value_v_10_type.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { + TypeBuilder as __TypeBuilder, + t as __t, + type AlgebraicTypeType as __AlgebraicTypeType, + type Infer as __Infer, +} from '../../lib/type_builders'; + +export default __t.object('RawColumnDefaultValueV10', { + colId: __t.u16(), + value: __t.byteArray(), +}); diff --git a/crates/bindings-typescript/src/lib/autogen/raw_constraint_def_v_10_type.ts b/crates/bindings-typescript/src/lib/autogen/raw_constraint_def_v_10_type.ts new file mode 100644 index 00000000000..76145329659 --- /dev/null +++ b/crates/bindings-typescript/src/lib/autogen/raw_constraint_def_v_10_type.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { + TypeBuilder as __TypeBuilder, + t as __t, + type AlgebraicTypeType as __AlgebraicTypeType, + type Infer as __Infer, +} from '../../lib/type_builders'; +import RawConstraintDataV9 from './raw_constraint_data_v_9_type'; + +export default __t.object('RawConstraintDefV10', { + sourceName: __t.option(__t.string()), + get data() { + return RawConstraintDataV9; + }, +}); diff --git a/crates/bindings-typescript/src/lib/autogen/raw_index_def_v_10_type.ts b/crates/bindings-typescript/src/lib/autogen/raw_index_def_v_10_type.ts new file mode 100644 index 00000000000..2a1913b7ae4 --- /dev/null +++ b/crates/bindings-typescript/src/lib/autogen/raw_index_def_v_10_type.ts @@ -0,0 +1,20 @@ +// 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 '../../lib/type_builders'; +import RawIndexAlgorithm from './raw_index_algorithm_type'; + +export default __t.object('RawIndexDefV10', { + sourceName: __t.option(__t.string()), + accessorName: __t.option(__t.string()), + get algorithm() { + return RawIndexAlgorithm; + }, +}); diff --git a/crates/bindings-typescript/src/lib/autogen/raw_life_cycle_reducer_def_v_10_type.ts b/crates/bindings-typescript/src/lib/autogen/raw_life_cycle_reducer_def_v_10_type.ts new file mode 100644 index 00000000000..7ccc26d79a3 --- /dev/null +++ b/crates/bindings-typescript/src/lib/autogen/raw_life_cycle_reducer_def_v_10_type.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { + TypeBuilder as __TypeBuilder, + t as __t, + type AlgebraicTypeType as __AlgebraicTypeType, + type Infer as __Infer, +} from '../../lib/type_builders'; +import Lifecycle from './lifecycle_type'; + +export default __t.object('RawLifeCycleReducerDefV10', { + get lifecycleSpec() { + return Lifecycle; + }, + functionName: __t.string(), +}); diff --git a/crates/bindings-typescript/src/lib/autogen/raw_module_def_type.ts b/crates/bindings-typescript/src/lib/autogen/raw_module_def_type.ts index e0f91b646ff..40255921356 100644 --- a/crates/bindings-typescript/src/lib/autogen/raw_module_def_type.ts +++ b/crates/bindings-typescript/src/lib/autogen/raw_module_def_type.ts @@ -11,6 +11,7 @@ import { } from '../../lib/type_builders'; import RawModuleDefV8 from './raw_module_def_v_8_type'; import RawModuleDefV9 from './raw_module_def_v_9_type'; +import RawModuleDefV10 from './raw_module_def_v_10_type'; // The tagged union or sum type for the algebraic type `RawModuleDef`. const RawModuleDef = __t.enum('RawModuleDef', { @@ -20,6 +21,9 @@ const RawModuleDef = __t.enum('RawModuleDef', { get V9() { return RawModuleDefV9; }, + get V10() { + return RawModuleDefV10; + }, }); export default RawModuleDef; diff --git a/crates/bindings-typescript/src/lib/autogen/raw_module_def_v_10_section_type.ts b/crates/bindings-typescript/src/lib/autogen/raw_module_def_v_10_section_type.ts new file mode 100644 index 00000000000..dcf579b9fd6 --- /dev/null +++ b/crates/bindings-typescript/src/lib/autogen/raw_module_def_v_10_section_type.ts @@ -0,0 +1,53 @@ +// 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 '../../lib/type_builders'; +import Typespace from './typespace_type'; +import RawRowLevelSecurityDefV9 from './raw_row_level_security_def_v_9_type'; +import RawTypeDefV10 from './raw_type_def_v_10_type'; +import RawTableDefV10 from './raw_table_def_v_10_type'; +import RawReducerDefV10 from './raw_reducer_def_v_10_type'; +import RawProcedureDefV10 from './raw_procedure_def_v_10_type'; +import RawViewDefV10 from './raw_view_def_v_10_type'; +import RawScheduleDefV10 from './raw_schedule_def_v_10_type'; +import RawLifeCycleReducerDefV10 from './raw_life_cycle_reducer_def_v_10_type'; + +// The tagged union or sum type for the algebraic type `RawModuleDefV10Section`. +const RawModuleDefV10Section = __t.enum('RawModuleDefV10Section', { + get Typespace() { + return Typespace; + }, + get Types() { + return __t.array(RawTypeDefV10); + }, + get Tables() { + return __t.array(RawTableDefV10); + }, + get Reducers() { + return __t.array(RawReducerDefV10); + }, + get Procedures() { + return __t.array(RawProcedureDefV10); + }, + get Views() { + return __t.array(RawViewDefV10); + }, + get Schedules() { + return __t.array(RawScheduleDefV10); + }, + get LifeCycleReducers() { + return __t.array(RawLifeCycleReducerDefV10); + }, + get RowLevelSecurity() { + return __t.array(RawRowLevelSecurityDefV9); + }, +}); + +export default RawModuleDefV10Section; diff --git a/crates/bindings-typescript/src/lib/autogen/raw_module_def_v_10_type.ts b/crates/bindings-typescript/src/lib/autogen/raw_module_def_v_10_type.ts new file mode 100644 index 00000000000..f12b1e66523 --- /dev/null +++ b/crates/bindings-typescript/src/lib/autogen/raw_module_def_v_10_type.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { + TypeBuilder as __TypeBuilder, + t as __t, + type AlgebraicTypeType as __AlgebraicTypeType, + type Infer as __Infer, +} from '../../lib/type_builders'; +import RawModuleDefV10Section from './raw_module_def_v_10_section_type'; + +export default __t.object('RawModuleDefV10', { + get sections() { + return __t.array(RawModuleDefV10Section); + }, +}); diff --git a/crates/bindings-typescript/src/lib/autogen/raw_procedure_def_v_10_type.ts b/crates/bindings-typescript/src/lib/autogen/raw_procedure_def_v_10_type.ts new file mode 100644 index 00000000000..1c2b312c126 --- /dev/null +++ b/crates/bindings-typescript/src/lib/autogen/raw_procedure_def_v_10_type.ts @@ -0,0 +1,27 @@ +// 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 '../../lib/type_builders'; +import AlgebraicType from './algebraic_type_type'; +import ProductType from './product_type_type'; +import FunctionVisibility from './function_visibility_type'; + +export default __t.object('RawProcedureDefV10', { + sourceName: __t.string(), + get params() { + return ProductType; + }, + get returnType() { + return AlgebraicType; + }, + get visibility() { + return FunctionVisibility; + }, +}); diff --git a/crates/bindings-typescript/src/lib/autogen/raw_reducer_def_v_10_type.ts b/crates/bindings-typescript/src/lib/autogen/raw_reducer_def_v_10_type.ts new file mode 100644 index 00000000000..2c40195ebb9 --- /dev/null +++ b/crates/bindings-typescript/src/lib/autogen/raw_reducer_def_v_10_type.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { + TypeBuilder as __TypeBuilder, + t as __t, + type AlgebraicTypeType as __AlgebraicTypeType, + type Infer as __Infer, +} from '../../lib/type_builders'; +import AlgebraicType from './algebraic_type_type'; +import ProductType from './product_type_type'; +import FunctionVisibility from './function_visibility_type'; + +export default __t.object('RawReducerDefV10', { + sourceName: __t.string(), + get params() { + return ProductType; + }, + get visibility() { + return FunctionVisibility; + }, + get okReturnType() { + return AlgebraicType; + }, + get errReturnType() { + return AlgebraicType; + }, +}); diff --git a/crates/bindings-typescript/src/lib/autogen/raw_schedule_def_v_10_type.ts b/crates/bindings-typescript/src/lib/autogen/raw_schedule_def_v_10_type.ts new file mode 100644 index 00000000000..7ad8b18bad1 --- /dev/null +++ b/crates/bindings-typescript/src/lib/autogen/raw_schedule_def_v_10_type.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { + TypeBuilder as __TypeBuilder, + t as __t, + type AlgebraicTypeType as __AlgebraicTypeType, + type Infer as __Infer, +} from '../../lib/type_builders'; + +export default __t.object('RawScheduleDefV10', { + sourceName: __t.option(__t.string()), + tableName: __t.string(), + scheduleAtCol: __t.u16(), + functionName: __t.string(), +}); diff --git a/crates/bindings-typescript/src/lib/autogen/raw_scoped_type_name_v_10_type.ts b/crates/bindings-typescript/src/lib/autogen/raw_scoped_type_name_v_10_type.ts new file mode 100644 index 00000000000..91bf0da5915 --- /dev/null +++ b/crates/bindings-typescript/src/lib/autogen/raw_scoped_type_name_v_10_type.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { + TypeBuilder as __TypeBuilder, + t as __t, + type AlgebraicTypeType as __AlgebraicTypeType, + type Infer as __Infer, +} from '../../lib/type_builders'; + +export default __t.object('RawScopedTypeNameV10', { + scope: __t.array(__t.string()), + sourceName: __t.string(), +}); diff --git a/crates/bindings-typescript/src/lib/autogen/raw_sequence_def_v_10_type.ts b/crates/bindings-typescript/src/lib/autogen/raw_sequence_def_v_10_type.ts new file mode 100644 index 00000000000..e5ebe17d853 --- /dev/null +++ b/crates/bindings-typescript/src/lib/autogen/raw_sequence_def_v_10_type.ts @@ -0,0 +1,20 @@ +// 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 '../../lib/type_builders'; + +export default __t.object('RawSequenceDefV10', { + sourceName: __t.option(__t.string()), + column: __t.u16(), + start: __t.option(__t.i128()), + minValue: __t.option(__t.i128()), + maxValue: __t.option(__t.i128()), + increment: __t.i128(), +}); diff --git a/crates/bindings-typescript/src/lib/autogen/raw_table_def_v_10_type.ts b/crates/bindings-typescript/src/lib/autogen/raw_table_def_v_10_type.ts new file mode 100644 index 00000000000..47d112d4506 --- /dev/null +++ b/crates/bindings-typescript/src/lib/autogen/raw_table_def_v_10_type.ts @@ -0,0 +1,41 @@ +// 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 '../../lib/type_builders'; +import TableType from './table_type_type'; +import TableAccess from './table_access_type'; +import RawIndexDefV10 from './raw_index_def_v_10_type'; +import RawConstraintDefV10 from './raw_constraint_def_v_10_type'; +import RawSequenceDefV10 from './raw_sequence_def_v_10_type'; +import RawColumnDefaultValueV10 from './raw_column_default_value_v_10_type'; + +export default __t.object('RawTableDefV10', { + sourceName: __t.string(), + productTypeRef: __t.u32(), + primaryKey: __t.array(__t.u16()), + get indexes() { + return __t.array(RawIndexDefV10); + }, + get constraints() { + return __t.array(RawConstraintDefV10); + }, + get sequences() { + return __t.array(RawSequenceDefV10); + }, + get tableType() { + return TableType; + }, + get tableAccess() { + return TableAccess; + }, + get defaultValues() { + return __t.array(RawColumnDefaultValueV10); + }, +}); diff --git a/crates/bindings-typescript/src/lib/autogen/raw_type_def_v_10_type.ts b/crates/bindings-typescript/src/lib/autogen/raw_type_def_v_10_type.ts new file mode 100644 index 00000000000..e3800eff3d2 --- /dev/null +++ b/crates/bindings-typescript/src/lib/autogen/raw_type_def_v_10_type.ts @@ -0,0 +1,20 @@ +// 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 '../../lib/type_builders'; +import RawScopedTypeNameV10 from './raw_scoped_type_name_v_10_type'; + +export default __t.object('RawTypeDefV10', { + get sourceName() { + return RawScopedTypeNameV10; + }, + ty: __t.u32(), + customOrdering: __t.bool(), +}); diff --git a/crates/bindings-typescript/src/lib/autogen/raw_view_def_v_10_type.ts b/crates/bindings-typescript/src/lib/autogen/raw_view_def_v_10_type.ts new file mode 100644 index 00000000000..755076ed315 --- /dev/null +++ b/crates/bindings-typescript/src/lib/autogen/raw_view_def_v_10_type.ts @@ -0,0 +1,26 @@ +// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE +// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. + +/* eslint-disable */ +/* tslint:disable */ +import { + TypeBuilder as __TypeBuilder, + t as __t, + type AlgebraicTypeType as __AlgebraicTypeType, + type Infer as __Infer, +} from '../../lib/type_builders'; +import AlgebraicType from './algebraic_type_type'; +import ProductType from './product_type_type'; + +export default __t.object('RawViewDefV10', { + sourceName: __t.string(), + index: __t.u32(), + isPublic: __t.bool(), + isAnonymous: __t.bool(), + get params() { + return ProductType; + }, + get returnType() { + return AlgebraicType; + }, +}); diff --git a/crates/bindings-typescript/src/sdk/client_api/index.ts b/crates/bindings-typescript/src/sdk/client_api/index.ts index c437f74400e..8a1c77e0f46 100644 --- a/crates/bindings-typescript/src/sdk/client_api/index.ts +++ b/crates/bindings-typescript/src/sdk/client_api/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.3 (commit dbe8a0dff3bfe776501978389e28b0fdfaf53eed). +// This was generated using spacetimedb cli version 1.11.3 (commit e902c2ba5c3f7e605297354734811bea92883b91). /* eslint-disable */ /* tslint:disable */ diff --git a/crates/bindings-typescript/test-app/src/module_bindings/index.ts b/crates/bindings-typescript/test-app/src/module_bindings/index.ts index 8ccbd096d65..8614a4a2ae7 100644 --- a/crates/bindings-typescript/test-app/src/module_bindings/index.ts +++ b/crates/bindings-typescript/test-app/src/module_bindings/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.3 (commit dbe8a0dff3bfe776501978389e28b0fdfaf53eed). +// This was generated using spacetimedb cli version 1.11.3 (commit e902c2ba5c3f7e605297354734811bea92883b91). /* eslint-disable */ /* tslint:disable */ diff --git a/templates/basic-ts/src/module_bindings/index.ts b/templates/basic-ts/src/module_bindings/index.ts index 003de49a6cb..356b9f1e22e 100644 --- a/templates/basic-ts/src/module_bindings/index.ts +++ b/templates/basic-ts/src/module_bindings/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.3 (commit dbe8a0dff3bfe776501978389e28b0fdfaf53eed). +// This was generated using spacetimedb cli version 1.11.3 (commit e902c2ba5c3f7e605297354734811bea92883b91). /* eslint-disable */ /* tslint:disable */ diff --git a/templates/chat-react-ts/src/module_bindings/index.ts b/templates/chat-react-ts/src/module_bindings/index.ts index 90c95e8c179..b300a41f5da 100644 --- a/templates/chat-react-ts/src/module_bindings/index.ts +++ b/templates/chat-react-ts/src/module_bindings/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.3 (commit dbe8a0dff3bfe776501978389e28b0fdfaf53eed). +// This was generated using spacetimedb cli version 1.11.3 (commit e902c2ba5c3f7e605297354734811bea92883b91). /* eslint-disable */ /* tslint:disable */ diff --git a/templates/react-ts/src/module_bindings/index.ts b/templates/react-ts/src/module_bindings/index.ts index 003de49a6cb..356b9f1e22e 100644 --- a/templates/react-ts/src/module_bindings/index.ts +++ b/templates/react-ts/src/module_bindings/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.3 (commit dbe8a0dff3bfe776501978389e28b0fdfaf53eed). +// This was generated using spacetimedb cli version 1.11.3 (commit e902c2ba5c3f7e605297354734811bea92883b91). /* eslint-disable */ /* tslint:disable */ diff --git a/templates/svelte-ts/src/module_bindings/index.ts b/templates/svelte-ts/src/module_bindings/index.ts index d726335a186..356b9f1e22e 100644 --- a/templates/svelte-ts/src/module_bindings/index.ts +++ b/templates/svelte-ts/src/module_bindings/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.3 (commit 02449737ca3b29e7e39679fccbef541a50f32094). +// This was generated using spacetimedb cli version 1.11.3 (commit e902c2ba5c3f7e605297354734811bea92883b91). /* eslint-disable */ /* tslint:disable */ @@ -12,6 +12,7 @@ import { TypeBuilder as __TypeBuilder, Uuid as __Uuid, convertToAccessorMap as __convertToAccessorMap, + makeQueryBuilder as __makeQueryBuilder, procedureSchema as __procedureSchema, procedures as __procedures, reducerSchema as __reducerSchema, @@ -25,41 +26,23 @@ import { type Event as __Event, type EventContextInterface as __EventContextInterface, type Infer as __Infer, + type QueryBuilder as __QueryBuilder, type ReducerEventContextInterface as __ReducerEventContextInterface, type RemoteModule as __RemoteModule, type SubscriptionEventContextInterface as __SubscriptionEventContextInterface, type SubscriptionHandleImpl as __SubscriptionHandleImpl, } from 'spacetimedb'; -// Import and reexport all reducer arg types -import OnConnectReducer from './on_connect_reducer'; -export { OnConnectReducer }; -import OnDisconnectReducer from './on_disconnect_reducer'; -export { OnDisconnectReducer }; +// Import all reducer arg schemas import AddReducer from './add_reducer'; -export { AddReducer }; import SayHelloReducer from './say_hello_reducer'; -export { SayHelloReducer }; -// Import and reexport all procedure arg types +// Import all procedure arg schemas -// Import and reexport all table handle types +// Import all table schema definitions import PersonRow from './person_table'; -export { PersonRow }; - -// Import and reexport all types -import Add from './add_type'; -export { Add }; -import Init from './init_type'; -export { Init }; -import OnConnect from './on_connect_type'; -export { OnConnect }; -import OnDisconnect from './on_disconnect_type'; -export { OnDisconnect }; -import Person from './person_type'; -export { Person }; -import SayHello from './say_hello_type'; -export { SayHello }; + +/** Type-only namespace exports for generated type groups. */ /** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */ const tablesSchema = __schema( @@ -99,6 +82,10 @@ const REMOTE_MODULE = { /** The tables available in this remote SpacetimeDB module. */ export const tables = __convertToAccessorMap(tablesSchema.schemaType.tables); +/** A typed query builder for this remote SpacetimeDB module. */ +export const query: __QueryBuilder = + __makeQueryBuilder(tablesSchema.schemaType); + /** The reducers available in this remote SpacetimeDB module. */ export const reducers = __convertToAccessorMap( reducersSchema.reducersType.reducers diff --git a/templates/svelte-ts/src/module_bindings/types/index.ts b/templates/svelte-ts/src/module_bindings/types/index.ts new file mode 100644 index 00000000000..06296d8bf15 --- /dev/null +++ b/templates/svelte-ts/src/module_bindings/types/index.ts @@ -0,0 +1,11 @@ +// 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 { type Infer as __Infer } from 'spacetimedb'; + +// Import all non-reducer types +import Person from '../person_type'; + +export type Person = __Infer; diff --git a/templates/svelte-ts/src/module_bindings/types/procedures.ts b/templates/svelte-ts/src/module_bindings/types/procedures.ts new file mode 100644 index 00000000000..b2102264f4d --- /dev/null +++ b/templates/svelte-ts/src/module_bindings/types/procedures.ts @@ -0,0 +1,8 @@ +// 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 { type Infer as __Infer } from 'spacetimedb'; + +// Import all procedure arg schemas diff --git a/templates/svelte-ts/src/module_bindings/types/reducers.ts b/templates/svelte-ts/src/module_bindings/types/reducers.ts new file mode 100644 index 00000000000..de9884fd999 --- /dev/null +++ b/templates/svelte-ts/src/module_bindings/types/reducers.ts @@ -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. + +/* eslint-disable */ +/* tslint:disable */ +import { type Infer as __Infer } from 'spacetimedb'; + +// Import all reducer arg schemas +import OnConnectReducer from '../on_connect_reducer'; +import OnDisconnectReducer from '../on_disconnect_reducer'; +import AddReducer from '../add_reducer'; +import SayHelloReducer from '../say_hello_reducer'; + +export type OnConnectParams = __Infer; +export type OnDisconnectParams = __Infer; +export type AddParams = __Infer; +export type SayHelloParams = __Infer; diff --git a/templates/vue-ts/src/module_bindings/index.ts b/templates/vue-ts/src/module_bindings/index.ts index 003de49a6cb..356b9f1e22e 100644 --- a/templates/vue-ts/src/module_bindings/index.ts +++ b/templates/vue-ts/src/module_bindings/index.ts @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.3 (commit dbe8a0dff3bfe776501978389e28b0fdfaf53eed). +// This was generated using spacetimedb cli version 1.11.3 (commit e902c2ba5c3f7e605297354734811bea92883b91). /* eslint-disable */ /* tslint:disable */ From 5ec9d17dfa5f9b92b63538bb984f28d900a51dfa Mon Sep 17 00:00:00 2001 From: Jeffrey Dallatezza Date: Fri, 6 Feb 2026 09:39:14 -0800 Subject: [PATCH 15/16] Update snaps --- .../snapshots/codegen__codegen_csharp.snap | 130 ---------- .../snapshots/codegen__codegen_rust.snap | 229 ------------------ .../codegen__codegen_typescript.snap | 42 ---- 3 files changed, 401 deletions(-) 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 f942a5a2f75..825a94717f9 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 @@ -264,7 +249,6 @@ import DeletePlayersByNameReducer from "./delete_players_by_name_reducer"; import ListOverAgeReducer from "./list_over_age_reducer"; import LogModuleIdentityReducer from "./log_module_identity_reducer"; import QueryPrivateReducer from "./query_private_reducer"; -import RepeatingTestReducer from "./repeating_test_reducer"; import SayHelloReducer from "./say_hello_reducer"; import TestReducer from "./test_reducer"; import TestBtreeIndexArgsReducer from "./test_btree_index_args_reducer"; @@ -463,7 +447,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), @@ -911,27 +894,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 @@ -1316,13 +1278,11 @@ import AddReducer from "../add_reducer"; import AddPlayerReducer from "../add_player_reducer"; import AddPrivateReducer from "../add_private_reducer"; import AssertCallerIdentityIsModuleIdentityReducer from "../assert_caller_identity_is_module_identity_reducer"; -import ClientConnectedReducer from "../client_connected_reducer"; import DeletePlayerReducer from "../delete_player_reducer"; import DeletePlayersByNameReducer from "../delete_players_by_name_reducer"; import ListOverAgeReducer from "../list_over_age_reducer"; import LogModuleIdentityReducer from "../log_module_identity_reducer"; import QueryPrivateReducer from "../query_private_reducer"; -import RepeatingTestReducer from "../repeating_test_reducer"; import SayHelloReducer from "../say_hello_reducer"; import TestReducer from "../test_reducer"; import TestBtreeIndexArgsReducer from "../test_btree_index_args_reducer"; @@ -1331,13 +1291,11 @@ export type AddParams = __Infer; export type AddPlayerParams = __Infer; export type AddPrivateParams = __Infer; export type AssertCallerIdentityIsModuleIdentityParams = __Infer; -export type ClientConnectedParams = __Infer; export type DeletePlayerParams = __Infer; export type DeletePlayersByNameParams = __Infer; export type ListOverAgeParams = __Infer; export type LogModuleIdentityParams = __Infer; export type QueryPrivateParams = __Infer; -export type RepeatingTestParams = __Infer; export type SayHelloParams = __Infer; export type TestParams = __Infer; export type TestBtreeIndexArgsParams = __Infer; From 0642fe4c6ead839daeaa5e3bbe341f9206947a2f Mon Sep 17 00:00:00 2001 From: Jeffrey Dallatezza Date: Fri, 6 Feb 2026 19:49:01 -0800 Subject: [PATCH 16/16] regen --- .../src/module_bindings/mod.rs | 2 +- .../src/module_bindings/mod.rs | 4 +- .../scheduled_proc_procedure.rs | 46 ------------------- .../test-client/src/module_bindings/mod.rs | 2 +- .../view-client/src/module_bindings/mod.rs | 2 +- 5 files changed, 4 insertions(+), 52 deletions(-) delete mode 100644 sdks/rust/tests/procedure-client/src/module_bindings/scheduled_proc_procedure.rs diff --git a/sdks/rust/tests/connect_disconnect_client/src/module_bindings/mod.rs b/sdks/rust/tests/connect_disconnect_client/src/module_bindings/mod.rs index 5a54035abec..83378c9d38a 100644 --- a/sdks/rust/tests/connect_disconnect_client/src/module_bindings/mod.rs +++ b/sdks/rust/tests/connect_disconnect_client/src/module_bindings/mod.rs @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.2 (commit 13a0172567170d9b8c87d2aa71de3246c21acb8c). +// This was generated using spacetimedb cli version 1.12.0 (commit 8d9a0a040ece2b8b579b050d8b1dac87d801e98e). #![allow(unused, clippy::all)] use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; diff --git a/sdks/rust/tests/procedure-client/src/module_bindings/mod.rs b/sdks/rust/tests/procedure-client/src/module_bindings/mod.rs index 892f78d2899..5b4eb30668f 100644 --- a/sdks/rust/tests/procedure-client/src/module_bindings/mod.rs +++ b/sdks/rust/tests/procedure-client/src/module_bindings/mod.rs @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.2 (commit 13a0172567170d9b8c87d2aa71de3246c21acb8c). +// This was generated using spacetimedb cli version 1.12.0 (commit 8d9a0a040ece2b8b579b050d8b1dac87d801e98e). #![allow(unused, clippy::all)] use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; @@ -23,7 +23,6 @@ pub mod return_primitive_procedure; pub mod return_struct_procedure; pub mod return_struct_type; pub mod schedule_proc_reducer; -pub mod scheduled_proc_procedure; pub mod scheduled_proc_table_table; pub mod scheduled_proc_table_type; pub mod sorted_uuids_insert_procedure; @@ -46,7 +45,6 @@ pub use return_primitive_procedure::return_primitive; pub use return_struct_procedure::return_struct; pub use return_struct_type::ReturnStruct; pub use schedule_proc_reducer::{schedule_proc, set_flags_for_schedule_proc, ScheduleProcCallbackId}; -pub use scheduled_proc_procedure::scheduled_proc; pub use scheduled_proc_table_table::*; pub use scheduled_proc_table_type::ScheduledProcTable; pub use sorted_uuids_insert_procedure::sorted_uuids_insert; diff --git a/sdks/rust/tests/procedure-client/src/module_bindings/scheduled_proc_procedure.rs b/sdks/rust/tests/procedure-client/src/module_bindings/scheduled_proc_procedure.rs deleted file mode 100644 index 124f51162f0..00000000000 --- a/sdks/rust/tests/procedure-client/src/module_bindings/scheduled_proc_procedure.rs +++ /dev/null @@ -1,46 +0,0 @@ -// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE -// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. - -#![allow(unused, clippy::all)] -use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; - -use super::scheduled_proc_table_type::ScheduledProcTable; - -#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)] -#[sats(crate = __lib)] -struct ScheduledProcArgs { - pub data: ScheduledProcTable, -} - -impl __sdk::InModule for ScheduledProcArgs { - type Module = super::RemoteModule; -} - -#[allow(non_camel_case_types)] -/// Extension trait for access to the procedure `scheduled_proc`. -/// -/// Implemented for [`super::RemoteProcedures`]. -pub trait scheduled_proc { - fn scheduled_proc(&self, data: ScheduledProcTable) { - self.scheduled_proc_then(data, |_, _| {}); - } - - fn scheduled_proc_then( - &self, - data: ScheduledProcTable, - - __callback: impl FnOnce(&super::ProcedureEventContext, Result<(), __sdk::InternalError>) + Send + 'static, - ); -} - -impl scheduled_proc for super::RemoteProcedures { - fn scheduled_proc_then( - &self, - data: ScheduledProcTable, - - __callback: impl FnOnce(&super::ProcedureEventContext, Result<(), __sdk::InternalError>) + Send + 'static, - ) { - self.imp - .invoke_procedure_with_callback::<_, ()>("scheduled_proc", ScheduledProcArgs { data }, __callback); - } -} diff --git a/sdks/rust/tests/test-client/src/module_bindings/mod.rs b/sdks/rust/tests/test-client/src/module_bindings/mod.rs index 88c57803d23..1c4c56f6c5d 100644 --- a/sdks/rust/tests/test-client/src/module_bindings/mod.rs +++ b/sdks/rust/tests/test-client/src/module_bindings/mod.rs @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.2 (commit 13a0172567170d9b8c87d2aa71de3246c21acb8c). +// This was generated using spacetimedb cli version 1.12.0 (commit 8d9a0a040ece2b8b579b050d8b1dac87d801e98e). #![allow(unused, clippy::all)] use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws}; diff --git a/sdks/rust/tests/view-client/src/module_bindings/mod.rs b/sdks/rust/tests/view-client/src/module_bindings/mod.rs index 40ff3f092bf..e5c447d1554 100644 --- a/sdks/rust/tests/view-client/src/module_bindings/mod.rs +++ b/sdks/rust/tests/view-client/src/module_bindings/mod.rs @@ -1,7 +1,7 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. -// This was generated using spacetimedb cli version 1.11.2 (commit 13a0172567170d9b8c87d2aa71de3246c21acb8c). +// This was generated using spacetimedb cli version 1.12.0 (commit 8d9a0a040ece2b8b579b050d8b1dac87d801e98e). #![allow(unused, clippy::all)] use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};