Commit Graph

11 Commits

Author SHA1 Message Date
Noa 695ec1c730 Remove tsup from module-test-ts and fix workspace member 2025-10-15 16:17:53 -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 bc8d62ff61 Add sdk test 2025-10-14 13:53:57 -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