diff --git a/crates/bindings-typescript/README.md b/crates/bindings-typescript/README.md index f6e8a69d1..6012b11da 100644 --- a/crates/bindings-typescript/README.md +++ b/crates/bindings-typescript/README.md @@ -25,7 +25,7 @@ import { DbConnection } from './module_bindings'; const connection = DbConnection.builder() .withUri('ws://localhost:3000') - .withModuleName('MODULE_NAME') + .withDatabaseName('MODULE_NAME') .onDisconnect(() => { console.log('disconnected'); }) @@ -71,7 +71,7 @@ This module also include React hooks to subscribe to tables under the `spacetime ```tsx const connectionBuilder = DbConnection.builder() .withUri('ws://localhost:3000') - .withModuleName('MODULE_NAME') + .withDatabaseName('MODULE_NAME') .withLightMode(true) .onDisconnect(() => { console.log('disconnected'); diff --git a/crates/bindings-typescript/src/sdk/db_connection_builder.ts b/crates/bindings-typescript/src/sdk/db_connection_builder.ts index b3906575a..12c4b76d2 100644 --- a/crates/bindings-typescript/src/sdk/db_connection_builder.ts +++ b/crates/bindings-typescript/src/sdk/db_connection_builder.ts @@ -57,13 +57,13 @@ export class DbConnectionBuilder> { } /** - * Set the name or Identity of the database module to connect to. + * Set the name or Identity of the remote database to connect to. * * @param nameOrAddress * * @returns The `DbConnectionBuilder` instance. */ - withModuleName(nameOrAddress: string): this { + withDatabaseName(nameOrAddress: string): this { this.#nameOrAddress = nameOrAddress; return this; } @@ -243,7 +243,7 @@ export class DbConnectionBuilder> { * const host = "http://localhost:3000"; * const name_or_address = "database_name" * const auth_token = undefined; - * DbConnection.builder().withUri(host).withModuleName(name_or_address).withToken(auth_token).build(); + * DbConnection.builder().withUri(host).withDatabaseName(name_or_address).withToken(auth_token).build(); * ``` */ build(): DbConnection { diff --git a/crates/bindings-typescript/test-app/src/main.tsx b/crates/bindings-typescript/test-app/src/main.tsx index fb1ac03c2..ba2d46ac4 100644 --- a/crates/bindings-typescript/test-app/src/main.tsx +++ b/crates/bindings-typescript/test-app/src/main.tsx @@ -7,7 +7,7 @@ import { DbConnection, query } from './module_bindings/index.ts'; const connectionBuilder = DbConnection.builder() .withUri('ws://localhost:3000') - .withModuleName('game') + .withDatabaseName('game') .withLightMode(true) .onDisconnect(() => { console.log('disconnected'); diff --git a/crates/bindings-typescript/test-react-router-app/src/main.tsx b/crates/bindings-typescript/test-react-router-app/src/main.tsx index 1cb185417..83aee035d 100644 --- a/crates/bindings-typescript/test-react-router-app/src/main.tsx +++ b/crates/bindings-typescript/test-react-router-app/src/main.tsx @@ -24,7 +24,7 @@ const onConnectError = (_ctx: ErrorContext, err: Error) => { // set all the settings you need, be sure your Uri and Module Name are correct const connBuilder = DbConnection.builder() .withUri('ws://localhost:3000') - .withModuleName('simple-stdb-react-hooks-example') + .withDatabaseName('simple-stdb-react-hooks-example') .withToken(localStorage.getItem('stdbToken') || '') .onConnect(onConnect) .onConnectError(onConnectError) diff --git a/crates/bindings-typescript/tests/db_connection.test.ts b/crates/bindings-typescript/tests/db_connection.test.ts index 897e228e4..c56532386 100644 --- a/crates/bindings-typescript/tests/db_connection.test.ts +++ b/crates/bindings-typescript/tests/db_connection.test.ts @@ -73,7 +73,7 @@ describe('DbConnection', () => { let connectCalled = false; const client = DbConnection.builder() .withUri('ws://127.0.0.1:1234') - .withModuleName('db') + .withDatabaseName('db') .withWSFn(() => { return Promise.reject(new Error('Failed to connect')); }) @@ -99,7 +99,7 @@ describe('DbConnection', () => { let called = false; const client = DbConnection.builder() .withUri('ws://127.0.0.1:1234') - .withModuleName('db') + .withDatabaseName('db') .withWSFn(wsAdapter.createWebSocketFn.bind(wsAdapter) as any) .onConnect(() => { called = true; @@ -126,7 +126,7 @@ describe('DbConnection', () => { const wsAdapter = new WebsocketTestAdapter(); const client = DbConnection.builder() .withUri('ws://127.0.0.1:1234') - .withModuleName('db') + .withDatabaseName('db') .withWSFn(wsAdapter.createWebSocketFn.bind(wsAdapter) as any) .onConnect(() => {}) .build(); @@ -305,7 +305,7 @@ describe('DbConnection', () => { const wsAdapter = new WebsocketTestAdapter(); const client = DbConnection.builder() .withUri('ws://127.0.0.1:1234') - .withModuleName('db') + .withDatabaseName('db') .withWSFn(wsAdapter.createWebSocketFn.bind(wsAdapter) as any) .onConnect(() => {}) .build(); @@ -373,7 +373,7 @@ describe('DbConnection', () => { const wsAdapter = new WebsocketTestAdapter(); const client = DbConnection.builder() .withUri('ws://127.0.0.1:1234') - .withModuleName('db') + .withDatabaseName('db') .withWSFn(wsAdapter.createWebSocketFn.bind(wsAdapter) as any) .onConnect(() => {}) .build(); @@ -451,7 +451,7 @@ describe('DbConnection', () => { const wsAdapter = new WebsocketTestAdapter(); const client = DbConnection.builder() .withUri('ws://127.0.0.1:1234') - .withModuleName('db') + .withDatabaseName('db') .withWSFn(wsAdapter.createWebSocketFn.bind(wsAdapter) as any) .onConnect(() => {}) .build(); @@ -585,7 +585,7 @@ describe('DbConnection', () => { const wsAdapter = new WebsocketTestAdapter(); const client = DbConnection.builder() .withUri('ws://127.0.0.1:1234') - .withModuleName('db') + .withDatabaseName('db') .withWSFn(wsAdapter.createWebSocketFn.bind(wsAdapter) as any) .build(); await client['wsPromise']; diff --git a/crates/codegen/src/unrealcpp.rs b/crates/codegen/src/unrealcpp.rs index e2334cd17..bb0452bd9 100644 --- a/crates/codegen/src/unrealcpp.rs +++ b/crates/codegen/src/unrealcpp.rs @@ -2854,7 +2854,7 @@ fn generate_db_connection_builder_class(output: &mut UnrealCppAutogen, api_macro writeln!(output, " UFUNCTION(BlueprintCallable, Category = \"SpacetimeDB\")"); writeln!( output, - " UDbConnectionBuilder* WithModuleName(const FString& InName);" + " UDbConnectionBuilder* WithDatabaseName(const FString& InName);" ); writeln!(output, " UFUNCTION(BlueprintCallable, Category = \"SpacetimeDB\")"); writeln!(output, " UDbConnectionBuilder* WithToken(const FString& InToken);"); @@ -3455,12 +3455,12 @@ fn generate_client_implementation( writeln!(output, "}}"); writeln!( output, - "UDbConnectionBuilder* UDbConnectionBuilder::WithModuleName(const FString& InName)" + "UDbConnectionBuilder* UDbConnectionBuilder::WithDatabaseName(const FString& InName)" ); writeln!(output, "{{"); writeln!( output, - "\treturn Cast(WithModuleNameBase(InName));" + "\treturn Cast(WithDatabaseNameBase(InName));" ); writeln!(output, "}}"); writeln!( diff --git a/demo/Blackholio/client-unity/Assets/PlayModeTests/PlayModeExampleTest.cs b/demo/Blackholio/client-unity/Assets/PlayModeTests/PlayModeExampleTest.cs index fde14ca21..ea1216acf 100644 --- a/demo/Blackholio/client-unity/Assets/PlayModeTests/PlayModeExampleTest.cs +++ b/demo/Blackholio/client-unity/Assets/PlayModeTests/PlayModeExampleTest.cs @@ -27,7 +27,7 @@ public class PlayModeExampleTest { Debug.Assert(false, "Connection failed!"); }).WithUri("http://127.0.0.1:3000") - .WithModuleName("blackholio").Build(); + .WithDatabaseName("blackholio").Build(); while (!connected) { diff --git a/demo/Blackholio/client-unity/Assets/Scripts/GameManager.cs b/demo/Blackholio/client-unity/Assets/Scripts/GameManager.cs index 3996b5d4f..37548d7a9 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/GameManager.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/GameManager.cs @@ -42,7 +42,7 @@ public class GameManager : MonoBehaviour .OnConnectError(HandleConnectError) .OnDisconnect(HandleDisconnect) .WithUri(SERVER_URL) - .WithModuleName(MODULE_NAME); + .WithDatabaseName(MODULE_NAME); // If the user has a SpacetimeDB auth token stored in the Unity PlayerPrefs, // we can use it to authenticate the connection. diff --git a/demo/Blackholio/client-unreal/Source/client_unreal/Private/GameManager.cpp b/demo/Blackholio/client-unreal/Source/client_unreal/Private/GameManager.cpp index 52a778b46..4579401da 100644 --- a/demo/Blackholio/client-unreal/Source/client_unreal/Private/GameManager.cpp +++ b/demo/Blackholio/client-unreal/Source/client_unreal/Private/GameManager.cpp @@ -65,7 +65,7 @@ void AGameManager::BeginPlay() UDbConnectionBuilder* Builder = UDbConnection::Builder() ->WithUri(ServerUri) - ->WithModuleName(ModuleName) + ->WithDatabaseName(ModuleName) ->OnConnect(ConnectDelegate) ->OnDisconnect(DisconnectDelegate) ->OnConnectError(ConnectErrorDelegate); @@ -338,4 +338,4 @@ AFood* AGameManager::SpawnFood(const FFoodType& FoodEntity) EntityMap.Add(FoodEntity.EntityId, Food); } return Food; -} \ No newline at end of file +} diff --git a/demo/Blackholio/client-unreal/Source/client_unreal/Private/ModuleBindings/SpacetimeDBClient.g.cpp b/demo/Blackholio/client-unreal/Source/client_unreal/Private/ModuleBindings/SpacetimeDBClient.g.cpp index c3f5355ed..cb9ada839 100644 --- a/demo/Blackholio/client-unreal/Source/client_unreal/Private/ModuleBindings/SpacetimeDBClient.g.cpp +++ b/demo/Blackholio/client-unreal/Source/client_unreal/Private/ModuleBindings/SpacetimeDBClient.g.cpp @@ -981,9 +981,9 @@ UDbConnectionBuilder* UDbConnectionBuilder::WithUri(const FString& InUri) { return Cast(WithUriBase(InUri)); } -UDbConnectionBuilder* UDbConnectionBuilder::WithModuleName(const FString& InName) +UDbConnectionBuilder* UDbConnectionBuilder::WithDatabaseName(const FString& InName) { - return Cast(WithModuleNameBase(InName)); + return Cast(WithDatabaseNameBase(InName)); } UDbConnectionBuilder* UDbConnectionBuilder::WithToken(const FString& InToken) { diff --git a/demo/Blackholio/client-unreal/Source/client_unreal/Public/ModuleBindings/SpacetimeDBClient.g.h b/demo/Blackholio/client-unreal/Source/client_unreal/Public/ModuleBindings/SpacetimeDBClient.g.h index 4334be14a..8092d9eb8 100644 --- a/demo/Blackholio/client-unreal/Source/client_unreal/Public/ModuleBindings/SpacetimeDBClient.g.h +++ b/demo/Blackholio/client-unreal/Source/client_unreal/Public/ModuleBindings/SpacetimeDBClient.g.h @@ -1257,7 +1257,7 @@ public: UFUNCTION(BlueprintCallable, Category = "SpacetimeDB") UDbConnectionBuilder* WithUri(const FString& InUri); UFUNCTION(BlueprintCallable, Category = "SpacetimeDB") - UDbConnectionBuilder* WithModuleName(const FString& InName); + UDbConnectionBuilder* WithDatabaseName(const FString& InName); UFUNCTION(BlueprintCallable, Category = "SpacetimeDB") UDbConnectionBuilder* WithToken(const FString& InToken); UFUNCTION(BlueprintCallable, Category = "SpacetimeDB") diff --git a/docs/docs/00100-intro/00200-quickstarts/00180-browser.md b/docs/docs/00100-intro/00200-quickstarts/00180-browser.md index 0362b93c5..e430d55cd 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00180-browser.md +++ b/docs/docs/00100-intro/00200-quickstarts/00180-browser.md @@ -61,7 +61,7 @@ npm run build