Commit Graph

130 Commits

Author SHA1 Message Date
Noa bb43213245 Typescript module API (#3327)
# Description of Changes

Currently based on #3361 

Implements most of the TS module API (not yet a function for type
aliases).

# Expected complexity level and risk

<!--
How complicated do you think these changes are? Grade on a scale from 1
to 5,
where 1 is a trivial change, and 5 is a deep-reaching and complex
change.

This complexity rating applies not only to the complexity apparent in
the diff,
but also to its interactions with existing and future code.

If you answered more than a 2, explain what is complex about the PR,
and what other components it interacts with in potentially concerning
ways. -->

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

- [x] Extremely basic module stuff works
- [ ] <!-- maybe a test you want a reviewer to do, so they can check it
off when they're satisfied. -->

---------

Signed-off-by: Noa <coolreader18@gmail.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@aol.com>
Co-authored-by: = <cloutiertyler@gmail.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-10-16 14:58:50 +00:00
Kim Altintop 43389dd4e0 Make the .NET global.json file global (#3297)
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".
2025-09-30 16:39:21 +00:00
Phoebe Goldman ecc00cae40 Add reducer name to database log records (#3274)
# Description of Changes

Extends log records with a new field, `function`, which stores the name
of the reducer being executed when the log was produced. I have chosen
to name this field `function` rather than `reducer` because we will soon
be adding procedures, which are not reducers but will also be valid
values for this field.

While making this change, I noticed inconsistent values for injected
logs. Previously, we injected logs in three places, with different
values for the record fields:

1. `SystemLogger` (used when publishing and updating) set `filename:
Some("spacetimedb")` and `target: None`.
2. `log_reducer_error` (used for reducer error returns) set `filename:
None` and `target: Some(reducer)`, with `reducer` being the name of the
reducer.
3. `ModuleHost::inject_logs` (used for calls to nonexistent reducers and
calls with ill-typed arguments) set `filename: Some("external")` and
`target: None`.

With this change, I have decided that injected logs universally have
`filename: Some("__spacetimedb__")` and `target:
Some("__spacetimedb__")`. I have chosen the double-underscore convention
for reserved names to avoid confusion should a user name a source file
or reducer `spacetimedb`. I am not terribly attached to using
`spacetimedb` here, and would be happy to change to some other string,
like `internal` or `system`.

I have further decided that `log_reducer_error` and `inject_logs` both
have access to a sensible non-`None` value for `function` and so should
set it to the name of the reducer. The `target` field is not used for
this. Note that in cases where a client attempts to call a non-existent
reducer, the `function` field of the log record will be set to that
client-supplied non-existent reducer name.

# API and ABI breaking changes

Changes our log record format. This is at least backwards-compatible (as
in, newer consumers can read older logs) because the new field is
optional. I am unsure if it is forwards-compatible (as in, older
consumers reading newer logs) because I don't know if `serde_json` will
ignore unknown fields or will error.

# Expected complexity level and risk

1

# Testing

- [x] Manually ran `quickstart-chat` (modified to log messages and name
changes) and saw sensible output.
2025-09-23 16:01:26 +00:00
Shubham Mishra cfb185a235 rust: default macro (#3177)
# Description of Changes
PR introduces support for column-level default values via a new
`#[default(...)]` attribute.

It also validates, `default` macro is not used along with `primary_key`,
`unique` or `auto_inc`.

# API and ABI breaking changes

NA

# Expected complexity level and risk
2

# Testing
Start using macro in `module-test`.

---------

Co-authored-by: James Gilles <jameshgilles@gmail.com>
2025-09-16 08:39:52 +00:00
rekhoff 833f750c12 Uncommented out 'delete by index' test code (#3156)
# Description of Changes

Uncommented out code from test, in order to have "delete row by index"
test of C# module code ran.
This is the implementation of a fix for issue
https://github.com/clockworklabs/SpacetimeDB/issues/2233

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

- [X] Ran `dotnet run` and `dotnet test`, both returned no errors.
2025-08-26 21:19:42 +00:00
Zeke Foppa b9d30991f1 Fix remaining LICENSE files (#3193)
# Description of Changes

Apparently, I missed several license files in #3002. I'm not sure what
method I was using to find them, but apparently it was insufficient.

**This replaces all empty `LICENSE` files with an explicit (symlink to)
BSL license, and all apache licenses with symlinks to the root apache
license.** This PR does not intentionally change any license terms, so
if you see one that changed, **it's a mistake**.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

```bash
$ find . -name '*LICENSE*' -type f | grep -v '\.meta$'
./crates/sqltest/standards/LICENSE # this one is an external library that we are not allowed to re-license
./LICENSE.txt # this is the root license
```

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-08-22 19:36:47 +00:00
Zeke Foppa 83f52cad97 Blackholio import - README updates (#2947)
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-07-17 17:53:48 +00:00
Zeke Foppa cbba2b29c1 Fix up GitHub files related to TypeScript SDK (#2943)
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-07-16 19:32:04 +00:00
Noa 742303ca49 Bump rust-toolchain to rust 1.88 (#2749)
Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
2025-07-15 17:39:41 +00:00
Viktor Szépe f6da9e1f5f Fix typos (#2812)
Signed-off-by: Viktor Szépe <viktor@szepe.net>
2025-06-04 16:33:32 +00:00
Adrien Figueiredo d7d5306018 Update quickstart-chat README.md (#2727)
Signed-off-by: Adrien Figueiredo <43353685+Trobyss@users.noreply.github.com>
2025-05-16 18:35:13 +00:00
Rafael Guerreiro 0f70e63304 Simple implementation of insert_or_update and try_insert_or_update (#2678)
Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
2025-05-02 15:51:48 -04:00
Mazdak Farrokhzad c39f7fa64c Plain enums as index keys with specialized indices (#2506) 2025-04-09 18:52:15 +00:00
joshua-spacetime aac7894aac Feature gate [ClientVisibilityFilter] in C# (#2556) 2025-04-08 20:42:00 +00:00
joshua-spacetime ec30c0b048 Add rls to the subscription api (#2546) 2025-04-04 21:12:39 +00:00
Mario Montoya 4ade692700 Update formatting of timestamps and identities in PsqlFormatter (#2486) 2025-04-02 16:53:27 +00:00
joshua-spacetime 20e92ced5a Feature gate #[client_visibility_filter] (#2528) 2025-03-31 23:15:24 +00:00
james gilles 13dfb03135 Add [ClientVisibilityFilter] to csharp module library (#2481) 2025-03-28 19:03:13 +00:00
Mario Montoya ee7970e752 Add .cargo/config.toml to spacetime init Rust project with default target to wasm (#2328) 2025-03-26 14:34:32 +00:00
joshua-spacetime 25abdd5857 fix: bag semantics for joins (#2398) 2025-03-11 18:33:07 +00:00
Mario Montoya 04fd294627 Add missing LICENSE (#2319) 2025-02-28 14:32:59 +00:00
Mazdak Farrokhzad b34caf8306 Rust SDK: Deduplicate rows accross queries (#2286)
Signed-off-by: Mazdak Farrokhzad <twingoow@gmail.com>
Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
2025-02-21 21:12:29 +00:00
Mario Montoya 32e24b4095 Add README.md to all modules in SpacetimeDB/modules describing their usage (#2282) 2025-02-19 17:03:34 +00:00
Mazdak Farrokhzad 224f7b6808 keynote-benchmarks: measure the hot latency in 'roundtrip' (#2264) 2025-02-17 14:51:42 +00:00
Mazdak Farrokhzad fe68fe6f98 Add keynote-benchmarks (#2252) 2025-02-11 22:05:32 +00:00
Phoebe Goldman aedc601145 Rename Address to ConnectionId (#2220)
Signed-off-by: Phoebe Goldman <phoebe@goldman-tribe.org>
Co-authored-by: James Gilles <jameshgilles@gmail.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
2025-02-10 00:40:16 +00:00
Tyler Cloutier e54a28584a Standardized module names and added module-test-cs based on module-test (#2232) 2025-02-09 05:58:19 +00:00
Phoebe Goldman 91327d585e Make Timestamp a special SATS type (#1836)
Signed-off-by: Phoebe Goldman <phoebe@goldman-tribe.org>
Co-authored-by: James Gilles <jameshgilles@gmail.com>
Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
2025-02-07 18:17:53 +00:00
Ingvar Stepanyan 88090ec73a Rewrite C# codegen to the new Lang infra + fixes (#2184)
Co-authored-by: James Gilles <jameshgilles@gmail.com>
2025-02-05 22:07:45 +00:00
Tyler Cloutier 85ffb2838c Fixed issues with the Rust module quickstart-chat README.md (#2154)
Signed-off-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
2025-01-24 18:24:14 +00:00
Ingvar Stepanyan 972d775840 Fix & test row deletion API (#2146)
Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
2025-01-23 00:53:15 +00:00
Noa cf6ac18eaf Lookup lifecycle reducers by lifecycle flag, not by name (#2132) 2025-01-17 23:21:52 +00:00
Phoebe Goldman dc0bdce324 Rework RLS macro for amended syntax (#2105)
Signed-off-by: Phoebe Goldman <phoebe@goldman-tribe.org>
Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
2025-01-14 21:21:35 +00:00
Phoebe Goldman 44d7b76d29 Fix defining multiple tables on the same struct in Rust modules (#2103) 2025-01-10 01:58:20 +00:00
Ingvar Stepanyan 79a9c712f0 Implement new C# index syntax (#2078) 2025-01-07 20:58:17 +00:00
Ingvar Stepanyan 40faad6e2e Implement ctx.Identity for C# (#2091) 2025-01-07 20:45:27 +00:00
Ingvar Stepanyan 763ba5ef5c Enforce .NET 8 SDK for new C# modules (#2046) 2025-01-07 20:40:56 +00:00
Phoebe Goldman a4b46c5ddb Implement the identity host call and ctx.identity() in Rust (#2085) 2025-01-03 19:09:34 +00:00
Noa 4015237f6a Tweak scheduled_at macro syntax (#2054) 2025-01-02 18:26:44 +00:00
Ingvar Stepanyan 08a3f3210b Migrate C# ModuleDef to V9 (#1670) 2024-12-16 21:49:42 +00:00
james gilles b9b36d5de1 Fix declaration order of ScheduleAt in C# (#2007)
Co-authored-by: Tyler Cloutier <cloutiertyler@aol.com>
2024-12-10 05:07:48 +00:00
Zeke Foppa a5feed08b0 Remove IO macros (#1929)
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2024-12-03 19:39:24 +00:00
Noa 94c66c97da Don't autogen schedule fields (#1894)
Co-authored-by: Phoebe Goldman <phoebe@goldman-tribe.org>
2024-11-22 18:39:39 +00:00
Ingvar Stepanyan a7a1d36535 Run and test benchmarks against C# as well (#1965)
Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
2024-11-15 17:27:11 +00:00
Ingvar Stepanyan 6d712b4b0d Simplify benchmarking wrappers (#1951) 2024-11-06 17:21:56 +00:00
Mario Montoya cb9e0176e6 Fix benches for ia_loop, circles (#1922) 2024-11-05 14:50:31 +00:00
Ingvar Stepanyan 0935b7346b Fix Find() with struct-based rows (#1917) 2024-10-29 21:33:59 +00:00
Phoebe Goldman 437eed7760 Rust modules: Revise BTreeIndexBounds (#1815) 2024-10-22 14:49:32 +00:00
Mario Montoya 637d6d77b2 RLS: Adding a new filter! macro (#1849)
Signed-off-by: Mario Montoya <mamcx@elmalabarista.com>
Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
2024-10-17 18:31:22 +00:00
Jeremie Pelletier 02b70d5c94 c# client generate (#1707) 2024-10-04 04:12:15 +00:00