Commit Graph

148 Commits

Author SHA1 Message Date
Noa 2e0c9d2378 'Fix' insert_primitives_as_strings 2025-10-15 22:51:15 -05:00
Noa 16609893eb Fix most of sdk-test-ts 2025-10-15 22:43:49 -05:00
Noa 10f10064a9 Add SenderError 2025-10-15 16:18:19 -05:00
Noa 695ec1c730 Remove tsup from module-test-ts and fix workspace member 2025-10-15 16:17:53 -05:00
Noa ec09e9f56b Undo changes to syscall.rs 2025-10-15 16:14:05 -05:00
Noa 9ef19d4f8e [TS] Register describe_module/call_reducer through the sys module (#3404)
# Description of Changes

This exports the following API from `spacetime:sys@1.0`:

```ts
export type ModuleHooks = {
  __describe_module__(): Uint8Array;

  __call_reducer__(
    reducerId: u32,
    sender: u256,
    connId: u128,
    timestamp: bigint,
    argsBuf: Uint8Array
  ): { tag: 'ok' } | { tag: 'err'; value: string };
};

export function register_hooks(hooks: ModuleHooks);
```

This is then called by the `spacetimedb` package. This means that users
no longer need to export `__call_reducer__` and `__describe_module__`
from their own code, and differently from how it was before it doesn't
pollute the global namespace. It also means that the signatures for
`__call_reducer__` can be changed when we change the ABI version - the
bindings would then do `import { register_hooks } from
"spacetime:sys@2.0";` and that version of the function would expect a
different signature..

# Expected complexity level and risk

2 - it's a change, but not all that different from the existing way
we've been doing it.

# Testing, and also , and also 

<!-- 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] Automated testing
- [ ] <!-- maybe a test you want a reviewer to do, so they can check it
off when they're satisfied. -->
2025-10-14 17:40:57 -04:00
Noa f4106d6d04 Add quickstart-chat-ts 2025-10-14 14:01:07 -05:00
Noa 9d95af71e9 Add sdk-test-connect-disconnect-ts 2025-10-14 13:53:59 -05:00
Noa 08a2d478d1 Add clientVisibilityFilter 2025-10-14 13:53:59 -05:00
Noa bc8d62ff61 Add sdk test 2025-10-14 13:53:57 -05:00
Noa f6f062192e Remove indexed_option_field/unique_option_field 2025-10-12 11:11:41 -05:00
Tyler Cloutier d011e2b9d7 tyler/ts-module-api (#3383)
# Description of Changes

Changes into #3327 

# API and ABI breaking changes

None

# Expected complexity level and risk

2

# Testing

- [ ] None yet

---------

Co-authored-by: Noa <coolreader18@gmail.com>
2025-10-10 15:19:36 -05:00
Noa 50cbb1dff5 Namespacing 2025-10-10 14:40:32 -05:00
Noa 6a7b00797c Get working again 2025-10-10 14:40:31 -05:00
= a1e66503b0 Refactored module-test-ts to be closer to Rust 2025-10-10 14:40:31 -05:00
= 9e008e8f5c module-test-ts now compiles 2025-10-10 14:40:31 -05:00
= 86f429b42f lots and lots of goodies, getting there! 2025-10-10 14:40:30 -05:00
= 1bacfc3588 Fixed bug, added tests, and fixed broken tests related to binary reader 2025-10-10 14:40:30 -05:00
Noa fb06c134f5 Basic test module & final fixes 2025-10-10 14:40:30 -05: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