diff --git a/.github/workflows/typescript-test.yml b/.github/workflows/typescript-test.yml index b8beef61f72..9affa726f47 100644 --- a/.github/workflows/typescript-test.yml +++ b/.github/workflows/typescript-test.yml @@ -115,11 +115,9 @@ jobs: fi - name: Generate client bindings - working-directory: templates/quickstart-chat-typescript/spacetimedb + working-directory: templates/quickstart-chat-typescript run: | - spacetime generate --lang typescript --out-dir ../src/module_bindings - cd ../../../crates/bindings-typescript - pnpm format + pnpm generate - name: Check for changes working-directory: templates/quickstart-chat-typescript @@ -149,6 +147,14 @@ jobs: working-directory: templates/quickstart-chat-typescript run: pnpm build + - name: Check that templates build + working-directory: templates/ + run: pnpm -r --filter "./**" run build + + - name: Check that subdirectories build + working-directory: crates/bindings-typescript + run: pnpm -r --filter "./**" run build + # - name: Run quickstart-chat tests # working-directory: examples/quickstart-chat # run: pnpm test diff --git a/crates/bindings-typescript/src/sdk/client_api/index.ts b/crates/bindings-typescript/src/sdk/client_api/index.ts index 1dffeccfdd1..584808d7bbe 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.0 (commit 492e591845db8b174ee885b74294cb4ecbf655dc). +// This was generated using spacetimedb cli version 1.11.2 (commit 902af09c55b418c987000e739eb176a3368296ca). /* eslint-disable */ /* tslint:disable */ @@ -10,6 +10,7 @@ import { DbConnectionImpl as __DbConnectionImpl, SubscriptionBuilderImpl as __SubscriptionBuilderImpl, TypeBuilder as __TypeBuilder, + Uuid as __Uuid, convertToAccessorMap as __convertToAccessorMap, procedureSchema as __procedureSchema, procedures as __procedures, @@ -118,7 +119,7 @@ const proceduresSchema = __procedures(); /** The remote SpacetimeDB module schema, both runtime and type information. */ const REMOTE_MODULE = { versionInfo: { - cliVersion: '1.11.0' as const, + cliVersion: '1.11.2' as const, }, tables: tablesSchema.schemaType.tables, reducers: reducersSchema.reducersType.reducers, 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 46ef1b99735..8a960614437 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.0 (commit 492e591845db8b174ee885b74294cb4ecbf655dc). +// This was generated using spacetimedb cli version 1.11.2 (commit 902af09c55b418c987000e739eb176a3368296ca). /* eslint-disable */ /* tslint:disable */ @@ -10,6 +10,7 @@ import { DbConnectionImpl as __DbConnectionImpl, SubscriptionBuilderImpl as __SubscriptionBuilderImpl, TypeBuilder as __TypeBuilder, + Uuid as __Uuid, convertToAccessorMap as __convertToAccessorMap, procedureSchema as __procedureSchema, procedures as __procedures, @@ -109,7 +110,7 @@ const proceduresSchema = __procedures(); /** The remote SpacetimeDB module schema, both runtime and type information. */ const REMOTE_MODULE = { versionInfo: { - cliVersion: '1.11.0' as const, + cliVersion: '1.11.2' as const, }, tables: tablesSchema.schemaType.tables, reducers: reducersSchema.reducersType.reducers, diff --git a/package.json b/package.json index 64fa9419780..fb9b8211531 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,11 @@ "engines": { "node": ">=18.0.0", "pnpm": ">=9.0.0" }, "type": "module", "scripts": { - "format": "pnpm --filter ./crates/bindings-typescript run format && pnpm --filter ./docs run format && pnpm --filter ./crates/bindings-typescript/examples/quickstart-chat run format && pnpm --filter ./crates/bindings-typescript/test-app run format", - "lint": "pnpm --filter ./crates/bindings-typescript run lint && pnpm --filter ./docs run lint && pnpm --filter ./crates/bindings-typescript/examples/quickstart-chat run lint && pnpm --filter ./crates/bindings-typescript/test-app run lint", - "build": "pnpm --filter ./crates/bindings-typescript run build && pnpm --filter ./docs run build && pnpm --filter ./crates/bindings-typescript/examples/quickstart-chat run build && pnpm --filter ./crates/bindings-typescript/test-app run build", + "format": "pnpm --filter ./crates/bindings-typescript run format && pnpm --filter ./docs run format && pnpm --filter ./crates/bindings-typescript/test-app run format && pnpm -r --filter './templates/**' run format", + "lint": "pnpm --filter ./crates/bindings-typescript run lint && pnpm --filter ./docs run lint && pnpm --filter ./crates/bindings-typescript/test-app run lint && pnpm -r --filter './templates/**' run lint", + "build": "pnpm --filter ./crates/bindings-typescript run build && pnpm --filter ./docs run build && pnpm --filter ./crates/bindings-typescript/test-app run build && pnpm -r --filter './templates/**' run build", "test": "pnpm --filter ./crates/bindings-typescript run test && pnpm --filter ./docs run test && pnpm --filter ./crates/bindings-typescript/examples/quickstart-chat run test && pnpm --filter ./crates/bindings-typescript/test-app run test", - "generate": "pnpm --filter ./crates/bindings-typescript run generate && pnpm --filter ./docs run generate && pnpm --filter ./crates/bindings-typescript/examples/quickstart-chat run generate && pnpm --filter ./crates/bindings-typescript/test-app run generate", + "generate": "pnpm --filter ./crates/bindings-typescript run generate && pnpm --filter ./docs run generate && pnpm --filter ./crates/bindings-typescript/test-app run generate && pnpm -r --filter './templates/**' run generate", "clean": "pnpm -r exec rimraf dist .tsbuildinfo coverage" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index bd8b2c2a44f..e9de64e1c10 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -162,7 +162,7 @@ importers: version: 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) '@docusaurus/plugin-content-docs': specifier: 3.9.2 - version: 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) + version: 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(debug@4.4.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) '@docusaurus/preset-classic': specifier: 3.9.2 version: 3.9.2(@algolia/client-search@5.39.0)(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(@types/react@18.3.23)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.17.3)(typescript@5.6.3) @@ -10466,7 +10466,7 @@ snapshots: '@docusaurus/core': 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(debug@4.4.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) '@docusaurus/logger': 3.9.2 '@docusaurus/mdx-loader': 3.9.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@docusaurus/plugin-content-docs': 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) + '@docusaurus/plugin-content-docs': 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(debug@4.4.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) '@docusaurus/theme-common': 3.9.2(@docusaurus/plugin-content-docs@3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@docusaurus/types': 3.9.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@docusaurus/utils': 3.9.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -10503,46 +10503,6 @@ snapshots: - webpack-cli '@docusaurus/plugin-content-docs@3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(debug@4.4.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3)': - dependencies: - '@docusaurus/core': 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(debug@4.4.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) - '@docusaurus/logger': 3.9.2 - '@docusaurus/mdx-loader': 3.9.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@docusaurus/module-type-aliases': 3.9.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@docusaurus/theme-common': 3.9.2(@docusaurus/plugin-content-docs@3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(debug@4.4.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@docusaurus/types': 3.9.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@docusaurus/utils': 3.9.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@docusaurus/utils-common': 3.9.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@docusaurus/utils-validation': 3.9.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@types/react-router-config': 5.0.11 - combine-promises: 1.2.0 - fs-extra: 11.3.2 - js-yaml: 4.1.0 - lodash: 4.17.21 - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) - schema-dts: 1.1.5 - tslib: 2.8.1 - utility-types: 3.11.0 - webpack: 5.102.0 - transitivePeerDependencies: - - '@docusaurus/faster' - - '@mdx-js/react' - - '@parcel/css' - - '@rspack/core' - - '@swc/core' - - '@swc/css' - - bufferutil - - csso - - debug - - esbuild - - lightningcss - - supports-color - - typescript - - uglify-js - - utf-8-validate - - webpack-cli - - '@docusaurus/plugin-content-docs@3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3)': dependencies: '@docusaurus/core': 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(debug@4.4.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) '@docusaurus/logger': 3.9.2 @@ -10811,7 +10771,7 @@ snapshots: dependencies: '@docusaurus/core': 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(debug@4.4.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) '@docusaurus/plugin-content-blog': 3.9.2(@docusaurus/plugin-content-docs@3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3))(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) - '@docusaurus/plugin-content-docs': 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) + '@docusaurus/plugin-content-docs': 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(debug@4.4.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) '@docusaurus/plugin-content-pages': 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) '@docusaurus/plugin-css-cascade-layers': 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) '@docusaurus/plugin-debug': 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) @@ -10859,7 +10819,7 @@ snapshots: '@docusaurus/mdx-loader': 3.9.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@docusaurus/module-type-aliases': 3.9.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@docusaurus/plugin-content-blog': 3.9.2(@docusaurus/plugin-content-docs@3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3))(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) - '@docusaurus/plugin-content-docs': 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) + '@docusaurus/plugin-content-docs': 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(debug@4.4.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) '@docusaurus/plugin-content-pages': 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) '@docusaurus/theme-common': 3.9.2(@docusaurus/plugin-content-docs@3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@docusaurus/theme-translations': 3.9.2 @@ -10899,35 +10859,11 @@ snapshots: - utf-8-validate - webpack-cli - '@docusaurus/theme-common@3.9.2(@docusaurus/plugin-content-docs@3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(debug@4.4.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': - dependencies: - '@docusaurus/mdx-loader': 3.9.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@docusaurus/module-type-aliases': 3.9.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@docusaurus/plugin-content-docs': 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(debug@4.4.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) - '@docusaurus/utils': 3.9.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@docusaurus/utils-common': 3.9.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@types/history': 4.7.11 - '@types/react': 18.3.23 - '@types/react-router-config': 5.0.11 - clsx: 2.1.1 - parse-numeric-range: 1.3.0 - prism-react-renderer: 2.4.1(react@18.3.1) - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) - tslib: 2.8.1 - utility-types: 3.11.0 - transitivePeerDependencies: - - '@swc/core' - - esbuild - - supports-color - - uglify-js - - webpack-cli - '@docusaurus/theme-common@3.9.2(@docusaurus/plugin-content-docs@3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@docusaurus/mdx-loader': 3.9.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@docusaurus/module-type-aliases': 3.9.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - '@docusaurus/plugin-content-docs': 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) + '@docusaurus/plugin-content-docs': 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(debug@4.4.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) '@docusaurus/utils': 3.9.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@docusaurus/utils-common': 3.9.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@types/history': 4.7.11 @@ -10952,7 +10888,7 @@ snapshots: '@docsearch/react': 4.2.0(@algolia/client-search@5.39.0)(@types/react@18.3.23)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(search-insights@2.17.3) '@docusaurus/core': 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(debug@4.4.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) '@docusaurus/logger': 3.9.2 - '@docusaurus/plugin-content-docs': 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) + '@docusaurus/plugin-content-docs': 3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(debug@4.4.3)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3) '@docusaurus/theme-common': 3.9.2(@docusaurus/plugin-content-docs@3.9.2(@mdx-js/react@3.1.1(@types/react@18.3.23)(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(typescript@5.6.3))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@docusaurus/theme-translations': 3.9.2 '@docusaurus/utils': 3.9.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1) diff --git a/templates/basic-react/src/module_bindings/add_reducer.ts b/templates/basic-react/src/module_bindings/add_reducer.ts index ce493ee8574..85081559c7d 100644 --- a/templates/basic-react/src/module_bindings/add_reducer.ts +++ b/templates/basic-react/src/module_bindings/add_reducer.ts @@ -8,7 +8,7 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; export default { name: __t.string(), diff --git a/templates/basic-react/src/module_bindings/add_type.ts b/templates/basic-react/src/module_bindings/add_type.ts new file mode 100644 index 00000000000..638f62cea39 --- /dev/null +++ b/templates/basic-react/src/module_bindings/add_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('Add', { + name: __t.string(), +}); diff --git a/templates/basic-react/src/module_bindings/index.ts b/templates/basic-react/src/module_bindings/index.ts index 6d610f99e69..5aedda6b8bb 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.2 (commit dc5997d48f7c472faf2756b07c012bcf28edc50b). +// This was generated using spacetimedb cli version 1.11.2 (commit 902af09c55b418c987000e739eb176a3368296ca). /* eslint-disable */ /* tslint:disable */ @@ -29,53 +29,63 @@ import { type RemoteModule as __RemoteModule, type SubscriptionEventContextInterface as __SubscriptionEventContextInterface, type SubscriptionHandleImpl as __SubscriptionHandleImpl, -} from "spacetimedb"; +} from 'spacetimedb'; // Import and reexport all reducer arg types -import OnConnectReducer from "./on_connect_reducer"; +import OnConnectReducer from './on_connect_reducer'; export { OnConnectReducer }; -import OnDisconnectReducer from "./on_disconnect_reducer"; +import OnDisconnectReducer from './on_disconnect_reducer'; export { OnDisconnectReducer }; -import AddReducer from "./add_reducer"; +import AddReducer from './add_reducer'; export { AddReducer }; -import SayHelloReducer from "./say_hello_reducer"; +import SayHelloReducer from './say_hello_reducer'; export { SayHelloReducer }; // Import and reexport all procedure arg types // Import and reexport all table handle types -import PersonRow from "./person_table"; +import PersonRow from './person_table'; export { PersonRow }; // Import and reexport all types -import Person from "./person_type"; +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 }; /** 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( - __table({ - name: 'person', - indexes: [ - ], - constraints: [ - ], - }, PersonRow), + __table( + { + name: 'person', + indexes: [], + constraints: [], + }, + PersonRow + ) ); /** The schema information for all reducers in this module. This is defined the same way as the reducers would have been defined in the server, except the body of the reducer is omitted in code generation. */ const reducersSchema = __reducers( - __reducerSchema("add", AddReducer), - __reducerSchema("say_hello", SayHelloReducer), + __reducerSchema('add', AddReducer), + __reducerSchema('say_hello', SayHelloReducer) ); /** The schema information for all procedures in this module. This is defined the same way as the procedures would have been defined in the server. */ -const proceduresSchema = __procedures( -); +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.2' as const, }, tables: tablesSchema.schemaType.tables, reducers: reducersSchema.reducersType.reducers, @@ -90,21 +100,29 @@ const REMOTE_MODULE = { export const tables = __convertToAccessorMap(tablesSchema.schemaType.tables); /** The reducers available in this remote SpacetimeDB module. */ -export const reducers = __convertToAccessorMap(reducersSchema.reducersType.reducers); +export const reducers = __convertToAccessorMap( + reducersSchema.reducersType.reducers +); /** The context type returned in callbacks for all possible events. */ export type EventContext = __EventContextInterface; /** The context type returned in callbacks for reducer events. */ -export type ReducerEventContext = __ReducerEventContextInterface; +export type ReducerEventContext = __ReducerEventContextInterface< + typeof REMOTE_MODULE +>; /** The context type returned in callbacks for subscription events. */ -export type SubscriptionEventContext = __SubscriptionEventContextInterface; +export type SubscriptionEventContext = __SubscriptionEventContextInterface< + typeof REMOTE_MODULE +>; /** The context type returned in callbacks for error events. */ export type ErrorContext = __ErrorContextInterface; /** The subscription handle type to manage active subscriptions created from a {@link SubscriptionBuilder}. */ export type SubscriptionHandle = __SubscriptionHandleImpl; /** Builder class to configure a new subscription to the remote SpacetimeDB instance. */ -export class SubscriptionBuilder extends __SubscriptionBuilderImpl {} +export class SubscriptionBuilder extends __SubscriptionBuilderImpl< + typeof REMOTE_MODULE +> {} /** Builder class to configure a new database connection to the remote SpacetimeDB instance. */ export class DbConnectionBuilder extends __DbConnectionBuilder {} @@ -113,7 +131,11 @@ export class DbConnectionBuilder extends __DbConnectionBuilder {} export class DbConnection extends __DbConnectionImpl { /** Creates a new {@link DbConnectionBuilder} to configure and connect to the remote SpacetimeDB instance. */ static builder = (): DbConnectionBuilder => { - return new DbConnectionBuilder(REMOTE_MODULE, (config: __DbConnectionConfig) => new DbConnection(config)); + return new DbConnectionBuilder( + REMOTE_MODULE, + (config: __DbConnectionConfig) => + new DbConnection(config) + ); }; /** Creates a new {@link SubscriptionBuilder} to configure a subscription to the remote SpacetimeDB instance. */ @@ -121,4 +143,3 @@ export class DbConnection extends __DbConnectionImpl { return new SubscriptionBuilder(this); }; } - diff --git a/templates/basic-react/src/module_bindings/init_type.ts b/templates/basic-react/src/module_bindings/init_type.ts new file mode 100644 index 00000000000..52ed691ed94 --- /dev/null +++ b/templates/basic-react/src/module_bindings/init_type.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 { + TypeBuilder as __TypeBuilder, + t as __t, + type AlgebraicTypeType as __AlgebraicTypeType, + type Infer as __Infer, +} from 'spacetimedb'; + +export default __t.object('Init', {}); diff --git a/templates/basic-react/src/module_bindings/on_connect_reducer.ts b/templates/basic-react/src/module_bindings/on_connect_reducer.ts index e18fbc0a086..2ca99c88fea 100644 --- a/templates/basic-react/src/module_bindings/on_connect_reducer.ts +++ b/templates/basic-react/src/module_bindings/on_connect_reducer.ts @@ -8,6 +8,6 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; export default {}; diff --git a/templates/basic-react/src/module_bindings/on_connect_type.ts b/templates/basic-react/src/module_bindings/on_connect_type.ts new file mode 100644 index 00000000000..d36362515de --- /dev/null +++ b/templates/basic-react/src/module_bindings/on_connect_type.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 { + TypeBuilder as __TypeBuilder, + t as __t, + type AlgebraicTypeType as __AlgebraicTypeType, + type Infer as __Infer, +} from 'spacetimedb'; + +export default __t.object('OnConnect', {}); diff --git a/templates/basic-react/src/module_bindings/on_disconnect_reducer.ts b/templates/basic-react/src/module_bindings/on_disconnect_reducer.ts index e18fbc0a086..2ca99c88fea 100644 --- a/templates/basic-react/src/module_bindings/on_disconnect_reducer.ts +++ b/templates/basic-react/src/module_bindings/on_disconnect_reducer.ts @@ -8,6 +8,6 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; export default {}; diff --git a/templates/basic-react/src/module_bindings/on_disconnect_type.ts b/templates/basic-react/src/module_bindings/on_disconnect_type.ts new file mode 100644 index 00000000000..efda71ebcfd --- /dev/null +++ b/templates/basic-react/src/module_bindings/on_disconnect_type.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 { + TypeBuilder as __TypeBuilder, + t as __t, + type AlgebraicTypeType as __AlgebraicTypeType, + type Infer as __Infer, +} from 'spacetimedb'; + +export default __t.object('OnDisconnect', {}); diff --git a/templates/basic-react/src/module_bindings/person_table.ts b/templates/basic-react/src/module_bindings/person_table.ts index 4dc4a822cc3..0f70f74f617 100644 --- a/templates/basic-react/src/module_bindings/person_table.ts +++ b/templates/basic-react/src/module_bindings/person_table.ts @@ -8,7 +8,7 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; export default __t.row({ name: __t.string(), diff --git a/templates/basic-react/src/module_bindings/person_type.ts b/templates/basic-react/src/module_bindings/person_type.ts index 817473e2817..1156775a3cf 100644 --- a/templates/basic-react/src/module_bindings/person_type.ts +++ b/templates/basic-react/src/module_bindings/person_type.ts @@ -8,10 +8,8 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; -export default __t.object("Person", { +export default __t.object('Person', { name: __t.string(), }); - - diff --git a/templates/basic-react/src/module_bindings/say_hello_reducer.ts b/templates/basic-react/src/module_bindings/say_hello_reducer.ts index e18fbc0a086..2ca99c88fea 100644 --- a/templates/basic-react/src/module_bindings/say_hello_reducer.ts +++ b/templates/basic-react/src/module_bindings/say_hello_reducer.ts @@ -8,6 +8,6 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; export default {}; diff --git a/templates/basic-react/src/module_bindings/say_hello_type.ts b/templates/basic-react/src/module_bindings/say_hello_type.ts new file mode 100644 index 00000000000..6293ca6bd09 --- /dev/null +++ b/templates/basic-react/src/module_bindings/say_hello_type.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 { + TypeBuilder as __TypeBuilder, + t as __t, + type AlgebraicTypeType as __AlgebraicTypeType, + type Infer as __Infer, +} from 'spacetimedb'; + +export default __t.object('SayHello', {}); diff --git a/templates/basic-typescript/src/module_bindings/add_reducer.ts b/templates/basic-typescript/src/module_bindings/add_reducer.ts index ce493ee8574..85081559c7d 100644 --- a/templates/basic-typescript/src/module_bindings/add_reducer.ts +++ b/templates/basic-typescript/src/module_bindings/add_reducer.ts @@ -8,7 +8,7 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; export default { name: __t.string(), diff --git a/templates/basic-typescript/src/module_bindings/add_type.ts b/templates/basic-typescript/src/module_bindings/add_type.ts new file mode 100644 index 00000000000..638f62cea39 --- /dev/null +++ b/templates/basic-typescript/src/module_bindings/add_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('Add', { + name: __t.string(), +}); diff --git a/templates/basic-typescript/src/module_bindings/index.ts b/templates/basic-typescript/src/module_bindings/index.ts index 6d610f99e69..5aedda6b8bb 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.2 (commit dc5997d48f7c472faf2756b07c012bcf28edc50b). +// This was generated using spacetimedb cli version 1.11.2 (commit 902af09c55b418c987000e739eb176a3368296ca). /* eslint-disable */ /* tslint:disable */ @@ -29,53 +29,63 @@ import { type RemoteModule as __RemoteModule, type SubscriptionEventContextInterface as __SubscriptionEventContextInterface, type SubscriptionHandleImpl as __SubscriptionHandleImpl, -} from "spacetimedb"; +} from 'spacetimedb'; // Import and reexport all reducer arg types -import OnConnectReducer from "./on_connect_reducer"; +import OnConnectReducer from './on_connect_reducer'; export { OnConnectReducer }; -import OnDisconnectReducer from "./on_disconnect_reducer"; +import OnDisconnectReducer from './on_disconnect_reducer'; export { OnDisconnectReducer }; -import AddReducer from "./add_reducer"; +import AddReducer from './add_reducer'; export { AddReducer }; -import SayHelloReducer from "./say_hello_reducer"; +import SayHelloReducer from './say_hello_reducer'; export { SayHelloReducer }; // Import and reexport all procedure arg types // Import and reexport all table handle types -import PersonRow from "./person_table"; +import PersonRow from './person_table'; export { PersonRow }; // Import and reexport all types -import Person from "./person_type"; +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 }; /** 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( - __table({ - name: 'person', - indexes: [ - ], - constraints: [ - ], - }, PersonRow), + __table( + { + name: 'person', + indexes: [], + constraints: [], + }, + PersonRow + ) ); /** The schema information for all reducers in this module. This is defined the same way as the reducers would have been defined in the server, except the body of the reducer is omitted in code generation. */ const reducersSchema = __reducers( - __reducerSchema("add", AddReducer), - __reducerSchema("say_hello", SayHelloReducer), + __reducerSchema('add', AddReducer), + __reducerSchema('say_hello', SayHelloReducer) ); /** The schema information for all procedures in this module. This is defined the same way as the procedures would have been defined in the server. */ -const proceduresSchema = __procedures( -); +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.2' as const, }, tables: tablesSchema.schemaType.tables, reducers: reducersSchema.reducersType.reducers, @@ -90,21 +100,29 @@ const REMOTE_MODULE = { export const tables = __convertToAccessorMap(tablesSchema.schemaType.tables); /** The reducers available in this remote SpacetimeDB module. */ -export const reducers = __convertToAccessorMap(reducersSchema.reducersType.reducers); +export const reducers = __convertToAccessorMap( + reducersSchema.reducersType.reducers +); /** The context type returned in callbacks for all possible events. */ export type EventContext = __EventContextInterface; /** The context type returned in callbacks for reducer events. */ -export type ReducerEventContext = __ReducerEventContextInterface; +export type ReducerEventContext = __ReducerEventContextInterface< + typeof REMOTE_MODULE +>; /** The context type returned in callbacks for subscription events. */ -export type SubscriptionEventContext = __SubscriptionEventContextInterface; +export type SubscriptionEventContext = __SubscriptionEventContextInterface< + typeof REMOTE_MODULE +>; /** The context type returned in callbacks for error events. */ export type ErrorContext = __ErrorContextInterface; /** The subscription handle type to manage active subscriptions created from a {@link SubscriptionBuilder}. */ export type SubscriptionHandle = __SubscriptionHandleImpl; /** Builder class to configure a new subscription to the remote SpacetimeDB instance. */ -export class SubscriptionBuilder extends __SubscriptionBuilderImpl {} +export class SubscriptionBuilder extends __SubscriptionBuilderImpl< + typeof REMOTE_MODULE +> {} /** Builder class to configure a new database connection to the remote SpacetimeDB instance. */ export class DbConnectionBuilder extends __DbConnectionBuilder {} @@ -113,7 +131,11 @@ export class DbConnectionBuilder extends __DbConnectionBuilder {} export class DbConnection extends __DbConnectionImpl { /** Creates a new {@link DbConnectionBuilder} to configure and connect to the remote SpacetimeDB instance. */ static builder = (): DbConnectionBuilder => { - return new DbConnectionBuilder(REMOTE_MODULE, (config: __DbConnectionConfig) => new DbConnection(config)); + return new DbConnectionBuilder( + REMOTE_MODULE, + (config: __DbConnectionConfig) => + new DbConnection(config) + ); }; /** Creates a new {@link SubscriptionBuilder} to configure a subscription to the remote SpacetimeDB instance. */ @@ -121,4 +143,3 @@ export class DbConnection extends __DbConnectionImpl { return new SubscriptionBuilder(this); }; } - diff --git a/templates/basic-typescript/src/module_bindings/init_type.ts b/templates/basic-typescript/src/module_bindings/init_type.ts new file mode 100644 index 00000000000..52ed691ed94 --- /dev/null +++ b/templates/basic-typescript/src/module_bindings/init_type.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 { + TypeBuilder as __TypeBuilder, + t as __t, + type AlgebraicTypeType as __AlgebraicTypeType, + type Infer as __Infer, +} from 'spacetimedb'; + +export default __t.object('Init', {}); diff --git a/templates/basic-typescript/src/module_bindings/on_connect_reducer.ts b/templates/basic-typescript/src/module_bindings/on_connect_reducer.ts index e18fbc0a086..2ca99c88fea 100644 --- a/templates/basic-typescript/src/module_bindings/on_connect_reducer.ts +++ b/templates/basic-typescript/src/module_bindings/on_connect_reducer.ts @@ -8,6 +8,6 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; export default {}; diff --git a/templates/basic-typescript/src/module_bindings/on_connect_type.ts b/templates/basic-typescript/src/module_bindings/on_connect_type.ts new file mode 100644 index 00000000000..d36362515de --- /dev/null +++ b/templates/basic-typescript/src/module_bindings/on_connect_type.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 { + TypeBuilder as __TypeBuilder, + t as __t, + type AlgebraicTypeType as __AlgebraicTypeType, + type Infer as __Infer, +} from 'spacetimedb'; + +export default __t.object('OnConnect', {}); diff --git a/templates/basic-typescript/src/module_bindings/on_disconnect_reducer.ts b/templates/basic-typescript/src/module_bindings/on_disconnect_reducer.ts index e18fbc0a086..2ca99c88fea 100644 --- a/templates/basic-typescript/src/module_bindings/on_disconnect_reducer.ts +++ b/templates/basic-typescript/src/module_bindings/on_disconnect_reducer.ts @@ -8,6 +8,6 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; export default {}; diff --git a/templates/basic-typescript/src/module_bindings/on_disconnect_type.ts b/templates/basic-typescript/src/module_bindings/on_disconnect_type.ts new file mode 100644 index 00000000000..efda71ebcfd --- /dev/null +++ b/templates/basic-typescript/src/module_bindings/on_disconnect_type.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 { + TypeBuilder as __TypeBuilder, + t as __t, + type AlgebraicTypeType as __AlgebraicTypeType, + type Infer as __Infer, +} from 'spacetimedb'; + +export default __t.object('OnDisconnect', {}); diff --git a/templates/basic-typescript/src/module_bindings/person_table.ts b/templates/basic-typescript/src/module_bindings/person_table.ts index 4dc4a822cc3..0f70f74f617 100644 --- a/templates/basic-typescript/src/module_bindings/person_table.ts +++ b/templates/basic-typescript/src/module_bindings/person_table.ts @@ -8,7 +8,7 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; export default __t.row({ name: __t.string(), diff --git a/templates/basic-typescript/src/module_bindings/person_type.ts b/templates/basic-typescript/src/module_bindings/person_type.ts index 817473e2817..1156775a3cf 100644 --- a/templates/basic-typescript/src/module_bindings/person_type.ts +++ b/templates/basic-typescript/src/module_bindings/person_type.ts @@ -8,10 +8,8 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; -export default __t.object("Person", { +export default __t.object('Person', { name: __t.string(), }); - - diff --git a/templates/basic-typescript/src/module_bindings/say_hello_reducer.ts b/templates/basic-typescript/src/module_bindings/say_hello_reducer.ts index e18fbc0a086..2ca99c88fea 100644 --- a/templates/basic-typescript/src/module_bindings/say_hello_reducer.ts +++ b/templates/basic-typescript/src/module_bindings/say_hello_reducer.ts @@ -8,6 +8,6 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; export default {}; diff --git a/templates/basic-typescript/src/module_bindings/say_hello_type.ts b/templates/basic-typescript/src/module_bindings/say_hello_type.ts new file mode 100644 index 00000000000..6293ca6bd09 --- /dev/null +++ b/templates/basic-typescript/src/module_bindings/say_hello_type.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 { + TypeBuilder as __TypeBuilder, + t as __t, + type AlgebraicTypeType as __AlgebraicTypeType, + type Infer as __Infer, +} from 'spacetimedb'; + +export default __t.object('SayHello', {}); diff --git a/templates/quickstart-chat-typescript/src/module_bindings/index.ts b/templates/quickstart-chat-typescript/src/module_bindings/index.ts index 42cbd9d5a06..1867d8af58a 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.2 (commit dc5997d48f7c472faf2756b07c012bcf28edc50b). +// This was generated using spacetimedb cli version 1.11.2 (commit 902af09c55b418c987000e739eb176a3368296ca). /* eslint-disable */ /* tslint:disable */ @@ -29,78 +29,83 @@ import { type RemoteModule as __RemoteModule, type SubscriptionEventContextInterface as __SubscriptionEventContextInterface, type SubscriptionHandleImpl as __SubscriptionHandleImpl, -} from "spacetimedb"; +} from 'spacetimedb'; // Import and reexport all reducer arg types -import SetNameReducer from "./set_name_reducer"; +import SetNameReducer from './set_name_reducer'; export { SetNameReducer }; -import SendMessageReducer from "./send_message_reducer"; +import SendMessageReducer from './send_message_reducer'; export { SendMessageReducer }; -import OnConnectReducer from "./on_connect_reducer"; +import OnConnectReducer from './on_connect_reducer'; export { OnConnectReducer }; -import OnDisconnectReducer from "./on_disconnect_reducer"; +import OnDisconnectReducer from './on_disconnect_reducer'; export { OnDisconnectReducer }; // Import and reexport all procedure arg types // Import and reexport all table handle types -import MessageRow from "./message_table"; +import MessageRow from './message_table'; export { MessageRow }; -import UserRow from "./user_table"; +import UserRow from './user_table'; export { UserRow }; // Import and reexport all types -import Init from "./init_type"; +import Init from './init_type'; export { Init }; -import Message from "./message_type"; +import Message from './message_type'; export { Message }; -import OnConnect from "./on_connect_type"; +import OnConnect from './on_connect_type'; export { OnConnect }; -import OnDisconnect from "./on_disconnect_type"; +import OnDisconnect from './on_disconnect_type'; export { OnDisconnect }; -import SendMessage from "./send_message_type"; +import SendMessage from './send_message_type'; export { SendMessage }; -import SetName from "./set_name_type"; +import SetName from './set_name_type'; export { SetName }; -import User from "./user_type"; +import User from './user_type'; export { User }; /** 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( - __table({ - name: 'message', - indexes: [ - ], - constraints: [ - ], - }, MessageRow), - __table({ - name: 'user', - indexes: [ - { name: 'identity', algorithm: 'btree', columns: [ - 'identity', - ] }, - ], - constraints: [ - { name: 'user_identity_key', constraint: 'unique', columns: ['identity'] }, - ], - }, UserRow), + __table( + { + name: 'message', + indexes: [], + constraints: [], + }, + MessageRow + ), + __table( + { + name: 'user', + indexes: [ + { name: 'identity', algorithm: 'btree', columns: ['identity'] }, + ], + constraints: [ + { + name: 'user_identity_key', + constraint: 'unique', + columns: ['identity'], + }, + ], + }, + UserRow + ) ); /** The schema information for all reducers in this module. This is defined the same way as the reducers would have been defined in the server, except the body of the reducer is omitted in code generation. */ const reducersSchema = __reducers( - __reducerSchema("set_name", SetNameReducer), - __reducerSchema("send_message", SendMessageReducer), + __reducerSchema('set_name', SetNameReducer), + __reducerSchema('send_message', SendMessageReducer) ); /** The schema information for all procedures in this module. This is defined the same way as the procedures would have been defined in the server. */ -const proceduresSchema = __procedures( -); +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.2' as const, }, tables: tablesSchema.schemaType.tables, reducers: reducersSchema.reducersType.reducers, @@ -115,21 +120,29 @@ const REMOTE_MODULE = { export const tables = __convertToAccessorMap(tablesSchema.schemaType.tables); /** The reducers available in this remote SpacetimeDB module. */ -export const reducers = __convertToAccessorMap(reducersSchema.reducersType.reducers); +export const reducers = __convertToAccessorMap( + reducersSchema.reducersType.reducers +); /** The context type returned in callbacks for all possible events. */ export type EventContext = __EventContextInterface; /** The context type returned in callbacks for reducer events. */ -export type ReducerEventContext = __ReducerEventContextInterface; +export type ReducerEventContext = __ReducerEventContextInterface< + typeof REMOTE_MODULE +>; /** The context type returned in callbacks for subscription events. */ -export type SubscriptionEventContext = __SubscriptionEventContextInterface; +export type SubscriptionEventContext = __SubscriptionEventContextInterface< + typeof REMOTE_MODULE +>; /** The context type returned in callbacks for error events. */ export type ErrorContext = __ErrorContextInterface; /** The subscription handle type to manage active subscriptions created from a {@link SubscriptionBuilder}. */ export type SubscriptionHandle = __SubscriptionHandleImpl; /** Builder class to configure a new subscription to the remote SpacetimeDB instance. */ -export class SubscriptionBuilder extends __SubscriptionBuilderImpl {} +export class SubscriptionBuilder extends __SubscriptionBuilderImpl< + typeof REMOTE_MODULE +> {} /** Builder class to configure a new database connection to the remote SpacetimeDB instance. */ export class DbConnectionBuilder extends __DbConnectionBuilder {} @@ -138,7 +151,11 @@ export class DbConnectionBuilder extends __DbConnectionBuilder {} export class DbConnection extends __DbConnectionImpl { /** Creates a new {@link DbConnectionBuilder} to configure and connect to the remote SpacetimeDB instance. */ static builder = (): DbConnectionBuilder => { - return new DbConnectionBuilder(REMOTE_MODULE, (config: __DbConnectionConfig) => new DbConnection(config)); + return new DbConnectionBuilder( + REMOTE_MODULE, + (config: __DbConnectionConfig) => + new DbConnection(config) + ); }; /** Creates a new {@link SubscriptionBuilder} to configure a subscription to the remote SpacetimeDB instance. */ @@ -146,4 +163,3 @@ export class DbConnection extends __DbConnectionImpl { return new SubscriptionBuilder(this); }; } - diff --git a/templates/quickstart-chat-typescript/src/module_bindings/init_type.ts b/templates/quickstart-chat-typescript/src/module_bindings/init_type.ts index 847f94de0ec..52ed691ed94 100644 --- a/templates/quickstart-chat-typescript/src/module_bindings/init_type.ts +++ b/templates/quickstart-chat-typescript/src/module_bindings/init_type.ts @@ -8,8 +8,6 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; - -export default __t.object("Init", {}); - +} from 'spacetimedb'; +export default __t.object('Init', {}); diff --git a/templates/quickstart-chat-typescript/src/module_bindings/message_table.ts b/templates/quickstart-chat-typescript/src/module_bindings/message_table.ts index 2f08057cede..87044c64df4 100644 --- a/templates/quickstart-chat-typescript/src/module_bindings/message_table.ts +++ b/templates/quickstart-chat-typescript/src/module_bindings/message_table.ts @@ -8,7 +8,7 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; export default __t.row({ sender: __t.identity(), diff --git a/templates/quickstart-chat-typescript/src/module_bindings/message_type.ts b/templates/quickstart-chat-typescript/src/module_bindings/message_type.ts index d3b0e9dde03..c15fedf0f6a 100644 --- a/templates/quickstart-chat-typescript/src/module_bindings/message_type.ts +++ b/templates/quickstart-chat-typescript/src/module_bindings/message_type.ts @@ -8,12 +8,10 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; -export default __t.object("Message", { +export default __t.object('Message', { sender: __t.identity(), sent: __t.timestamp(), text: __t.string(), }); - - diff --git a/templates/quickstart-chat-typescript/src/module_bindings/on_connect_reducer.ts b/templates/quickstart-chat-typescript/src/module_bindings/on_connect_reducer.ts index e18fbc0a086..2ca99c88fea 100644 --- a/templates/quickstart-chat-typescript/src/module_bindings/on_connect_reducer.ts +++ b/templates/quickstart-chat-typescript/src/module_bindings/on_connect_reducer.ts @@ -8,6 +8,6 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; export default {}; diff --git a/templates/quickstart-chat-typescript/src/module_bindings/on_connect_type.ts b/templates/quickstart-chat-typescript/src/module_bindings/on_connect_type.ts index d95ba1fa6e2..d36362515de 100644 --- a/templates/quickstart-chat-typescript/src/module_bindings/on_connect_type.ts +++ b/templates/quickstart-chat-typescript/src/module_bindings/on_connect_type.ts @@ -8,8 +8,6 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; - -export default __t.object("OnConnect", {}); - +} from 'spacetimedb'; +export default __t.object('OnConnect', {}); diff --git a/templates/quickstart-chat-typescript/src/module_bindings/on_disconnect_reducer.ts b/templates/quickstart-chat-typescript/src/module_bindings/on_disconnect_reducer.ts index e18fbc0a086..2ca99c88fea 100644 --- a/templates/quickstart-chat-typescript/src/module_bindings/on_disconnect_reducer.ts +++ b/templates/quickstart-chat-typescript/src/module_bindings/on_disconnect_reducer.ts @@ -8,6 +8,6 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; export default {}; diff --git a/templates/quickstart-chat-typescript/src/module_bindings/on_disconnect_type.ts b/templates/quickstart-chat-typescript/src/module_bindings/on_disconnect_type.ts index 3d29234b70e..efda71ebcfd 100644 --- a/templates/quickstart-chat-typescript/src/module_bindings/on_disconnect_type.ts +++ b/templates/quickstart-chat-typescript/src/module_bindings/on_disconnect_type.ts @@ -8,8 +8,6 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; - -export default __t.object("OnDisconnect", {}); - +} from 'spacetimedb'; +export default __t.object('OnDisconnect', {}); diff --git a/templates/quickstart-chat-typescript/src/module_bindings/send_message_reducer.ts b/templates/quickstart-chat-typescript/src/module_bindings/send_message_reducer.ts index 0039b8ebcdc..4aeb65a0ae9 100644 --- a/templates/quickstart-chat-typescript/src/module_bindings/send_message_reducer.ts +++ b/templates/quickstart-chat-typescript/src/module_bindings/send_message_reducer.ts @@ -8,7 +8,7 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; export default { text: __t.string(), diff --git a/templates/quickstart-chat-typescript/src/module_bindings/send_message_type.ts b/templates/quickstart-chat-typescript/src/module_bindings/send_message_type.ts index 612f7336270..7414d114886 100644 --- a/templates/quickstart-chat-typescript/src/module_bindings/send_message_type.ts +++ b/templates/quickstart-chat-typescript/src/module_bindings/send_message_type.ts @@ -8,10 +8,8 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; -export default __t.object("SendMessage", { +export default __t.object('SendMessage', { text: __t.string(), }); - - diff --git a/templates/quickstart-chat-typescript/src/module_bindings/set_name_reducer.ts b/templates/quickstart-chat-typescript/src/module_bindings/set_name_reducer.ts index ce493ee8574..85081559c7d 100644 --- a/templates/quickstart-chat-typescript/src/module_bindings/set_name_reducer.ts +++ b/templates/quickstart-chat-typescript/src/module_bindings/set_name_reducer.ts @@ -8,7 +8,7 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; export default { name: __t.string(), diff --git a/templates/quickstart-chat-typescript/src/module_bindings/set_name_type.ts b/templates/quickstart-chat-typescript/src/module_bindings/set_name_type.ts index 6e321df4c9e..d3fe09ef92e 100644 --- a/templates/quickstart-chat-typescript/src/module_bindings/set_name_type.ts +++ b/templates/quickstart-chat-typescript/src/module_bindings/set_name_type.ts @@ -8,10 +8,8 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; -export default __t.object("SetName", { +export default __t.object('SetName', { name: __t.string(), }); - - diff --git a/templates/quickstart-chat-typescript/src/module_bindings/user_table.ts b/templates/quickstart-chat-typescript/src/module_bindings/user_table.ts index 4072746a6ac..93e32698c03 100644 --- a/templates/quickstart-chat-typescript/src/module_bindings/user_table.ts +++ b/templates/quickstart-chat-typescript/src/module_bindings/user_table.ts @@ -8,7 +8,7 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; export default __t.row({ identity: __t.identity().primaryKey(), diff --git a/templates/quickstart-chat-typescript/src/module_bindings/user_type.ts b/templates/quickstart-chat-typescript/src/module_bindings/user_type.ts index 15d5f14bfa4..89123cb9ad8 100644 --- a/templates/quickstart-chat-typescript/src/module_bindings/user_type.ts +++ b/templates/quickstart-chat-typescript/src/module_bindings/user_type.ts @@ -8,12 +8,10 @@ import { t as __t, type AlgebraicTypeType as __AlgebraicTypeType, type Infer as __Infer, -} from "spacetimedb"; +} from 'spacetimedb'; -export default __t.object("User", { +export default __t.object('User', { identity: __t.identity(), name: __t.option(__t.string()), online: __t.bool(), }); - -