Commit Graph

130 Commits

Author SHA1 Message Date
Jeremie Pelletier 483a9cdb2b Add DbConnection argument to OnConnect 2024-10-01 07:31:21 -04:00
Jeremie Pelletier 9d7bcad408 Format + meta 2024-09-30 09:38:11 -04:00
Jeremie Pelletier 7517dbef86 Space 2024-09-30 09:34:45 -04:00
Jeremie Pelletier 7e932cdacd Internal onConnect 2024-09-30 09:31:30 -04:00
Jeremie Pelletier 925a8b6a10 Remove commented code 2024-09-29 08:22:19 -04:00
Jeremie Pelletier ff55aebe0f Remove unneeded IReducerArgs.InvokeHandler 2024-09-29 08:17:18 -04:00
Jeremie Pelletier 2809fa8366 dotnet format 2024-09-29 01:44:06 -04:00
Jeremie Pelletier 7a620934dc Logger 2024-09-29 01:41:39 -04:00
Jeremie Pelletier fa528ff5a0 Missing files 2024-09-29 01:36:29 -04:00
Jeremie Pelletier 8ef600c4fd sdk callbacks 2024-09-29 01:34:19 -04:00
Ingvar Stepanyan c5b2be6ffe Fixup type bounds 2024-09-29 01:33:45 -04:00
Ingvar Stepanyan 0e566151a6 Rename example back
Fixes sln path.
2024-09-29 01:33:45 -04:00
Jeremie Pelletier bf7366b5a0 Review feedback 2024-09-29 01:33:45 -04:00
Jeremie Pelletier b661bff83c Review feedback 2024-09-29 01:33:45 -04:00
Jeremie Pelletier 2cb655369f c# client SDK 2024-09-29 01:33:45 -04:00
SteveGibson 589d40480f Logging API (#132)
## Description of Changes
*Describe what has been changed, any new features or bug fixes*

Changed logging based on [this
proposal](https://github.com/clockworklabs/SpacetimeDBPrivate/pull/981)

## API

 - [x] This is an API breaking change to the SDK

*If the API is breaking, please state below what will break*

Logging interface is different now. `Logger` has been renamed to `Log`,
and its methods have been renamed as well (ex. `Logger.LogError` is now
`Log.Error`)


## Requires SpacetimeDB PRs
*List any PRs here that are required for this SDK change to work*

---------

Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
Co-authored-by: Jeremie Pelletier <jeremiep@gmail.com>
Co-authored-by: Steve Boytsun <steve@clockwokrlabs.io>
Co-authored-by: Ingvar Stepanyan <me@rreverser.com>
2024-09-23 13:52:50 -04:00
Zeke Foppa 6312c455f3 Copy files from old repo (#127)
## Description of Changes
For some reason, this repo was not quite properly synced up with the
state of
https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk-archive
after https://github.com/clockworklabs/spacetimedb-csharp-sdk/pull/117.

It's unclear to me how this happened, since the current state seems to
be compatible with 0.11, but the [0.11 release
commit/PR](https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk-archive/commit/382cce05fecbc00caf7c7d060fbde9a2854ad981)
also bumped the `package.json` version, which didn't happen in this
repo.

I re-copied files over. Fortunately, the only real changes were to
`package.json` and `README.md`.

## API
No breaking changes.

## Requires SpacetimeDB PRs
None

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2024-09-09 19:27:55 -05:00
Mazdak Farrokhzad 2422b8cce1 Nix Primitives.cs - types now defined in main repo (#120)
## Description of Changes

These types have been moved to the main repo, where they are used by
bindings-csharp as well.

## Requires SpacetimeDB PRs

- https://github.com/clockworklabs/SpacetimeDB/pull/1477

---------

Co-authored-by: Ingvar Stepanyan <me@rreverser.com>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2024-08-29 09:32:11 -07:00
Jeremie Pelletier 5670db6fe6 Update DEVELOP.md to reflect new codegen (#119)
Also ran it again, committing a few generation changes too :)
2024-08-29 09:32:11 -07:00
Zeke Foppa 341be7f582 Restore dotnet pack functionality (#118)
## Description of Changes
Single-line change so that `dotnet pack` stops complaining that nothing
was generated.

Per @RReverser this brings this package more in line with our other C#
packages.

## API
Nah nothing breaking.

## Requires SpacetimeDB PRs
Nope

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2024-08-29 09:32:11 -07:00
Mazdak Farrokhzad e57e5896ca Don't use BuiltinType.I/U128, use AlgebraicType.I/U128 (#116)
## Description of Changes

Required to make "SDK Tests" pass in
https://github.com/clockworklabs/SpacetimeDB/pull/1559.

## API

Not breaking.

## Requires SpacetimeDB PRs

- https://github.com/clockworklabs/SpacetimeDB/pull/1559

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2024-08-29 09:32:11 -07:00
Zeke Foppa e28849e22c Revert master to a stable state (#123)
## Description of Changes
Revert `master` to the original state of this PR:
https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk/issues/53.

We should prevent merging into `master` from now on, since the
repositories are now merged.

## 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*

## Testing
I loaded a bitcraft world and ran around.

I used the versions listed here:
https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk-archive/pull/57

---------

Co-authored-by: Ingvar Stepanyan <me@rreverser.com>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2024-08-29 12:21:48 -04:00
Ingvar Stepanyan cb59ebac99 Merge Unity SDK into C# SDK (#117)
## Description of Changes

This creates a frankenstein monster of a repo that is compatible with
both .NET / MSBuild as well as can be consumed as a Unity package.

- `.meta` files, Unity manifests and Unity README were copied over from
the Unity repo.
- `examples` and `tests` folders were renamed to `examples~` and
`tests~` correspondingly, as the `~` suffix is the only way to get
entire folders ignored by Unity.
- MSBuild was configured to change `bin` and `obj` to `bin~` and `obj~`
for the same reasons. This doesn't matter for the Git repo, but helpful
for local development where you don't want Unity to try and load local
DLL artifacts.
- NuGet was configured to restore Unity-compatible NuGet DLLs (and
delete others) in a local folder and committed to the repo - so, from
now on, we can easily update them by modifying `.csproj` and via
standard `dotnet restore` / `dotnet build`.

After this change, this repo should be compatible with both .NET CLI
(e.g. `dotnet test`) as well as consumable from Unity, but due to amount
of metadata changes, it needs further testing before we merge repos
properly.

Fixes #114.

## 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*

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2024-08-28 11:13:33 -07:00
Mazdak Farrokhzad 996633bebc Nix Primitives.cs - types now defined in main repo (#120)
## Description of Changes

These types have been moved to the main repo, where they are used by
bindings-csharp as well.

## Requires SpacetimeDB PRs

- https://github.com/clockworklabs/SpacetimeDB/pull/1477

---------

Co-authored-by: Ingvar Stepanyan <me@rreverser.com>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2024-08-13 21:02:39 +01:00
Jeremie Pelletier 2efa162ce9 Update DEVELOP.md to reflect new codegen (#119)
Also ran it again, committing a few generation changes too :)
2024-08-07 13:39:13 -04:00
Zeke Foppa 655c2ccb1d Restore dotnet pack functionality (#118)
## Description of Changes
Single-line change so that `dotnet pack` stops complaining that nothing
was generated.

Per @RReverser this brings this package more in line with our other C#
packages.

## API
Nah nothing breaking.

## Requires SpacetimeDB PRs
Nope

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2024-08-06 12:28:53 -07:00
Mazdak Farrokhzad 5394c639cd Don't use BuiltinType.I/U128, use AlgebraicType.I/U128 (#116)
## Description of Changes

Required to make "SDK Tests" pass in
https://github.com/clockworklabs/SpacetimeDB/pull/1559.

## API

Not breaking.

## Requires SpacetimeDB PRs

- https://github.com/clockworklabs/SpacetimeDB/pull/1559

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2024-08-06 12:06:17 -07:00
Ingvar Stepanyan 9fba1562ab Minor BSATN simplifications (#111)
## Description of Changes

Minor simplifications using BSATN helpers for Protobufectomy code.

Also removed unnecessary usings and a pattern.

## 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*
2024-07-29 12:20:25 +01:00
Zeke Foppa cd5f44b316 CI - push events only trigger on pushes to master (#110)
## Description of Changes
Currently, a push to a PR triggers our `dotnet` workflows twice: once
for the `push` event, and once for the `pull_request` event.

This PR brings the CI behavior in line with how SpacetimeDB does it.

(Someday we should reduce the number of `pull_request` events that
trigger this, but today is not that day).

---------

Co-authored-by: Zeke Foppa <github.com/bfops>
2024-07-26 15:40:03 +00:00
Ingvar Stepanyan 554df35b31 0.11 upgrades (#101)
## Description of Changes

- Roslyn codegen won't need to be added as a separate dependency
anymore.
- ByteArrayComparer, Identity, and Address will now live in
BSATN.Runtime so that they're reused between the client and module SDKs.

## API

 - [ ] This is an API breaking change to the SDK

*If the API is breaking, please state below what will break*


## Requires SpacetimeDB PRs

- [x] https://github.com/clockworklabs/SpacetimeDB/pull/1440
- [ ] https://github.com/clockworklabs/SpacetimeDB/pull/1455

---------

Co-authored-by: Zeke Foppa <github.com/bfops>
2024-07-25 17:18:45 +01:00
Zeke Foppa 5e065065b5 CI - Use SpacetimeDB master when applicable (#108)
## Description of Changes
Our CI now uses the packages from SpacetimeDB's `master` branch when
applicable.

## Testing
- [x] CI passes in test PR merging in the 0.11 upgrades:
https://github.com/clockworklabs/spacetimedb-csharp-sdk/pull/109

---------

Co-authored-by: Zeke Foppa <github.com/bfops>
2024-07-24 21:46:07 +01:00
Jeremie Pelletier 706b945103 Revert breaking change in message preprocessing (#106)
## 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*
2024-07-13 00:36:21 +08:00
Jeremie Pelletier 06285d3c06 Protobufectomy: c# sdk (#104)
## Description of Changes

- Removed JSON support (similar to changes being made on the TypeScript
side)
- Removed all references to protobuf
- Swapped the protobuf codegen for the output of our own C# codegen in
rust
- Refactored the connection class to reflect the API changes from
protobuf to bsatn
- Updated the example to reflect these changes

## API

 - [ ] This is an API breaking change to the SDK

Changes the SDK types passed into event handlers.


## Requires SpacetimeDB PRs
*List any PRs here that are required for this SDK change to work*
2024-07-11 13:40:32 -04:00
Ingvar Stepanyan 7e8a6ed876 Update test snapshots 2024-06-17 21:05:18 +01:00
Ingvar Stepanyan 27120e8242 Move Verify converters around 2024-06-17 11:50:42 +01:00
Ingvar Stepanyan 9c01734a1e Simplify Identity scrubbing 2024-06-17 11:48:04 +01:00
Ingvar Stepanyan e345452304 Fix formatting 2024-06-15 23:43:06 +01:00
Ingvar Stepanyan 21e475b1cc Add Stats snapshot 2024-06-15 23:40:38 +01:00
Ingvar Stepanyan 17ce57ffe1 Store test dump in a maintainable format 2024-06-15 23:24:15 +01:00
Ingvar Stepanyan 40f6138c4c Update API docs 2024-06-15 22:08:20 +01:00
Ingvar Stepanyan 0267f02332 Add snapshot-based tests 2024-06-15 22:04:50 +01:00
Ingvar Stepanyan b648b9ca88 Autoformat & verify on CI 2024-06-15 16:45:43 +01:00
Zeke Foppa 53d6f9c3ed Release v0.10.0 (#98)
## Description of Changes

Changes for release 0.10.

---------

Co-authored-by: Zeke Foppa <github.com/bfops>
Co-authored-by: Ingvar Stepanyan <me@rreverser.com>
2024-06-13 22:51:31 +01:00
Ingvar Stepanyan 7bafc7f1c7 Switch to shared BSATN support (#97)
## Description of Changes

See https://github.com/clockworklabs/SpacetimeDB/pull/1312 for the main
description and API breakages.

In the process extracted and simplified various common bits from
generated code into the SDK itself to make generated code more concise.

 - Closes #67.
 - Closes #68.
 - Closes #73.
 - Closes #76.

## API

 - [x] 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/1312
2024-06-07 20:22:59 +01:00
Zeke Foppa 92f5a17ba7 Bump version to 0.9.2 (#95)
## Description of Changes
Just bumps the version number. Since 0.9.1 has been released, we are now
on 0.9.2+!

## 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*

Co-authored-by: Zeke Foppa <github.com/bfops>
2024-05-28 15:48:11 -04:00
Ingvar Stepanyan 4819292d74 Simplify update handling as per consistent filtering proposal (#93)
## Description of Changes

As a result of the consistent filtering rules proposal
(clockworklabs/SpacetimeDB#1256), all equatable types are now natively
equatable in C# as well.

This allows us to compare objects directly, without holding and
comparing AlgebraicValue in the entries map as well, which has a bit of
a domino effect and allows to optimise, simplify or even remove some
parts of the SDK.

## API

 - [x] This is an API breaking change to the SDK

New filtering rules limit types on which filtering can be done, as well
as change the return type of `FilterBy` functions to always be iterable.

## Requires SpacetimeDB PRs

https://github.com/clockworklabs/SpacetimeDB/pull/1277
2024-05-28 15:23:20 +01:00
Ingvar Stepanyan ed6a3aac38 Ignore duplicate inserts in the same subscription update (#92)
## Description of Changes

Ignore duplicate inserts in the same subscription update

## 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*
2024-05-27 12:49:44 -05:00
Kurtis Mullins 1af72339f0 Bump version for release v0.9 (#94)
## Description of Changes

Bumped the version number to 0.9.0 as this was forgotten in the previous
release. Includes all changes to date.

## API

 - [X] This is an API breaking change to the SDK

*If the API is breaking, please state below what will break*

Not sure but its going out with the latest release. The previous package
was 5 months ago.

## Requires SpacetimeDB PRs
*List any PRs here that are required for this SDK change to work*
2024-05-22 17:49:34 +01:00
Ingvar Stepanyan 125c5e7bc2 NFC: inline insert/delete update handling (#86)
## Description of Changes

Instead of a separate TableOp enum, and 4 fields to handle insert/delete
metadata in DbOp, use a nullable struct that contains non-nullable
object + bytes pair internally:

- if `insert` is present (non-nullable) and `delete` is nullable, that
naturally indicates insert operation
- if `insert` is nullable and `delete` is not, that's a delete
- if both are non-nullable, it's an update
- if both are null, it's an internal "no change" state

This simplifies and shortens update handling as well as reduces risk of
state getting out of sync - e.g. TableOp saying that the operation is
insert should exist but field containing inserted value being null. Now
nullable struct itself communicates whether there is an insert or not,
without a separate enum.

## 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*
2024-05-14 12:48:52 +01:00
Ingvar Stepanyan 6ba3da5466 Minor refactoring of AuthToken (#84)
## Description of Changes

Initially just fixed the nullability issues / warnings, but in the
process did a few more minor drive-by refactorings.

## 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*
2024-05-14 12:45:22 +01:00