Commit Graph

117 Commits

Author SHA1 Message Date
Zeke Foppa 677bc584e1 Merge remote-tracking branch 'origin/master' into unified 2024-08-28 10:49:00 -07:00
Ingvar Stepanyan 49fce299f9 Use wildcard for unsupported DLL cleanup 2024-08-21 21:13:42 +01: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 87055a788b Delete .vscode/launch.json 2024-08-06 17:18:59 +01:00
Ingvar Stepanyan d0b4e879d4 Add comment for packages dir 2024-08-05 19:58:04 +01:00
Ingvar Stepanyan 5a41fe42d6 Fix build 2024-08-05 19:55:32 +01:00
Ingvar Stepanyan 0fd4091fe8 Bump 2024-08-05 18:14:04 +01:00
Ingvar Stepanyan 2663fb8fd8 More fixes for restore 2024-08-05 17:51:52 +01:00
Ingvar Stepanyan 0983d21584 Commit some more meta files 2024-08-05 16:44:04 +01:00
Ingvar Stepanyan 2279633239 More meta files 2024-08-05 14:38:08 +01:00
Ingvar Stepanyan 9ce9c89353 Merge Unity files into this repo 2024-08-05 14:16:53 +01: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
Ingvar Stepanyan 8db08a7354 Switch to TaskCompletionSource (#89)
## Description of Changes

There is only one place where we use Channels, and it's to create and await a channel with one element - which is functionally the same as a more precise and low-weight TaskCompletionSource.

Switching also makes the SDK compatible with the widely supported .NET Standard 2.1 subset, which is supported natively in Unity and allows to remove a custom System.Threading.Channels package from Unity SDK dependencies.

## 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-13 17:07:28 +01:00
Ingvar Stepanyan c8319ebb98 Simplify event dispatch in WebSocket (#90)
## Description of Changes

Instead of using custom class hierarchy of messages, we can just use
native C# lambdas stored as Actions.

OnConnectError case can be further simplified by merging two branches
for different exception types into one.

## 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-13 17:05:43 +01:00
Ingvar Stepanyan 8ca04842c5 Add basic CI (#88) 2024-05-13 16:49:57 +01:00
Ingvar Stepanyan c925af1791 Fix conflict resolution shenanigans (#87) 2024-05-13 16:45:56 +01:00
Ingvar Stepanyan 1bb67c59a9 Remove RowUpdate event (#83)
We talked about this for a while, so decided to do this in a separate PR.
2024-05-10 22:41:23 +01:00
Ingvar Stepanyan ce38cd100b NFC: remove unused primaryKeyValue field (#85)
This field is only used in self-assignment, so can be safely removed.
2024-05-09 19:18:18 -04:00
Ingvar Stepanyan 6b5b23d5b8 Extract common logic from OnMessageProcessComplete (#81)
Minor refactoring that extracts common part of subscription and transaction update handling into a separate function, so that the main logic in `OnMessageProcessComplete` is a bit more straightforward and handles all event types with a sinlge `switch` instead of 3 separate `switch`es.

This is a small no-op step that makes further refactoring and optimisation of said common logic a bit easier.
2024-05-09 15:47:14 +01:00
Ingvar Stepanyan eaa8fa0894 Merge ByteArrayComparers (#78)
* Merge ByteArrayComparers

Merge various mismatched implementation of byte array comparison/hashing into a single utils class (choosing the most efficient implementation already present).

* Forward hex conversion too

* Use const for Identity & Address sizes
2024-05-08 10:03:18 -04:00
Ingvar Stepanyan 2fd9eb48ea Fix nullability warnings in WebSocket class (#82)
There is a bunch of nullability issues in the project; this PR fixes just the ones in WebSocket + some drive-by fixups and/or syntax simplifications.
2024-04-25 15:43:04 +01:00
Ingvar Stepanyan 383ba27324 Make logger a separate SDK setting from client instance (#79)
This allows to:

1. Have a preset logger that is already correctly matching the environment (console vs Unity).
2. Removes the need for explicit `SpacetimeDBClient.CreateInstance(...)` which is particularly awkward to use and easy to forget with singleton as it doesn't return a result as a factory method name could suggest. Instead, `SpacetimeDBClient.instance` is available on first use.
3. Slightly simplifies dependencies between classes, e.g. `ClientCache` doesn't need a circular dependency on `SpacetimeDBClient`, making future maintenance and changes a bit easier.
2024-04-24 17:51:53 +01:00
Ingvar Stepanyan f6aa76c733 Set language version to 9 (#80)
This is the last C# version supported by Unity.

While this PR doesn't require almost any C# code changes, I found that limiting the version is helpful for ensuring that I don't accidentally introduce Unity-incompatible code in larger PRs.
2024-04-24 15:34:17 +01:00
Ingvar Stepanyan 0ca2a5453d Nit: remove unused inserts field (#77) 2024-04-23 13:10:18 +01:00
Ingvar Stepanyan e649c49e80 Add Brotli decompression (#75)
C# client counterpart for https://github.com/clockworklabs/SpacetimeDB/pull/1026.
2024-03-29 11:45:52 -04:00