Merge remote-tracking branch 'origin/master' into shub/default-macro

This commit is contained in:
Shubham Mishra
2025-09-08 18:32:54 +05:30
743 changed files with 14384 additions and 10859 deletions
+2
View File
@@ -1,7 +1,9 @@
/crates/core/src/db/datastore/traits.rs @cloutiertyler
/rust-toolchain.toml @cloutiertyler
/.github/CODEOWNERS @cloutiertyler
LICENSE @cloutiertyler
LICENSE.txt @cloutiertyler
/licenses/ @cloutiertyler
/crates/client-api-messages/src/websocket.rs @centril @gefjon
/crates/cli/src/ @bfops @cloutiertyler @jdetter
+28 -5
View File
@@ -254,19 +254,41 @@ jobs:
GIT_REF="${{ github.ref }}"
fi
echo "GIT_REF=${GIT_REF}" >>"$GITHUB_ENV"
- name: Checkout sources
uses: actions/checkout@v4
with:
ref: ${{ env.GIT_REF }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- uses: pnpm/action-setup@v4
with:
run_install: true
- name: Get pnpm store directory
shell: bash
working-directory: sdks/typescript
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- uses: dsherret/rust-toolchain-file@v1
- name: Check for docs change
run: |
cargo run --features markdown-docs -p spacetimedb-cli > docs/docs/cli-reference.md
cd docs
# This is needed because our website doesn't render markdown quite properly.
# See the README in docs for more details.
sed -i'' -E 's!^(##) `(.*)`$!\1 \2!' docs/cli-reference.md
sed -i'' -E 's!^(######) \*\*(.*)\*\*$!\1 <b>\2</b>!' docs/cli-reference.md
pnpm format
git status
if git diff --exit-code HEAD; then
echo "No docs changes detected"
@@ -274,3 +296,4 @@ jobs:
echo "It looks like the CLI docs have changed:"
exit 1
fi
+1
View File
@@ -16,6 +16,7 @@ jobs:
timeout-minutes: 30
steps:
- name: Checkout repository
id: checkout-stdb
uses: actions/checkout@v4
# Run cheap .NET tests first. If those fail, no need to run expensive Unity tests.
+27 -4
View File
@@ -18,12 +18,35 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '18'
- uses: pnpm/action-setup@v4
with:
run_install: true
- name: Get pnpm store directory
working-directory: sdks/typescript
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
working-directory: docs
run: |
npm install
pnpm install
- name: Lint
working-directory: docs
run: |
pnpm lint
- name: Backup existing nav.js
working-directory: docs
@@ -33,12 +56,12 @@ jobs:
- name: Build nav.ts
working-directory: docs
run: |
npm run build
pnpm build
- name: Compare generated nav.js with original nav.js
working-directory: docs
run: |
diff -q docs/nav.js docs/nav.js.original || (echo "Generated nav.js differs from committed version. Run 'npm run build' and commit the updated file." && exit 1)
diff -q docs/nav.js docs/nav.js.original || (echo "Generated nav.js differs from committed version. Run 'pnpm build' and commit the updated file." && exit 1)
# We do this after checking that nav.js matches nav.ts, to avoid confusing error messages if an author updates one but not the other.
# If the .ts and .js are in sync, it doesn't matter which one we check against here.
-1
View File
@@ -22,7 +22,6 @@ jobs:
- uses: pnpm/action-setup@v4
with:
version: 9.7
run_install: true
- name: Get pnpm store directory
+3 -4
View File
@@ -8,7 +8,7 @@ on:
merge_group:
jobs:
compile-and-test:
build-and-test:
runs-on: ubuntu-latest
steps:
@@ -22,7 +22,6 @@ jobs:
- uses: pnpm/action-setup@v4
with:
version: 9.7
run_install: true
- name: Get pnpm store directory
@@ -39,9 +38,9 @@ jobs:
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Compile
- name: Build
working-directory: sdks/typescript
run: pnpm compile
run: pnpm build
- name: Run sdk tests
working-directory: sdks/typescript/packages/sdk
@@ -2,4 +2,4 @@ node_modules
pnpm-lock.yaml
dist
target
/.github
.github
View File
Generated
+221 -104
View File
@@ -404,7 +404,7 @@ name = "benchmarks-module"
version = "0.1.0"
dependencies = [
"anyhow",
"spacetimedb",
"spacetimedb 1.4.0",
]
[[package]]
@@ -753,6 +753,15 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]]
name = "check-license-symlinks"
version = "0.1.0"
dependencies = [
"anyhow",
"log",
"walkdir",
]
[[package]]
name = "chrono"
version = "0.4.41"
@@ -950,7 +959,7 @@ dependencies = [
[[package]]
name = "connect_disconnect_client"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"spacetimedb-sdk",
@@ -2982,7 +2991,7 @@ name = "keynote-benchmarks"
version = "0.1.0"
dependencies = [
"log",
"spacetimedb",
"spacetimedb 1.4.0",
]
[[package]]
@@ -3272,7 +3281,7 @@ version = "0.0.0"
dependencies = [
"anyhow",
"log",
"spacetimedb",
"spacetimedb 1.4.0",
]
[[package]]
@@ -3755,7 +3764,7 @@ name = "perf-test-module"
version = "0.1.0"
dependencies = [
"log",
"spacetimedb",
"spacetimedb 1.4.0",
]
[[package]]
@@ -4214,7 +4223,7 @@ name = "quickstart-chat-module"
version = "0.1.0"
dependencies = [
"log",
"spacetimedb",
"spacetimedb 1.4.0",
]
[[package]]
@@ -4894,7 +4903,7 @@ dependencies = [
"anyhow",
"log",
"paste",
"spacetimedb",
"spacetimedb 1.4.0",
]
[[package]]
@@ -5255,12 +5264,30 @@ name = "spacetime-module"
version = "0.1.0"
dependencies = [
"log",
"spacetimedb",
"spacetimedb 1.4.0",
]
[[package]]
name = "spacetimedb"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6cd00b22d3170c92858f448db222a135c6302e336f1729c17e77f634c7e9e849"
dependencies = [
"bytemuck",
"derive_more",
"getrandom 0.2.16",
"log",
"rand 0.8.5",
"scoped-tls",
"spacetimedb-bindings-macro 1.3.0",
"spacetimedb-bindings-sys 1.3.0",
"spacetimedb-lib 1.3.0",
"spacetimedb-primitives 1.3.0",
]
[[package]]
name = "spacetimedb"
version = "1.4.0"
dependencies = [
"bytemuck",
"derive_more",
@@ -5269,28 +5296,28 @@ dependencies = [
"log",
"rand 0.8.5",
"scoped-tls",
"spacetimedb-bindings-macro",
"spacetimedb-bindings-sys",
"spacetimedb-lib",
"spacetimedb-primitives",
"spacetimedb-bindings-macro 1.4.0",
"spacetimedb-bindings-sys 1.4.0",
"spacetimedb-lib 1.4.0",
"spacetimedb-primitives 1.4.0",
"trybuild",
]
[[package]]
name = "spacetimedb-auth"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"serde",
"serde_json",
"serde_with",
"spacetimedb-jsonwebtoken",
"spacetimedb-lib",
"spacetimedb-lib 1.4.0",
]
[[package]]
name = "spacetimedb-bench"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"anymap",
@@ -5318,11 +5345,11 @@ dependencies = [
"spacetimedb-data-structures",
"spacetimedb-datastore",
"spacetimedb-execution",
"spacetimedb-lib",
"spacetimedb-lib 1.4.0",
"spacetimedb-paths",
"spacetimedb-primitives",
"spacetimedb-primitives 1.4.0",
"spacetimedb-query",
"spacetimedb-sats",
"spacetimedb-sats 1.4.0",
"spacetimedb-schema",
"spacetimedb-standalone",
"spacetimedb-table",
@@ -5338,25 +5365,48 @@ dependencies = [
[[package]]
name = "spacetimedb-bindings-macro"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87dcccbad947dbecdb49f6c241762a78451344f04c1bdad023a3b1b5942238b2"
dependencies = [
"heck 0.4.1",
"humantime",
"proc-macro2",
"quote",
"spacetimedb-primitives",
"spacetimedb-primitives 1.3.0",
"syn 2.0.101",
]
[[package]]
name = "spacetimedb-bindings-macro"
version = "1.4.0"
dependencies = [
"heck 0.4.1",
"humantime",
"proc-macro2",
"quote",
"spacetimedb-primitives 1.4.0",
"syn 2.0.101",
]
[[package]]
name = "spacetimedb-bindings-sys"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "969e77710b67e7db3e86bb4e195ba325f5f288efd1bfd6b1997ca9c389d22b04"
dependencies = [
"spacetimedb-primitives",
"spacetimedb-primitives 1.3.0",
]
[[package]]
name = "spacetimedb-bindings-sys"
version = "1.4.0"
dependencies = [
"spacetimedb-primitives 1.4.0",
]
[[package]]
name = "spacetimedb-cli"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"base64 0.21.7",
@@ -5392,9 +5442,9 @@ dependencies = [
"spacetimedb-data-structures",
"spacetimedb-fs-utils",
"spacetimedb-jsonwebtoken",
"spacetimedb-lib",
"spacetimedb-lib 1.4.0",
"spacetimedb-paths",
"spacetimedb-primitives",
"spacetimedb-primitives 1.4.0",
"spacetimedb-schema",
"syntect",
"tabled",
@@ -5417,7 +5467,7 @@ dependencies = [
[[package]]
name = "spacetimedb-client-api"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"async-stream",
@@ -5453,7 +5503,7 @@ dependencies = [
"spacetimedb-data-structures",
"spacetimedb-datastore",
"spacetimedb-jsonwebtoken",
"spacetimedb-lib",
"spacetimedb-lib 1.4.0",
"spacetimedb-paths",
"spacetimedb-schema",
"tempfile",
@@ -5470,7 +5520,7 @@ dependencies = [
[[package]]
name = "spacetimedb-client-api-messages"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"bytes",
"bytestring",
@@ -5484,16 +5534,16 @@ dependencies = [
"serde_json",
"serde_with",
"smallvec",
"spacetimedb-lib",
"spacetimedb-primitives",
"spacetimedb-sats",
"spacetimedb-lib 1.4.0",
"spacetimedb-primitives 1.4.0",
"spacetimedb-sats 1.4.0",
"strum",
"thiserror 1.0.69",
]
[[package]]
name = "spacetimedb-codegen"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"convert_case 0.6.0",
@@ -5502,15 +5552,15 @@ dependencies = [
"itertools 0.12.1",
"regex",
"spacetimedb-data-structures",
"spacetimedb-lib",
"spacetimedb-primitives",
"spacetimedb-lib 1.4.0",
"spacetimedb-primitives 1.4.0",
"spacetimedb-schema",
"spacetimedb-testing",
]
[[package]]
name = "spacetimedb-commitlog"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"async-stream",
"bitflags 2.9.0",
@@ -5530,8 +5580,8 @@ dependencies = [
"spacetimedb-commitlog",
"spacetimedb-fs-utils",
"spacetimedb-paths",
"spacetimedb-primitives",
"spacetimedb-sats",
"spacetimedb-primitives 1.4.0",
"spacetimedb-sats 1.4.0",
"tempfile",
"thiserror 1.0.69",
"tokio",
@@ -5542,7 +5592,7 @@ dependencies = [
[[package]]
name = "spacetimedb-core"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"arrayvec",
@@ -5619,14 +5669,14 @@ dependencies = [
"spacetimedb-fs-utils",
"spacetimedb-jsonwebtoken",
"spacetimedb-jwks",
"spacetimedb-lib",
"spacetimedb-lib 1.4.0",
"spacetimedb-memory-usage",
"spacetimedb-metrics",
"spacetimedb-paths",
"spacetimedb-physical-plan",
"spacetimedb-primitives",
"spacetimedb-primitives 1.4.0",
"spacetimedb-query",
"spacetimedb-sats",
"spacetimedb-sats 1.4.0",
"spacetimedb-schema",
"spacetimedb-snapshot",
"spacetimedb-subscription",
@@ -5661,7 +5711,7 @@ dependencies = [
[[package]]
name = "spacetimedb-data-structures"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"ahash 0.8.12",
"crossbeam-queue",
@@ -5675,7 +5725,7 @@ dependencies = [
[[package]]
name = "spacetimedb-datastore"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"bytes",
@@ -5695,11 +5745,11 @@ dependencies = [
"spacetimedb-data-structures",
"spacetimedb-durability",
"spacetimedb-execution",
"spacetimedb-lib",
"spacetimedb-lib 1.4.0",
"spacetimedb-metrics",
"spacetimedb-paths",
"spacetimedb-primitives",
"spacetimedb-sats",
"spacetimedb-primitives 1.4.0",
"spacetimedb-sats 1.4.0",
"spacetimedb-schema",
"spacetimedb-snapshot",
"spacetimedb-table",
@@ -5710,46 +5760,46 @@ dependencies = [
[[package]]
name = "spacetimedb-durability"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"itertools 0.12.1",
"log",
"spacetimedb-commitlog",
"spacetimedb-paths",
"spacetimedb-sats",
"spacetimedb-sats 1.4.0",
"tokio",
"tracing",
]
[[package]]
name = "spacetimedb-execution"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"itertools 0.12.1",
"spacetimedb-expr",
"spacetimedb-lib",
"spacetimedb-lib 1.4.0",
"spacetimedb-physical-plan",
"spacetimedb-primitives",
"spacetimedb-sats",
"spacetimedb-primitives 1.4.0",
"spacetimedb-sats 1.4.0",
"spacetimedb-sql-parser",
"spacetimedb-table",
]
[[package]]
name = "spacetimedb-expr"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"bigdecimal",
"derive_more",
"ethnum",
"pretty_assertions",
"spacetimedb",
"spacetimedb-lib",
"spacetimedb-primitives",
"spacetimedb-sats",
"spacetimedb 1.4.0",
"spacetimedb-lib 1.4.0",
"spacetimedb-primitives 1.4.0",
"spacetimedb-sats 1.4.0",
"spacetimedb-schema",
"spacetimedb-sql-parser",
"thiserror 1.0.69",
@@ -5757,7 +5807,7 @@ dependencies = [
[[package]]
name = "spacetimedb-fs-utils"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"hex",
@@ -5800,6 +5850,26 @@ dependencies = [
[[package]]
name = "spacetimedb-lib"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3e9b8d04af6da14e3b7cc79b4b88c1c309c994eeba6a97f298fd0cdc7f897209"
dependencies = [
"anyhow",
"bitflags 2.9.0",
"blake3",
"chrono",
"derive_more",
"enum-as-inner",
"hex",
"itertools 0.12.1",
"spacetimedb-bindings-macro 1.3.0",
"spacetimedb-primitives 1.3.0",
"spacetimedb-sats 1.3.0",
"thiserror 1.0.69",
]
[[package]]
name = "spacetimedb-lib"
version = "1.4.0"
dependencies = [
"anyhow",
"bitflags 2.9.0",
@@ -5817,17 +5887,17 @@ dependencies = [
"ron",
"serde",
"serde_json",
"spacetimedb-bindings-macro",
"spacetimedb-bindings-macro 1.4.0",
"spacetimedb-memory-usage",
"spacetimedb-metrics",
"spacetimedb-primitives",
"spacetimedb-sats",
"spacetimedb-primitives 1.4.0",
"spacetimedb-sats 1.4.0",
"thiserror 1.0.69",
]
[[package]]
name = "spacetimedb-memory-usage"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"decorum",
"ethnum",
@@ -5837,7 +5907,7 @@ dependencies = [
[[package]]
name = "spacetimedb-metrics"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"arrayvec",
"itertools 0.12.1",
@@ -5847,7 +5917,7 @@ dependencies = [
[[package]]
name = "spacetimedb-paths"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"chrono",
@@ -5863,15 +5933,15 @@ dependencies = [
[[package]]
name = "spacetimedb-physical-plan"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"derive_more",
"either",
"pretty_assertions",
"spacetimedb-expr",
"spacetimedb-lib",
"spacetimedb-primitives",
"spacetimedb-lib 1.4.0",
"spacetimedb-primitives 1.4.0",
"spacetimedb-schema",
"spacetimedb-sql-parser",
"spacetimedb-table",
@@ -5880,6 +5950,18 @@ dependencies = [
[[package]]
name = "spacetimedb-primitives"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0181dc495c66138755705e573f0e0a9a7024660f207ebd1e35d0a1f839813e84"
dependencies = [
"bitflags 2.9.0",
"either",
"itertools 0.12.1",
"nohash-hasher",
]
[[package]]
name = "spacetimedb-primitives"
version = "1.4.0"
dependencies = [
"bitflags 2.9.0",
"either",
@@ -5891,7 +5973,7 @@ dependencies = [
[[package]]
name = "spacetimedb-query"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"itertools 0.12.1",
@@ -5899,9 +5981,9 @@ dependencies = [
"spacetimedb-client-api-messages",
"spacetimedb-execution",
"spacetimedb-expr",
"spacetimedb-lib",
"spacetimedb-lib 1.4.0",
"spacetimedb-physical-plan",
"spacetimedb-primitives",
"spacetimedb-primitives 1.4.0",
"spacetimedb-sql-parser",
"spacetimedb-table",
]
@@ -5909,6 +5991,32 @@ dependencies = [
[[package]]
name = "spacetimedb-sats"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e9700ea5d62401c05633ce86d369dbc4a73ec978ac7e347ab8563626ad01fbc"
dependencies = [
"anyhow",
"arrayvec",
"bitflags 2.9.0",
"bytemuck",
"bytes",
"chrono",
"decorum",
"derive_more",
"enum-as-inner",
"ethnum",
"hex",
"itertools 0.12.1",
"second-stack",
"sha3",
"smallvec",
"spacetimedb-bindings-macro 1.3.0",
"spacetimedb-primitives 1.3.0",
"thiserror 1.0.69",
]
[[package]]
name = "spacetimedb-sats"
version = "1.4.0"
dependencies = [
"ahash 0.8.12",
"anyhow",
@@ -5932,16 +6040,16 @@ dependencies = [
"serde",
"sha3",
"smallvec",
"spacetimedb-bindings-macro",
"spacetimedb-bindings-macro 1.4.0",
"spacetimedb-memory-usage",
"spacetimedb-metrics",
"spacetimedb-primitives",
"spacetimedb-primitives 1.4.0",
"thiserror 1.0.69",
]
[[package]]
name = "spacetimedb-schema"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"derive_more",
@@ -5958,9 +6066,9 @@ dependencies = [
"serial_test",
"smallvec",
"spacetimedb-data-structures",
"spacetimedb-lib",
"spacetimedb-primitives",
"spacetimedb-sats",
"spacetimedb-lib 1.4.0",
"spacetimedb-primitives 1.4.0",
"spacetimedb-sats 1.4.0",
"spacetimedb-sql-parser",
"spacetimedb-testing",
"termcolor",
@@ -5971,7 +6079,7 @@ dependencies = [
[[package]]
name = "spacetimedb-sdk"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anymap",
"base64 0.21.7",
@@ -5990,9 +6098,9 @@ dependencies = [
"rand 0.9.1",
"spacetimedb-client-api-messages",
"spacetimedb-data-structures",
"spacetimedb-lib",
"spacetimedb-lib 1.4.0",
"spacetimedb-metrics",
"spacetimedb-sats",
"spacetimedb-sats 1.4.0",
"spacetimedb-testing",
"thiserror 1.0.69",
"tokio",
@@ -6001,7 +6109,7 @@ dependencies = [
[[package]]
name = "spacetimedb-snapshot"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"blake3",
@@ -6018,10 +6126,10 @@ dependencies = [
"spacetimedb-datastore",
"spacetimedb-durability",
"spacetimedb-fs-utils",
"spacetimedb-lib",
"spacetimedb-lib 1.4.0",
"spacetimedb-paths",
"spacetimedb-primitives",
"spacetimedb-sats",
"spacetimedb-primitives 1.4.0",
"spacetimedb-sats 1.4.0",
"spacetimedb-schema",
"spacetimedb-table",
"tempfile",
@@ -6034,17 +6142,17 @@ dependencies = [
[[package]]
name = "spacetimedb-sql-parser"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"derive_more",
"spacetimedb-lib",
"spacetimedb-lib 1.4.0",
"sqlparser",
"thiserror 1.0.69",
]
[[package]]
name = "spacetimedb-standalone"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"async-trait",
@@ -6068,7 +6176,7 @@ dependencies = [
"spacetimedb-client-api-messages",
"spacetimedb-core",
"spacetimedb-datastore",
"spacetimedb-lib",
"spacetimedb-lib 1.4.0",
"spacetimedb-paths",
"spacetimedb-table",
"tempfile",
@@ -6083,20 +6191,20 @@ dependencies = [
[[package]]
name = "spacetimedb-subscription"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"spacetimedb-execution",
"spacetimedb-expr",
"spacetimedb-lib",
"spacetimedb-lib 1.4.0",
"spacetimedb-physical-plan",
"spacetimedb-primitives",
"spacetimedb-primitives 1.4.0",
"spacetimedb-query",
]
[[package]]
name = "spacetimedb-table"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"ahash 0.8.12",
"blake3",
@@ -6112,17 +6220,17 @@ dependencies = [
"rand 0.9.1",
"smallvec",
"spacetimedb-data-structures",
"spacetimedb-lib",
"spacetimedb-lib 1.4.0",
"spacetimedb-memory-usage",
"spacetimedb-primitives",
"spacetimedb-sats",
"spacetimedb-primitives 1.4.0",
"spacetimedb-sats 1.4.0",
"spacetimedb-schema",
"thiserror 1.0.69",
]
[[package]]
name = "spacetimedb-testing"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"clap 4.5.37",
@@ -6138,7 +6246,7 @@ dependencies = [
"spacetimedb-client-api",
"spacetimedb-core",
"spacetimedb-data-structures",
"spacetimedb-lib",
"spacetimedb-lib 1.4.0",
"spacetimedb-paths",
"spacetimedb-schema",
"spacetimedb-standalone",
@@ -6149,7 +6257,7 @@ dependencies = [
[[package]]
name = "spacetimedb-update"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"bytes",
@@ -6174,7 +6282,7 @@ dependencies = [
[[package]]
name = "spacetimedb-vm"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"arrayvec",
@@ -6184,9 +6292,9 @@ dependencies = [
"smallvec",
"spacetimedb-data-structures",
"spacetimedb-execution",
"spacetimedb-lib",
"spacetimedb-primitives",
"spacetimedb-sats",
"spacetimedb-lib 1.4.0",
"spacetimedb-primitives 1.4.0",
"spacetimedb-sats 1.4.0",
"spacetimedb-schema",
"spacetimedb-table",
"tempfile",
@@ -6265,7 +6373,7 @@ dependencies = [
[[package]]
name = "sqltest"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"async-trait",
@@ -6284,8 +6392,8 @@ dependencies = [
"rust_decimal",
"spacetimedb-core",
"spacetimedb-datastore",
"spacetimedb-lib",
"spacetimedb-sats",
"spacetimedb-lib 1.4.0",
"spacetimedb-sats 1.4.0",
"spacetimedb-vm",
"sqllogictest",
"sqllogictest-engines",
@@ -6603,7 +6711,7 @@ dependencies = [
[[package]]
name = "test-client"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"env_logger 0.10.2",
@@ -6615,7 +6723,7 @@ dependencies = [
[[package]]
name = "test-counter"
version = "1.3.0"
version = "1.4.0"
dependencies = [
"anyhow",
"spacetimedb-data-structures",
@@ -7190,6 +7298,15 @@ version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f"
[[package]]
name = "typescript-test-app"
version = "0.1.0"
dependencies = [
"anyhow",
"log",
"spacetimedb 1.3.0",
]
[[package]]
name = "unarray"
version = "0.1.4"
+35 -33
View File
@@ -44,7 +44,9 @@ members = [
"sdks/rust/tests/test-client",
"sdks/rust/tests/test-counter",
"sdks/rust/tests/connect_disconnect_client",
"tools/upgrade-version", "crates/codegen",
"tools/upgrade-version",
"tools/license-check",
"sdks/typescript/packages/test-app/server",
]
default-members = ["crates/cli", "crates/standalone", "crates/update"]
# cargo feature graph resolver. v3 is default in edition2024 but workspace
@@ -88,43 +90,43 @@ inherits = "release"
debug = true
[workspace.package]
version = "1.3.0"
version = "1.4.0"
edition = "2021"
# update rust-toolchain.toml too!
rust-version = "1.88.0"
[workspace.dependencies]
spacetimedb = { path = "crates/bindings", version = "1.3.0" }
spacetimedb-auth = { path = "crates/auth", version = "1.3.0" }
spacetimedb-bindings-macro = { path = "crates/bindings-macro", version = "1.3.0" }
spacetimedb-bindings-sys = { path = "crates/bindings-sys", version = "1.3.0" }
spacetimedb-cli = { path = "crates/cli", version = "1.3.0" }
spacetimedb-client-api = { path = "crates/client-api", version = "1.3.0" }
spacetimedb-client-api-messages = { path = "crates/client-api-messages", version = "1.3.0" }
spacetimedb-codegen = { path = "crates/codegen", version = "1.3.0" }
spacetimedb-commitlog = { path = "crates/commitlog", version = "1.3.0" }
spacetimedb-core = { path = "crates/core", version = "1.3.0" }
spacetimedb-data-structures = { path = "crates/data-structures", version = "1.3.0" }
spacetimedb-datastore = { path = "crates/datastore", version = "1.3.0" }
spacetimedb-durability = { path = "crates/durability", version = "1.3.0" }
spacetimedb-execution = { path = "crates/execution", version = "1.3.0" }
spacetimedb-expr = { path = "crates/expr", version = "1.3.0" }
spacetimedb-lib = { path = "crates/lib", default-features = false, version = "1.3.0" }
spacetimedb-memory-usage = { path = "crates/memory-usage", version = "1.3.0", default-features = false }
spacetimedb-metrics = { path = "crates/metrics", version = "1.3.0" }
spacetimedb-paths = { path = "crates/paths", version = "1.3.0" }
spacetimedb-physical-plan = { path = "crates/physical-plan", version = "1.3.0" }
spacetimedb-primitives = { path = "crates/primitives", version = "1.3.0" }
spacetimedb-query = { path = "crates/query", version = "1.3.0" }
spacetimedb-sats = { path = "crates/sats", version = "1.3.0" }
spacetimedb-schema = { path = "crates/schema", version = "1.3.0" }
spacetimedb-standalone = { path = "crates/standalone", version = "1.3.0" }
spacetimedb-sql-parser = { path = "crates/sql-parser", version = "1.3.0" }
spacetimedb-table = { path = "crates/table", version = "1.3.0" }
spacetimedb-vm = { path = "crates/vm", version = "1.3.0" }
spacetimedb-fs-utils = { path = "crates/fs-utils", version = "1.3.0" }
spacetimedb-snapshot = { path = "crates/snapshot", version = "1.3.0" }
spacetimedb-subscription = { path = "crates/subscription", version = "1.3.0" }
spacetimedb = { path = "crates/bindings", version = "1.4.0" }
spacetimedb-auth = { path = "crates/auth", version = "1.4.0" }
spacetimedb-bindings-macro = { path = "crates/bindings-macro", version = "1.4.0" }
spacetimedb-bindings-sys = { path = "crates/bindings-sys", version = "1.4.0" }
spacetimedb-cli = { path = "crates/cli", version = "1.4.0" }
spacetimedb-client-api = { path = "crates/client-api", version = "1.4.0" }
spacetimedb-client-api-messages = { path = "crates/client-api-messages", version = "1.4.0" }
spacetimedb-codegen = { path = "crates/codegen", version = "1.4.0" }
spacetimedb-commitlog = { path = "crates/commitlog", version = "1.4.0" }
spacetimedb-core = { path = "crates/core", version = "1.4.0" }
spacetimedb-data-structures = { path = "crates/data-structures", version = "1.4.0" }
spacetimedb-datastore = { path = "crates/datastore", version = "1.4.0" }
spacetimedb-durability = { path = "crates/durability", version = "1.4.0" }
spacetimedb-execution = { path = "crates/execution", version = "1.4.0" }
spacetimedb-expr = { path = "crates/expr", version = "1.4.0" }
spacetimedb-lib = { path = "crates/lib", default-features = false, version = "1.4.0" }
spacetimedb-memory-usage = { path = "crates/memory-usage", version = "1.4.0", default-features = false }
spacetimedb-metrics = { path = "crates/metrics", version = "1.4.0" }
spacetimedb-paths = { path = "crates/paths", version = "1.4.0" }
spacetimedb-physical-plan = { path = "crates/physical-plan", version = "1.4.0" }
spacetimedb-primitives = { path = "crates/primitives", version = "1.4.0" }
spacetimedb-query = { path = "crates/query", version = "1.4.0" }
spacetimedb-sats = { path = "crates/sats", version = "1.4.0" }
spacetimedb-schema = { path = "crates/schema", version = "1.4.0" }
spacetimedb-standalone = { path = "crates/standalone", version = "1.4.0" }
spacetimedb-sql-parser = { path = "crates/sql-parser", version = "1.4.0" }
spacetimedb-table = { path = "crates/table", version = "1.4.0" }
spacetimedb-vm = { path = "crates/vm", version = "1.4.0" }
spacetimedb-fs-utils = { path = "crates/fs-utils", version = "1.4.0" }
spacetimedb-snapshot = { path = "crates/snapshot", version = "1.4.0" }
spacetimedb-subscription = { path = "crates/subscription", version = "1.4.0" }
# Prevent `ahash` from pulling in `getrandom` by disabling default features.
# Modules use `getrandom02` and we need to prevent an incompatible version
+2 -2
View File
@@ -5,7 +5,7 @@ Business Source License 1.1
Parameters
Licensor: Clockwork Laboratories, Inc.
Licensed Work: SpacetimeDB 1.3.0
Licensed Work: SpacetimeDB 1.4.0
The Licensed Work is
(c) 2023 Clockwork Laboratories, Inc.
@@ -21,7 +21,7 @@ Additional Use Grant: You may make use of the Licensed Work provided your
Licensed Work by creating tables whose schemas are
controlled by such third parties.
Change Date: 2030-07-30
Change Date: 2030-09-03
Change License: GNU Affero General Public License v3.0 with a linking
exception
+36 -15
View File
@@ -1,5 +1,14 @@
namespace SpacetimeDB.Codegen;
// Generate code to implement serialization to the BSATN format (https://spacetimedb.com/docs/bsatn).
// C# doesn't support static methods in interfaces, so instead we declare a zero-sized `struct` type that implements
// the serialization interface (IReadWrite) for us.
//
// See BSATN.Runtime for the support code referenced by code generation,
// and see Codegen.Tests/fixtures/*/snapshots for examples of generated code.
// Also, if you set <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles> in a csproj,
// you can find the generated code in obj/Debug/*/generated/SpacetimeDB.BSATN.Codegen.
using System.Collections.Immutable;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
@@ -27,6 +36,14 @@ using static Utils;
/// <param name="BSATNName">The name of the BSATN struct for the type.</param>
public abstract record TypeUse(string Name, string BSATNName)
{
internal static string BSATN_FIELD_SUFFIX = "RW";
/// <summary>
/// The name of the static field containing an IReadWrite in the IReadWrite struct associated with this type.
/// We make sure this is different from the field name so that collisions cannot occur.
/// </summary>
public static string BsatnFieldSuffix => $"{BSATN_FIELD_SUFFIX}";
/// <summary>
/// Parse a type use for a member.
/// </summary>
@@ -330,14 +347,20 @@ public record MemberDeclaration(
var visStr = SyntaxFacts.GetText(visibility);
return string.Join(
"\n ",
members.Select(m => $"{visStr} static readonly {m.Type.BSATNName} {m.Name} = new();")
members.Select(m =>
$"{visStr} static readonly {m.Type.BSATNName} {m.Name}{TypeUse.BsatnFieldSuffix} = new();"
)
);
}
public static string GenerateDefs(IEnumerable<MemberDeclaration> members) =>
string.Join(
",\n ",
members.Select(m => $"new(nameof({m.Name}), {m.Name}.GetAlgebraicType(registrar))")
// we can't use nameof(m.Type.BsatnFieldName) because the bsatn field name differs from the logical name
// assigned in the type.
members.Select(m =>
$"new(\"{m.Name}\", {m.Name}{TypeUse.BsatnFieldSuffix}.GetAlgebraicType(registrar))"
)
);
}
@@ -450,8 +473,6 @@ public abstract record BaseTypeDeclaration<M>
var extensions = new Scope.Extensions(Scope, FullName);
var bsatnDecls = Members.Cast<MemberDeclaration>();
var fieldNames = bsatnDecls.Select(m => m.Name);
var fieldNamesAndIds = fieldNames.Select((name, i) => (name, i));
extensions.BaseTypes.Add($"System.IEquatable<{ShortName}>");
@@ -480,8 +501,8 @@ public abstract record BaseTypeDeclaration<M>
return reader.ReadByte() switch {
{{string.Join(
"\n ",
fieldNames.Select((name, i) =>
$"{i} => new {name}({name}.Read(reader)),"
bsatnDecls.Select((m, i) =>
$"{i} => new {m.Name}({m.Name}{TypeUse.BsatnFieldSuffix}.Read(reader)),"
)
)}}
_ => throw new System.InvalidOperationException("Invalid tag value, this state should be unreachable.")
@@ -492,12 +513,12 @@ public abstract record BaseTypeDeclaration<M>
switch (value) {
{{string.Join(
"\n",
fieldNames.Select((name, i) => $"""
case {name}(var inner):
writer.Write((byte){i});
{name}.Write(writer, inner);
break;
"""))}}
bsatnDecls.Select((m, i) => $"""
case {m.Name}(var inner):
writer.Write((byte){i});
{m.Name}{TypeUse.BsatnFieldSuffix}.Write(writer, inner);
break;
"""))}}
}
""";
@@ -530,14 +551,14 @@ public abstract record BaseTypeDeclaration<M>
public void ReadFields(System.IO.BinaryReader reader) {
{{string.Join(
"\n",
fieldNames.Select(name => $" {name} = BSATN.{name}.Read(reader);")
bsatnDecls.Select(m => $" {m.Name} = BSATN.{m.Name}{TypeUse.BsatnFieldSuffix}.Read(reader);")
)}}
}
public void WriteFields(System.IO.BinaryWriter writer) {
{{string.Join(
"\n",
fieldNames.Select(name => $" BSATN.{name}.Write(writer, {name});")
bsatnDecls.Select(m => $" BSATN.{m.Name}{TypeUse.BsatnFieldSuffix}.Write(writer, {m.Name});")
)}}
}
@@ -557,7 +578,7 @@ public abstract record BaseTypeDeclaration<M>
public override string ToString() =>
$"{{ShortName}} {{start}} {{string.Join(
", ",
fieldNames.Select(name => $$"""{{name}} = {SpacetimeDB.BSATN.StringUtil.GenericToString({{name}})}""")
bsatnDecls.Select(m => $$"""{{m.Name}} = {SpacetimeDB.BSATN.StringUtil.GenericToString({{m.Name}})}""")
)}} {{end}}";
"""
);
@@ -6,14 +6,14 @@ partial struct CustomClass : System.IEquatable<CustomClass>, SpacetimeDB.BSATN.I
{
public void ReadFields(System.IO.BinaryReader reader)
{
IntField = BSATN.IntField.Read(reader);
StringField = BSATN.StringField.Read(reader);
IntField = BSATN.IntFieldRW.Read(reader);
StringField = BSATN.StringFieldRW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.IntField.Write(writer, IntField);
BSATN.StringField.Write(writer, StringField);
BSATN.IntFieldRW.Write(writer, IntField);
BSATN.StringFieldRW.Write(writer, StringField);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
@@ -26,8 +26,8 @@ partial struct CustomClass : System.IEquatable<CustomClass>, SpacetimeDB.BSATN.I
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<CustomClass>
{
internal static readonly SpacetimeDB.BSATN.I32 IntField = new();
internal static readonly SpacetimeDB.BSATN.String StringField = new();
internal static readonly SpacetimeDB.BSATN.I32 IntFieldRW = new();
internal static readonly SpacetimeDB.BSATN.String StringFieldRW = new();
public CustomClass Read(System.IO.BinaryReader reader)
{
@@ -47,8 +47,8 @@ partial struct CustomClass : System.IEquatable<CustomClass>, SpacetimeDB.BSATN.I
registrar.RegisterType<CustomClass>(_ => new SpacetimeDB.BSATN.AlgebraicType.Product(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(IntField), IntField.GetAlgebraicType(registrar)),
new(nameof(StringField), StringField.GetAlgebraicType(registrar))
new("IntField", IntFieldRW.GetAlgebraicType(registrar)),
new("StringField", StringFieldRW.GetAlgebraicType(registrar))
}
));
@@ -8,14 +8,14 @@ partial struct CustomStruct
{
public void ReadFields(System.IO.BinaryReader reader)
{
IntField = BSATN.IntField.Read(reader);
StringField = BSATN.StringField.Read(reader);
IntField = BSATN.IntFieldRW.Read(reader);
StringField = BSATN.StringFieldRW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.IntField.Write(writer, IntField);
BSATN.StringField.Write(writer, StringField);
BSATN.IntFieldRW.Write(writer, IntField);
BSATN.StringFieldRW.Write(writer, StringField);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
@@ -28,8 +28,8 @@ partial struct CustomStruct
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<CustomStruct>
{
internal static readonly SpacetimeDB.BSATN.I32 IntField = new();
internal static readonly SpacetimeDB.BSATN.String StringField = new();
internal static readonly SpacetimeDB.BSATN.I32 IntFieldRW = new();
internal static readonly SpacetimeDB.BSATN.String StringFieldRW = new();
public CustomStruct Read(System.IO.BinaryReader reader)
{
@@ -49,8 +49,8 @@ partial struct CustomStruct
registrar.RegisterType<CustomStruct>(_ => new SpacetimeDB.BSATN.AlgebraicType.Product(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(IntField), IntField.GetAlgebraicType(registrar)),
new(nameof(StringField), StringField.GetAlgebraicType(registrar))
new("IntField", IntFieldRW.GetAlgebraicType(registrar)),
new("StringField", StringFieldRW.GetAlgebraicType(registrar))
}
));
@@ -18,15 +18,15 @@ partial record CustomTaggedEnum : System.IEquatable<CustomTaggedEnum>
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<CustomTaggedEnum>
{
internal static readonly SpacetimeDB.BSATN.I32 IntVariant = new();
internal static readonly SpacetimeDB.BSATN.String StringVariant = new();
internal static readonly SpacetimeDB.BSATN.I32 IntVariantRW = new();
internal static readonly SpacetimeDB.BSATN.String StringVariantRW = new();
public CustomTaggedEnum Read(System.IO.BinaryReader reader)
{
return reader.ReadByte() switch
{
0 => new IntVariant(IntVariant.Read(reader)),
1 => new StringVariant(StringVariant.Read(reader)),
0 => new IntVariant(IntVariantRW.Read(reader)),
1 => new StringVariant(StringVariantRW.Read(reader)),
_
=> throw new System.InvalidOperationException(
"Invalid tag value, this state should be unreachable."
@@ -40,11 +40,11 @@ partial record CustomTaggedEnum : System.IEquatable<CustomTaggedEnum>
{
case IntVariant(var inner):
writer.Write((byte)0);
IntVariant.Write(writer, inner);
IntVariantRW.Write(writer, inner);
break;
case StringVariant(var inner):
writer.Write((byte)1);
StringVariant.Write(writer, inner);
StringVariantRW.Write(writer, inner);
break;
}
}
@@ -55,8 +55,8 @@ partial record CustomTaggedEnum : System.IEquatable<CustomTaggedEnum>
registrar.RegisterType<CustomTaggedEnum>(_ => new SpacetimeDB.BSATN.AlgebraicType.Sum(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(IntVariant), IntVariant.GetAlgebraicType(registrar)),
new(nameof(StringVariant), StringVariant.GetAlgebraicType(registrar))
new("IntVariant", IntVariantRW.GetAlgebraicType(registrar)),
new("StringVariant", StringVariantRW.GetAlgebraicType(registrar))
}
));
@@ -6,60 +6,60 @@ partial struct PublicTable : System.IEquatable<PublicTable>, SpacetimeDB.BSATN.I
{
public void ReadFields(System.IO.BinaryReader reader)
{
ByteField = BSATN.ByteField.Read(reader);
UshortField = BSATN.UshortField.Read(reader);
UintField = BSATN.UintField.Read(reader);
UlongField = BSATN.UlongField.Read(reader);
U128Field = BSATN.U128Field.Read(reader);
U256Field = BSATN.U256Field.Read(reader);
SbyteField = BSATN.SbyteField.Read(reader);
ShortField = BSATN.ShortField.Read(reader);
IntField = BSATN.IntField.Read(reader);
LongField = BSATN.LongField.Read(reader);
I128Field = BSATN.I128Field.Read(reader);
I256Field = BSATN.I256Field.Read(reader);
BoolField = BSATN.BoolField.Read(reader);
FloatField = BSATN.FloatField.Read(reader);
DoubleField = BSATN.DoubleField.Read(reader);
StringField = BSATN.StringField.Read(reader);
IdentityField = BSATN.IdentityField.Read(reader);
ConnectionIdField = BSATN.ConnectionIdField.Read(reader);
CustomStructField = BSATN.CustomStructField.Read(reader);
CustomClassField = BSATN.CustomClassField.Read(reader);
CustomEnumField = BSATN.CustomEnumField.Read(reader);
CustomTaggedEnumField = BSATN.CustomTaggedEnumField.Read(reader);
ListField = BSATN.ListField.Read(reader);
NullableValueField = BSATN.NullableValueField.Read(reader);
NullableReferenceField = BSATN.NullableReferenceField.Read(reader);
ByteField = BSATN.ByteFieldRW.Read(reader);
UshortField = BSATN.UshortFieldRW.Read(reader);
UintField = BSATN.UintFieldRW.Read(reader);
UlongField = BSATN.UlongFieldRW.Read(reader);
U128Field = BSATN.U128FieldRW.Read(reader);
U256Field = BSATN.U256FieldRW.Read(reader);
SbyteField = BSATN.SbyteFieldRW.Read(reader);
ShortField = BSATN.ShortFieldRW.Read(reader);
IntField = BSATN.IntFieldRW.Read(reader);
LongField = BSATN.LongFieldRW.Read(reader);
I128Field = BSATN.I128FieldRW.Read(reader);
I256Field = BSATN.I256FieldRW.Read(reader);
BoolField = BSATN.BoolFieldRW.Read(reader);
FloatField = BSATN.FloatFieldRW.Read(reader);
DoubleField = BSATN.DoubleFieldRW.Read(reader);
StringField = BSATN.StringFieldRW.Read(reader);
IdentityField = BSATN.IdentityFieldRW.Read(reader);
ConnectionIdField = BSATN.ConnectionIdFieldRW.Read(reader);
CustomStructField = BSATN.CustomStructFieldRW.Read(reader);
CustomClassField = BSATN.CustomClassFieldRW.Read(reader);
CustomEnumField = BSATN.CustomEnumFieldRW.Read(reader);
CustomTaggedEnumField = BSATN.CustomTaggedEnumFieldRW.Read(reader);
ListField = BSATN.ListFieldRW.Read(reader);
NullableValueField = BSATN.NullableValueFieldRW.Read(reader);
NullableReferenceField = BSATN.NullableReferenceFieldRW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.ByteField.Write(writer, ByteField);
BSATN.UshortField.Write(writer, UshortField);
BSATN.UintField.Write(writer, UintField);
BSATN.UlongField.Write(writer, UlongField);
BSATN.U128Field.Write(writer, U128Field);
BSATN.U256Field.Write(writer, U256Field);
BSATN.SbyteField.Write(writer, SbyteField);
BSATN.ShortField.Write(writer, ShortField);
BSATN.IntField.Write(writer, IntField);
BSATN.LongField.Write(writer, LongField);
BSATN.I128Field.Write(writer, I128Field);
BSATN.I256Field.Write(writer, I256Field);
BSATN.BoolField.Write(writer, BoolField);
BSATN.FloatField.Write(writer, FloatField);
BSATN.DoubleField.Write(writer, DoubleField);
BSATN.StringField.Write(writer, StringField);
BSATN.IdentityField.Write(writer, IdentityField);
BSATN.ConnectionIdField.Write(writer, ConnectionIdField);
BSATN.CustomStructField.Write(writer, CustomStructField);
BSATN.CustomClassField.Write(writer, CustomClassField);
BSATN.CustomEnumField.Write(writer, CustomEnumField);
BSATN.CustomTaggedEnumField.Write(writer, CustomTaggedEnumField);
BSATN.ListField.Write(writer, ListField);
BSATN.NullableValueField.Write(writer, NullableValueField);
BSATN.NullableReferenceField.Write(writer, NullableReferenceField);
BSATN.ByteFieldRW.Write(writer, ByteField);
BSATN.UshortFieldRW.Write(writer, UshortField);
BSATN.UintFieldRW.Write(writer, UintField);
BSATN.UlongFieldRW.Write(writer, UlongField);
BSATN.U128FieldRW.Write(writer, U128Field);
BSATN.U256FieldRW.Write(writer, U256Field);
BSATN.SbyteFieldRW.Write(writer, SbyteField);
BSATN.ShortFieldRW.Write(writer, ShortField);
BSATN.IntFieldRW.Write(writer, IntField);
BSATN.LongFieldRW.Write(writer, LongField);
BSATN.I128FieldRW.Write(writer, I128Field);
BSATN.I256FieldRW.Write(writer, I256Field);
BSATN.BoolFieldRW.Write(writer, BoolField);
BSATN.FloatFieldRW.Write(writer, FloatField);
BSATN.DoubleFieldRW.Write(writer, DoubleField);
BSATN.StringFieldRW.Write(writer, StringField);
BSATN.IdentityFieldRW.Write(writer, IdentityField);
BSATN.ConnectionIdFieldRW.Write(writer, ConnectionIdField);
BSATN.CustomStructFieldRW.Write(writer, CustomStructField);
BSATN.CustomClassFieldRW.Write(writer, CustomClassField);
BSATN.CustomEnumFieldRW.Write(writer, CustomEnumField);
BSATN.CustomTaggedEnumFieldRW.Write(writer, CustomTaggedEnumField);
BSATN.ListFieldRW.Write(writer, ListField);
BSATN.NullableValueFieldRW.Write(writer, NullableValueField);
BSATN.NullableReferenceFieldRW.Write(writer, NullableReferenceField);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
@@ -72,38 +72,38 @@ partial struct PublicTable : System.IEquatable<PublicTable>, SpacetimeDB.BSATN.I
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<PublicTable>
{
internal static readonly SpacetimeDB.BSATN.U8 ByteField = new();
internal static readonly SpacetimeDB.BSATN.U16 UshortField = new();
internal static readonly SpacetimeDB.BSATN.U32 UintField = new();
internal static readonly SpacetimeDB.BSATN.U64 UlongField = new();
internal static readonly SpacetimeDB.BSATN.U128Stdb U128Field = new();
internal static readonly SpacetimeDB.BSATN.U256 U256Field = new();
internal static readonly SpacetimeDB.BSATN.I8 SbyteField = new();
internal static readonly SpacetimeDB.BSATN.I16 ShortField = new();
internal static readonly SpacetimeDB.BSATN.I32 IntField = new();
internal static readonly SpacetimeDB.BSATN.I64 LongField = new();
internal static readonly SpacetimeDB.BSATN.I128Stdb I128Field = new();
internal static readonly SpacetimeDB.BSATN.I256 I256Field = new();
internal static readonly SpacetimeDB.BSATN.Bool BoolField = new();
internal static readonly SpacetimeDB.BSATN.F32 FloatField = new();
internal static readonly SpacetimeDB.BSATN.F64 DoubleField = new();
internal static readonly SpacetimeDB.BSATN.String StringField = new();
internal static readonly SpacetimeDB.Identity.BSATN IdentityField = new();
internal static readonly SpacetimeDB.ConnectionId.BSATN ConnectionIdField = new();
internal static readonly CustomStruct.BSATN CustomStructField = new();
internal static readonly CustomClass.BSATN CustomClassField = new();
internal static readonly SpacetimeDB.BSATN.Enum<CustomEnum> CustomEnumField = new();
internal static readonly CustomTaggedEnum.BSATN CustomTaggedEnumField = new();
internal static readonly SpacetimeDB.BSATN.List<int, SpacetimeDB.BSATN.I32> ListField =
internal static readonly SpacetimeDB.BSATN.U8 ByteFieldRW = new();
internal static readonly SpacetimeDB.BSATN.U16 UshortFieldRW = new();
internal static readonly SpacetimeDB.BSATN.U32 UintFieldRW = new();
internal static readonly SpacetimeDB.BSATN.U64 UlongFieldRW = new();
internal static readonly SpacetimeDB.BSATN.U128Stdb U128FieldRW = new();
internal static readonly SpacetimeDB.BSATN.U256 U256FieldRW = new();
internal static readonly SpacetimeDB.BSATN.I8 SbyteFieldRW = new();
internal static readonly SpacetimeDB.BSATN.I16 ShortFieldRW = new();
internal static readonly SpacetimeDB.BSATN.I32 IntFieldRW = new();
internal static readonly SpacetimeDB.BSATN.I64 LongFieldRW = new();
internal static readonly SpacetimeDB.BSATN.I128Stdb I128FieldRW = new();
internal static readonly SpacetimeDB.BSATN.I256 I256FieldRW = new();
internal static readonly SpacetimeDB.BSATN.Bool BoolFieldRW = new();
internal static readonly SpacetimeDB.BSATN.F32 FloatFieldRW = new();
internal static readonly SpacetimeDB.BSATN.F64 DoubleFieldRW = new();
internal static readonly SpacetimeDB.BSATN.String StringFieldRW = new();
internal static readonly SpacetimeDB.Identity.BSATN IdentityFieldRW = new();
internal static readonly SpacetimeDB.ConnectionId.BSATN ConnectionIdFieldRW = new();
internal static readonly CustomStruct.BSATN CustomStructFieldRW = new();
internal static readonly CustomClass.BSATN CustomClassFieldRW = new();
internal static readonly SpacetimeDB.BSATN.Enum<CustomEnum> CustomEnumFieldRW = new();
internal static readonly CustomTaggedEnum.BSATN CustomTaggedEnumFieldRW = new();
internal static readonly SpacetimeDB.BSATN.List<int, SpacetimeDB.BSATN.I32> ListFieldRW =
new();
internal static readonly SpacetimeDB.BSATN.ValueOption<
int,
SpacetimeDB.BSATN.I32
> NullableValueField = new();
> NullableValueFieldRW = new();
internal static readonly SpacetimeDB.BSATN.RefOption<
string,
SpacetimeDB.BSATN.String
> NullableReferenceField = new();
> NullableReferenceFieldRW = new();
public PublicTable Read(System.IO.BinaryReader reader)
{
@@ -123,36 +123,36 @@ partial struct PublicTable : System.IEquatable<PublicTable>, SpacetimeDB.BSATN.I
registrar.RegisterType<PublicTable>(_ => new SpacetimeDB.BSATN.AlgebraicType.Product(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(ByteField), ByteField.GetAlgebraicType(registrar)),
new(nameof(UshortField), UshortField.GetAlgebraicType(registrar)),
new(nameof(UintField), UintField.GetAlgebraicType(registrar)),
new(nameof(UlongField), UlongField.GetAlgebraicType(registrar)),
new(nameof(U128Field), U128Field.GetAlgebraicType(registrar)),
new(nameof(U256Field), U256Field.GetAlgebraicType(registrar)),
new(nameof(SbyteField), SbyteField.GetAlgebraicType(registrar)),
new(nameof(ShortField), ShortField.GetAlgebraicType(registrar)),
new(nameof(IntField), IntField.GetAlgebraicType(registrar)),
new(nameof(LongField), LongField.GetAlgebraicType(registrar)),
new(nameof(I128Field), I128Field.GetAlgebraicType(registrar)),
new(nameof(I256Field), I256Field.GetAlgebraicType(registrar)),
new(nameof(BoolField), BoolField.GetAlgebraicType(registrar)),
new(nameof(FloatField), FloatField.GetAlgebraicType(registrar)),
new(nameof(DoubleField), DoubleField.GetAlgebraicType(registrar)),
new(nameof(StringField), StringField.GetAlgebraicType(registrar)),
new(nameof(IdentityField), IdentityField.GetAlgebraicType(registrar)),
new(nameof(ConnectionIdField), ConnectionIdField.GetAlgebraicType(registrar)),
new(nameof(CustomStructField), CustomStructField.GetAlgebraicType(registrar)),
new(nameof(CustomClassField), CustomClassField.GetAlgebraicType(registrar)),
new(nameof(CustomEnumField), CustomEnumField.GetAlgebraicType(registrar)),
new("ByteField", ByteFieldRW.GetAlgebraicType(registrar)),
new("UshortField", UshortFieldRW.GetAlgebraicType(registrar)),
new("UintField", UintFieldRW.GetAlgebraicType(registrar)),
new("UlongField", UlongFieldRW.GetAlgebraicType(registrar)),
new("U128Field", U128FieldRW.GetAlgebraicType(registrar)),
new("U256Field", U256FieldRW.GetAlgebraicType(registrar)),
new("SbyteField", SbyteFieldRW.GetAlgebraicType(registrar)),
new("ShortField", ShortFieldRW.GetAlgebraicType(registrar)),
new("IntField", IntFieldRW.GetAlgebraicType(registrar)),
new("LongField", LongFieldRW.GetAlgebraicType(registrar)),
new("I128Field", I128FieldRW.GetAlgebraicType(registrar)),
new("I256Field", I256FieldRW.GetAlgebraicType(registrar)),
new("BoolField", BoolFieldRW.GetAlgebraicType(registrar)),
new("FloatField", FloatFieldRW.GetAlgebraicType(registrar)),
new("DoubleField", DoubleFieldRW.GetAlgebraicType(registrar)),
new("StringField", StringFieldRW.GetAlgebraicType(registrar)),
new("IdentityField", IdentityFieldRW.GetAlgebraicType(registrar)),
new("ConnectionIdField", ConnectionIdFieldRW.GetAlgebraicType(registrar)),
new("CustomStructField", CustomStructFieldRW.GetAlgebraicType(registrar)),
new("CustomClassField", CustomClassFieldRW.GetAlgebraicType(registrar)),
new("CustomEnumField", CustomEnumFieldRW.GetAlgebraicType(registrar)),
new(
nameof(CustomTaggedEnumField),
CustomTaggedEnumField.GetAlgebraicType(registrar)
"CustomTaggedEnumField",
CustomTaggedEnumFieldRW.GetAlgebraicType(registrar)
),
new(nameof(ListField), ListField.GetAlgebraicType(registrar)),
new(nameof(NullableValueField), NullableValueField.GetAlgebraicType(registrar)),
new("ListField", ListFieldRW.GetAlgebraicType(registrar)),
new("NullableValueField", NullableValueFieldRW.GetAlgebraicType(registrar)),
new(
nameof(NullableReferenceField),
NullableReferenceField.GetAlgebraicType(registrar)
"NullableReferenceField",
NullableReferenceFieldRW.GetAlgebraicType(registrar)
)
}
));
@@ -116,7 +116,7 @@ SpacetimeDB.Internal.Module.RegisterClientVisibilityFilter(global::Module.MY_THI
},
{/*
{
internal static readonly TRW Field = new();
internal static readonly TRW FieldRW = new();
^^^
*/
@@ -44,13 +44,13 @@ namespace SpacetimeDB
{
if (row.AutoIncField == default)
{
row.AutoIncField = global::TestAutoIncNotInteger.BSATN.AutoIncField.Read(
row.AutoIncField = global::TestAutoIncNotInteger.BSATN.AutoIncFieldRW.Read(
reader
);
}
if (row.IdentityField == default)
{
row.IdentityField = global::TestAutoIncNotInteger.BSATN.IdentityField.Read(
row.IdentityField = global::TestAutoIncNotInteger.BSATN.IdentityFieldRW.Read(
reader
);
}
@@ -859,14 +859,14 @@ static class ModuleRegistration
class DummyScheduledReducer : SpacetimeDB.Internal.IReducer
{
private static readonly TestScheduleIssues.BSATN table = new();
private static readonly TestScheduleIssues.BSATN tableRW = new();
public SpacetimeDB.Internal.RawReducerDefV9 MakeReducerDef(
SpacetimeDB.BSATN.ITypeRegistrar registrar
) =>
new(
nameof(DummyScheduledReducer),
[new(nameof(table), table.GetAlgebraicType(registrar))],
[new("table", tableRW.GetAlgebraicType(registrar))],
null
);
@@ -874,7 +874,7 @@ static class ModuleRegistration
{
TestScheduleIssues.DummyScheduledReducer(
(SpacetimeDB.ReducerContext)ctx,
table.Read(reader)
tableRW.Read(reader)
);
}
}
@@ -8,14 +8,14 @@ partial struct TestAutoIncNotInteger
{
public void ReadFields(System.IO.BinaryReader reader)
{
AutoIncField = BSATN.AutoIncField.Read(reader);
IdentityField = BSATN.IdentityField.Read(reader);
AutoIncField = BSATN.AutoIncFieldRW.Read(reader);
IdentityField = BSATN.IdentityFieldRW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.AutoIncField.Write(writer, AutoIncField);
BSATN.IdentityField.Write(writer, IdentityField);
BSATN.AutoIncFieldRW.Write(writer, AutoIncField);
BSATN.IdentityFieldRW.Write(writer, IdentityField);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
@@ -28,8 +28,8 @@ partial struct TestAutoIncNotInteger
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<TestAutoIncNotInteger>
{
internal static readonly SpacetimeDB.BSATN.F32 AutoIncField = new();
internal static readonly SpacetimeDB.BSATN.String IdentityField = new();
internal static readonly SpacetimeDB.BSATN.F32 AutoIncFieldRW = new();
internal static readonly SpacetimeDB.BSATN.String IdentityFieldRW = new();
public TestAutoIncNotInteger Read(System.IO.BinaryReader reader)
{
@@ -50,8 +50,8 @@ partial struct TestAutoIncNotInteger
_ => new SpacetimeDB.BSATN.AlgebraicType.Product(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(AutoIncField), AutoIncField.GetAlgebraicType(registrar)),
new(nameof(IdentityField), IdentityField.GetAlgebraicType(registrar))
new("AutoIncField", AutoIncFieldRW.GetAlgebraicType(registrar)),
new("IdentityField", IdentityFieldRW.GetAlgebraicType(registrar))
}
)
);
@@ -8,12 +8,12 @@ partial struct TestIndexIssues
{
public void ReadFields(System.IO.BinaryReader reader)
{
SelfIndexingColumn = BSATN.SelfIndexingColumn.Read(reader);
SelfIndexingColumn = BSATN.SelfIndexingColumnRW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.SelfIndexingColumn.Write(writer, SelfIndexingColumn);
BSATN.SelfIndexingColumnRW.Write(writer, SelfIndexingColumn);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
@@ -26,7 +26,7 @@ partial struct TestIndexIssues
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<TestIndexIssues>
{
internal static readonly SpacetimeDB.BSATN.I32 SelfIndexingColumn = new();
internal static readonly SpacetimeDB.BSATN.I32 SelfIndexingColumnRW = new();
public TestIndexIssues Read(System.IO.BinaryReader reader)
{
@@ -47,10 +47,7 @@ partial struct TestIndexIssues
_ => new SpacetimeDB.BSATN.AlgebraicType.Product(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(
nameof(SelfIndexingColumn),
SelfIndexingColumn.GetAlgebraicType(registrar)
)
new("SelfIndexingColumn", SelfIndexingColumnRW.GetAlgebraicType(registrar))
}
)
);
@@ -8,18 +8,18 @@ partial struct TestScheduleIssues
{
public void ReadFields(System.IO.BinaryReader reader)
{
IdWrongType = BSATN.IdWrongType.Read(reader);
IdCorrectType = BSATN.IdCorrectType.Read(reader);
ScheduleAtWrongType = BSATN.ScheduleAtWrongType.Read(reader);
ScheduleAtCorrectType = BSATN.ScheduleAtCorrectType.Read(reader);
IdWrongType = BSATN.IdWrongTypeRW.Read(reader);
IdCorrectType = BSATN.IdCorrectTypeRW.Read(reader);
ScheduleAtWrongType = BSATN.ScheduleAtWrongTypeRW.Read(reader);
ScheduleAtCorrectType = BSATN.ScheduleAtCorrectTypeRW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.IdWrongType.Write(writer, IdWrongType);
BSATN.IdCorrectType.Write(writer, IdCorrectType);
BSATN.ScheduleAtWrongType.Write(writer, ScheduleAtWrongType);
BSATN.ScheduleAtCorrectType.Write(writer, ScheduleAtCorrectType);
BSATN.IdWrongTypeRW.Write(writer, IdWrongType);
BSATN.IdCorrectTypeRW.Write(writer, IdCorrectType);
BSATN.ScheduleAtWrongTypeRW.Write(writer, ScheduleAtWrongType);
BSATN.ScheduleAtCorrectTypeRW.Write(writer, ScheduleAtCorrectType);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
@@ -32,10 +32,10 @@ partial struct TestScheduleIssues
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<TestScheduleIssues>
{
internal static readonly SpacetimeDB.BSATN.String IdWrongType = new();
internal static readonly SpacetimeDB.BSATN.I32 IdCorrectType = new();
internal static readonly SpacetimeDB.BSATN.I32 ScheduleAtWrongType = new();
internal static readonly SpacetimeDB.ScheduleAt.BSATN ScheduleAtCorrectType = new();
internal static readonly SpacetimeDB.BSATN.String IdWrongTypeRW = new();
internal static readonly SpacetimeDB.BSATN.I32 IdCorrectTypeRW = new();
internal static readonly SpacetimeDB.BSATN.I32 ScheduleAtWrongTypeRW = new();
internal static readonly SpacetimeDB.ScheduleAt.BSATN ScheduleAtCorrectTypeRW = new();
public TestScheduleIssues Read(System.IO.BinaryReader reader)
{
@@ -56,15 +56,15 @@ partial struct TestScheduleIssues
_ => new SpacetimeDB.BSATN.AlgebraicType.Product(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(IdWrongType), IdWrongType.GetAlgebraicType(registrar)),
new(nameof(IdCorrectType), IdCorrectType.GetAlgebraicType(registrar)),
new("IdWrongType", IdWrongTypeRW.GetAlgebraicType(registrar)),
new("IdCorrectType", IdCorrectTypeRW.GetAlgebraicType(registrar)),
new(
nameof(ScheduleAtWrongType),
ScheduleAtWrongType.GetAlgebraicType(registrar)
"ScheduleAtWrongType",
ScheduleAtWrongTypeRW.GetAlgebraicType(registrar)
),
new(
nameof(ScheduleAtCorrectType),
ScheduleAtCorrectType.GetAlgebraicType(registrar)
"ScheduleAtCorrectType",
ScheduleAtCorrectTypeRW.GetAlgebraicType(registrar)
)
}
)
@@ -18,15 +18,15 @@ partial record TestTableTaggedEnum : System.IEquatable<TestTableTaggedEnum>
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<TestTableTaggedEnum>
{
internal static readonly SpacetimeDB.BSATN.I32 X = new();
internal static readonly SpacetimeDB.BSATN.I32 Y = new();
internal static readonly SpacetimeDB.BSATN.I32 XRW = new();
internal static readonly SpacetimeDB.BSATN.I32 YRW = new();
public TestTableTaggedEnum Read(System.IO.BinaryReader reader)
{
return reader.ReadByte() switch
{
0 => new X(X.Read(reader)),
1 => new Y(Y.Read(reader)),
0 => new X(XRW.Read(reader)),
1 => new Y(YRW.Read(reader)),
_
=> throw new System.InvalidOperationException(
"Invalid tag value, this state should be unreachable."
@@ -40,11 +40,11 @@ partial record TestTableTaggedEnum : System.IEquatable<TestTableTaggedEnum>
{
case X(var inner):
writer.Write((byte)0);
X.Write(writer, inner);
XRW.Write(writer, inner);
break;
case Y(var inner):
writer.Write((byte)1);
Y.Write(writer, inner);
YRW.Write(writer, inner);
break;
}
}
@@ -56,8 +56,8 @@ partial record TestTableTaggedEnum : System.IEquatable<TestTableTaggedEnum>
_ => new SpacetimeDB.BSATN.AlgebraicType.Sum(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(X), X.GetAlgebraicType(registrar)),
new(nameof(Y), Y.GetAlgebraicType(registrar))
new("X", XRW.GetAlgebraicType(registrar)),
new("Y", YRW.GetAlgebraicType(registrar))
}
)
);
@@ -8,14 +8,14 @@ partial struct TestUniqueNotEquatable
{
public void ReadFields(System.IO.BinaryReader reader)
{
UniqueField = BSATN.UniqueField.Read(reader);
PrimaryKeyField = BSATN.PrimaryKeyField.Read(reader);
UniqueField = BSATN.UniqueFieldRW.Read(reader);
PrimaryKeyField = BSATN.PrimaryKeyFieldRW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.UniqueField.Write(writer, UniqueField);
BSATN.PrimaryKeyField.Write(writer, PrimaryKeyField);
BSATN.UniqueFieldRW.Write(writer, UniqueField);
BSATN.PrimaryKeyFieldRW.Write(writer, PrimaryKeyField);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
@@ -31,8 +31,8 @@ partial struct TestUniqueNotEquatable
internal static readonly SpacetimeDB.BSATN.ValueOption<
int,
SpacetimeDB.BSATN.I32
> UniqueField = new();
internal static readonly SpacetimeDB.BSATN.Enum<TestEnumWithExplicitValues> PrimaryKeyField =
> UniqueFieldRW = new();
internal static readonly SpacetimeDB.BSATN.Enum<TestEnumWithExplicitValues> PrimaryKeyFieldRW =
new();
public TestUniqueNotEquatable Read(System.IO.BinaryReader reader)
@@ -54,8 +54,8 @@ partial struct TestUniqueNotEquatable
_ => new SpacetimeDB.BSATN.AlgebraicType.Product(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(UniqueField), UniqueField.GetAlgebraicType(registrar)),
new(nameof(PrimaryKeyField), PrimaryKeyField.GetAlgebraicType(registrar))
new("UniqueField", UniqueFieldRW.GetAlgebraicType(registrar)),
new("PrimaryKeyField", PrimaryKeyFieldRW.GetAlgebraicType(registrar))
}
)
);
@@ -18,15 +18,15 @@ partial record TestTaggedEnumField : System.IEquatable<TestTaggedEnumField>
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<TestTaggedEnumField>
{
internal static readonly SpacetimeDB.BSATN.I32 X = new();
internal static readonly SpacetimeDB.BSATN.I32 Y = new();
internal static readonly SpacetimeDB.BSATN.I32 XRW = new();
internal static readonly SpacetimeDB.BSATN.I32 YRW = new();
public TestTaggedEnumField Read(System.IO.BinaryReader reader)
{
return reader.ReadByte() switch
{
0 => new X(X.Read(reader)),
1 => new Y(Y.Read(reader)),
0 => new X(XRW.Read(reader)),
1 => new Y(YRW.Read(reader)),
_
=> throw new System.InvalidOperationException(
"Invalid tag value, this state should be unreachable."
@@ -40,11 +40,11 @@ partial record TestTaggedEnumField : System.IEquatable<TestTaggedEnumField>
{
case X(var inner):
writer.Write((byte)0);
X.Write(writer, inner);
XRW.Write(writer, inner);
break;
case Y(var inner):
writer.Write((byte)1);
Y.Write(writer, inner);
YRW.Write(writer, inner);
break;
}
}
@@ -56,8 +56,8 @@ partial record TestTaggedEnumField : System.IEquatable<TestTaggedEnumField>
_ => new SpacetimeDB.BSATN.AlgebraicType.Sum(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(X), X.GetAlgebraicType(registrar)),
new(nameof(Y), Y.GetAlgebraicType(registrar))
new("X", XRW.GetAlgebraicType(registrar)),
new("Y", YRW.GetAlgebraicType(registrar))
}
)
);
@@ -12,13 +12,13 @@ partial record TestTaggedEnumInlineTuple : System.IEquatable<TestTaggedEnumInlin
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<TestTaggedEnumInlineTuple>
{
internal static readonly SpacetimeDB.BSATN.I32 Item1 = new();
internal static readonly SpacetimeDB.BSATN.I32 Item1RW = new();
public TestTaggedEnumInlineTuple Read(System.IO.BinaryReader reader)
{
return reader.ReadByte() switch
{
0 => new Item1(Item1.Read(reader)),
0 => new Item1(Item1RW.Read(reader)),
_
=> throw new System.InvalidOperationException(
"Invalid tag value, this state should be unreachable."
@@ -32,7 +32,7 @@ partial record TestTaggedEnumInlineTuple : System.IEquatable<TestTaggedEnumInlin
{
case Item1(var inner):
writer.Write((byte)0);
Item1.Write(writer, inner);
Item1RW.Write(writer, inner);
break;
}
}
@@ -44,7 +44,7 @@ partial record TestTaggedEnumInlineTuple : System.IEquatable<TestTaggedEnumInlin
_ => new SpacetimeDB.BSATN.AlgebraicType.Sum(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(Item1), Item1.GetAlgebraicType(registrar))
new("Item1", Item1RW.GetAlgebraicType(registrar))
}
)
);
@@ -8,12 +8,12 @@ partial struct TestTypeParams<T>
{
public void ReadFields(System.IO.BinaryReader reader)
{
Field = BSATN.Field.Read(reader);
Field = BSATN.FieldRW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.Field.Write(writer, Field);
BSATN.FieldRW.Write(writer, Field);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
@@ -26,7 +26,7 @@ partial struct TestTypeParams<T>
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<TestTypeParams<T>>
{
internal static readonly TRW Field = new();
internal static readonly TRW FieldRW = new();
public TestTypeParams<T> Read(System.IO.BinaryReader reader)
{
@@ -47,7 +47,7 @@ partial struct TestTypeParams<T>
_ => new SpacetimeDB.BSATN.AlgebraicType.Product(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(Field), Field.GetAlgebraicType(registrar))
new("Field", FieldRW.GetAlgebraicType(registrar))
}
)
);
@@ -8,18 +8,18 @@ partial struct TestUnsupportedType
{
public void ReadFields(System.IO.BinaryReader reader)
{
UnsupportedSpecialType = BSATN.UnsupportedSpecialType.Read(reader);
UnsupportedSystemType = BSATN.UnsupportedSystemType.Read(reader);
UnresolvedType = BSATN.UnresolvedType.Read(reader);
UnsupportedEnum = BSATN.UnsupportedEnum.Read(reader);
UnsupportedSpecialType = BSATN.UnsupportedSpecialTypeRW.Read(reader);
UnsupportedSystemType = BSATN.UnsupportedSystemTypeRW.Read(reader);
UnresolvedType = BSATN.UnresolvedTypeRW.Read(reader);
UnsupportedEnum = BSATN.UnsupportedEnumRW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.UnsupportedSpecialType.Write(writer, UnsupportedSpecialType);
BSATN.UnsupportedSystemType.Write(writer, UnsupportedSystemType);
BSATN.UnresolvedType.Write(writer, UnresolvedType);
BSATN.UnsupportedEnum.Write(writer, UnsupportedEnum);
BSATN.UnsupportedSpecialTypeRW.Write(writer, UnsupportedSpecialType);
BSATN.UnsupportedSystemTypeRW.Write(writer, UnsupportedSystemType);
BSATN.UnresolvedTypeRW.Write(writer, UnresolvedType);
BSATN.UnsupportedEnumRW.Write(writer, UnsupportedEnum);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
@@ -32,12 +32,12 @@ partial struct TestUnsupportedType
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<TestUnsupportedType>
{
internal static readonly SpacetimeDB.BSATN.Unsupported<System.DateTime> UnsupportedSpecialType =
internal static readonly SpacetimeDB.BSATN.Unsupported<System.DateTime> UnsupportedSpecialTypeRW =
new();
internal static readonly SpacetimeDB.BSATN.Unsupported<System.Exception> UnsupportedSystemType =
internal static readonly SpacetimeDB.BSATN.Unsupported<System.Exception> UnsupportedSystemTypeRW =
new();
internal static readonly SpacetimeDB.BSATN.Unsupported<object> UnresolvedType = new();
internal static readonly SpacetimeDB.BSATN.Unsupported<LocalEnum> UnsupportedEnum = new();
internal static readonly SpacetimeDB.BSATN.Unsupported<object> UnresolvedTypeRW = new();
internal static readonly SpacetimeDB.BSATN.Unsupported<LocalEnum> UnsupportedEnumRW = new();
public TestUnsupportedType Read(System.IO.BinaryReader reader)
{
@@ -59,15 +59,15 @@ partial struct TestUnsupportedType
new SpacetimeDB.BSATN.AggregateElement[]
{
new(
nameof(UnsupportedSpecialType),
UnsupportedSpecialType.GetAlgebraicType(registrar)
"UnsupportedSpecialType",
UnsupportedSpecialTypeRW.GetAlgebraicType(registrar)
),
new(
nameof(UnsupportedSystemType),
UnsupportedSystemType.GetAlgebraicType(registrar)
"UnsupportedSystemType",
UnsupportedSystemTypeRW.GetAlgebraicType(registrar)
),
new(nameof(UnresolvedType), UnresolvedType.GetAlgebraicType(registrar)),
new(nameof(UnsupportedEnum), UnsupportedEnum.GetAlgebraicType(registrar))
new("UnresolvedType", UnresolvedTypeRW.GetAlgebraicType(registrar)),
new("UnsupportedEnum", UnsupportedEnumRW.GetAlgebraicType(registrar))
}
)
);
@@ -97,7 +97,7 @@ public partial record CustomTaggedEnum
[SpacetimeDB.Table]
public partial class PrivateTable { }
[SpacetimeDB.Table]
[SpacetimeDB.Table(Public = true)]
public partial struct PublicTable
{
[SpacetimeDB.AutoInc]
@@ -258,6 +258,17 @@ partial struct RegressionMultipleUniqueIndexesHadSameName
public uint Unique2;
}
/// <summary>
/// These used to cause conflicts when generating the BSATN struct for a type.
/// </summary>
[SpacetimeDB.Type]
partial struct FormerlyForbiddenFieldNames
{
public uint Read;
public uint Write;
public uint GetAlgebraicType;
}
public class Module
{
[SpacetimeDB.ClientVisibilityFilter]
@@ -8,16 +8,16 @@ partial struct BTreeMultiColumn
{
public void ReadFields(System.IO.BinaryReader reader)
{
X = BSATN.X.Read(reader);
Y = BSATN.Y.Read(reader);
Z = BSATN.Z.Read(reader);
X = BSATN.XRW.Read(reader);
Y = BSATN.YRW.Read(reader);
Z = BSATN.ZRW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.X.Write(writer, X);
BSATN.Y.Write(writer, Y);
BSATN.Z.Write(writer, Z);
BSATN.XRW.Write(writer, X);
BSATN.YRW.Write(writer, Y);
BSATN.ZRW.Write(writer, Z);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
@@ -30,9 +30,9 @@ partial struct BTreeMultiColumn
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<BTreeMultiColumn>
{
internal static readonly SpacetimeDB.BSATN.U32 X = new();
internal static readonly SpacetimeDB.BSATN.U32 Y = new();
internal static readonly SpacetimeDB.BSATN.U32 Z = new();
internal static readonly SpacetimeDB.BSATN.U32 XRW = new();
internal static readonly SpacetimeDB.BSATN.U32 YRW = new();
internal static readonly SpacetimeDB.BSATN.U32 ZRW = new();
public BTreeMultiColumn Read(System.IO.BinaryReader reader)
{
@@ -53,9 +53,9 @@ partial struct BTreeMultiColumn
_ => new SpacetimeDB.BSATN.AlgebraicType.Product(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(X), X.GetAlgebraicType(registrar)),
new(nameof(Y), Y.GetAlgebraicType(registrar)),
new(nameof(Z), Z.GetAlgebraicType(registrar))
new("X", XRW.GetAlgebraicType(registrar)),
new("Y", YRW.GetAlgebraicType(registrar)),
new("Z", ZRW.GetAlgebraicType(registrar))
}
)
);
@@ -6,18 +6,18 @@ partial struct BTreeViews : System.IEquatable<BTreeViews>, SpacetimeDB.BSATN.ISt
{
public void ReadFields(System.IO.BinaryReader reader)
{
Id = BSATN.Id.Read(reader);
X = BSATN.X.Read(reader);
Y = BSATN.Y.Read(reader);
Faction = BSATN.Faction.Read(reader);
Id = BSATN.IdRW.Read(reader);
X = BSATN.XRW.Read(reader);
Y = BSATN.YRW.Read(reader);
Faction = BSATN.FactionRW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.Id.Write(writer, Id);
BSATN.X.Write(writer, X);
BSATN.Y.Write(writer, Y);
BSATN.Faction.Write(writer, Faction);
BSATN.IdRW.Write(writer, Id);
BSATN.XRW.Write(writer, X);
BSATN.YRW.Write(writer, Y);
BSATN.FactionRW.Write(writer, Faction);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
@@ -30,10 +30,10 @@ partial struct BTreeViews : System.IEquatable<BTreeViews>, SpacetimeDB.BSATN.ISt
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<BTreeViews>
{
internal static readonly SpacetimeDB.Identity.BSATN Id = new();
internal static readonly SpacetimeDB.BSATN.U32 X = new();
internal static readonly SpacetimeDB.BSATN.U32 Y = new();
internal static readonly SpacetimeDB.BSATN.String Faction = new();
internal static readonly SpacetimeDB.Identity.BSATN IdRW = new();
internal static readonly SpacetimeDB.BSATN.U32 XRW = new();
internal static readonly SpacetimeDB.BSATN.U32 YRW = new();
internal static readonly SpacetimeDB.BSATN.String FactionRW = new();
public BTreeViews Read(System.IO.BinaryReader reader)
{
@@ -53,10 +53,10 @@ partial struct BTreeViews : System.IEquatable<BTreeViews>, SpacetimeDB.BSATN.ISt
registrar.RegisterType<BTreeViews>(_ => new SpacetimeDB.BSATN.AlgebraicType.Product(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(Id), Id.GetAlgebraicType(registrar)),
new(nameof(X), X.GetAlgebraicType(registrar)),
new(nameof(Y), Y.GetAlgebraicType(registrar)),
new(nameof(Faction), Faction.GetAlgebraicType(registrar))
new("Id", IdRW.GetAlgebraicType(registrar)),
new("X", XRW.GetAlgebraicType(registrar)),
new("Y", YRW.GetAlgebraicType(registrar)),
new("Faction", FactionRW.GetAlgebraicType(registrar))
}
));
@@ -408,7 +408,7 @@ namespace SpacetimeDB
{
if (row.Foo == default)
{
row.Foo = global::MultiTableRow.BSATN.Foo.Read(reader);
row.Foo = global::MultiTableRow.BSATN.FooRW.Read(reader);
}
return row;
}
@@ -530,7 +530,7 @@ namespace SpacetimeDB
{
if (row.Foo == default)
{
row.Foo = global::MultiTableRow.BSATN.Foo.Read(reader);
row.Foo = global::MultiTableRow.BSATN.FooRW.Read(reader);
}
return row;
}
@@ -652,7 +652,7 @@ namespace SpacetimeDB
{
if (row.Id == default)
{
row.Id = global::PublicTable.BSATN.Id.Read(reader);
row.Id = global::PublicTable.BSATN.IdRW.Read(reader);
}
return row;
}
@@ -690,7 +690,7 @@ namespace SpacetimeDB
],
Schedule: null,
TableType: SpacetimeDB.Internal.TableType.User,
TableAccess: SpacetimeDB.Internal.TableAccess.Private
TableAccess: SpacetimeDB.Internal.TableAccess.Public
);
public ulong Count =>
@@ -870,7 +870,7 @@ namespace SpacetimeDB
{
if (row.ScheduledId == default)
{
row.ScheduledId = global::Timers.SendMessageTimer.BSATN.ScheduledId.Read(
row.ScheduledId = global::Timers.SendMessageTimer.BSATN.ScheduledIdRW.Read(
reader
);
}
@@ -998,89 +998,80 @@ static class ModuleRegistration
class InsertData : SpacetimeDB.Internal.IReducer
{
private static readonly PublicTable.BSATN data = new();
private static readonly PublicTable.BSATN dataRW = new();
public SpacetimeDB.Internal.RawReducerDefV9 MakeReducerDef(
SpacetimeDB.BSATN.ITypeRegistrar registrar
) => new(nameof(InsertData), [new(nameof(data), data.GetAlgebraicType(registrar))], null);
) => new(nameof(InsertData), [new("data", dataRW.GetAlgebraicType(registrar))], null);
public void Invoke(BinaryReader reader, SpacetimeDB.Internal.IReducerContext ctx)
{
Reducers.InsertData((SpacetimeDB.ReducerContext)ctx, data.Read(reader));
Reducers.InsertData((SpacetimeDB.ReducerContext)ctx, dataRW.Read(reader));
}
}
class InsertData2 : SpacetimeDB.Internal.IReducer
{
private static readonly PublicTable.BSATN data = new();
private static readonly PublicTable.BSATN dataRW = new();
public SpacetimeDB.Internal.RawReducerDefV9 MakeReducerDef(
SpacetimeDB.BSATN.ITypeRegistrar registrar
) => new(nameof(InsertData2), [new(nameof(data), data.GetAlgebraicType(registrar))], null);
) => new(nameof(InsertData2), [new("data", dataRW.GetAlgebraicType(registrar))], null);
public void Invoke(BinaryReader reader, SpacetimeDB.Internal.IReducerContext ctx)
{
Test.NestingNamespaces.AndClasses.InsertData2(
(SpacetimeDB.ReducerContext)ctx,
data.Read(reader)
dataRW.Read(reader)
);
}
}
class InsertMultiData : SpacetimeDB.Internal.IReducer
{
private static readonly MultiTableRow.BSATN data = new();
private static readonly MultiTableRow.BSATN dataRW = new();
public SpacetimeDB.Internal.RawReducerDefV9 MakeReducerDef(
SpacetimeDB.BSATN.ITypeRegistrar registrar
) =>
new(
nameof(InsertMultiData),
[new(nameof(data), data.GetAlgebraicType(registrar))],
null
);
) => new(nameof(InsertMultiData), [new("data", dataRW.GetAlgebraicType(registrar))], null);
public void Invoke(BinaryReader reader, SpacetimeDB.Internal.IReducerContext ctx)
{
MultiTableRow.InsertMultiData((SpacetimeDB.ReducerContext)ctx, data.Read(reader));
MultiTableRow.InsertMultiData((SpacetimeDB.ReducerContext)ctx, dataRW.Read(reader));
}
}
class ScheduleImmediate : SpacetimeDB.Internal.IReducer
{
private static readonly PublicTable.BSATN data = new();
private static readonly PublicTable.BSATN dataRW = new();
public SpacetimeDB.Internal.RawReducerDefV9 MakeReducerDef(
SpacetimeDB.BSATN.ITypeRegistrar registrar
) =>
new(
nameof(ScheduleImmediate),
[new(nameof(data), data.GetAlgebraicType(registrar))],
null
);
new(nameof(ScheduleImmediate), [new("data", dataRW.GetAlgebraicType(registrar))], null);
public void Invoke(BinaryReader reader, SpacetimeDB.Internal.IReducerContext ctx)
{
Reducers.ScheduleImmediate((SpacetimeDB.ReducerContext)ctx, data.Read(reader));
Reducers.ScheduleImmediate((SpacetimeDB.ReducerContext)ctx, dataRW.Read(reader));
}
}
class SendScheduledMessage : SpacetimeDB.Internal.IReducer
{
private static readonly Timers.SendMessageTimer.BSATN arg = new();
private static readonly Timers.SendMessageTimer.BSATN argRW = new();
public SpacetimeDB.Internal.RawReducerDefV9 MakeReducerDef(
SpacetimeDB.BSATN.ITypeRegistrar registrar
) =>
new(
nameof(SendScheduledMessage),
[new(nameof(arg), arg.GetAlgebraicType(registrar))],
[new("arg", argRW.GetAlgebraicType(registrar))],
null
);
public void Invoke(BinaryReader reader, SpacetimeDB.Internal.IReducerContext ctx)
{
Timers.SendScheduledMessage((SpacetimeDB.ReducerContext)ctx, arg.Read(reader));
Timers.SendScheduledMessage((SpacetimeDB.ReducerContext)ctx, argRW.Read(reader));
}
}
@@ -8,16 +8,16 @@ partial struct MultiTableRow
{
public void ReadFields(System.IO.BinaryReader reader)
{
Name = BSATN.Name.Read(reader);
Foo = BSATN.Foo.Read(reader);
Bar = BSATN.Bar.Read(reader);
Name = BSATN.NameRW.Read(reader);
Foo = BSATN.FooRW.Read(reader);
Bar = BSATN.BarRW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.Name.Write(writer, Name);
BSATN.Foo.Write(writer, Foo);
BSATN.Bar.Write(writer, Bar);
BSATN.NameRW.Write(writer, Name);
BSATN.FooRW.Write(writer, Foo);
BSATN.BarRW.Write(writer, Bar);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
@@ -30,9 +30,9 @@ partial struct MultiTableRow
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<MultiTableRow>
{
internal static readonly SpacetimeDB.BSATN.String Name = new();
internal static readonly SpacetimeDB.BSATN.U32 Foo = new();
internal static readonly SpacetimeDB.BSATN.U32 Bar = new();
internal static readonly SpacetimeDB.BSATN.String NameRW = new();
internal static readonly SpacetimeDB.BSATN.U32 FooRW = new();
internal static readonly SpacetimeDB.BSATN.U32 BarRW = new();
public MultiTableRow Read(System.IO.BinaryReader reader)
{
@@ -52,9 +52,9 @@ partial struct MultiTableRow
registrar.RegisterType<MultiTableRow>(_ => new SpacetimeDB.BSATN.AlgebraicType.Product(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(Name), Name.GetAlgebraicType(registrar)),
new(nameof(Foo), Foo.GetAlgebraicType(registrar)),
new(nameof(Bar), Bar.GetAlgebraicType(registrar))
new("Name", NameRW.GetAlgebraicType(registrar)),
new("Foo", FooRW.GetAlgebraicType(registrar)),
new("Bar", BarRW.GetAlgebraicType(registrar))
}
));
@@ -6,66 +6,66 @@ partial struct PublicTable : System.IEquatable<PublicTable>, SpacetimeDB.BSATN.I
{
public void ReadFields(System.IO.BinaryReader reader)
{
Id = BSATN.Id.Read(reader);
ByteField = BSATN.ByteField.Read(reader);
UshortField = BSATN.UshortField.Read(reader);
UintField = BSATN.UintField.Read(reader);
UlongField = BSATN.UlongField.Read(reader);
UInt128Field = BSATN.UInt128Field.Read(reader);
U128Field = BSATN.U128Field.Read(reader);
U256Field = BSATN.U256Field.Read(reader);
SbyteField = BSATN.SbyteField.Read(reader);
ShortField = BSATN.ShortField.Read(reader);
IntField = BSATN.IntField.Read(reader);
LongField = BSATN.LongField.Read(reader);
Int128Field = BSATN.Int128Field.Read(reader);
I128Field = BSATN.I128Field.Read(reader);
I256Field = BSATN.I256Field.Read(reader);
BoolField = BSATN.BoolField.Read(reader);
FloatField = BSATN.FloatField.Read(reader);
DoubleField = BSATN.DoubleField.Read(reader);
StringField = BSATN.StringField.Read(reader);
IdentityField = BSATN.IdentityField.Read(reader);
ConnectionIdField = BSATN.ConnectionIdField.Read(reader);
CustomStructField = BSATN.CustomStructField.Read(reader);
CustomClassField = BSATN.CustomClassField.Read(reader);
CustomEnumField = BSATN.CustomEnumField.Read(reader);
CustomTaggedEnumField = BSATN.CustomTaggedEnumField.Read(reader);
ListField = BSATN.ListField.Read(reader);
NullableValueField = BSATN.NullableValueField.Read(reader);
NullableReferenceField = BSATN.NullableReferenceField.Read(reader);
Id = BSATN.IdRW.Read(reader);
ByteField = BSATN.ByteFieldRW.Read(reader);
UshortField = BSATN.UshortFieldRW.Read(reader);
UintField = BSATN.UintFieldRW.Read(reader);
UlongField = BSATN.UlongFieldRW.Read(reader);
UInt128Field = BSATN.UInt128FieldRW.Read(reader);
U128Field = BSATN.U128FieldRW.Read(reader);
U256Field = BSATN.U256FieldRW.Read(reader);
SbyteField = BSATN.SbyteFieldRW.Read(reader);
ShortField = BSATN.ShortFieldRW.Read(reader);
IntField = BSATN.IntFieldRW.Read(reader);
LongField = BSATN.LongFieldRW.Read(reader);
Int128Field = BSATN.Int128FieldRW.Read(reader);
I128Field = BSATN.I128FieldRW.Read(reader);
I256Field = BSATN.I256FieldRW.Read(reader);
BoolField = BSATN.BoolFieldRW.Read(reader);
FloatField = BSATN.FloatFieldRW.Read(reader);
DoubleField = BSATN.DoubleFieldRW.Read(reader);
StringField = BSATN.StringFieldRW.Read(reader);
IdentityField = BSATN.IdentityFieldRW.Read(reader);
ConnectionIdField = BSATN.ConnectionIdFieldRW.Read(reader);
CustomStructField = BSATN.CustomStructFieldRW.Read(reader);
CustomClassField = BSATN.CustomClassFieldRW.Read(reader);
CustomEnumField = BSATN.CustomEnumFieldRW.Read(reader);
CustomTaggedEnumField = BSATN.CustomTaggedEnumFieldRW.Read(reader);
ListField = BSATN.ListFieldRW.Read(reader);
NullableValueField = BSATN.NullableValueFieldRW.Read(reader);
NullableReferenceField = BSATN.NullableReferenceFieldRW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.Id.Write(writer, Id);
BSATN.ByteField.Write(writer, ByteField);
BSATN.UshortField.Write(writer, UshortField);
BSATN.UintField.Write(writer, UintField);
BSATN.UlongField.Write(writer, UlongField);
BSATN.UInt128Field.Write(writer, UInt128Field);
BSATN.U128Field.Write(writer, U128Field);
BSATN.U256Field.Write(writer, U256Field);
BSATN.SbyteField.Write(writer, SbyteField);
BSATN.ShortField.Write(writer, ShortField);
BSATN.IntField.Write(writer, IntField);
BSATN.LongField.Write(writer, LongField);
BSATN.Int128Field.Write(writer, Int128Field);
BSATN.I128Field.Write(writer, I128Field);
BSATN.I256Field.Write(writer, I256Field);
BSATN.BoolField.Write(writer, BoolField);
BSATN.FloatField.Write(writer, FloatField);
BSATN.DoubleField.Write(writer, DoubleField);
BSATN.StringField.Write(writer, StringField);
BSATN.IdentityField.Write(writer, IdentityField);
BSATN.ConnectionIdField.Write(writer, ConnectionIdField);
BSATN.CustomStructField.Write(writer, CustomStructField);
BSATN.CustomClassField.Write(writer, CustomClassField);
BSATN.CustomEnumField.Write(writer, CustomEnumField);
BSATN.CustomTaggedEnumField.Write(writer, CustomTaggedEnumField);
BSATN.ListField.Write(writer, ListField);
BSATN.NullableValueField.Write(writer, NullableValueField);
BSATN.NullableReferenceField.Write(writer, NullableReferenceField);
BSATN.IdRW.Write(writer, Id);
BSATN.ByteFieldRW.Write(writer, ByteField);
BSATN.UshortFieldRW.Write(writer, UshortField);
BSATN.UintFieldRW.Write(writer, UintField);
BSATN.UlongFieldRW.Write(writer, UlongField);
BSATN.UInt128FieldRW.Write(writer, UInt128Field);
BSATN.U128FieldRW.Write(writer, U128Field);
BSATN.U256FieldRW.Write(writer, U256Field);
BSATN.SbyteFieldRW.Write(writer, SbyteField);
BSATN.ShortFieldRW.Write(writer, ShortField);
BSATN.IntFieldRW.Write(writer, IntField);
BSATN.LongFieldRW.Write(writer, LongField);
BSATN.Int128FieldRW.Write(writer, Int128Field);
BSATN.I128FieldRW.Write(writer, I128Field);
BSATN.I256FieldRW.Write(writer, I256Field);
BSATN.BoolFieldRW.Write(writer, BoolField);
BSATN.FloatFieldRW.Write(writer, FloatField);
BSATN.DoubleFieldRW.Write(writer, DoubleField);
BSATN.StringFieldRW.Write(writer, StringField);
BSATN.IdentityFieldRW.Write(writer, IdentityField);
BSATN.ConnectionIdFieldRW.Write(writer, ConnectionIdField);
BSATN.CustomStructFieldRW.Write(writer, CustomStructField);
BSATN.CustomClassFieldRW.Write(writer, CustomClassField);
BSATN.CustomEnumFieldRW.Write(writer, CustomEnumField);
BSATN.CustomTaggedEnumFieldRW.Write(writer, CustomTaggedEnumField);
BSATN.ListFieldRW.Write(writer, ListField);
BSATN.NullableValueFieldRW.Write(writer, NullableValueField);
BSATN.NullableReferenceFieldRW.Write(writer, NullableReferenceField);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
@@ -78,41 +78,41 @@ partial struct PublicTable : System.IEquatable<PublicTable>, SpacetimeDB.BSATN.I
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<PublicTable>
{
internal static readonly SpacetimeDB.BSATN.I32 Id = new();
internal static readonly SpacetimeDB.BSATN.U8 ByteField = new();
internal static readonly SpacetimeDB.BSATN.U16 UshortField = new();
internal static readonly SpacetimeDB.BSATN.U32 UintField = new();
internal static readonly SpacetimeDB.BSATN.U64 UlongField = new();
internal static readonly SpacetimeDB.BSATN.U128 UInt128Field = new();
internal static readonly SpacetimeDB.BSATN.U128Stdb U128Field = new();
internal static readonly SpacetimeDB.BSATN.U256 U256Field = new();
internal static readonly SpacetimeDB.BSATN.I8 SbyteField = new();
internal static readonly SpacetimeDB.BSATN.I16 ShortField = new();
internal static readonly SpacetimeDB.BSATN.I32 IntField = new();
internal static readonly SpacetimeDB.BSATN.I64 LongField = new();
internal static readonly SpacetimeDB.BSATN.I128 Int128Field = new();
internal static readonly SpacetimeDB.BSATN.I128Stdb I128Field = new();
internal static readonly SpacetimeDB.BSATN.I256 I256Field = new();
internal static readonly SpacetimeDB.BSATN.Bool BoolField = new();
internal static readonly SpacetimeDB.BSATN.F32 FloatField = new();
internal static readonly SpacetimeDB.BSATN.F64 DoubleField = new();
internal static readonly SpacetimeDB.BSATN.String StringField = new();
internal static readonly SpacetimeDB.Identity.BSATN IdentityField = new();
internal static readonly SpacetimeDB.ConnectionId.BSATN ConnectionIdField = new();
internal static readonly CustomStruct.BSATN CustomStructField = new();
internal static readonly CustomClass.BSATN CustomClassField = new();
internal static readonly SpacetimeDB.BSATN.Enum<CustomEnum> CustomEnumField = new();
internal static readonly CustomTaggedEnum.BSATN CustomTaggedEnumField = new();
internal static readonly SpacetimeDB.BSATN.List<int, SpacetimeDB.BSATN.I32> ListField =
internal static readonly SpacetimeDB.BSATN.I32 IdRW = new();
internal static readonly SpacetimeDB.BSATN.U8 ByteFieldRW = new();
internal static readonly SpacetimeDB.BSATN.U16 UshortFieldRW = new();
internal static readonly SpacetimeDB.BSATN.U32 UintFieldRW = new();
internal static readonly SpacetimeDB.BSATN.U64 UlongFieldRW = new();
internal static readonly SpacetimeDB.BSATN.U128 UInt128FieldRW = new();
internal static readonly SpacetimeDB.BSATN.U128Stdb U128FieldRW = new();
internal static readonly SpacetimeDB.BSATN.U256 U256FieldRW = new();
internal static readonly SpacetimeDB.BSATN.I8 SbyteFieldRW = new();
internal static readonly SpacetimeDB.BSATN.I16 ShortFieldRW = new();
internal static readonly SpacetimeDB.BSATN.I32 IntFieldRW = new();
internal static readonly SpacetimeDB.BSATN.I64 LongFieldRW = new();
internal static readonly SpacetimeDB.BSATN.I128 Int128FieldRW = new();
internal static readonly SpacetimeDB.BSATN.I128Stdb I128FieldRW = new();
internal static readonly SpacetimeDB.BSATN.I256 I256FieldRW = new();
internal static readonly SpacetimeDB.BSATN.Bool BoolFieldRW = new();
internal static readonly SpacetimeDB.BSATN.F32 FloatFieldRW = new();
internal static readonly SpacetimeDB.BSATN.F64 DoubleFieldRW = new();
internal static readonly SpacetimeDB.BSATN.String StringFieldRW = new();
internal static readonly SpacetimeDB.Identity.BSATN IdentityFieldRW = new();
internal static readonly SpacetimeDB.ConnectionId.BSATN ConnectionIdFieldRW = new();
internal static readonly CustomStruct.BSATN CustomStructFieldRW = new();
internal static readonly CustomClass.BSATN CustomClassFieldRW = new();
internal static readonly SpacetimeDB.BSATN.Enum<CustomEnum> CustomEnumFieldRW = new();
internal static readonly CustomTaggedEnum.BSATN CustomTaggedEnumFieldRW = new();
internal static readonly SpacetimeDB.BSATN.List<int, SpacetimeDB.BSATN.I32> ListFieldRW =
new();
internal static readonly SpacetimeDB.BSATN.ValueOption<
int,
SpacetimeDB.BSATN.I32
> NullableValueField = new();
> NullableValueFieldRW = new();
internal static readonly SpacetimeDB.BSATN.RefOption<
string,
SpacetimeDB.BSATN.String
> NullableReferenceField = new();
> NullableReferenceFieldRW = new();
public PublicTable Read(System.IO.BinaryReader reader)
{
@@ -132,39 +132,39 @@ partial struct PublicTable : System.IEquatable<PublicTable>, SpacetimeDB.BSATN.I
registrar.RegisterType<PublicTable>(_ => new SpacetimeDB.BSATN.AlgebraicType.Product(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(Id), Id.GetAlgebraicType(registrar)),
new(nameof(ByteField), ByteField.GetAlgebraicType(registrar)),
new(nameof(UshortField), UshortField.GetAlgebraicType(registrar)),
new(nameof(UintField), UintField.GetAlgebraicType(registrar)),
new(nameof(UlongField), UlongField.GetAlgebraicType(registrar)),
new(nameof(UInt128Field), UInt128Field.GetAlgebraicType(registrar)),
new(nameof(U128Field), U128Field.GetAlgebraicType(registrar)),
new(nameof(U256Field), U256Field.GetAlgebraicType(registrar)),
new(nameof(SbyteField), SbyteField.GetAlgebraicType(registrar)),
new(nameof(ShortField), ShortField.GetAlgebraicType(registrar)),
new(nameof(IntField), IntField.GetAlgebraicType(registrar)),
new(nameof(LongField), LongField.GetAlgebraicType(registrar)),
new(nameof(Int128Field), Int128Field.GetAlgebraicType(registrar)),
new(nameof(I128Field), I128Field.GetAlgebraicType(registrar)),
new(nameof(I256Field), I256Field.GetAlgebraicType(registrar)),
new(nameof(BoolField), BoolField.GetAlgebraicType(registrar)),
new(nameof(FloatField), FloatField.GetAlgebraicType(registrar)),
new(nameof(DoubleField), DoubleField.GetAlgebraicType(registrar)),
new(nameof(StringField), StringField.GetAlgebraicType(registrar)),
new(nameof(IdentityField), IdentityField.GetAlgebraicType(registrar)),
new(nameof(ConnectionIdField), ConnectionIdField.GetAlgebraicType(registrar)),
new(nameof(CustomStructField), CustomStructField.GetAlgebraicType(registrar)),
new(nameof(CustomClassField), CustomClassField.GetAlgebraicType(registrar)),
new(nameof(CustomEnumField), CustomEnumField.GetAlgebraicType(registrar)),
new("Id", IdRW.GetAlgebraicType(registrar)),
new("ByteField", ByteFieldRW.GetAlgebraicType(registrar)),
new("UshortField", UshortFieldRW.GetAlgebraicType(registrar)),
new("UintField", UintFieldRW.GetAlgebraicType(registrar)),
new("UlongField", UlongFieldRW.GetAlgebraicType(registrar)),
new("UInt128Field", UInt128FieldRW.GetAlgebraicType(registrar)),
new("U128Field", U128FieldRW.GetAlgebraicType(registrar)),
new("U256Field", U256FieldRW.GetAlgebraicType(registrar)),
new("SbyteField", SbyteFieldRW.GetAlgebraicType(registrar)),
new("ShortField", ShortFieldRW.GetAlgebraicType(registrar)),
new("IntField", IntFieldRW.GetAlgebraicType(registrar)),
new("LongField", LongFieldRW.GetAlgebraicType(registrar)),
new("Int128Field", Int128FieldRW.GetAlgebraicType(registrar)),
new("I128Field", I128FieldRW.GetAlgebraicType(registrar)),
new("I256Field", I256FieldRW.GetAlgebraicType(registrar)),
new("BoolField", BoolFieldRW.GetAlgebraicType(registrar)),
new("FloatField", FloatFieldRW.GetAlgebraicType(registrar)),
new("DoubleField", DoubleFieldRW.GetAlgebraicType(registrar)),
new("StringField", StringFieldRW.GetAlgebraicType(registrar)),
new("IdentityField", IdentityFieldRW.GetAlgebraicType(registrar)),
new("ConnectionIdField", ConnectionIdFieldRW.GetAlgebraicType(registrar)),
new("CustomStructField", CustomStructFieldRW.GetAlgebraicType(registrar)),
new("CustomClassField", CustomClassFieldRW.GetAlgebraicType(registrar)),
new("CustomEnumField", CustomEnumFieldRW.GetAlgebraicType(registrar)),
new(
nameof(CustomTaggedEnumField),
CustomTaggedEnumField.GetAlgebraicType(registrar)
"CustomTaggedEnumField",
CustomTaggedEnumFieldRW.GetAlgebraicType(registrar)
),
new(nameof(ListField), ListField.GetAlgebraicType(registrar)),
new(nameof(NullableValueField), NullableValueField.GetAlgebraicType(registrar)),
new("ListField", ListFieldRW.GetAlgebraicType(registrar)),
new("NullableValueField", NullableValueFieldRW.GetAlgebraicType(registrar)),
new(
nameof(NullableReferenceField),
NullableReferenceField.GetAlgebraicType(registrar)
"NullableReferenceField",
NullableReferenceFieldRW.GetAlgebraicType(registrar)
)
}
));
@@ -8,14 +8,14 @@ partial struct RegressionMultipleUniqueIndexesHadSameName
{
public void ReadFields(System.IO.BinaryReader reader)
{
Unique1 = BSATN.Unique1.Read(reader);
Unique2 = BSATN.Unique2.Read(reader);
Unique1 = BSATN.Unique1RW.Read(reader);
Unique2 = BSATN.Unique2RW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.Unique1.Write(writer, Unique1);
BSATN.Unique2.Write(writer, Unique2);
BSATN.Unique1RW.Write(writer, Unique1);
BSATN.Unique2RW.Write(writer, Unique2);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
@@ -29,8 +29,8 @@ partial struct RegressionMultipleUniqueIndexesHadSameName
public readonly partial struct BSATN
: SpacetimeDB.BSATN.IReadWrite<RegressionMultipleUniqueIndexesHadSameName>
{
internal static readonly SpacetimeDB.BSATN.U32 Unique1 = new();
internal static readonly SpacetimeDB.BSATN.U32 Unique2 = new();
internal static readonly SpacetimeDB.BSATN.U32 Unique1RW = new();
internal static readonly SpacetimeDB.BSATN.U32 Unique2RW = new();
public RegressionMultipleUniqueIndexesHadSameName Read(System.IO.BinaryReader reader)
{
@@ -54,8 +54,8 @@ partial struct RegressionMultipleUniqueIndexesHadSameName
_ => new SpacetimeDB.BSATN.AlgebraicType.Product(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(Unique1), Unique1.GetAlgebraicType(registrar)),
new(nameof(Unique2), Unique2.GetAlgebraicType(registrar))
new("Unique1", Unique1RW.GetAlgebraicType(registrar)),
new("Unique2", Unique2RW.GetAlgebraicType(registrar))
}
)
);
@@ -10,16 +10,16 @@ partial class Timers
{
public void ReadFields(System.IO.BinaryReader reader)
{
ScheduledId = BSATN.ScheduledId.Read(reader);
ScheduledAt = BSATN.ScheduledAt.Read(reader);
Text = BSATN.Text.Read(reader);
ScheduledId = BSATN.ScheduledIdRW.Read(reader);
ScheduledAt = BSATN.ScheduledAtRW.Read(reader);
Text = BSATN.TextRW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.ScheduledId.Write(writer, ScheduledId);
BSATN.ScheduledAt.Write(writer, ScheduledAt);
BSATN.Text.Write(writer, Text);
BSATN.ScheduledIdRW.Write(writer, ScheduledId);
BSATN.ScheduledAtRW.Write(writer, ScheduledAt);
BSATN.TextRW.Write(writer, Text);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
@@ -32,9 +32,9 @@ partial class Timers
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<Timers.SendMessageTimer>
{
internal static readonly SpacetimeDB.BSATN.U64 ScheduledId = new();
internal static readonly SpacetimeDB.ScheduleAt.BSATN ScheduledAt = new();
internal static readonly SpacetimeDB.BSATN.String Text = new();
internal static readonly SpacetimeDB.BSATN.U64 ScheduledIdRW = new();
internal static readonly SpacetimeDB.ScheduleAt.BSATN ScheduledAtRW = new();
internal static readonly SpacetimeDB.BSATN.String TextRW = new();
public Timers.SendMessageTimer Read(System.IO.BinaryReader reader)
{
@@ -55,9 +55,9 @@ partial class Timers
_ => new SpacetimeDB.BSATN.AlgebraicType.Product(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(ScheduledId), ScheduledId.GetAlgebraicType(registrar)),
new(nameof(ScheduledAt), ScheduledAt.GetAlgebraicType(registrar)),
new(nameof(Text), Text.GetAlgebraicType(registrar))
new("ScheduledId", ScheduledIdRW.GetAlgebraicType(registrar)),
new("ScheduledAt", ScheduledAtRW.GetAlgebraicType(registrar)),
new("Text", TextRW.GetAlgebraicType(registrar))
}
)
);
@@ -8,26 +8,26 @@ partial class ContainsNestedLists
{
public void ReadFields(System.IO.BinaryReader reader)
{
IntList = BSATN.IntList.Read(reader);
StringList = BSATN.StringList.Read(reader);
IntArray = BSATN.IntArray.Read(reader);
StringArray = BSATN.StringArray.Read(reader);
IntArrayArrayList = BSATN.IntArrayArrayList.Read(reader);
IntListListArray = BSATN.IntListListArray.Read(reader);
StringArrayArrayList = BSATN.StringArrayArrayList.Read(reader);
StringListListArray = BSATN.StringListListArray.Read(reader);
IntList = BSATN.IntListRW.Read(reader);
StringList = BSATN.StringListRW.Read(reader);
IntArray = BSATN.IntArrayRW.Read(reader);
StringArray = BSATN.StringArrayRW.Read(reader);
IntArrayArrayList = BSATN.IntArrayArrayListRW.Read(reader);
IntListListArray = BSATN.IntListListArrayRW.Read(reader);
StringArrayArrayList = BSATN.StringArrayArrayListRW.Read(reader);
StringListListArray = BSATN.StringListListArrayRW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.IntList.Write(writer, IntList);
BSATN.StringList.Write(writer, StringList);
BSATN.IntArray.Write(writer, IntArray);
BSATN.StringArray.Write(writer, StringArray);
BSATN.IntArrayArrayList.Write(writer, IntArrayArrayList);
BSATN.IntListListArray.Write(writer, IntListListArray);
BSATN.StringArrayArrayList.Write(writer, StringArrayArrayList);
BSATN.StringListListArray.Write(writer, StringListListArray);
BSATN.IntListRW.Write(writer, IntList);
BSATN.StringListRW.Write(writer, StringList);
BSATN.IntArrayRW.Write(writer, IntArray);
BSATN.StringArrayRW.Write(writer, StringArray);
BSATN.IntArrayArrayListRW.Write(writer, IntArrayArrayList);
BSATN.IntListListArrayRW.Write(writer, IntListListArray);
BSATN.StringArrayArrayListRW.Write(writer, StringArrayArrayList);
BSATN.StringListListArrayRW.Write(writer, StringListListArray);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
@@ -40,42 +40,43 @@ partial class ContainsNestedLists
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<ContainsNestedLists>
{
internal static readonly SpacetimeDB.BSATN.List<int, SpacetimeDB.BSATN.I32> IntList = new();
internal static readonly SpacetimeDB.BSATN.List<int, SpacetimeDB.BSATN.I32> IntListRW =
new();
internal static readonly SpacetimeDB.BSATN.List<
string,
SpacetimeDB.BSATN.String
> StringList = new();
internal static readonly SpacetimeDB.BSATN.Array<int, SpacetimeDB.BSATN.I32> IntArray =
> StringListRW = new();
internal static readonly SpacetimeDB.BSATN.Array<int, SpacetimeDB.BSATN.I32> IntArrayRW =
new();
internal static readonly SpacetimeDB.BSATN.Array<
string,
SpacetimeDB.BSATN.String
> StringArray = new();
> StringArrayRW = new();
internal static readonly SpacetimeDB.BSATN.List<
int[][],
SpacetimeDB.BSATN.Array<int[], SpacetimeDB.BSATN.Array<int, SpacetimeDB.BSATN.I32>>
> IntArrayArrayList = new();
> IntArrayArrayListRW = new();
internal static readonly SpacetimeDB.BSATN.Array<
System.Collections.Generic.List<System.Collections.Generic.List<int>>,
SpacetimeDB.BSATN.List<
System.Collections.Generic.List<int>,
SpacetimeDB.BSATN.List<int, SpacetimeDB.BSATN.I32>
>
> IntListListArray = new();
> IntListListArrayRW = new();
internal static readonly SpacetimeDB.BSATN.List<
string[][],
SpacetimeDB.BSATN.Array<
string[],
SpacetimeDB.BSATN.Array<string, SpacetimeDB.BSATN.String>
>
> StringArrayArrayList = new();
> StringArrayArrayListRW = new();
internal static readonly SpacetimeDB.BSATN.Array<
System.Collections.Generic.List<System.Collections.Generic.List<string>>,
SpacetimeDB.BSATN.List<
System.Collections.Generic.List<string>,
SpacetimeDB.BSATN.List<string, SpacetimeDB.BSATN.String>
>
> StringListListArray = new();
> StringListListArrayRW = new();
public ContainsNestedLists Read(System.IO.BinaryReader reader)
{
@@ -96,22 +97,19 @@ partial class ContainsNestedLists
_ => new SpacetimeDB.BSATN.AlgebraicType.Product(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(IntList), IntList.GetAlgebraicType(registrar)),
new(nameof(StringList), StringList.GetAlgebraicType(registrar)),
new(nameof(IntArray), IntArray.GetAlgebraicType(registrar)),
new(nameof(StringArray), StringArray.GetAlgebraicType(registrar)),
new("IntList", IntListRW.GetAlgebraicType(registrar)),
new("StringList", StringListRW.GetAlgebraicType(registrar)),
new("IntArray", IntArrayRW.GetAlgebraicType(registrar)),
new("StringArray", StringArrayRW.GetAlgebraicType(registrar)),
new("IntArrayArrayList", IntArrayArrayListRW.GetAlgebraicType(registrar)),
new("IntListListArray", IntListListArrayRW.GetAlgebraicType(registrar)),
new(
nameof(IntArrayArrayList),
IntArrayArrayList.GetAlgebraicType(registrar)
),
new(nameof(IntListListArray), IntListListArray.GetAlgebraicType(registrar)),
new(
nameof(StringArrayArrayList),
StringArrayArrayList.GetAlgebraicType(registrar)
"StringArrayArrayList",
StringArrayArrayListRW.GetAlgebraicType(registrar)
),
new(
nameof(StringListListArray),
StringListListArray.GetAlgebraicType(registrar)
"StringListListArray",
StringListListArrayRW.GetAlgebraicType(registrar)
)
}
)
@@ -6,18 +6,18 @@ partial class CustomClass : System.IEquatable<CustomClass>, SpacetimeDB.BSATN.IS
{
public void ReadFields(System.IO.BinaryReader reader)
{
IntField = BSATN.IntField.Read(reader);
StringField = BSATN.StringField.Read(reader);
NullableIntField = BSATN.NullableIntField.Read(reader);
NullableStringField = BSATN.NullableStringField.Read(reader);
IntField = BSATN.IntFieldRW.Read(reader);
StringField = BSATN.StringFieldRW.Read(reader);
NullableIntField = BSATN.NullableIntFieldRW.Read(reader);
NullableStringField = BSATN.NullableStringFieldRW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.IntField.Write(writer, IntField);
BSATN.StringField.Write(writer, StringField);
BSATN.NullableIntField.Write(writer, NullableIntField);
BSATN.NullableStringField.Write(writer, NullableStringField);
BSATN.IntFieldRW.Write(writer, IntField);
BSATN.StringFieldRW.Write(writer, StringField);
BSATN.NullableIntFieldRW.Write(writer, NullableIntField);
BSATN.NullableStringFieldRW.Write(writer, NullableStringField);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
@@ -30,16 +30,16 @@ partial class CustomClass : System.IEquatable<CustomClass>, SpacetimeDB.BSATN.IS
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<CustomClass>
{
internal static readonly SpacetimeDB.BSATN.I32 IntField = new();
internal static readonly SpacetimeDB.BSATN.String StringField = new();
internal static readonly SpacetimeDB.BSATN.I32 IntFieldRW = new();
internal static readonly SpacetimeDB.BSATN.String StringFieldRW = new();
internal static readonly SpacetimeDB.BSATN.ValueOption<
int,
SpacetimeDB.BSATN.I32
> NullableIntField = new();
> NullableIntFieldRW = new();
internal static readonly SpacetimeDB.BSATN.RefOption<
string,
SpacetimeDB.BSATN.String
> NullableStringField = new();
> NullableStringFieldRW = new();
public CustomClass Read(System.IO.BinaryReader reader)
{
@@ -59,13 +59,10 @@ partial class CustomClass : System.IEquatable<CustomClass>, SpacetimeDB.BSATN.IS
registrar.RegisterType<CustomClass>(_ => new SpacetimeDB.BSATN.AlgebraicType.Product(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(IntField), IntField.GetAlgebraicType(registrar)),
new(nameof(StringField), StringField.GetAlgebraicType(registrar)),
new(nameof(NullableIntField), NullableIntField.GetAlgebraicType(registrar)),
new(
nameof(NullableStringField),
NullableStringField.GetAlgebraicType(registrar)
)
new("IntField", IntFieldRW.GetAlgebraicType(registrar)),
new("StringField", StringFieldRW.GetAlgebraicType(registrar)),
new("NullableIntField", NullableIntFieldRW.GetAlgebraicType(registrar)),
new("NullableStringField", NullableStringFieldRW.GetAlgebraicType(registrar))
}
));
@@ -8,26 +8,26 @@ partial class CustomNestedClass
{
public void ReadFields(System.IO.BinaryReader reader)
{
NestedClass = BSATN.NestedClass.Read(reader);
NestedNullableClass = BSATN.NestedNullableClass.Read(reader);
NestedEnum = BSATN.NestedEnum.Read(reader);
NestedNullableEnum = BSATN.NestedNullableEnum.Read(reader);
NestedTaggedEnum = BSATN.NestedTaggedEnum.Read(reader);
NestedNullableTaggedEnum = BSATN.NestedNullableTaggedEnum.Read(reader);
NestedCustomRecord = BSATN.NestedCustomRecord.Read(reader);
NestedNullableCustomRecord = BSATN.NestedNullableCustomRecord.Read(reader);
NestedClass = BSATN.NestedClassRW.Read(reader);
NestedNullableClass = BSATN.NestedNullableClassRW.Read(reader);
NestedEnum = BSATN.NestedEnumRW.Read(reader);
NestedNullableEnum = BSATN.NestedNullableEnumRW.Read(reader);
NestedTaggedEnum = BSATN.NestedTaggedEnumRW.Read(reader);
NestedNullableTaggedEnum = BSATN.NestedNullableTaggedEnumRW.Read(reader);
NestedCustomRecord = BSATN.NestedCustomRecordRW.Read(reader);
NestedNullableCustomRecord = BSATN.NestedNullableCustomRecordRW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.NestedClass.Write(writer, NestedClass);
BSATN.NestedNullableClass.Write(writer, NestedNullableClass);
BSATN.NestedEnum.Write(writer, NestedEnum);
BSATN.NestedNullableEnum.Write(writer, NestedNullableEnum);
BSATN.NestedTaggedEnum.Write(writer, NestedTaggedEnum);
BSATN.NestedNullableTaggedEnum.Write(writer, NestedNullableTaggedEnum);
BSATN.NestedCustomRecord.Write(writer, NestedCustomRecord);
BSATN.NestedNullableCustomRecord.Write(writer, NestedNullableCustomRecord);
BSATN.NestedClassRW.Write(writer, NestedClass);
BSATN.NestedNullableClassRW.Write(writer, NestedNullableClass);
BSATN.NestedEnumRW.Write(writer, NestedEnum);
BSATN.NestedNullableEnumRW.Write(writer, NestedNullableEnum);
BSATN.NestedTaggedEnumRW.Write(writer, NestedTaggedEnum);
BSATN.NestedNullableTaggedEnumRW.Write(writer, NestedNullableTaggedEnum);
BSATN.NestedCustomRecordRW.Write(writer, NestedCustomRecord);
BSATN.NestedNullableCustomRecordRW.Write(writer, NestedNullableCustomRecord);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
@@ -40,26 +40,26 @@ partial class CustomNestedClass
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<CustomNestedClass>
{
internal static readonly CustomClass.BSATN NestedClass = new();
internal static readonly CustomClass.BSATN NestedClassRW = new();
internal static readonly SpacetimeDB.BSATN.RefOption<
CustomClass,
CustomClass.BSATN
> NestedNullableClass = new();
internal static readonly SpacetimeDB.BSATN.Enum<CustomEnum> NestedEnum = new();
> NestedNullableClassRW = new();
internal static readonly SpacetimeDB.BSATN.Enum<CustomEnum> NestedEnumRW = new();
internal static readonly SpacetimeDB.BSATN.ValueOption<
CustomEnum,
SpacetimeDB.BSATN.Enum<CustomEnum>
> NestedNullableEnum = new();
internal static readonly CustomTaggedEnum.BSATN NestedTaggedEnum = new();
> NestedNullableEnumRW = new();
internal static readonly CustomTaggedEnum.BSATN NestedTaggedEnumRW = new();
internal static readonly SpacetimeDB.BSATN.RefOption<
CustomTaggedEnum,
CustomTaggedEnum.BSATN
> NestedNullableTaggedEnum = new();
internal static readonly CustomRecord.BSATN NestedCustomRecord = new();
> NestedNullableTaggedEnumRW = new();
internal static readonly CustomRecord.BSATN NestedCustomRecordRW = new();
internal static readonly SpacetimeDB.BSATN.RefOption<
CustomRecord,
CustomRecord.BSATN
> NestedNullableCustomRecord = new();
> NestedNullableCustomRecordRW = new();
public CustomNestedClass Read(System.IO.BinaryReader reader)
{
@@ -80,28 +80,22 @@ partial class CustomNestedClass
_ => new SpacetimeDB.BSATN.AlgebraicType.Product(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(NestedClass), NestedClass.GetAlgebraicType(registrar)),
new("NestedClass", NestedClassRW.GetAlgebraicType(registrar)),
new(
nameof(NestedNullableClass),
NestedNullableClass.GetAlgebraicType(registrar)
"NestedNullableClass",
NestedNullableClassRW.GetAlgebraicType(registrar)
),
new(nameof(NestedEnum), NestedEnum.GetAlgebraicType(registrar)),
new("NestedEnum", NestedEnumRW.GetAlgebraicType(registrar)),
new("NestedNullableEnum", NestedNullableEnumRW.GetAlgebraicType(registrar)),
new("NestedTaggedEnum", NestedTaggedEnumRW.GetAlgebraicType(registrar)),
new(
nameof(NestedNullableEnum),
NestedNullableEnum.GetAlgebraicType(registrar)
"NestedNullableTaggedEnum",
NestedNullableTaggedEnumRW.GetAlgebraicType(registrar)
),
new(nameof(NestedTaggedEnum), NestedTaggedEnum.GetAlgebraicType(registrar)),
new("NestedCustomRecord", NestedCustomRecordRW.GetAlgebraicType(registrar)),
new(
nameof(NestedNullableTaggedEnum),
NestedNullableTaggedEnum.GetAlgebraicType(registrar)
),
new(
nameof(NestedCustomRecord),
NestedCustomRecord.GetAlgebraicType(registrar)
),
new(
nameof(NestedNullableCustomRecord),
NestedNullableCustomRecord.GetAlgebraicType(registrar)
"NestedNullableCustomRecord",
NestedNullableCustomRecordRW.GetAlgebraicType(registrar)
)
}
)
@@ -6,18 +6,18 @@ partial class CustomRecord : System.IEquatable<CustomRecord>, SpacetimeDB.BSATN.
{
public void ReadFields(System.IO.BinaryReader reader)
{
IntField = BSATN.IntField.Read(reader);
StringField = BSATN.StringField.Read(reader);
NullableIntField = BSATN.NullableIntField.Read(reader);
NullableStringField = BSATN.NullableStringField.Read(reader);
IntField = BSATN.IntFieldRW.Read(reader);
StringField = BSATN.StringFieldRW.Read(reader);
NullableIntField = BSATN.NullableIntFieldRW.Read(reader);
NullableStringField = BSATN.NullableStringFieldRW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.IntField.Write(writer, IntField);
BSATN.StringField.Write(writer, StringField);
BSATN.NullableIntField.Write(writer, NullableIntField);
BSATN.NullableStringField.Write(writer, NullableStringField);
BSATN.IntFieldRW.Write(writer, IntField);
BSATN.StringFieldRW.Write(writer, StringField);
BSATN.NullableIntFieldRW.Write(writer, NullableIntField);
BSATN.NullableStringFieldRW.Write(writer, NullableStringField);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
@@ -30,16 +30,16 @@ partial class CustomRecord : System.IEquatable<CustomRecord>, SpacetimeDB.BSATN.
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<CustomRecord>
{
internal static readonly SpacetimeDB.BSATN.I32 IntField = new();
internal static readonly SpacetimeDB.BSATN.String StringField = new();
internal static readonly SpacetimeDB.BSATN.I32 IntFieldRW = new();
internal static readonly SpacetimeDB.BSATN.String StringFieldRW = new();
internal static readonly SpacetimeDB.BSATN.ValueOption<
int,
SpacetimeDB.BSATN.I32
> NullableIntField = new();
> NullableIntFieldRW = new();
internal static readonly SpacetimeDB.BSATN.RefOption<
string,
SpacetimeDB.BSATN.String
> NullableStringField = new();
> NullableStringFieldRW = new();
public CustomRecord Read(System.IO.BinaryReader reader)
{
@@ -59,13 +59,10 @@ partial class CustomRecord : System.IEquatable<CustomRecord>, SpacetimeDB.BSATN.
registrar.RegisterType<CustomRecord>(_ => new SpacetimeDB.BSATN.AlgebraicType.Product(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(IntField), IntField.GetAlgebraicType(registrar)),
new(nameof(StringField), StringField.GetAlgebraicType(registrar)),
new(nameof(NullableIntField), NullableIntField.GetAlgebraicType(registrar)),
new(
nameof(NullableStringField),
NullableStringField.GetAlgebraicType(registrar)
)
new("IntField", IntFieldRW.GetAlgebraicType(registrar)),
new("StringField", StringFieldRW.GetAlgebraicType(registrar)),
new("NullableIntField", NullableIntFieldRW.GetAlgebraicType(registrar)),
new("NullableStringField", NullableStringFieldRW.GetAlgebraicType(registrar))
}
));
@@ -8,18 +8,18 @@ partial struct CustomStruct
{
public void ReadFields(System.IO.BinaryReader reader)
{
IntField = BSATN.IntField.Read(reader);
StringField = BSATN.StringField.Read(reader);
NullableIntField = BSATN.NullableIntField.Read(reader);
NullableStringField = BSATN.NullableStringField.Read(reader);
IntField = BSATN.IntFieldRW.Read(reader);
StringField = BSATN.StringFieldRW.Read(reader);
NullableIntField = BSATN.NullableIntFieldRW.Read(reader);
NullableStringField = BSATN.NullableStringFieldRW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.IntField.Write(writer, IntField);
BSATN.StringField.Write(writer, StringField);
BSATN.NullableIntField.Write(writer, NullableIntField);
BSATN.NullableStringField.Write(writer, NullableStringField);
BSATN.IntFieldRW.Write(writer, IntField);
BSATN.StringFieldRW.Write(writer, StringField);
BSATN.NullableIntFieldRW.Write(writer, NullableIntField);
BSATN.NullableStringFieldRW.Write(writer, NullableStringField);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
@@ -32,16 +32,16 @@ partial struct CustomStruct
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<CustomStruct>
{
internal static readonly SpacetimeDB.BSATN.I32 IntField = new();
internal static readonly SpacetimeDB.BSATN.String StringField = new();
internal static readonly SpacetimeDB.BSATN.I32 IntFieldRW = new();
internal static readonly SpacetimeDB.BSATN.String StringFieldRW = new();
internal static readonly SpacetimeDB.BSATN.ValueOption<
int,
SpacetimeDB.BSATN.I32
> NullableIntField = new();
> NullableIntFieldRW = new();
internal static readonly SpacetimeDB.BSATN.RefOption<
string,
SpacetimeDB.BSATN.String
> NullableStringField = new();
> NullableStringFieldRW = new();
public CustomStruct Read(System.IO.BinaryReader reader)
{
@@ -61,13 +61,10 @@ partial struct CustomStruct
registrar.RegisterType<CustomStruct>(_ => new SpacetimeDB.BSATN.AlgebraicType.Product(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(IntField), IntField.GetAlgebraicType(registrar)),
new(nameof(StringField), StringField.GetAlgebraicType(registrar)),
new(nameof(NullableIntField), NullableIntField.GetAlgebraicType(registrar)),
new(
nameof(NullableStringField),
NullableStringField.GetAlgebraicType(registrar)
)
new("IntField", IntFieldRW.GetAlgebraicType(registrar)),
new("StringField", StringFieldRW.GetAlgebraicType(registrar)),
new("NullableIntField", NullableIntFieldRW.GetAlgebraicType(registrar)),
new("NullableStringField", NullableStringFieldRW.GetAlgebraicType(registrar))
}
));
@@ -30,25 +30,25 @@ partial record CustomTaggedEnum : System.IEquatable<CustomTaggedEnum>
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<CustomTaggedEnum>
{
internal static readonly SpacetimeDB.BSATN.I32 IntVariant = new();
internal static readonly SpacetimeDB.BSATN.String StringVariant = new();
internal static readonly SpacetimeDB.BSATN.I32 IntVariantRW = new();
internal static readonly SpacetimeDB.BSATN.String StringVariantRW = new();
internal static readonly SpacetimeDB.BSATN.ValueOption<
int,
SpacetimeDB.BSATN.I32
> NullableIntVariant = new();
> NullableIntVariantRW = new();
internal static readonly SpacetimeDB.BSATN.RefOption<
string,
SpacetimeDB.BSATN.String
> NullableStringVariant = new();
> NullableStringVariantRW = new();
public CustomTaggedEnum Read(System.IO.BinaryReader reader)
{
return reader.ReadByte() switch
{
0 => new IntVariant(IntVariant.Read(reader)),
1 => new StringVariant(StringVariant.Read(reader)),
2 => new NullableIntVariant(NullableIntVariant.Read(reader)),
3 => new NullableStringVariant(NullableStringVariant.Read(reader)),
0 => new IntVariant(IntVariantRW.Read(reader)),
1 => new StringVariant(StringVariantRW.Read(reader)),
2 => new NullableIntVariant(NullableIntVariantRW.Read(reader)),
3 => new NullableStringVariant(NullableStringVariantRW.Read(reader)),
_
=> throw new System.InvalidOperationException(
"Invalid tag value, this state should be unreachable."
@@ -62,19 +62,19 @@ partial record CustomTaggedEnum : System.IEquatable<CustomTaggedEnum>
{
case IntVariant(var inner):
writer.Write((byte)0);
IntVariant.Write(writer, inner);
IntVariantRW.Write(writer, inner);
break;
case StringVariant(var inner):
writer.Write((byte)1);
StringVariant.Write(writer, inner);
StringVariantRW.Write(writer, inner);
break;
case NullableIntVariant(var inner):
writer.Write((byte)2);
NullableIntVariant.Write(writer, inner);
NullableIntVariantRW.Write(writer, inner);
break;
case NullableStringVariant(var inner):
writer.Write((byte)3);
NullableStringVariant.Write(writer, inner);
NullableStringVariantRW.Write(writer, inner);
break;
}
}
@@ -85,12 +85,12 @@ partial record CustomTaggedEnum : System.IEquatable<CustomTaggedEnum>
registrar.RegisterType<CustomTaggedEnum>(_ => new SpacetimeDB.BSATN.AlgebraicType.Sum(
new SpacetimeDB.BSATN.AggregateElement[]
{
new(nameof(IntVariant), IntVariant.GetAlgebraicType(registrar)),
new(nameof(StringVariant), StringVariant.GetAlgebraicType(registrar)),
new(nameof(NullableIntVariant), NullableIntVariant.GetAlgebraicType(registrar)),
new("IntVariant", IntVariantRW.GetAlgebraicType(registrar)),
new("StringVariant", StringVariantRW.GetAlgebraicType(registrar)),
new("NullableIntVariant", NullableIntVariantRW.GetAlgebraicType(registrar)),
new(
nameof(NullableStringVariant),
NullableStringVariant.GetAlgebraicType(registrar)
"NullableStringVariant",
NullableStringVariantRW.GetAlgebraicType(registrar)
)
}
));
@@ -0,0 +1,123 @@
//HintName: FormerlyForbiddenFieldNames.cs
// <auto-generated />
#nullable enable
partial struct FormerlyForbiddenFieldNames
: System.IEquatable<FormerlyForbiddenFieldNames>,
SpacetimeDB.BSATN.IStructuralReadWrite
{
public void ReadFields(System.IO.BinaryReader reader)
{
Read = BSATN.ReadRW.Read(reader);
Write = BSATN.WriteRW.Read(reader);
GetAlgebraicType = BSATN.GetAlgebraicTypeRW.Read(reader);
}
public void WriteFields(System.IO.BinaryWriter writer)
{
BSATN.ReadRW.Write(writer, Read);
BSATN.WriteRW.Write(writer, Write);
BSATN.GetAlgebraicTypeRW.Write(writer, GetAlgebraicType);
}
object SpacetimeDB.BSATN.IStructuralReadWrite.GetSerializer()
{
return new BSATN();
}
public override string ToString() =>
$"FormerlyForbiddenFieldNames {{ Read = {SpacetimeDB.BSATN.StringUtil.GenericToString(Read)}, Write = {SpacetimeDB.BSATN.StringUtil.GenericToString(Write)}, GetAlgebraicType = {SpacetimeDB.BSATN.StringUtil.GenericToString(GetAlgebraicType)} }}";
public readonly partial struct BSATN : SpacetimeDB.BSATN.IReadWrite<FormerlyForbiddenFieldNames>
{
internal static readonly SpacetimeDB.BSATN.U32 ReadRW = new();
internal static readonly SpacetimeDB.BSATN.U32 WriteRW = new();
internal static readonly SpacetimeDB.BSATN.U32 GetAlgebraicTypeRW = new();
public FormerlyForbiddenFieldNames Read(System.IO.BinaryReader reader)
{
var ___result = new FormerlyForbiddenFieldNames();
___result.ReadFields(reader);
return ___result;
}
public void Write(System.IO.BinaryWriter writer, FormerlyForbiddenFieldNames value)
{
value.WriteFields(writer);
}
public SpacetimeDB.BSATN.AlgebraicType.Ref GetAlgebraicType(
SpacetimeDB.BSATN.ITypeRegistrar registrar
) =>
registrar.RegisterType<FormerlyForbiddenFieldNames>(
_ => new SpacetimeDB.BSATN.AlgebraicType.Product(
new SpacetimeDB.BSATN.AggregateElement[]
{
new("Read", ReadRW.GetAlgebraicType(registrar)),
new("Write", WriteRW.GetAlgebraicType(registrar)),
new("GetAlgebraicType", GetAlgebraicTypeRW.GetAlgebraicType(registrar))
}
)
);
SpacetimeDB.BSATN.AlgebraicType SpacetimeDB.BSATN.IReadWrite<FormerlyForbiddenFieldNames>.GetAlgebraicType(
SpacetimeDB.BSATN.ITypeRegistrar registrar
) => GetAlgebraicType(registrar);
}
public override int GetHashCode()
{
var ___hashRead = Read.GetHashCode();
var ___hashWrite = Write.GetHashCode();
var ___hashGetAlgebraicType = GetAlgebraicType.GetHashCode();
return ___hashRead ^ ___hashWrite ^ ___hashGetAlgebraicType;
}
#nullable enable
public bool Equals(FormerlyForbiddenFieldNames that)
{
var ___eqRead = this.Read.Equals(that.Read);
var ___eqWrite = this.Write.Equals(that.Write);
var ___eqGetAlgebraicType = this.GetAlgebraicType.Equals(that.GetAlgebraicType);
return ___eqRead && ___eqWrite && ___eqGetAlgebraicType;
}
public override bool Equals(object? that)
{
if (that == null)
{
return false;
}
var that_ = that as FormerlyForbiddenFieldNames?;
if (((object?)that_) == null)
{
return false;
}
return Equals(that_);
}
public static bool operator ==(
FormerlyForbiddenFieldNames this_,
FormerlyForbiddenFieldNames that
)
{
if (((object?)this_) == null || ((object?)that) == null)
{
return object.Equals(this_, that);
}
return this_.Equals(that);
}
public static bool operator !=(
FormerlyForbiddenFieldNames this_,
FormerlyForbiddenFieldNames that
)
{
if (((object?)this_) == null || ((object?)that) == null)
{
return !object.Equals(this_, that);
}
return !this_.Equals(that);
}
#nullable restore
} // FormerlyForbiddenFieldNames
+6 -8
View File
@@ -144,7 +144,7 @@ record ColumnDeclaration : MemberDeclaration
// For the `TableDesc` constructor.
public string GenerateColumnDef() =>
$"new (nameof({Name}), BSATN.{Name}.GetAlgebraicType(registrar))";
$"new (nameof({Name}), BSATN.{Name}{TypeUse.BsatnFieldSuffix}.GetAlgebraicType(registrar))";
}
record Scheduled(string ReducerName, int ScheduledAtColumn);
@@ -478,9 +478,7 @@ record TableDeclaration : BaseTypeDeclaration<ColumnDeclaration>
}
foreach (var v in Views)
{
var autoIncFields = Members
.Where(f => f.GetAttrs(v).HasFlag(ColumnAttrs.AutoInc))
.Select(f => f.Name);
var autoIncFields = Members.Where(m => m.GetAttrs(v).HasFlag(ColumnAttrs.AutoInc));
var globalName = $"global::{FullName}";
var iTable = $"SpacetimeDB.Internal.ITableView<{v.Name}, {globalName}>";
@@ -492,11 +490,11 @@ record TableDeclaration : BaseTypeDeclaration<ColumnDeclaration>
static {{globalName}} {{iTable}}.ReadGenFields(System.IO.BinaryReader reader, {{globalName}} row) {
{{string.Join(
"\n",
autoIncFields.Select(name =>
autoIncFields.Select(m =>
$$"""
if (row.{{name}} == default)
if (row.{{m.Name}} == default)
{
row.{{name}} = {{globalName}}.BSATN.{{name}}.Read(reader);
row.{{m.Name}} = {{globalName}}.BSATN.{{m.Name}}{{TypeUse.BsatnFieldSuffix}}.Read(reader);
}
"""
)
@@ -638,7 +636,7 @@ record ReducerDeclaration
? "throw new System.InvalidOperationException()"
: $"{FullName}({string.Join(
", ",
Args.Select(a => $"{a.Name}.Read(reader)").Prepend("(SpacetimeDB.ReducerContext)ctx")
Args.Select(a => $"{a.Name}{TypeUse.BsatnFieldSuffix}.Read(reader)").Prepend("(SpacetimeDB.ReducerContext)ctx")
)})";
return $$"""
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
@@ -1,8 +1,6 @@
// 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.2.0 (commit 1814483514681baeedb23e1dadd342dac4697ac5).
#nullable enable
using System;
+1
View File
@@ -0,0 +1 @@
../../licenses/BSL.txt
@@ -0,0 +1,41 @@
import js from '@eslint/js';
import globals from 'globals';
import tseslint from 'typescript-eslint';
import { defineConfig } from 'eslint/config';
export default defineConfig([
{ ignores: ['dist'] },
{
files: ['**/*.{ts,tsx}'],
languageOptions: {
parser: tseslint.parser,
ecmaVersion: 'latest',
sourceType: 'module',
globals: { ...globals.browser, ...globals.node },
},
plugins: {
'@typescript-eslint': tseslint.plugin,
},
extends: [js.configs.recommended, ...tseslint.configs.recommended],
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-namespace': 'error',
'no-restricted-syntax': [
'error',
{
selector: 'TSEnumDeclaration',
message: 'Do not use enums; stick to JS-compatible types.',
},
{
selector: 'TSEnumDeclaration[const=true]',
message: 'Do not use const enum; use unions or objects.',
},
{ selector: 'Decorator', message: 'Do not use decorators.' },
{
selector: 'TSParameterProperty',
message: 'Do not use parameter properties.',
},
],
},
},
]);
+61
View File
@@ -0,0 +1,61 @@
{
"name": "spacetimedb",
"version": "0.0.1",
"description": "API and ABI bindings for the SpacetimeDB TypeScript module library",
"homepage": "https://github.com/clockworklabs/SpacetimeDB#readme",
"bugs": {
"url": "https://github.com/clockworklabs/SpacetimeDB/issues"
},
"source": "src/index.ts",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "src/index.ts",
"exports": {
".": {
"types": "./src/index.ts",
"source": "./src/index.ts",
"development": "./src/index.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"default": "./dist/index.mjs"
}
},
"files": [
"src",
"dist",
"README.md",
"LICENSE.txt"
],
"repository": {
"type": "git",
"url": "git+https://github.com/clockworklabs/SpacetimeDB.git"
},
"license": "ISC",
"author": "Clockwork Labs",
"type": "module",
"scripts": {
"build": "tsc",
"format": "prettier --write .",
"lint": "eslint . && prettier . --check",
"test": "vitest run",
"coverage": "vitest run --coverage",
"generate": "cargo run -p spacetimedb-codegen --example regen-typescript-moduledef && prettier --write src/autogen"
},
"dependencies": {
"@zxing/text-encoding": "^0.9.0",
"base64-js": "^1.5.1",
"prettier": "^3.3.3"
},
"devDependencies": {
"@eslint/js": "^9.17.0",
"@typescript-eslint/eslint-plugin": "^8.18.2",
"@typescript-eslint/parser": "^8.18.2",
"eslint": "^9.33.0",
"globals": "^15.14.0",
"ts-node": "^10.9.2",
"typescript": "^5.9.2",
"typescript-eslint": "^8.18.2",
"vite": "^7.1.3",
"vitest": "^3.2.4"
}
}
@@ -0,0 +1,482 @@
import { TimeDuration } from './time_duration';
import { Timestamp } from './timestamp';
import { ConnectionId } from './connection_id';
import type BinaryReader from './binary_reader';
import BinaryWriter from './binary_writer';
import { Identity } from './identity';
import {
AlgebraicType as AlgebraicTypeType,
AlgebraicType as AlgebraicTypeValue,
} from './autogen/algebraic_type_type';
import {
type ProductType as ProductTypeType,
ProductType as ProductTypeValue,
} from './autogen/product_type_type';
import {
type SumType as SumTypeType,
SumType as SumTypeValue,
} from './autogen/sum_type_type';
import ScheduleAt from './schedule_at';
/**
* A factor / element of a product type.
*
* An element consist of an optional name and a type.
*
* NOTE: Each element has an implicit element tag based on its order.
* Uniquely identifies an element similarly to protobuf tags.
*/
export * from './autogen/product_type_element_type';
/**
* A variant of a sum type.
*
* NOTE: Each element has an implicit element tag based on its order.
* Uniquely identifies an element similarly to protobuf tags.
*/
export * from './autogen/sum_type_variant_type';
/**
* The variant types of the Algebraic Type tagged union.
*/
export type * as AlgebraicTypeVariants from './autogen/algebraic_type_variants';
/**
* The SpacetimeDB Algebraic Type System (SATS) is a structural type system in
* which a nominal type system can be constructed.
*
* The type system unifies the concepts sum types, product types, and built-in
* primitive types into a single type system.
*/
export type AlgebraicType = AlgebraicTypeType;
/**
* Algebraic Type utilities.
*/
export const AlgebraicType: {
createOptionType(innerType: AlgebraicTypeType): AlgebraicTypeType;
createIdentityType(): AlgebraicTypeType;
createConnectionIdType(): AlgebraicTypeType;
createScheduleAtType(): AlgebraicTypeType;
createTimestampType(): AlgebraicTypeType;
createTimeDurationType(): AlgebraicTypeType;
serializeValue(writer: BinaryWriter, ty: AlgebraicTypeType, value: any): void;
deserializeValue(reader: BinaryReader, ty: AlgebraicTypeType): any;
/**
* Convert a value of the algebraic type into something that can be used as a key in a map.
* There are no guarantees about being able to order it.
* This is only guaranteed to be comparable to other values of the same type.
* @param value A value of the algebraic type
* @returns Something that can be used as a key in a map.
*/
intoMapKey(ty: AlgebraicTypeType, value: any): ComparablePrimitive;
} & typeof AlgebraicTypeValue = {
...AlgebraicTypeValue,
createOptionType: function (innerType: AlgebraicTypeType): AlgebraicTypeType {
return AlgebraicTypeValue.Sum({
variants: [
{ name: 'some', algebraicType: innerType },
{
name: 'none',
algebraicType: AlgebraicTypeValue.Product({ elements: [] }),
},
],
});
},
createIdentityType: function (): AlgebraicTypeType {
return AlgebraicTypeValue.Product({
elements: [
{ name: '__identity__', algebraicType: AlgebraicTypeValue.U256 },
],
});
},
createConnectionIdType: function (): AlgebraicTypeType {
return AlgebraicTypeValue.Product({
elements: [
{ name: '__connection_id__', algebraicType: AlgebraicTypeValue.U128 },
],
});
},
createScheduleAtType: function (): AlgebraicTypeType {
return ScheduleAt.getAlgebraicType();
},
createTimestampType: function (): AlgebraicTypeType {
return AlgebraicTypeValue.Product({
elements: [
{
name: '__timestamp_micros_since_unix_epoch__',
algebraicType: AlgebraicTypeValue.I64,
},
],
});
},
createTimeDurationType: function (): AlgebraicTypeType {
return AlgebraicTypeValue.Product({
elements: [
{
name: '__time_duration_micros__',
algebraicType: AlgebraicTypeValue.I64,
},
],
});
},
serializeValue: function (
writer: BinaryWriter,
ty: AlgebraicTypeType,
value: any
): void {
switch (ty.tag) {
case 'Product':
ProductType.serializeValue(writer, ty.value, value);
break;
case 'Sum':
SumType.serializeValue(writer, ty.value, value);
break;
case 'Array':
if (ty.value.tag === 'U8') {
writer.writeUInt8Array(value);
} else {
const elemType = ty.value;
writer.writeU32(value.length);
for (const elem of value) {
AlgebraicType.serializeValue(writer, elemType, elem);
}
}
break;
case 'Bool':
writer.writeBool(value);
break;
case 'I8':
writer.writeI8(value);
break;
case 'U8':
writer.writeU8(value);
break;
case 'I16':
writer.writeI16(value);
break;
case 'U16':
writer.writeU16(value);
break;
case 'I32':
writer.writeI32(value);
break;
case 'U32':
writer.writeU32(value);
break;
case 'I64':
writer.writeI64(value);
break;
case 'U64':
writer.writeU64(value);
break;
case 'I128':
writer.writeI128(value);
break;
case 'U128':
writer.writeU128(value);
break;
case 'I256':
writer.writeI256(value);
break;
case 'U256':
writer.writeU256(value);
break;
case 'F32':
writer.writeF32(value);
break;
case 'F64':
writer.writeF64(value);
break;
case 'String':
writer.writeString(value);
break;
default:
throw new Error(`not implemented, ${ty.tag}`);
}
},
deserializeValue: function (
reader: BinaryReader,
ty: AlgebraicTypeType
): any {
switch (ty.tag) {
case 'Product':
return ProductType.deserializeValue(reader, ty.value);
case 'Sum':
return SumType.deserializeValue(reader, ty.value);
case 'Array':
if (ty.value.tag === 'U8') {
return reader.readUInt8Array();
} else {
const elemType = ty.value;
const length = reader.readU32();
const result: any[] = [];
for (let i = 0; i < length; i++) {
result.push(AlgebraicType.deserializeValue(reader, elemType));
}
return result;
}
case 'Bool':
return reader.readBool();
case 'I8':
return reader.readI8();
case 'U8':
return reader.readU8();
case 'I16':
return reader.readI16();
case 'U16':
return reader.readU16();
case 'I32':
return reader.readI32();
case 'U32':
return reader.readU32();
case 'I64':
return reader.readI64();
case 'U64':
return reader.readU64();
case 'I128':
return reader.readI128();
case 'U128':
return reader.readU128();
case 'I256':
return reader.readI256();
case 'U256':
return reader.readU256();
case 'F32':
return reader.readF32();
case 'F64':
return reader.readF64();
case 'String':
return reader.readString();
default:
throw new Error(`not implemented, ${ty.tag}`);
}
},
/**
* Convert a value of the algebraic type into something that can be used as a key in a map.
* There are no guarantees about being able to order it.
* This is only guaranteed to be comparable to other values of the same type.
* @param value A value of the algebraic type
* @returns Something that can be used as a key in a map.
*/
intoMapKey: function (
ty: AlgebraicTypeType,
value: any
): ComparablePrimitive {
switch (ty.tag) {
case 'U8':
case 'U16':
case 'U32':
case 'U64':
case 'U128':
case 'U256':
case 'I8':
case 'I16':
case 'I64':
case 'I128':
case 'F32':
case 'F64':
case 'String':
case 'Bool':
return value;
case 'Product':
return ProductType.intoMapKey(ty.value, value);
default: {
const writer = new BinaryWriter(10);
this.serialize(writer, value);
return writer.toBase64();
}
}
},
};
/**
* A structural product type of the factors given by `elements`.
*
* This is also known as `struct` and `tuple` in many languages,
* but note that unlike most languages, products in SATs are *[structural]* and not nominal.
* When checking whether two nominal types are the same,
* their names and/or declaration sites (e.g., module / namespace) are considered.
* Meanwhile, a structural type system would only check the structure of the type itself,
* e.g., the names of its fields and their types in the case of a record.
* The name "product" comes from category theory.
*
* See also: https://ncatlab.org/nlab/show/product+type.
*
* These structures are known as product types because the number of possible values in product
* ```ignore
* { N_0: T_0, N_1: T_1, ..., N_n: T_n }
* ```
* is:
* ```ignore
* Π (i 0..n). values(T_i)
* ```
* so for example, `values({ A: U64, B: Bool }) = values(U64) * values(Bool)`.
*
* [structural]: https://en.wikipedia.org/wiki/Structural_type_system
*/
export type ProductType = ProductTypeType;
export const ProductType: {
serializeValue(writer: BinaryWriter, ty: ProductTypeType, value: any): void;
deserializeValue(reader: BinaryReader, ty: ProductTypeType): any;
intoMapKey(ty: ProductTypeType, value: any): ComparablePrimitive;
} = {
...ProductTypeValue,
serializeValue(writer: BinaryWriter, ty: ProductTypeType, value: any): void {
for (const element of ty.elements) {
AlgebraicType.serializeValue(
writer,
element.algebraicType,
value[element.name!]
);
}
},
deserializeValue(reader: BinaryReader, ty: ProductTypeType): any {
const result: { [key: string]: any } = {};
if (ty.elements.length === 1) {
if (ty.elements[0].name === '__time_duration_micros__') {
return new TimeDuration(reader.readI64());
}
if (ty.elements[0].name === '__timestamp_micros_since_unix_epoch__') {
return new Timestamp(reader.readI64());
}
if (ty.elements[0].name === '__identity__') {
return new Identity(reader.readU256());
}
if (ty.elements[0].name === '__connection_id__') {
return new ConnectionId(reader.readU128());
}
}
for (const element of ty.elements) {
result[element.name!] = AlgebraicType.deserializeValue(
reader,
element.algebraicType
);
}
return result;
},
intoMapKey(ty: ProductTypeType, value: any): ComparablePrimitive {
if (ty.elements.length === 1) {
if (ty.elements[0].name === '__time_duration_micros__') {
return (value as TimeDuration).__time_duration_micros__;
}
if (ty.elements[0].name === '__timestamp_micros_since_unix_epoch__') {
return (value as Timestamp).__timestamp_micros_since_unix_epoch__;
}
if (ty.elements[0].name === '__identity__') {
return (value as Identity).__identity__;
}
if (ty.elements[0].name === '__connection_id__') {
return (value as ConnectionId).__connection_id__;
}
}
// The fallback is to serialize and base64 encode the bytes.
const writer = new BinaryWriter(10);
AlgebraicType.serializeValue(writer, AlgebraicType.Product(ty), value);
return writer.toBase64();
},
};
/**
* Unlike most languages, sums in SATS are *[structural]* and not nominal.
* When checking whether two nominal types are the same,
* their names and/or declaration sites (e.g., module / namespace) are considered.
* Meanwhile, a structural type system would only check the structure of the type itself,
* e.g., the names of its variants and their inner data types in the case of a sum.
*
* This is also known as a discriminated union (implementation) or disjoint union.
* Another name is [coproduct (category theory)](https://ncatlab.org/nlab/show/coproduct).
*
* These structures are known as sum types because the number of possible values a sum
* ```ignore
* { N_0(T_0), N_1(T_1), ..., N_n(T_n) }
* ```
* is:
* ```ignore
* Σ (i 0..n). values(T_i)
* ```
* so for example, `values({ A(U64), B(Bool) }) = values(U64) + values(Bool)`.
*
* See also: https://ncatlab.org/nlab/show/sum+type.
*
* [structural]: https://en.wikipedia.org/wiki/Structural_type_system
*/
export const SumType: {
serializeValue(writer: BinaryWriter, ty: SumTypeType, value: any): void;
deserializeValue(reader: BinaryReader, ty: SumTypeType): any;
} = {
...SumTypeValue,
serializeValue: function (
writer: BinaryWriter,
ty: SumTypeType,
value: any
): void {
if (
ty.variants.length == 2 &&
ty.variants[0].name === 'some' &&
ty.variants[1].name === 'none'
) {
if (value !== null && value !== undefined) {
writer.writeByte(0);
AlgebraicType.serializeValue(
writer,
ty.variants[0].algebraicType,
value
);
} else {
writer.writeByte(1);
}
} else {
const variant = value['tag'];
const index = ty.variants.findIndex(v => v.name === variant);
if (index < 0) {
throw `Can't serialize a sum type, couldn't find ${value.tag} tag`;
}
writer.writeU8(index);
AlgebraicType.serializeValue(
writer,
ty.variants[index].algebraicType,
value['value']
);
}
},
deserializeValue: function (reader: BinaryReader, ty: SumTypeType): any {
const tag = reader.readU8();
// In TypeScript we handle Option values as a special case
// we don't represent the some and none variants, but instead
// we represent the value directly.
if (
ty.variants.length == 2 &&
ty.variants[0].name === 'some' &&
ty.variants[1].name === 'none'
) {
if (tag === 0) {
return AlgebraicType.deserializeValue(
reader,
ty.variants[0].algebraicType
);
} else if (tag === 1) {
return undefined;
} else {
throw `Can't deserialize an option type, couldn't find ${tag} tag`;
}
} else {
const variant = ty.variants[tag];
const value = AlgebraicType.deserializeValue(
reader,
variant.algebraicType
);
return { tag: variant.name, value };
}
},
};
export type ComparablePrimitive = number | string | boolean | bigint;
@@ -0,0 +1,10 @@
import BinaryReader from './binary_reader';
export interface ParseableType<T> {
deserialize: (reader: BinaryReader) => T;
}
export function parseValue<T>(ty: ParseableType<T>, src: Uint8Array): T {
const reader = new BinaryReader(src);
return ty.deserialize(reader);
}
@@ -0,0 +1,176 @@
// 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 {
AlgebraicType as __AlgebraicTypeValue,
BinaryReader as __BinaryReader,
BinaryWriter as __BinaryWriter,
ConnectionId as __ConnectionId,
Identity as __Identity,
TimeDuration as __TimeDuration,
Timestamp as __Timestamp,
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
import { SumType } from './sum_type_type';
// Mark import as potentially unused
declare type __keep_SumType = SumType;
import { ProductType } from './product_type_type';
// Mark import as potentially unused
declare type __keep_ProductType = ProductType;
import * as AlgebraicTypeVariants from './algebraic_type_variants';
// The tagged union or sum type for the algebraic type `AlgebraicType`.
export type AlgebraicType =
| AlgebraicTypeVariants.Ref
| AlgebraicTypeVariants.Sum
| AlgebraicTypeVariants.Product
| AlgebraicTypeVariants.Array
| AlgebraicTypeVariants.String
| AlgebraicTypeVariants.Bool
| AlgebraicTypeVariants.I8
| AlgebraicTypeVariants.U8
| AlgebraicTypeVariants.I16
| AlgebraicTypeVariants.U16
| AlgebraicTypeVariants.I32
| AlgebraicTypeVariants.U32
| AlgebraicTypeVariants.I64
| AlgebraicTypeVariants.U64
| AlgebraicTypeVariants.I128
| AlgebraicTypeVariants.U128
| AlgebraicTypeVariants.I256
| AlgebraicTypeVariants.U256
| AlgebraicTypeVariants.F32
| AlgebraicTypeVariants.F64;
// A value with helper functions to construct the type.
export const AlgebraicType = {
// Helper functions for constructing each variant of the tagged union.
// ```
// const foo = Foo.A(42);
// assert!(foo.tag === "A");
// assert!(foo.value === 42);
// ```
Ref: (value: number): AlgebraicType => ({ tag: 'Ref', value }),
Sum: (value: SumType): AlgebraicType => ({ tag: 'Sum', value }),
Product: (value: ProductType): AlgebraicType => ({ tag: 'Product', value }),
Array: (value: AlgebraicType): AlgebraicType => ({ tag: 'Array', value }),
String: { tag: 'String' } as const,
Bool: { tag: 'Bool' } as const,
I8: { tag: 'I8' } as const,
U8: { tag: 'U8' } as const,
I16: { tag: 'I16' } as const,
U16: { tag: 'U16' } as const,
I32: { tag: 'I32' } as const,
U32: { tag: 'U32' } as const,
I64: { tag: 'I64' } as const,
U64: { tag: 'U64' } as const,
I128: { tag: 'I128' } as const,
U128: { tag: 'U128' } as const,
I256: { tag: 'I256' } as const,
U256: { tag: 'U256' } as const,
F32: { tag: 'F32' } as const,
F64: { tag: 'F64' } as const,
getTypeScriptAlgebraicType(): __AlgebraicTypeType {
return __AlgebraicTypeValue.Sum({
variants: [
{ name: 'Ref', algebraicType: __AlgebraicTypeValue.U32 },
{ name: 'Sum', algebraicType: SumType.getTypeScriptAlgebraicType() },
{
name: 'Product',
algebraicType: ProductType.getTypeScriptAlgebraicType(),
},
{
name: 'Array',
algebraicType: AlgebraicType.getTypeScriptAlgebraicType(),
},
{
name: 'String',
algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),
},
{
name: 'Bool',
algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),
},
{
name: 'I8',
algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),
},
{
name: 'U8',
algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),
},
{
name: 'I16',
algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),
},
{
name: 'U16',
algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),
},
{
name: 'I32',
algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),
},
{
name: 'U32',
algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),
},
{
name: 'I64',
algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),
},
{
name: 'U64',
algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),
},
{
name: 'I128',
algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),
},
{
name: 'U128',
algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),
},
{
name: 'I256',
algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),
},
{
name: 'U256',
algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),
},
{
name: 'F32',
algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),
},
{
name: 'F64',
algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),
},
],
});
},
serialize(writer: __BinaryWriter, value: AlgebraicType): void {
__AlgebraicTypeValue.serializeValue(
writer,
AlgebraicType.getTypeScriptAlgebraicType(),
value
);
},
deserialize(reader: __BinaryReader): AlgebraicType {
return __AlgebraicTypeValue.deserializeValue(
reader,
AlgebraicType.getTypeScriptAlgebraicType()
);
},
};
export default AlgebraicType;
@@ -0,0 +1,47 @@
// 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 {
AlgebraicType as __AlgebraicTypeValue,
BinaryReader as __BinaryReader,
BinaryWriter as __BinaryWriter,
ConnectionId as __ConnectionId,
Identity as __Identity,
TimeDuration as __TimeDuration,
Timestamp as __Timestamp,
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
import { AlgebraicType as AlgebraicTypeType } from './algebraic_type_type';
// Mark import as potentially unused
declare type __keep_AlgebraicTypeType = AlgebraicTypeType;
import { SumType as SumTypeType } from './sum_type_type';
// Mark import as potentially unused
declare type __keep_SumTypeType = SumTypeType;
import { ProductType as ProductTypeType } from './product_type_type';
// Mark import as potentially unused
declare type __keep_ProductTypeType = ProductTypeType;
export type Ref = { tag: 'Ref'; value: number };
export type Sum = { tag: 'Sum'; value: SumTypeType };
export type Product = { tag: 'Product'; value: ProductTypeType };
export type Array = { tag: 'Array'; value: AlgebraicTypeType };
export type String = { tag: 'String' };
export type Bool = { tag: 'Bool' };
export type I8 = { tag: 'I8' };
export type U8 = { tag: 'U8' };
export type I16 = { tag: 'I16' };
export type U16 = { tag: 'U16' };
export type I32 = { tag: 'I32' };
export type U32 = { tag: 'U32' };
export type I64 = { tag: 'I64' };
export type U64 = { tag: 'U64' };
export type I128 = { tag: 'I128' };
export type U128 = { tag: 'U128' };
export type I256 = { tag: 'I256' };
export type U256 = { tag: 'U256' };
export type F32 = { tag: 'F32' };
export type F64 = { tag: 'F64' };
@@ -0,0 +1,65 @@
// 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 {
AlgebraicType as __AlgebraicTypeValue,
BinaryReader as __BinaryReader,
BinaryWriter as __BinaryWriter,
ConnectionId as __ConnectionId,
Identity as __Identity,
TimeDuration as __TimeDuration,
Timestamp as __Timestamp,
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
import * as IndexTypeVariants from './index_type_variants';
// The tagged union or sum type for the algebraic type `IndexType`.
export type IndexType = IndexTypeVariants.BTree | IndexTypeVariants.Hash;
// A value with helper functions to construct the type.
export const IndexType = {
// Helper functions for constructing each variant of the tagged union.
// ```
// const foo = Foo.A(42);
// assert!(foo.tag === "A");
// assert!(foo.value === 42);
// ```
BTree: { tag: 'BTree' } as const,
Hash: { tag: 'Hash' } as const,
getTypeScriptAlgebraicType(): __AlgebraicTypeType {
return __AlgebraicTypeValue.Sum({
variants: [
{
name: 'BTree',
algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),
},
{
name: 'Hash',
algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),
},
],
});
},
serialize(writer: __BinaryWriter, value: IndexType): void {
__AlgebraicTypeValue.serializeValue(
writer,
IndexType.getTypeScriptAlgebraicType(),
value
);
},
deserialize(reader: __BinaryReader): IndexType {
return __AlgebraicTypeValue.deserializeValue(
reader,
IndexType.getTypeScriptAlgebraicType()
);
},
};
export default IndexType;
@@ -0,0 +1,20 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
/* eslint-disable */
/* tslint:disable */
import {
AlgebraicType as __AlgebraicTypeValue,
BinaryReader as __BinaryReader,
BinaryWriter as __BinaryWriter,
ConnectionId as __ConnectionId,
Identity as __Identity,
TimeDuration as __TimeDuration,
Timestamp as __Timestamp,
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
export type BTree = { tag: 'BTree' };
export type Hash = { tag: 'Hash' };
@@ -0,0 +1,73 @@
// 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 {
AlgebraicType as __AlgebraicTypeValue,
BinaryReader as __BinaryReader,
BinaryWriter as __BinaryWriter,
ConnectionId as __ConnectionId,
Identity as __Identity,
TimeDuration as __TimeDuration,
Timestamp as __Timestamp,
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
import * as LifecycleVariants from './lifecycle_variants';
// The tagged union or sum type for the algebraic type `Lifecycle`.
export type Lifecycle =
| LifecycleVariants.Init
| LifecycleVariants.OnConnect
| LifecycleVariants.OnDisconnect;
// A value with helper functions to construct the type.
export const Lifecycle = {
// Helper functions for constructing each variant of the tagged union.
// ```
// const foo = Foo.A(42);
// assert!(foo.tag === "A");
// assert!(foo.value === 42);
// ```
Init: { tag: 'Init' } as const,
OnConnect: { tag: 'OnConnect' } as const,
OnDisconnect: { tag: 'OnDisconnect' } as const,
getTypeScriptAlgebraicType(): __AlgebraicTypeType {
return __AlgebraicTypeValue.Sum({
variants: [
{
name: 'Init',
algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),
},
{
name: 'OnConnect',
algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),
},
{
name: 'OnDisconnect',
algebraicType: __AlgebraicTypeValue.Product({ elements: [] }),
},
],
});
},
serialize(writer: __BinaryWriter, value: Lifecycle): void {
__AlgebraicTypeValue.serializeValue(
writer,
Lifecycle.getTypeScriptAlgebraicType(),
value
);
},
deserialize(reader: __BinaryReader): Lifecycle {
return __AlgebraicTypeValue.deserializeValue(
reader,
Lifecycle.getTypeScriptAlgebraicType()
);
},
};
export default Lifecycle;
@@ -0,0 +1,21 @@
// 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 {
AlgebraicType as __AlgebraicTypeValue,
BinaryReader as __BinaryReader,
BinaryWriter as __BinaryWriter,
ConnectionId as __ConnectionId,
Identity as __Identity,
TimeDuration as __TimeDuration,
Timestamp as __Timestamp,
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
export type Init = { tag: 'Init' };
export type OnConnect = { tag: 'OnConnect' };
export type OnDisconnect = { tag: 'OnDisconnect' };
@@ -0,0 +1,67 @@
// 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 {
AlgebraicType as __AlgebraicTypeValue,
BinaryReader as __BinaryReader,
BinaryWriter as __BinaryWriter,
ConnectionId as __ConnectionId,
Identity as __Identity,
TimeDuration as __TimeDuration,
Timestamp as __Timestamp,
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
import { TypeAlias } from './type_alias_type';
// Mark import as potentially unused
declare type __keep_TypeAlias = TypeAlias;
import * as MiscModuleExportVariants from './misc_module_export_variants';
// The tagged union or sum type for the algebraic type `MiscModuleExport`.
export type MiscModuleExport = MiscModuleExportVariants.TypeAlias;
// A value with helper functions to construct the type.
export const MiscModuleExport = {
// Helper functions for constructing each variant of the tagged union.
// ```
// const foo = Foo.A(42);
// assert!(foo.tag === "A");
// assert!(foo.value === 42);
// ```
TypeAlias: (value: TypeAlias): MiscModuleExport => ({
tag: 'TypeAlias',
value,
}),
getTypeScriptAlgebraicType(): __AlgebraicTypeType {
return __AlgebraicTypeValue.Sum({
variants: [
{
name: 'TypeAlias',
algebraicType: TypeAlias.getTypeScriptAlgebraicType(),
},
],
});
},
serialize(writer: __BinaryWriter, value: MiscModuleExport): void {
__AlgebraicTypeValue.serializeValue(
writer,
MiscModuleExport.getTypeScriptAlgebraicType(),
value
);
},
deserialize(reader: __BinaryReader): MiscModuleExport {
return __AlgebraicTypeValue.deserializeValue(
reader,
MiscModuleExport.getTypeScriptAlgebraicType()
);
},
};
export default MiscModuleExport;
@@ -0,0 +1,22 @@
// 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 {
AlgebraicType as __AlgebraicTypeValue,
BinaryReader as __BinaryReader,
BinaryWriter as __BinaryWriter,
ConnectionId as __ConnectionId,
Identity as __Identity,
TimeDuration as __TimeDuration,
Timestamp as __Timestamp,
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
import { TypeAlias as TypeAliasType } from './type_alias_type';
// Mark import as potentially unused
declare type __keep_TypeAliasType = TypeAliasType;
export type TypeAlias = { tag: 'TypeAlias'; value: TypeAliasType };
@@ -0,0 +1,67 @@
// 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 {
AlgebraicType as __AlgebraicTypeValue,
BinaryReader as __BinaryReader,
BinaryWriter as __BinaryWriter,
ConnectionId as __ConnectionId,
Identity as __Identity,
TimeDuration as __TimeDuration,
Timestamp as __Timestamp,
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
import { AlgebraicType } from './algebraic_type_type';
// Mark import as potentially unused
declare type __keep_AlgebraicType = AlgebraicType;
export type ProductTypeElement = {
name: string | undefined;
algebraicType: AlgebraicType;
};
/**
* An object for generated helper functions.
*/
export const ProductTypeElement = {
/**
* A function which returns this type represented as an AlgebraicType.
* This function is derived from the AlgebraicType used to generate this type.
*/
getTypeScriptAlgebraicType(): __AlgebraicTypeType {
return __AlgebraicTypeValue.Product({
elements: [
{
name: 'name',
algebraicType: __AlgebraicTypeValue.createOptionType(
__AlgebraicTypeValue.String
),
},
{
name: 'algebraicType',
algebraicType: AlgebraicType.getTypeScriptAlgebraicType(),
},
],
});
},
serialize(writer: __BinaryWriter, value: ProductTypeElement): void {
__AlgebraicTypeValue.serializeValue(
writer,
ProductTypeElement.getTypeScriptAlgebraicType(),
value
);
},
deserialize(reader: __BinaryReader): ProductTypeElement {
return __AlgebraicTypeValue.deserializeValue(
reader,
ProductTypeElement.getTypeScriptAlgebraicType()
);
},
};
export default ProductTypeElement;
@@ -0,0 +1,62 @@
// 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 {
AlgebraicType as __AlgebraicTypeValue,
BinaryReader as __BinaryReader,
BinaryWriter as __BinaryWriter,
ConnectionId as __ConnectionId,
Identity as __Identity,
TimeDuration as __TimeDuration,
Timestamp as __Timestamp,
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
import { ProductTypeElement } from './product_type_element_type';
// Mark import as potentially unused
declare type __keep_ProductTypeElement = ProductTypeElement;
export type ProductType = {
elements: ProductTypeElement[];
};
/**
* An object for generated helper functions.
*/
export const ProductType = {
/**
* A function which returns this type represented as an AlgebraicType.
* This function is derived from the AlgebraicType used to generate this type.
*/
getTypeScriptAlgebraicType(): __AlgebraicTypeType {
return __AlgebraicTypeValue.Product({
elements: [
{
name: 'elements',
algebraicType: __AlgebraicTypeValue.Array(
ProductTypeElement.getTypeScriptAlgebraicType()
),
},
],
});
},
serialize(writer: __BinaryWriter, value: ProductType): void {
__AlgebraicTypeValue.serializeValue(
writer,
ProductType.getTypeScriptAlgebraicType(),
value
);
},
deserialize(reader: __BinaryReader): ProductType {
return __AlgebraicTypeValue.deserializeValue(
reader,
ProductType.getTypeScriptAlgebraicType()
);
},
};
export default ProductType;
@@ -0,0 +1,62 @@
// 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 {
AlgebraicType as __AlgebraicTypeValue,
BinaryReader as __BinaryReader,
BinaryWriter as __BinaryWriter,
ConnectionId as __ConnectionId,
Identity as __Identity,
TimeDuration as __TimeDuration,
Timestamp as __Timestamp,
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
import { AlgebraicType } from './algebraic_type_type';
// Mark import as potentially unused
declare type __keep_AlgebraicType = AlgebraicType;
export type RawColumnDefV8 = {
colName: string;
colType: AlgebraicType;
};
/**
* An object for generated helper functions.
*/
export const RawColumnDefV8 = {
/**
* A function which returns this type represented as an AlgebraicType.
* This function is derived from the AlgebraicType used to generate this type.
*/
getTypeScriptAlgebraicType(): __AlgebraicTypeType {
return __AlgebraicTypeValue.Product({
elements: [
{ name: 'colName', algebraicType: __AlgebraicTypeValue.String },
{
name: 'colType',
algebraicType: AlgebraicType.getTypeScriptAlgebraicType(),
},
],
});
},
serialize(writer: __BinaryWriter, value: RawColumnDefV8): void {
__AlgebraicTypeValue.serializeValue(
writer,
RawColumnDefV8.getTypeScriptAlgebraicType(),
value
);
},
deserialize(reader: __BinaryReader): RawColumnDefV8 {
return __AlgebraicTypeValue.deserializeValue(
reader,
RawColumnDefV8.getTypeScriptAlgebraicType()
);
},
};
export default RawColumnDefV8;
@@ -0,0 +1,61 @@
// 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 {
AlgebraicType as __AlgebraicTypeValue,
BinaryReader as __BinaryReader,
BinaryWriter as __BinaryWriter,
ConnectionId as __ConnectionId,
Identity as __Identity,
TimeDuration as __TimeDuration,
Timestamp as __Timestamp,
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
export type RawColumnDefaultValueV9 = {
table: string;
colId: number;
value: Uint8Array;
};
/**
* An object for generated helper functions.
*/
export const RawColumnDefaultValueV9 = {
/**
* A function which returns this type represented as an AlgebraicType.
* This function is derived from the AlgebraicType used to generate this type.
*/
getTypeScriptAlgebraicType(): __AlgebraicTypeType {
return __AlgebraicTypeValue.Product({
elements: [
{ name: 'table', algebraicType: __AlgebraicTypeValue.String },
{ name: 'colId', algebraicType: __AlgebraicTypeValue.U16 },
{
name: 'value',
algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U8),
},
],
});
},
serialize(writer: __BinaryWriter, value: RawColumnDefaultValueV9): void {
__AlgebraicTypeValue.serializeValue(
writer,
RawColumnDefaultValueV9.getTypeScriptAlgebraicType(),
value
);
},
deserialize(reader: __BinaryReader): RawColumnDefaultValueV9 {
return __AlgebraicTypeValue.deserializeValue(
reader,
RawColumnDefaultValueV9.getTypeScriptAlgebraicType()
);
},
};
export default RawColumnDefaultValueV9;
@@ -0,0 +1,67 @@
// 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 {
AlgebraicType as __AlgebraicTypeValue,
BinaryReader as __BinaryReader,
BinaryWriter as __BinaryWriter,
ConnectionId as __ConnectionId,
Identity as __Identity,
TimeDuration as __TimeDuration,
Timestamp as __Timestamp,
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
import { RawUniqueConstraintDataV9 } from './raw_unique_constraint_data_v_9_type';
// Mark import as potentially unused
declare type __keep_RawUniqueConstraintDataV9 = RawUniqueConstraintDataV9;
import * as RawConstraintDataV9Variants from './raw_constraint_data_v_9_variants';
// The tagged union or sum type for the algebraic type `RawConstraintDataV9`.
export type RawConstraintDataV9 = RawConstraintDataV9Variants.Unique;
// A value with helper functions to construct the type.
export const RawConstraintDataV9 = {
// Helper functions for constructing each variant of the tagged union.
// ```
// const foo = Foo.A(42);
// assert!(foo.tag === "A");
// assert!(foo.value === 42);
// ```
Unique: (value: RawUniqueConstraintDataV9): RawConstraintDataV9 => ({
tag: 'Unique',
value,
}),
getTypeScriptAlgebraicType(): __AlgebraicTypeType {
return __AlgebraicTypeValue.Sum({
variants: [
{
name: 'Unique',
algebraicType: RawUniqueConstraintDataV9.getTypeScriptAlgebraicType(),
},
],
});
},
serialize(writer: __BinaryWriter, value: RawConstraintDataV9): void {
__AlgebraicTypeValue.serializeValue(
writer,
RawConstraintDataV9.getTypeScriptAlgebraicType(),
value
);
},
deserialize(reader: __BinaryReader): RawConstraintDataV9 {
return __AlgebraicTypeValue.deserializeValue(
reader,
RawConstraintDataV9.getTypeScriptAlgebraicType()
);
},
};
export default RawConstraintDataV9;
@@ -0,0 +1,23 @@
// 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 {
AlgebraicType as __AlgebraicTypeValue,
BinaryReader as __BinaryReader,
BinaryWriter as __BinaryWriter,
ConnectionId as __ConnectionId,
Identity as __Identity,
TimeDuration as __TimeDuration,
Timestamp as __Timestamp,
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
import { RawUniqueConstraintDataV9 as RawUniqueConstraintDataV9Type } from './raw_unique_constraint_data_v_9_type';
// Mark import as potentially unused
declare type __keep_RawUniqueConstraintDataV9Type =
RawUniqueConstraintDataV9Type;
export type Unique = { tag: 'Unique'; value: RawUniqueConstraintDataV9Type };
@@ -0,0 +1,61 @@
// 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 {
AlgebraicType as __AlgebraicTypeValue,
BinaryReader as __BinaryReader,
BinaryWriter as __BinaryWriter,
ConnectionId as __ConnectionId,
Identity as __Identity,
TimeDuration as __TimeDuration,
Timestamp as __Timestamp,
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
export type RawConstraintDefV8 = {
constraintName: string;
constraints: number;
columns: number[];
};
/**
* An object for generated helper functions.
*/
export const RawConstraintDefV8 = {
/**
* A function which returns this type represented as an AlgebraicType.
* This function is derived from the AlgebraicType used to generate this type.
*/
getTypeScriptAlgebraicType(): __AlgebraicTypeType {
return __AlgebraicTypeValue.Product({
elements: [
{ name: 'constraintName', algebraicType: __AlgebraicTypeValue.String },
{ name: 'constraints', algebraicType: __AlgebraicTypeValue.U8 },
{
name: 'columns',
algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U16),
},
],
});
},
serialize(writer: __BinaryWriter, value: RawConstraintDefV8): void {
__AlgebraicTypeValue.serializeValue(
writer,
RawConstraintDefV8.getTypeScriptAlgebraicType(),
value
);
},
deserialize(reader: __BinaryReader): RawConstraintDefV8 {
return __AlgebraicTypeValue.deserializeValue(
reader,
RawConstraintDefV8.getTypeScriptAlgebraicType()
);
},
};
export default RawConstraintDefV8;
@@ -0,0 +1,67 @@
// 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 {
AlgebraicType as __AlgebraicTypeValue,
BinaryReader as __BinaryReader,
BinaryWriter as __BinaryWriter,
ConnectionId as __ConnectionId,
Identity as __Identity,
TimeDuration as __TimeDuration,
Timestamp as __Timestamp,
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
import { RawConstraintDataV9 } from './raw_constraint_data_v_9_type';
// Mark import as potentially unused
declare type __keep_RawConstraintDataV9 = RawConstraintDataV9;
export type RawConstraintDefV9 = {
name: string | undefined;
data: RawConstraintDataV9;
};
/**
* An object for generated helper functions.
*/
export const RawConstraintDefV9 = {
/**
* A function which returns this type represented as an AlgebraicType.
* This function is derived from the AlgebraicType used to generate this type.
*/
getTypeScriptAlgebraicType(): __AlgebraicTypeType {
return __AlgebraicTypeValue.Product({
elements: [
{
name: 'name',
algebraicType: __AlgebraicTypeValue.createOptionType(
__AlgebraicTypeValue.String
),
},
{
name: 'data',
algebraicType: RawConstraintDataV9.getTypeScriptAlgebraicType(),
},
],
});
},
serialize(writer: __BinaryWriter, value: RawConstraintDefV9): void {
__AlgebraicTypeValue.serializeValue(
writer,
RawConstraintDefV9.getTypeScriptAlgebraicType(),
value
);
},
deserialize(reader: __BinaryReader): RawConstraintDefV9 {
return __AlgebraicTypeValue.deserializeValue(
reader,
RawConstraintDefV9.getTypeScriptAlgebraicType()
);
},
};
export default RawConstraintDefV9;
@@ -0,0 +1,70 @@
// 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 {
AlgebraicType as __AlgebraicTypeValue,
BinaryReader as __BinaryReader,
BinaryWriter as __BinaryWriter,
ConnectionId as __ConnectionId,
Identity as __Identity,
TimeDuration as __TimeDuration,
Timestamp as __Timestamp,
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
import * as RawIndexAlgorithmVariants from './raw_index_algorithm_variants';
// The tagged union or sum type for the algebraic type `RawIndexAlgorithm`.
export type RawIndexAlgorithm =
| RawIndexAlgorithmVariants.BTree
| RawIndexAlgorithmVariants.Hash
| RawIndexAlgorithmVariants.Direct;
// A value with helper functions to construct the type.
export const RawIndexAlgorithm = {
// Helper functions for constructing each variant of the tagged union.
// ```
// const foo = Foo.A(42);
// assert!(foo.tag === "A");
// assert!(foo.value === 42);
// ```
BTree: (value: number[]): RawIndexAlgorithm => ({ tag: 'BTree', value }),
Hash: (value: number[]): RawIndexAlgorithm => ({ tag: 'Hash', value }),
Direct: (value: number): RawIndexAlgorithm => ({ tag: 'Direct', value }),
getTypeScriptAlgebraicType(): __AlgebraicTypeType {
return __AlgebraicTypeValue.Sum({
variants: [
{
name: 'BTree',
algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U16),
},
{
name: 'Hash',
algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U16),
},
{ name: 'Direct', algebraicType: __AlgebraicTypeValue.U16 },
],
});
},
serialize(writer: __BinaryWriter, value: RawIndexAlgorithm): void {
__AlgebraicTypeValue.serializeValue(
writer,
RawIndexAlgorithm.getTypeScriptAlgebraicType(),
value
);
},
deserialize(reader: __BinaryReader): RawIndexAlgorithm {
return __AlgebraicTypeValue.deserializeValue(
reader,
RawIndexAlgorithm.getTypeScriptAlgebraicType()
);
},
};
export default RawIndexAlgorithm;
@@ -0,0 +1,21 @@
// 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 {
AlgebraicType as __AlgebraicTypeValue,
BinaryReader as __BinaryReader,
BinaryWriter as __BinaryWriter,
ConnectionId as __ConnectionId,
Identity as __Identity,
TimeDuration as __TimeDuration,
Timestamp as __Timestamp,
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
export type BTree = { tag: 'BTree'; value: number[] };
export type Hash = { tag: 'Hash'; value: number[] };
export type Direct = { tag: 'Direct'; value: number };
@@ -0,0 +1,69 @@
// 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 {
AlgebraicType as __AlgebraicTypeValue,
BinaryReader as __BinaryReader,
BinaryWriter as __BinaryWriter,
ConnectionId as __ConnectionId,
Identity as __Identity,
TimeDuration as __TimeDuration,
Timestamp as __Timestamp,
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
import { IndexType } from './index_type_type';
// Mark import as potentially unused
declare type __keep_IndexType = IndexType;
export type RawIndexDefV8 = {
indexName: string;
isUnique: boolean;
indexType: IndexType;
columns: number[];
};
/**
* An object for generated helper functions.
*/
export const RawIndexDefV8 = {
/**
* A function which returns this type represented as an AlgebraicType.
* This function is derived from the AlgebraicType used to generate this type.
*/
getTypeScriptAlgebraicType(): __AlgebraicTypeType {
return __AlgebraicTypeValue.Product({
elements: [
{ name: 'indexName', algebraicType: __AlgebraicTypeValue.String },
{ name: 'isUnique', algebraicType: __AlgebraicTypeValue.Bool },
{
name: 'indexType',
algebraicType: IndexType.getTypeScriptAlgebraicType(),
},
{
name: 'columns',
algebraicType: __AlgebraicTypeValue.Array(__AlgebraicTypeValue.U16),
},
],
});
},
serialize(writer: __BinaryWriter, value: RawIndexDefV8): void {
__AlgebraicTypeValue.serializeValue(
writer,
RawIndexDefV8.getTypeScriptAlgebraicType(),
value
);
},
deserialize(reader: __BinaryReader): RawIndexDefV8 {
return __AlgebraicTypeValue.deserializeValue(
reader,
RawIndexDefV8.getTypeScriptAlgebraicType()
);
},
};
export default RawIndexDefV8;
@@ -0,0 +1,74 @@
// 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 {
AlgebraicType as __AlgebraicTypeValue,
BinaryReader as __BinaryReader,
BinaryWriter as __BinaryWriter,
ConnectionId as __ConnectionId,
Identity as __Identity,
TimeDuration as __TimeDuration,
Timestamp as __Timestamp,
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
import { RawIndexAlgorithm } from './raw_index_algorithm_type';
// Mark import as potentially unused
declare type __keep_RawIndexAlgorithm = RawIndexAlgorithm;
export type RawIndexDefV9 = {
name: string | undefined;
accessorName: string | undefined;
algorithm: RawIndexAlgorithm;
};
/**
* An object for generated helper functions.
*/
export const RawIndexDefV9 = {
/**
* A function which returns this type represented as an AlgebraicType.
* This function is derived from the AlgebraicType used to generate this type.
*/
getTypeScriptAlgebraicType(): __AlgebraicTypeType {
return __AlgebraicTypeValue.Product({
elements: [
{
name: 'name',
algebraicType: __AlgebraicTypeValue.createOptionType(
__AlgebraicTypeValue.String
),
},
{
name: 'accessorName',
algebraicType: __AlgebraicTypeValue.createOptionType(
__AlgebraicTypeValue.String
),
},
{
name: 'algorithm',
algebraicType: RawIndexAlgorithm.getTypeScriptAlgebraicType(),
},
],
});
},
serialize(writer: __BinaryWriter, value: RawIndexDefV9): void {
__AlgebraicTypeValue.serializeValue(
writer,
RawIndexDefV9.getTypeScriptAlgebraicType(),
value
);
},
deserialize(reader: __BinaryReader): RawIndexDefV9 {
return __AlgebraicTypeValue.deserializeValue(
reader,
RawIndexDefV9.getTypeScriptAlgebraicType()
);
},
};
export default RawIndexDefV9;
@@ -0,0 +1,67 @@
// 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 {
AlgebraicType as __AlgebraicTypeValue,
BinaryReader as __BinaryReader,
BinaryWriter as __BinaryWriter,
ConnectionId as __ConnectionId,
Identity as __Identity,
TimeDuration as __TimeDuration,
Timestamp as __Timestamp,
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
import { RawColumnDefaultValueV9 } from './raw_column_default_value_v_9_type';
// Mark import as potentially unused
declare type __keep_RawColumnDefaultValueV9 = RawColumnDefaultValueV9;
import * as RawMiscModuleExportV9Variants from './raw_misc_module_export_v_9_variants';
// The tagged union or sum type for the algebraic type `RawMiscModuleExportV9`.
export type RawMiscModuleExportV9 =
RawMiscModuleExportV9Variants.ColumnDefaultValue;
// A value with helper functions to construct the type.
export const RawMiscModuleExportV9 = {
// Helper functions for constructing each variant of the tagged union.
// ```
// const foo = Foo.A(42);
// assert!(foo.tag === "A");
// assert!(foo.value === 42);
// ```
ColumnDefaultValue: (
value: RawColumnDefaultValueV9
): RawMiscModuleExportV9 => ({ tag: 'ColumnDefaultValue', value }),
getTypeScriptAlgebraicType(): __AlgebraicTypeType {
return __AlgebraicTypeValue.Sum({
variants: [
{
name: 'ColumnDefaultValue',
algebraicType: RawColumnDefaultValueV9.getTypeScriptAlgebraicType(),
},
],
});
},
serialize(writer: __BinaryWriter, value: RawMiscModuleExportV9): void {
__AlgebraicTypeValue.serializeValue(
writer,
RawMiscModuleExportV9.getTypeScriptAlgebraicType(),
value
);
},
deserialize(reader: __BinaryReader): RawMiscModuleExportV9 {
return __AlgebraicTypeValue.deserializeValue(
reader,
RawMiscModuleExportV9.getTypeScriptAlgebraicType()
);
},
};
export default RawMiscModuleExportV9;

Some files were not shown because too many files have changed in this diff Show More