-
Profile
+
Profile
{!settingName ? (
<>
{name}
{
setSettingName(true);
setNewName(name);
}}
>
- Edit Name
+ EDIT NAME
>
) : (
@@ -189,47 +192,48 @@ function App() {
value={newName}
onChange={(e) => setNewName(e.target.value)}
/>
-
Submit
+
SUBMIT
)}
-
-
Messages
- {messages.length < 1 &&
No messages
}
-
- {messages.map((message, key) => (
-
-
- {message.name} : {message.message}
-
-
- ))}
+
+
+
+
Messages
+ {messages.length < 1 &&
No messages
}
+
+ {messages.map(({ message, name }) => (
+
+
+ {name} : {message}
+
+
+ ))}
+
-
+
+
+
+
+
+
-
System
+
System
-
{systemMessage}
+ {Array.from(systemMessages).map((message) => (
+
{message}
+ ))}
-
-
-
);
}
diff --git a/examples/quickstart/client/src/index.css b/examples/quickstart/client/src/index.css
index 4a1df4d..fffcbbe 100644
--- a/examples/quickstart/client/src/index.css
+++ b/examples/quickstart/client/src/index.css
@@ -1,3 +1,31 @@
+*,
+*::before,
+*::after {
+ box-sizing: border-box;
+ margin: 0;
+ padding: 0;
+}
+
+:root {
+ --theme-color: #3dc373;
+ --theme-color-contrast: #08180e;
+ --textbox-color: #edfef4;
+ color-scheme: light dark;
+
+ display: flex;
+ justify-content: center;
+
+ height: 100%;
+}
+
+@media (prefers-color-scheme: dark) {
+ :root {
+ --theme-color: #4cf490;
+ --theme-color-contrast: #132219;
+ --textbox-color: #0f311d;
+ }
+}
+
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
@@ -5,9 +33,42 @@ body {
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
+ width: clamp(300px, 100%, 600px);
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
monospace;
}
+
+#root {
+ height: 100%;
+}
+
+button {
+ padding: 0.5rem 0.75rem;
+ border: none;
+ border-radius: 0.375rem;
+ background-color: var(--theme-color);
+ color: var(--theme-color-contrast);
+ cursor: pointer;
+ font-weight: 600;
+ letter-spacing: 0.1px;
+ font-family: monospace;
+}
+
+input {
+ height: 31.5px;
+ margin-bottom: 0 !important;
+ padding: 0.5rem 0.75rem;
+ border: none;
+ border-radius: 0.375rem;
+ caret-color: var(--theme-color);
+ font-weight: 600;
+ letter-spacing: 0.1px;
+}
+
+input:focus {
+ outline: none;
+ box-shadow: 0 0 0 2px var(--theme-color);
+}
diff --git a/examples/quickstart/client/src/index.tsx b/examples/quickstart/client/src/index.tsx
deleted file mode 100644
index ccbac81..0000000
--- a/examples/quickstart/client/src/index.tsx
+++ /dev/null
@@ -1,19 +0,0 @@
-import React from "react";
-import ReactDOM from "react-dom/client";
-import "./index.css";
-import App from "./App";
-import reportWebVitals from "./reportWebVitals";
-
-const root = ReactDOM.createRoot(
- document.getElementById("root") as HTMLElement
-);
-root.render(
-
-
-
-);
-
-// If you want to start measuring performance in your app, pass a function
-// to log results (for example: reportWebVitals(console.log))
-// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
-reportWebVitals();
diff --git a/examples/quickstart/client/src/logo.svg b/examples/quickstart/client/src/logo.svg
deleted file mode 100644
index 9dfc1c0..0000000
--- a/examples/quickstart/client/src/logo.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/examples/quickstart/client/src/main.tsx b/examples/quickstart/client/src/main.tsx
new file mode 100644
index 0000000..3d7150d
--- /dev/null
+++ b/examples/quickstart/client/src/main.tsx
@@ -0,0 +1,10 @@
+import React from 'react'
+import ReactDOM from 'react-dom/client'
+import App from './App.tsx'
+import './index.css'
+
+ReactDOM.createRoot(document.getElementById('root')!).render(
+
+
+ ,
+)
diff --git a/examples/quickstart/client/src/module_bindings/message.ts b/examples/quickstart/client/src/module_bindings/message.ts
index 6ed4f5b..e811c7c 100644
--- a/examples/quickstart/client/src/module_bindings/message.ts
+++ b/examples/quickstart/client/src/module_bindings/message.ts
@@ -2,98 +2,80 @@
// WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD.
// @ts-ignore
-import {
- __SPACETIMEDB__,
- AlgebraicType,
- ProductType,
- BuiltinType,
- ProductTypeElement,
- SumType,
- SumTypeVariant,
- DatabaseTable,
- AlgebraicValue,
- ReducerEvent,
- Identity,
- Address,
- ClientDB,
- SpacetimeDBClient,
-} from "@clockworklabs/spacetimedb-sdk";
+import { __SPACETIMEDB__, AlgebraicType, ProductType, BuiltinType, ProductTypeElement, SumType, SumTypeVariant, DatabaseTable, AlgebraicValue, ReducerEvent, Identity, Address, ClientDB, SpacetimeDBClient } from "@clockworklabs/spacetimedb-sdk";
-export class Message extends DatabaseTable {
- public static db: ClientDB = __SPACETIMEDB__.clientDB;
- public static tableName = "Message";
- public sender: Identity;
- public sent: BigInt;
- public text: string;
+export class Message extends DatabaseTable
+{
+ public static db: ClientDB = __SPACETIMEDB__.clientDB;
+ public static tableName = "Message";
+ public sender: Identity;
+ public sent: BigInt;
+ public text: string;
- constructor(sender: Identity, sent: BigInt, text: string) {
- super();
- this.sender = sender;
- this.sent = sent;
- this.text = text;
- }
+ constructor(sender: Identity, sent: BigInt, text: string) {
+ super();
+ this.sender = sender;
+ this.sent = sent;
+ this.text = text;
+ }
- public static serialize(value: Message): object {
- return [Array.from(value.sender.toUint8Array()), value.sent, value.text];
- }
+ public static serialize(value: Message): object {
+ return [
+ Array.from(value.sender.toUint8Array()), value.sent, value.text
+ ];
+ }
- public static getAlgebraicType(): AlgebraicType {
- return AlgebraicType.createProductType([
- new ProductTypeElement(
- "sender",
- AlgebraicType.createProductType([
- new ProductTypeElement(
- "__identity_bytes",
- AlgebraicType.createArrayType(
- AlgebraicType.createPrimitiveType(BuiltinType.Type.U8)
- )
- ),
- ])
- ),
- new ProductTypeElement(
- "sent",
- AlgebraicType.createPrimitiveType(BuiltinType.Type.U64)
- ),
- new ProductTypeElement(
- "text",
- AlgebraicType.createPrimitiveType(BuiltinType.Type.String)
- ),
- ]);
- }
+ public static getAlgebraicType(): AlgebraicType
+ {
+ return AlgebraicType.createProductType([
+ new ProductTypeElement("sender", AlgebraicType.createProductType([
+ new ProductTypeElement("__identity_bytes", AlgebraicType.createArrayType(AlgebraicType.createPrimitiveType(BuiltinType.Type.U8))),
+ ])),
+ new ProductTypeElement("sent", AlgebraicType.createPrimitiveType(BuiltinType.Type.U64)),
+ new ProductTypeElement("text", AlgebraicType.createPrimitiveType(BuiltinType.Type.String)),
+ ]);
+ }
- public static fromValue(value: AlgebraicValue): Message {
- let productValue = value.asProductValue();
- let __sender = new Identity(
- productValue.elements[0].asProductValue().elements[0].asBytes()
- );
- let __sent = productValue.elements[1].asBigInt();
- let __text = productValue.elements[2].asString();
- return new this(__sender, __sent, __text);
- }
+ public static fromValue(value: AlgebraicValue): Message
+ {
+ let productValue = value.asProductValue();
+ let __sender = new Identity(productValue.elements[0].asProductValue().elements[0].asBytes());
+ let __sent = productValue.elements[1].asBigInt();
+ let __text = productValue.elements[2].asString();
+ return new this(__sender, __sent, __text);
+ }
- public static *filterBySender(value: Identity): IterableIterator
{
- for (let instance of this.db.getTable("Message").getInstances()) {
- if (instance.sender.isEqual(value)) {
- yield instance;
- }
- }
- }
+ public static *filterBySender(value: Identity): IterableIterator
+ {
+ for (let instance of this.db.getTable("Message").getInstances())
+ {
+ if (instance.sender.isEqual(value)) {
+ yield instance;
+ }
+ }
+ }
+
+ public static *filterBySent(value: BigInt): IterableIterator
+ {
+ for (let instance of this.db.getTable("Message").getInstances())
+ {
+ if (instance.sent === value) {
+ yield instance;
+ }
+ }
+ }
+
+ public static *filterByText(value: string): IterableIterator
+ {
+ for (let instance of this.db.getTable("Message").getInstances())
+ {
+ if (instance.text === value) {
+ yield instance;
+ }
+ }
+ }
- public static *filterBySent(value: BigInt): IterableIterator {
- for (let instance of this.db.getTable("Message").getInstances()) {
- if (instance.sent === value) {
- yield instance;
- }
- }
- }
- public static *filterByText(value: string): IterableIterator {
- for (let instance of this.db.getTable("Message").getInstances()) {
- if (instance.text === value) {
- yield instance;
- }
- }
- }
}
export default Message;
diff --git a/examples/quickstart/client/src/module_bindings/send_message_reducer.ts b/examples/quickstart/client/src/module_bindings/send_message_reducer.ts
index 3e4ca1d..dc3c224 100644
--- a/examples/quickstart/client/src/module_bindings/send_message_reducer.ts
+++ b/examples/quickstart/client/src/module_bindings/send_message_reducer.ts
@@ -2,52 +2,37 @@
// WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD.
// @ts-ignore
-import {
- __SPACETIMEDB__,
- AlgebraicType,
- ProductType,
- BuiltinType,
- ProductTypeElement,
- DatabaseTable,
- AlgebraicValue,
- ReducerArgsAdapter,
- SumTypeVariant,
- Serializer,
- Identity,
- Address,
- ReducerEvent,
- Reducer,
- SpacetimeDBClient,
-} from "@clockworklabs/spacetimedb-sdk";
+import { __SPACETIMEDB__, AlgebraicType, ProductType, BuiltinType, ProductTypeElement, DatabaseTable, AlgebraicValue, ReducerArgsAdapter, SumTypeVariant, Serializer, Identity, Address, ReducerEvent, Reducer, SpacetimeDBClient } from "@clockworklabs/spacetimedb-sdk";
-export class SendMessageReducer extends Reducer {
- public static reducerName: string = "SendMessage";
- public static call(_text: string) {
- this.getReducer().call(_text);
- }
+export class SendMessageReducer extends Reducer
+{
+ public static reducerName: string = "SendMessage";
+ public static call(_text: string) {
+ this.getReducer().call(_text);
+ }
- public call(_text: string) {
- const serializer = this.client.getSerializer();
- let _textType = AlgebraicType.createPrimitiveType(BuiltinType.Type.String);
- serializer.write(_textType, _text);
- this.client.call("send_message", serializer);
- }
+ public call(_text: string) {
+ const serializer = this.client.getSerializer();
+ let _textType = AlgebraicType.createPrimitiveType(BuiltinType.Type.String);
+ serializer.write(_textType, _text);
+ this.client.call("send_message", serializer);
+ }
- public static deserializeArgs(adapter: ReducerArgsAdapter): any[] {
- let textType = AlgebraicType.createPrimitiveType(BuiltinType.Type.String);
- let textValue = AlgebraicValue.deserialize(textType, adapter.next());
- let text = textValue.asString();
- return [text];
- }
+ public static deserializeArgs(adapter: ReducerArgsAdapter): any[] {
+ let textType = AlgebraicType.createPrimitiveType(BuiltinType.Type.String);
+ let textValue = AlgebraicValue.deserialize(textType, adapter.next())
+ let text = textValue.asString();
+ return [text];
+ }
- public static on(
- callback: (reducerEvent: ReducerEvent, _text: string) => void
- ) {
- this.getReducer().on(callback);
- }
- public on(callback: (reducerEvent: ReducerEvent, _text: string) => void) {
- this.client.on("reducer:SendMessage", callback);
- }
+ public static on(callback: (reducerEvent: ReducerEvent, _text: string) => void) {
+ this.getReducer().on(callback);
+ }
+ public on(callback: (reducerEvent: ReducerEvent, _text: string) => void)
+ {
+ this.client.on("reducer:SendMessage", callback);
+ }
}
-export default SendMessageReducer;
+
+export default SendMessageReducer
diff --git a/examples/quickstart/client/src/module_bindings/set_name_reducer.ts b/examples/quickstart/client/src/module_bindings/set_name_reducer.ts
index b1eb683..d962289 100644
--- a/examples/quickstart/client/src/module_bindings/set_name_reducer.ts
+++ b/examples/quickstart/client/src/module_bindings/set_name_reducer.ts
@@ -2,52 +2,37 @@
// WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD.
// @ts-ignore
-import {
- __SPACETIMEDB__,
- AlgebraicType,
- ProductType,
- BuiltinType,
- ProductTypeElement,
- DatabaseTable,
- AlgebraicValue,
- ReducerArgsAdapter,
- SumTypeVariant,
- Serializer,
- Identity,
- Address,
- ReducerEvent,
- Reducer,
- SpacetimeDBClient,
-} from "@clockworklabs/spacetimedb-sdk";
+import { __SPACETIMEDB__, AlgebraicType, ProductType, BuiltinType, ProductTypeElement, DatabaseTable, AlgebraicValue, ReducerArgsAdapter, SumTypeVariant, Serializer, Identity, Address, ReducerEvent, Reducer, SpacetimeDBClient } from "@clockworklabs/spacetimedb-sdk";
-export class SetNameReducer extends Reducer {
- public static reducerName: string = "SetName";
- public static call(_name: string) {
- this.getReducer().call(_name);
- }
+export class SetNameReducer extends Reducer
+{
+ public static reducerName: string = "SetName";
+ public static call(_name: string) {
+ this.getReducer().call(_name);
+ }
- public call(_name: string) {
- const serializer = this.client.getSerializer();
- let _nameType = AlgebraicType.createPrimitiveType(BuiltinType.Type.String);
- serializer.write(_nameType, _name);
- this.client.call("set_name", serializer);
- }
+ public call(_name: string) {
+ const serializer = this.client.getSerializer();
+ let _nameType = AlgebraicType.createPrimitiveType(BuiltinType.Type.String);
+ serializer.write(_nameType, _name);
+ this.client.call("set_name", serializer);
+ }
- public static deserializeArgs(adapter: ReducerArgsAdapter): any[] {
- let nameType = AlgebraicType.createPrimitiveType(BuiltinType.Type.String);
- let nameValue = AlgebraicValue.deserialize(nameType, adapter.next());
- let name = nameValue.asString();
- return [name];
- }
+ public static deserializeArgs(adapter: ReducerArgsAdapter): any[] {
+ let nameType = AlgebraicType.createPrimitiveType(BuiltinType.Type.String);
+ let nameValue = AlgebraicValue.deserialize(nameType, adapter.next())
+ let name = nameValue.asString();
+ return [name];
+ }
- public static on(
- callback: (reducerEvent: ReducerEvent, _name: string) => void
- ) {
- this.getReducer().on(callback);
- }
- public on(callback: (reducerEvent: ReducerEvent, _name: string) => void) {
- this.client.on("reducer:SetName", callback);
- }
+ public static on(callback: (reducerEvent: ReducerEvent, _name: string) => void) {
+ this.getReducer().on(callback);
+ }
+ public on(callback: (reducerEvent: ReducerEvent, _name: string) => void)
+ {
+ this.client.on("reducer:SetName", callback);
+ }
}
-export default SetNameReducer;
+
+export default SetNameReducer
diff --git a/examples/quickstart/client/src/module_bindings/user.ts b/examples/quickstart/client/src/module_bindings/user.ts
index 2e076dd..8489cff 100644
--- a/examples/quickstart/client/src/module_bindings/user.ts
+++ b/examples/quickstart/client/src/module_bindings/user.ts
@@ -2,109 +2,81 @@
// WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD.
// @ts-ignore
-import {
- __SPACETIMEDB__,
- AlgebraicType,
- ProductType,
- BuiltinType,
- ProductTypeElement,
- SumType,
- SumTypeVariant,
- DatabaseTable,
- AlgebraicValue,
- ReducerEvent,
- Identity,
- Address,
- ClientDB,
- SpacetimeDBClient,
-} from "@clockworklabs/spacetimedb-sdk";
+import { __SPACETIMEDB__, AlgebraicType, ProductType, BuiltinType, ProductTypeElement, SumType, SumTypeVariant, DatabaseTable, AlgebraicValue, ReducerEvent, Identity, Address, ClientDB, SpacetimeDBClient } from "@clockworklabs/spacetimedb-sdk";
-export class User extends DatabaseTable {
- public static db: ClientDB = __SPACETIMEDB__.clientDB;
- public static tableName = "User";
- public identity: Identity;
- public name: string | null;
- public online: boolean;
+export class User extends DatabaseTable
+{
+ public static db: ClientDB = __SPACETIMEDB__.clientDB;
+ public static tableName = "User";
+ public identity: Identity;
+ public name: string | null;
+ public online: boolean;
- public static primaryKey: string | undefined = "identity";
+ public static primaryKey: string | undefined = "identity";
- constructor(identity: Identity, name: string | null, online: boolean) {
- super();
- this.identity = identity;
- this.name = name;
- this.online = online;
- }
+ constructor(identity: Identity, name: string | null, online: boolean) {
+ super();
+ this.identity = identity;
+ this.name = name;
+ this.online = online;
+ }
- public static serialize(value: User): object {
- return [
- Array.from(value.identity.toUint8Array()),
- value.name ? { some: value.name } : { none: [] },
- value.online,
- ];
- }
+ public static serialize(value: User): object {
+ return [
+ Array.from(value.identity.toUint8Array()), value.name ? { "some": value.name } : { "none": [] }, value.online
+ ];
+ }
- public static getAlgebraicType(): AlgebraicType {
- return AlgebraicType.createProductType([
- new ProductTypeElement(
- "identity",
- AlgebraicType.createProductType([
- new ProductTypeElement(
- "__identity_bytes",
- AlgebraicType.createArrayType(
- AlgebraicType.createPrimitiveType(BuiltinType.Type.U8)
- )
- ),
- ])
- ),
- new ProductTypeElement(
- "name",
- AlgebraicType.createSumType([
- new SumTypeVariant(
- "some",
- AlgebraicType.createPrimitiveType(BuiltinType.Type.String)
- ),
- new SumTypeVariant("none", AlgebraicType.createProductType([])),
- ])
- ),
- new ProductTypeElement(
- "online",
- AlgebraicType.createPrimitiveType(BuiltinType.Type.Bool)
- ),
- ]);
- }
+ public static getAlgebraicType(): AlgebraicType
+ {
+ return AlgebraicType.createProductType([
+ new ProductTypeElement("identity", AlgebraicType.createProductType([
+ new ProductTypeElement("__identity_bytes", AlgebraicType.createArrayType(AlgebraicType.createPrimitiveType(BuiltinType.Type.U8))),
+ ])),
+ new ProductTypeElement("name", AlgebraicType.createSumType([
+ new SumTypeVariant("some", AlgebraicType.createPrimitiveType(BuiltinType.Type.String)),
+ new SumTypeVariant("none", AlgebraicType.createProductType([
+ ])),
+ ])),
+ new ProductTypeElement("online", AlgebraicType.createPrimitiveType(BuiltinType.Type.Bool)),
+ ]);
+ }
- public static fromValue(value: AlgebraicValue): User {
- let productValue = value.asProductValue();
- let __identity = new Identity(
- productValue.elements[0].asProductValue().elements[0].asBytes()
- );
- let __name =
- productValue.elements[1].asSumValue().tag == 1
- ? null
- : productValue.elements[1].asSumValue().value.asString();
- let __online = productValue.elements[2].asBoolean();
- return new this(__identity, __name, __online);
- }
+ public static fromValue(value: AlgebraicValue): User
+ {
+ let productValue = value.asProductValue();
+ let __identity = new Identity(productValue.elements[0].asProductValue().elements[0].asBytes());
+ let __name = productValue.elements[1].asSumValue().tag == 1 ? null : productValue.elements[1].asSumValue().value.asString();
+ let __online = productValue.elements[2].asBoolean();
+ return new this(__identity, __name, __online);
+ }
- public static *filterByIdentity(value: Identity): IterableIterator {
- for (let instance of this.db.getTable("User").getInstances()) {
- if (instance.identity.isEqual(value)) {
- yield instance;
- }
- }
- }
+ public static *filterByIdentity(value: Identity): IterableIterator
+ {
+ for (let instance of this.db.getTable("User").getInstances())
+ {
+ if (instance.identity.isEqual(value)) {
+ yield instance;
+ }
+ }
+ }
+
+ public static findByIdentity(value: Identity): User | undefined
+ {
+ return this.filterByIdentity(value).next().value;
+ }
+
+ public static *filterByOnline(value: boolean): IterableIterator
+ {
+ for (let instance of this.db.getTable("User").getInstances())
+ {
+ if (instance.online === value) {
+ yield instance;
+ }
+ }
+ }
- public static findByIdentity(value: Identity): User | undefined {
- return this.filterByIdentity(value).next().value;
- }
- public static *filterByOnline(value: boolean): IterableIterator {
- for (let instance of this.db.getTable("User").getInstances()) {
- if (instance.online === value) {
- yield instance;
- }
- }
- }
}
export default User;
diff --git a/examples/quickstart/client/src/react-app-env.d.ts b/examples/quickstart/client/src/react-app-env.d.ts
deleted file mode 100644
index 6431bc5..0000000
--- a/examples/quickstart/client/src/react-app-env.d.ts
+++ /dev/null
@@ -1 +0,0 @@
-///
diff --git a/examples/quickstart/client/src/reportWebVitals.ts b/examples/quickstart/client/src/reportWebVitals.ts
deleted file mode 100644
index 5fa3583..0000000
--- a/examples/quickstart/client/src/reportWebVitals.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { ReportHandler } from "web-vitals";
-
-const reportWebVitals = (onPerfEntry?: ReportHandler) => {
- if (onPerfEntry && onPerfEntry instanceof Function) {
- import("web-vitals").then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
- getCLS(onPerfEntry);
- getFID(onPerfEntry);
- getFCP(onPerfEntry);
- getLCP(onPerfEntry);
- getTTFB(onPerfEntry);
- });
- }
-};
-
-export default reportWebVitals;
diff --git a/examples/quickstart/client/src/setupTests.ts b/examples/quickstart/client/src/setupTests.ts
deleted file mode 100644
index 1dd407a..0000000
--- a/examples/quickstart/client/src/setupTests.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-// jest-dom adds custom jest matchers for asserting on DOM nodes.
-// allows you to do things like:
-// expect(element).toHaveTextContent(/react/i)
-// learn more: https://github.com/testing-library/jest-dom
-import "@testing-library/jest-dom";
diff --git a/examples/quickstart/client/src/vite-env.d.ts b/examples/quickstart/client/src/vite-env.d.ts
new file mode 100644
index 0000000..11f02fe
--- /dev/null
+++ b/examples/quickstart/client/src/vite-env.d.ts
@@ -0,0 +1 @@
+///
diff --git a/examples/quickstart/client/tsconfig.json b/examples/quickstart/client/tsconfig.json
index 2d519b5..3bcc64f 100644
--- a/examples/quickstart/client/tsconfig.json
+++ b/examples/quickstart/client/tsconfig.json
@@ -1,20 +1,26 @@
{
"compilerOptions": {
- "target": "es2015",
- "lib": ["dom", "dom.iterable", "esnext"],
- "allowJs": true,
+ "composite": true,
+ "target": "ES2020",
+ "useDefineForClassFields": true,
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
+ "module": "ESNext",
"skipLibCheck": true,
- "esModuleInterop": true,
- "allowSyntheticDefaultImports": true,
- "strict": true,
- "forceConsistentCasingInFileNames": true,
- "noFallthroughCasesInSwitch": true,
- "module": "esnext",
- "moduleResolution": "node",
+
+ /* Bundler mode */
+ "moduleResolution": "bundler",
+ "allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
+ "moduleDetection": "force",
"noEmit": true,
- "jsx": "react-jsx"
+ "jsx": "react-jsx",
+
+ /* Linting */
+ "strict": true,
+ "noUnusedLocals": true,
+ "noUnusedParameters": true,
+ "noFallthroughCasesInSwitch": true
},
"include": ["src"]
}
diff --git a/examples/quickstart/client/vite.config.ts b/examples/quickstart/client/vite.config.ts
new file mode 100644
index 0000000..5a33944
--- /dev/null
+++ b/examples/quickstart/client/vite.config.ts
@@ -0,0 +1,7 @@
+import { defineConfig } from 'vite'
+import react from '@vitejs/plugin-react'
+
+// https://vitejs.dev/config/
+export default defineConfig({
+ plugins: [react()],
+})
diff --git a/examples/quickstart/server/Cargo.lock b/examples/quickstart/server/Cargo.lock
index 08c1666..4f19843 100644
--- a/examples/quickstart/server/Cargo.lock
+++ b/examples/quickstart/server/Cargo.lock
@@ -62,12 +62,6 @@ dependencies = [
"generic-array",
]
-[[package]]
-name = "bytes"
-version = "1.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
-
[[package]]
name = "cfg-if"
version = "1.0.0"
@@ -430,7 +424,6 @@ version = "0.10.0"
dependencies = [
"arrayvec",
"bitflags",
- "bytes",
"decorum",
"derive_more",
"enum-as-inner",
diff --git a/packages/sdk/src/websocket_decompress_adapter.ts b/packages/sdk/src/websocket_decompress_adapter.ts
index f67d5ce..54dc2d7 100644
--- a/packages/sdk/src/websocket_decompress_adapter.ts
+++ b/packages/sdk/src/websocket_decompress_adapter.ts
@@ -76,6 +76,7 @@ export class WebsocketDecompressAdapter {
if (typeof window === "undefined" || !params.auth_token) {
// NodeJS environment
const ws = new WebSocket(url, protocol, {
+ // @ts-ignore
maxReceivedFrameSize: 100000000,
maxReceivedMessageSize: 100000000,
headers,
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 5641392..27f429d 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -66,6 +66,34 @@ importers:
specifier: ^2.1.4
version: 2.1.4
+ examples/quickstart/client-vite:
+ dependencies:
+ '@clockworklabs/spacetimedb-sdk':
+ specifier: workspace:*
+ version: link:../../../packages/sdk
+ react:
+ specifier: ^18.3.1
+ version: 18.3.1
+ react-dom:
+ specifier: ^18.3.1
+ version: 18.3.1(react@18.3.1)
+ devDependencies:
+ '@types/react':
+ specifier: ^18.3.3
+ version: 18.3.3
+ '@types/react-dom':
+ specifier: ^18.3.0
+ version: 18.3.0
+ '@vitejs/plugin-react':
+ specifier: ^4.3.1
+ version: 4.3.1(vite@5.3.4(terser@5.31.2))
+ typescript:
+ specifier: ^5.2.2
+ version: 5.5.3
+ vite:
+ specifier: ^5.3.4
+ version: 5.3.4(terser@5.31.2)
+
packages/sdk:
dependencies:
brotli:
@@ -704,6 +732,18 @@ packages:
peerDependencies:
'@babel/core': ^7.0.0-0
+ '@babel/plugin-transform-react-jsx-self@7.24.7':
+ resolution: {integrity: sha512-fOPQYbGSgH0HUp4UJO4sMBFjY6DuWq+2i8rixyUMb3CdGixs/gccURvYOAhajBdKDoGajFr3mUq5rH3phtkGzw==}
+ engines: {node: '>=6.9.0'}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
+ '@babel/plugin-transform-react-jsx-source@7.24.7':
+ resolution: {integrity: sha512-J2z+MWzZHVOemyLweMqngXrgGC42jQ//R0KdxqkIz/OrbVIIlhFI3WigZ5fO+nwFvBlncr4MGapd8vTyc7RPNQ==}
+ engines: {node: '>=6.9.0'}
+ peerDependencies:
+ '@babel/core': ^7.0.0-0
+
'@babel/plugin-transform-react-jsx@7.24.7':
resolution: {integrity: sha512-+Dj06GDZEFRYvclU6k4bme55GKBEWUmByM/eoKuqg4zTNQHiApWRhQph5fxQB2wAEFvRzL1tOEj1RJ19wJrhoA==}
engines: {node: '>=6.9.0'}
@@ -1683,6 +1723,12 @@ packages:
'@ungap/structured-clone@1.2.0':
resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==}
+ '@vitejs/plugin-react@4.3.1':
+ resolution: {integrity: sha512-m/V2syj5CuVnaxcUJOQRel/Wr31FFXRFlnOoq1TVtkCxsY5veGMTEmpWHndrhB2U8ScHtCQB1e+4hWYExQc6Lg==}
+ engines: {node: ^14.18.0 || >=16.0.0}
+ peerDependencies:
+ vite: ^4.2.0 || ^5.0.0
+
'@vitest/expect@2.0.3':
resolution: {integrity: sha512-X6AepoOYePM0lDNUPsGXTxgXZAl3EXd0GYe/MZyVE4HzkUqyUVC6S3PrY5mClDJ6/7/7vALLMV3+xD/Ko60Hqg==}
@@ -4919,6 +4965,10 @@ packages:
resolution: {integrity: sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A==}
engines: {node: '>=0.10.0'}
+ react-refresh@0.14.2:
+ resolution: {integrity: sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==}
+ engines: {node: '>=0.10.0'}
+
react-scripts@5.0.1:
resolution: {integrity: sha512-8VAmEm/ZAwQzJ+GOMLbBsTdDKOpuZh7RPs0UymvBR2vRk4iZWCskjbFnxqjrzoIvlNNRZ3QJFx6/qDSi6zSnaQ==}
engines: {node: '>=14.0.0'}
@@ -6780,6 +6830,16 @@ snapshots:
transitivePeerDependencies:
- supports-color
+ '@babel/plugin-transform-react-jsx-self@7.24.7(@babel/core@7.24.9)':
+ dependencies:
+ '@babel/core': 7.24.9
+ '@babel/helper-plugin-utils': 7.24.8
+
+ '@babel/plugin-transform-react-jsx-source@7.24.7(@babel/core@7.24.9)':
+ dependencies:
+ '@babel/core': 7.24.9
+ '@babel/helper-plugin-utils': 7.24.8
+
'@babel/plugin-transform-react-jsx@7.24.7(@babel/core@7.24.9)':
dependencies:
'@babel/core': 7.24.9
@@ -7959,6 +8019,17 @@ snapshots:
'@ungap/structured-clone@1.2.0': {}
+ '@vitejs/plugin-react@4.3.1(vite@5.3.4(terser@5.31.2))':
+ dependencies:
+ '@babel/core': 7.24.9
+ '@babel/plugin-transform-react-jsx-self': 7.24.7(@babel/core@7.24.9)
+ '@babel/plugin-transform-react-jsx-source': 7.24.7(@babel/core@7.24.9)
+ '@types/babel__core': 7.20.5
+ react-refresh: 0.14.2
+ vite: 5.3.4(terser@5.31.2)
+ transitivePeerDependencies:
+ - supports-color
+
'@vitest/expect@2.0.3':
dependencies:
'@vitest/spy': 2.0.3
@@ -11760,6 +11831,8 @@ snapshots:
react-refresh@0.11.0: {}
+ react-refresh@0.14.2: {}
+
react-scripts@5.0.1(@babel/plugin-syntax-flow@7.24.7(@babel/core@7.24.9))(@babel/plugin-transform-react-jsx@7.24.7(@babel/core@7.24.9))(@types/babel__core@7.20.5)(bufferutil@4.0.8)(esbuild@0.21.5)(eslint@8.57.0)(react@18.3.1)(type-fest@0.21.3)(typescript@4.9.5)(utf-8-validate@5.0.10):
dependencies:
'@babel/core': 7.24.9