# Description of Changes
This PR implements a new command for the CLI: `spacetime dev`. If run
from outside of a project directory, it will call `init` in interactive
mode to allow user to create a project. If run from a project directory,
it will ask for a module to conect to and it will:
* subscribe to logs
* observe files in the `spacetimedb` directory and automatically publish
to SpacetimeDB
One caveat is that instead of reusing the `logs` code I did some
repetition cause currently the logs code acquires a lock that lives
through await points. It is fixable, but due to limited time I decided
to go with a bit of code duplication. It shouldn't be very hard to fix
later, though.
---------
Signed-off-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Signed-off-by: John Detter <4099508+jdetter@users.noreply.github.com>
Co-authored-by: = <cloutiertyler@gmail.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@aol.com>
Co-authored-by: John Detter <4099508+jdetter@users.noreply.github.com>
This is a draft of the new functionality for `spacetime init`. In order
to run it with built-in templates you have to set the path to the config
file:
```
export SPACETIMEDB_CLI_TEMPLATES_FILE=crates/cli/.init-templates.json
```
In the future it will fetch the list from GH.
A few notes:
* the previous functionality of `spacetime init` does not work at the
moment
* the code needs a bit more cleanup and tests before merging
* there is a bit of a mix in how we generate empty server and client
projects. For Rust we use the existing way of generating. For TypeScript
we clone an empty project from the repo. I wanted to play with both ways
of doing things, and I'm still not sure which is better. Generation in
Rust means that the generated code will match the CLI version and not
necessarily whatever is in Git. On the other hand, for the builtin
templates we will be fetching the newest version from GH, which I guess
might also not what we want, ie. we probably want only stable templates.
More discussion is needed here
* we use `spacetimedb` directory for the server files
* I don't particularly like the inability to disable interactive mode
easily. We discussed disabling it by default if all of the required
arguments are passed, but I don't think it's feature proof. For example,
if someone relies on a non-interactive mode, and we add a new required
argument, instead of printing a message `missing --foo`, we will
automatically launch interactive mode, which is harder to debug. That's
why I think I'd prefer to implement `--non-interactive` argument
* it's kind of hard to keep the legacy behaviour. If you don't pass any
arguments, we go into interactive mode. In the legacy version, we would
print required arguments. If someone passes `--lang` or `--project-path`
explicitly, I guess we could run the legacy workflow, but not sure if
it's worth it, as the command was marked as unstable anyway
* the project path defaults to the project name, but I think we should
probably replace change whitespaces to dashes, or at least ask for the
project path with the project name being the default (or both)
---------
Signed-off-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Signed-off-by: John Detter <4099508+jdetter@users.noreply.github.com>
Co-authored-by: = <cloutiertyler@gmail.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@aol.com>
Co-authored-by: John Detter <4099508+jdetter@users.noreply.github.com>
# Description of Changes
This implements a fix to an issue with debugging using the C# SDK, by
adding new exception types:
* `SpacetimeDBException`,
* `SpacetimeDBArgumentException`,
* `SpacetimeDBEmptyReducerNameException`
Additional, regenerating bindings will now allow clients to report an
`SpacetimeDBEmptyReducerNameException` rather than an
`ArgumentOutOfRangeException` when the client receives an empty reducer
name from the server.
An example of the generated code currently, that results in the
exception:
https://github.com/clockworklabs/SpacetimeDB/blob/544e2edc2d1f7d1dd118832a815b6dbd7a6c1d82/sdks/csharp/examples~/quickstart-chat/client/module_bindings/SpacetimeDBClient.g.cs#L475
Note: Normally this is not an issue for a client, because the
`SpacetimeDBEmptyReducerNameException` would be caught by the
[Try/Catch](https://github.com/clockworklabs/SpacetimeDB/blob/9f59118e24449cdd2d3e182bd44fdb26078e921b/sdks/csharp/src/SpacetimeDBClient.cs#L421C25-L421C42)
statement, but a debugger will still catch the exception and halt
operation. This can be annoying to a developer when debugging.
By separating out the exception into a custom `Exception` type, we allow
a developer to flag the new exception type as something it can ignore,
without ignoring other relevant exceptions.
# API and ABI breaking changes
Not a breaking change.
Clients will need to regenerate bindings to get the new exceptions
# Expected complexity level and risk
1
# Testing
- [X] Tested regenerating bindings and confirmed intended output.
- [X] Tested debugging and receiving
`SpacetimeDBEmptyReducerNameException` when expected.
---------
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
# Description of Changes
Bumping versions to 1.6.0 in preparation for upcoming release.
# API and ABI breaking changes
None
# Expected complexity level and risk
1
# Testing
- [x] Existing CI only
---------
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
# Description of Changes
* Small cleanups in `tools/check-diff.sh`
* Use `tools/check-diff.sh` wherever appropriate
* Simplify the `sdks/csharp/tools~/gen-*.sh` files after the repo merge
# API and ABI breaking changes
None.
# Expected complexity level and risk
1
# Testing
- [x] CI still passes
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
# Description of Changes
This is the implementation of issue #3191. This adds a Default attribute
to C# module fields.
**Note**: In C#, attribute arguments must be compile-time constants,
which means you can't directly use non-constant expressions like new
expressions, method calls, or dynamic values in attribute constructors.
(Ref:
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/attributes#2324-attribute-parameter-types)
For this reason, these default values are limited to primitive types,
enums, and strings.
This includes (shown as `C# Type` (`BSATN type`):
* `bool` (`Bool`)
* `sbyte` (`I8`)
* `byte` (`U8`)
* `short` (`I16`)
* `ushort` (`U16`)
* `int` (`I32`)
* `unit` (`U32`)
* `long` (`I64`)
* `ulong` (`U64`)
* `float` (`F32`)
* `double` (`F64`)
* `enum` (`Enum`)
* `string` (`String`)
* `null` (`RefOption`) <- Nullable type
Because of C# limitations, for nullable and complex data types, such as
a struct, can take use `[Default(null)]` to populate values with null
defaults. This allows things like structs to workaround the non-constant
expressions in attribute constructors limitation by allowing these
complex types to still be able to be added as new column tables.
The `int` type can also be in the form of Hex or Binary literals, such
as `[Default(0x2A)]` or `[Default(0b00101010)]`
Both Decimal (like `[Default(3.14m)]`) and Char (like `[Default('A')]`)
are unsupported types in BSATN and will still return `BSATN0001` errors.
# API and ABI breaking changes
Not API breaking.
This change only adds the `[Default(value)]` attribute logic.
Using the `[Default(value)]` attribute with older versions SpacetimeDB
C# modules will result in an error.
# Expected complexity level and risk
2
# Testing
Local testing of this requires use of CLI changes in #3278
- [x] Regression test of functionality added.
# Description of Changes
I chose to regenerate all of the bindings in
https://github.com/clockworklabs/SpacetimeDB/pull/3310, but that caused
the snapshots to change. This PR follows up to update them.
I also updated the outdated script `tools~/gen-quickstart-chat.sh`
(which was generating from a different module than the CI was), and
updated the CI to use it instead of manually running a similar command.
# API and ABI breaking changes
Test-only changes.
# Expected complexity level and risk
1
# Testing
- [x] unity-testsuite passes on this PR (which it does not on `master`).
---------
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
Move the global.json file to the repo root, which should make `dotnet`
resolve the correct SDK regardless of the directory it is run in.
Where a copy of the global.json file is needed, symlink it to the one at
the root.
Should fix "C#/Unity - Test Suite".
# Description of Changes
Bumping remaining files so that everything is at 1.4.0.
# API and ABI breaking changes
None.
# Expected complexity level and risk
1
# Testing
None
---------
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
# Description of Changes
Closes https://github.com/clockworklabs/SpacetimeDBPrivate/issues/1987
# API and ABI breaking changes
This does not affect any APIs but it does affect the code generated
# Expected complexity level and risk
1
# Testing
<!-- Describe any testing you've done, and any testing you'd like your
reviewers to do,
so that you're confident that all the changes work as expected! -->
- [ ] Snap tests
# Description of Changes
To address user issue
https://github.com/clockworklabs/SpacetimeDB/issues/2647 , the C#
implementation of quickstart-chat files and documentation have been
updated to pattern match the variable assignment of User.
This has the benefit of the variables never being perceived by the
analyzers as a nullable types.
# API and ABI breaking changes
Not API breaking
# Expected complexity level and risk
1
# Testing
- [X] Tested updated module code locally, following instructions from
the documentation.
Co-authored-by: John Detter <4099508+jdetter@users.noreply.github.com>
# Description of Changes
Add a RemoteQuery regression test to C# SDK to address issue:
https://github.com/clockworklabs/SpacetimeDB/issues/3064
This adds on to existing regression tests, creating a rather small
change.
# API and ABI breaking changes
Not breaking change
# Expected complexity level and risk
1
# Testing
- [X] Ran `dotnet test`, all tests pass
# Description of Changes
We recently merged several repos together. This PR clarifies the license
terms for several subdirectories, as well as the relationship between
the licenses.
The licenses in our subdirectories have become symbolic links to
licenses in our toplevel `licenses` directory. For any particular
subdirectory's license file in the diff, you can click `... -> View
file` and then click on the text that says "Symbolic Link" on that page.
This will take you to the license file that it links to.
I have also updated the `tools/upgrade-version` script to update the
change date in the new `licenses/BSL.txt` file.
# API and ABI breaking changes
None.
# Expected complexity level and risk
1
# Testing
None. Only changes to license files.
---------
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
# Description of Changes
Added a repo migration notice workflow to each repository that we've
merged into SpacetimeDB.
These need to be mirrored back to the actual repos with a process like:
```bash
git subtree split --prefix=sdks/typescript -b release/typescript
git push -f git@github.com:clockworklabs/spacetimedb-typescript-sdk.git release/typescript:main
git branch -D release/typescript
```
Once they're migrated there, the bot will automatically comment on any
PR or issue opened in those repos.
# API and ABI breaking changes
None. CI-only changes.
# Expected complexity level and risk
2
# Testing
- [x] In a demo repo, it properly commented and closed a PR:
https://github.com/clockworklabs/github-tooling-test/pull/42
- [x] In a demo repo, it properly commented and closed an issue:
https://github.com/clockworklabs/github-tooling-test/issues/43
---------
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
## Description of Changes
Moves table-specific operations out of `SpacetimeDBClient.cs` and into
`Table.cs` in order to reduce coupling between the two files.
This is the implementation of
https://github.com/clockworklabs/SpacetimeDB/issues/3047
This is a PR being duplicated/migrated from
https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk/pull/346,
which contains prior discussion/review/approval.
## API
- [ ] This is an API breaking change to the SDK
## Requires SpacetimeDB PRs
No PRs needed, works with latest master
## Testsuite
SpacetimeDB branch name: master
## Testing
- [X] Opened and ran Blackhol.io within Unity Editor and successfully
connecting to a locally running server
- [X] Compiled a WebGL build of Blackhol.io and successfully connecting
to a locally running server
- [x] Opened and ran BitCraft within Unity Editor and successfully
connecting to a locally running server
# Description of Changes
I forgot to do this in the original version bump PR... I just ran
`dotnet pack` and then moved the meta files.
# API and ABI breaking changes
None
# Expected complexity level and risk
1
# Testing
None.
---------
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
# Description of Changes
Bumped all versions to 1.3.0 in preparation for an upcoming minor
release.
# API and ABI breaking changes
No breaking changes.
# Expected complexity level and risk
1
# Testing
None
---------
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
# Description of Changes
I ran `python3 tools~/upgrade-version.py 1.2.2` in preparation for an
upcoming release.
# API and ABI breaking changes
None
# Expected complexity level and risk
1
# Testing
None, just a version bump.
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
# Description of Changes
This is a fix for community bug which auth token is not used to create
Websocket connection in Unity WebGL build.
The issue here:
https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk/issues/352
# API and ABI breaking changes
None
# Expected complexity level and risk
1
# Testing
- [ ] Using OAuth2.0 tokens, you should get the same `Identity` even
when the token is refreshed in the WebGL build
## Description of Changes
This is a fix for community bug
https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk/issues/340
that was the result of changes to SpacetimeDBClient code that missed
changes to the WebGL build.
## API
- [ ] This is an API breaking change to the SDK
## Requires SpacetimeDB PRs
- None
## Testsuite
SpacetimeDB branch name: master
## Testing
- [X] Tested changes against Blackholio running under a Unity WebGL
build
## Description of Changes
These version bumps were supposed to happen in
https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk/pull/332,
but apparently I messed something up while I was switching branches.
## API
- [ ] This is an API breaking change to the SDK
No breaking changes
## Requires SpacetimeDB PRs
None.
## Testsuite
SpacetimeDB branch name: master
## Testing
CI only
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
## Description of Changes
Updates the DLLs for
https://github.com/clockworklabs/SpacetimeDB/pull/2762, and bumps our
version numbers as well.
## API
- [ ] This is an API breaking change to the SDK
Not a breaking change
## Requires SpacetimeDB PRs
None afaik
## Testsuite
SpacetimeDB branch name: master
## Testing
*Write instructions for a test that you performed for this PR*
- [x] Ran through Bitcraft tutorial
- [x] Blackholio on CI
---------
Co-authored-by: James Gilles <jameshgilles@gmail.com>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
## Description of Changes
`NetworkRequestTracker` previously was keeping all historical reducer
request data, and searching through this every frame to get statistics.
I've modified it to throw out much more data -- it's much faster now,
but only updates every few seconds.
## API
Not an API break, but deprecates an argument of one of
NetworkRequestTracker's methods to no longer do anything.
Adds new APIs.
## Requires SpacetimeDB PRs
N/A
## Testsuite
SpacetimeDB branch name: master
## Testing
- [x] Tested Bitcraft. **Their F9 debug menu will require an update,
since we now only keep one time window of request data, rather than
being able to give information about multiple windows.** But it works.
- [x] Blackholio CI
## Description of Changes
*Describe what has been changed, any new features or bug fixes*
## API
- [ ] This is an API breaking change to the SDK
*If the API is breaking, please state below what will break*
## Requires SpacetimeDB PRs
*List any PRs here that are required for this SDK change to work*
## Testsuite
*If you would like to run the your SDK changes in this PR against a
specific SpacetimeDB branch, specify that here. This can be a branch
name or a link to a PR.*
SpacetimeDB branch name: master
## Testing
*Write instructions for a test that you performed for this PR*
- [ ] Describe a test for this PR that you have completed
---------
Co-authored-by: Alessandro Asoni <alessandro@clockworklabs.io>
Co-authored-by: James Gilles <jameshgilles@gmail.com>
## Description of Changes
Bump versions to 1.2.0, as well as update the DLLs from SpacetimeDB
(commit `fc8f7dcc8`). They don't have any changes, but the versions
needed bumping.
## API
This itself is not a breaking changes.
## Requires SpacetimeDB PRs
https://github.com/clockworklabs/SpacetimeDB/pull/2837
## Testsuite
SpacetimeDB branch name: release/v1.2.0
## Testing
CI only
---------
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
## Description of Changes
Update DLLs to the 1.1.2 versions that have been pushed to NuGet.
The SpacetimeDB tag that they were built from is
`v1.1.2-csharp-release`.
## API
- [ ] This is an API breaking change to the SDK
*If the API is breaking, please state below what will break*
## Requires SpacetimeDB PRs
None, because we're updating the DLLs to essentially include SpacetimeDB
PRs.
## Testsuite
SpacetimeDB branch name: master
## Testing
CI I guess?
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
## Description of Changes
Just bumping version numbers in preparation for a release.
The Unity SDK and C# SDK had different version numbers. That seems
confusing, so I bumped them both to 1.1.5.
## API
No breaking changes
## Requires SpacetimeDB PRs
None, afaik
## Testsuite
SpacetimeDB branch name: master
## Testing
None
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
## Description of Changes
Recreating #311 using a branch in this repo in the hope of fixing the
Unity build.
## API
- [ ] This is an API breaking change to the SDK
## Requires SpacetimeDB PRs
## Testsuite
SpacetimeDB branch name: master
## Testing
- [x] blackholio
- [ ] bitcraft
---------
Co-authored-by: Guribo <guribovr@gmail.com>
## Description of Changes
Leverages https://github.com/clockworklabs/SpacetimeDB/pull/2725 to
speed up row deserialization. Also updates DLLs for recent upstream
fixes.
Changes:
- Uses much simpler code when deserializing enums, avoiding the use of
reflection
- Uses manually monomorphized row deserialization methods, which again
avoid the use of reflection when constructing row objects
## API
- [ ] This is an API breaking change to the SDK
*If the API is breaking, please state below what will break*
## Requires SpacetimeDB PRs
https://github.com/clockworklabs/SpacetimeDB/pull/2725
## Testsuite
SpacetimeDB branch name: jgilles/perf/faster-allocation
## Testing
*Write instructions for a test that you performed for this PR*
- [x] Blackholio
- [x] Bitcraft (have done a basic test but no in-depth testing)
This purges the DbValue type, instead using row instances themselves as
primary key for rows without primary keys. In addition, it instantiates
only a single BinaryReader when reading updates for a table, rather than
instantiating a BinaryReader and performing an array copy per-row of the
table.
Addresses
https://github.com/clockworklabs/SpacetimeDBPrivate/issues/1633
## API
- [ ] This is an API breaking change to the SDK
*If the API is breaking, please state below what will break*
## Requires SpacetimeDB PRs
## Testsuite
SpacetimeDB branch name: master
## Testing
*Write instructions for a test that you performed for this PR*
- [ ] CI
---------
Co-authored-by: rekhoff <r.ekhoff@clockworklabs.io>
## Description of Changes
*Describe what has been changed, any new features or bug fixes*
- Bumps version to 1.1.4
## API
Not breaking
- [ ] This is an API breaking change to the SDK
*If the API is breaking, please state below what will break*
## Requires SpacetimeDB PRs
*List any PRs here that are required for this SDK change to work*
## Testsuite
*If you would like to run the your SDK changes in this PR against a
specific SpacetimeDB branch, specify that here. This can be a branch
name or a link to a PR.*
SpacetimeDB branch name: master
## Testing
*Write instructions for a test that you performed for this PR*
This is just a version bump
## Description of Changes
*Describe what has been changed, any new features or bug fixes*
- Bumps version to 1.1.3
## API
This is not an API breaking change
- [ ] This is an API breaking change to the SDK
*If the API is breaking, please state below what will break*
## Requires SpacetimeDB PRs
*List any PRs here that are required for this SDK change to work*
- None
## Testsuite
*If you would like to run the your SDK changes in this PR against a
specific SpacetimeDB branch, specify that here. This can be a branch
name or a link to a PR.*
SpacetimeDB branch name: master
## Testing
*Write instructions for a test that you performed for this PR*
This is just a version bump, CI is sufficient.
This dramatically improves performance by avoiding the default
implementation of BrotliStream.ReadByte() inherited from Stream, which
allocates an array per byte read.
## API
- [ ] This is an API breaking change to the SDK
*If the API is breaking, please state below what will break*
## Requires SpacetimeDB PRs
## Testsuite
SpacetimeDB branch name: master
## Testing
*Write instructions for a test that you performed for this PR*
- [ ] Describe a test for this PR that you have completed
## Description of Changes
Bumping the version since 1.1.1 has been released.
## API
No breaking changes
## Requires SpacetimeDB PRs
None
## Testsuite
SpacetimeDB branch name: master
## Testing
None, just a version bump.
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
## Description of Changes
Just bumping the DLLs for a version number update. No actual changes.
## API
No breaking changes
## Requires SpacetimeDB PRs
## Testsuite
SpacetimeDB branch name: master
## Testing
Just existing CI. This only bumps versions.
---------
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>