Commit Graph

165 Commits

Author SHA1 Message Date
Zeke Foppa bd8d191262 Add repo migration notice workflows (#3127)
# Description of Changes

Added a repo migration notice workflow to each repository that we've
merged into SpacetimeDB.

These need to be mirrored back to the actual repos with a process like:
```bash
git subtree split --prefix=sdks/typescript -b release/typescript
git push -f git@github.com:clockworklabs/spacetimedb-typescript-sdk.git release/typescript:main
git branch -D release/typescript
```

Once they're migrated there, the bot will automatically comment on any
PR or issue opened in those repos.

# API and ABI breaking changes

None. CI-only changes.

# Expected complexity level and risk

2

# Testing

- [x] In a demo repo, it properly commented and closed a PR:
https://github.com/clockworklabs/github-tooling-test/pull/42
- [x] In a demo repo, it properly commented and closed an issue:
https://github.com/clockworklabs/github-tooling-test/issues/43

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-08-05 20:30:42 +00:00
Zeke Foppa f8ccfa390a TypeScript - Bump version to 1.3.1 for release (#3123)
# Description of Changes

We want to release #2980 for the TS SDK, so I'm bumping our version
number.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

None, just a version bump.

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-08-05 17:19:25 +00:00
Tyler Cloutier 81e192e46e Addresses #2969 (#2980)
# Description of Changes

The `ScheduleAt` type appears to have an outdated structure. I've
updated the structure of the `ScheduleAt` type represented in TypeScript
to be in line with the Rust type:
https://docs.rs/spacetimedb/latest/spacetimedb/enum.ScheduleAt.html

Namely, we were missing the inner Spacetime library types of
`TimeDuration` and `Timestamp`.

This is to address #2969.

# API and ABI breaking changes

This is an API breaking change in that it changes the API, but it's
breaking in that it fixes a bug.

# Expected complexity level and risk

2

# Testing

I have not done additional testing, but I thought I would get this PR
started to make it easier for the next person who comes along.

The ideal automated test to add would be one which connects a TypeScript
client to a SpacetimeDB module with a scheduled table, and verifies that
the type is correctly deserialized and represented in TypeScript when
the rows are sent down.

---------

Co-authored-by: Jeffrey Dallatezza <jeffreydallatezza@gmail.com>
2025-08-01 16:22:45 +00:00
Zeke Foppa 2d6ed469bd Bump versions to 1.3.0 (#3005)
# Description of Changes

Bumped all versions to 1.3.0 in preparation for an upcoming minor
release.

# API and ABI breaking changes

No breaking changes.

# Expected complexity level and risk

1

# Testing

None

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-07-30 19:16:16 +00:00
Zeke Foppa bda98c31a9 TypeScript - Bump package version to 1.2.3 (#2997)
# Description of Changes

Bumping this in preparation for an upcoming release.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

None, just a version bump

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-07-29 03:59:43 +00:00
Julien Lavocat 19fa2bb906 Add React Native support to the Typescript SDK (#2955)
This PR helps to support React Native in the Typescript SDK. We have
identified two issues:

1. Certain versions of React Native exhibit a bug where the constructor
mistakenly treats a URL object as a string. This causes an error when
the constructor attempts to call `.endsWith()` on the URL object,
leading to runtime errors. This PR adds a .toString() call when passing
a URL instance to the URL constructor.
2. React Native doesn't provide an implementation for TextEncoder and
TextDecoder which are used to read/write strings in our binary reader
and writer. This PR use introduce the usage of a library for these two
types.

Note: this still requires the use of a Polyfill as React Native URL
implementation is missing most methods in version older than 0.79 (>= 6
month old)
2025-07-28 17:08:01 +00:00
Zeke Foppa f74cefc64f 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
Zeke Foppa 6414ec874f Release 1.2.2 (#200)
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-07-15 11:08:48 -07:00
Julien Lavocat 28c534dea6 Use toString() instead of an instance of Url when opening the websocket connection 2025-07-15 19:15:06 +02:00
Jeffrey Dallatezza 5579f1bf7a Improve performance of row ids (#180)
* Get it working with base64 encoded row ids, and start adding the better way for indexing.

* Use concat to avoid creating too many arguments for big updates.

* Use primitives as rowIds

* Remove OperationsMap

* Add some table cache tests and regen stuff.

* Cleanup

* revert accidental cargo change.

* Add semver parsing.

* Add a minimum version check.

* Use qmark syntax.

* Regen quickstart-chat bindings with 1.2.0 cli

* Bump minimum codegen version.

* Regen test app with 1.2
2025-07-14 10:09:12 -07:00
Zeke Foppa 5a9e8d3c7e CI - Test that quickstart-chat builds (#197)
* Test quickstart-chat in CI

* fix?

* ignore diffs containing SpacetimeDB commit

* prettier config

* fix?

* [REVERT THIS TEST COMMIT] add diff to module bindings

* revert previous test commit

* [REVERT THIS TEST COMMIT] introduce a typechecking error

* revert previous test commit

* tiny review

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-07-09 09:47:01 -07:00
Jeffrey Dallatezza bbd9aa2e06 Require a minimum code gen version (#186)
* Add semver parsing.

* Add a minimum version check.

* Use qmark syntax.

* Regen quickstart-chat bindings with 1.2.0 cli

* Bump minimum codegen version.

* Regen test app with 1.2
2025-07-07 12:07:11 -04:00
Zeke Foppa 92cd145186 Bump version to 1.2.1 for release (#196)
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-06-25 15:12:37 -07:00
Jeffrey Dallatezza 13b6392199 Use the temporary auth token. (#195) 2025-06-25 15:04:36 -07:00
Chip f47c39aee2 Update db_connection_impl.ts (#194)
fix for https://github.com/clockworklabs/SpacetimeDB/issues/2896
2025-06-25 10:36:34 -07:00
github-actions[bot] 4da9543008 Release 1.2.0 (#190)
* Version Packages

* revert major version bump

* changelog

* fix changelog

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-06-18 11:24:04 -07:00
Zeke Foppa f62d70bddd Release 1.2.0 (#187)
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-06-17 09:32:55 -07:00
Jeffrey Dallatezza 3a3ab31aec Handle falsy option values (#188) 2025-06-16 10:42:42 -07:00
Jeffrey Dallatezza a8426ae5d7 Run lint for PRs. (#184)
* Run lint for PRs.

* Fix dir

* Also hide changes to generated test app files.

* Only run on pushes to main.
2025-05-06 14:27:07 -07:00
ChaseLewis 95183519fd Fix so spacetimedb can be hosted with a pathname (#183)
* Allow spacetimedb sdk to work when spacetimedb url is more than a host name.

* run pnpm format

---------

Co-authored-by: DeveloperChaseLewis <developer.chase.lewis@gmail.com>
2025-05-01 12:06:53 -07:00
Jeffrey Dallatezza b3032ca032 Subscribe to all the subscriptions together in the quickstart example. (#173) 2025-04-23 07:59:19 -07:00
Bastian Ganze c4bdec6d27 Make ws connection fail when token is invalid (#176)
* Make ws connection fail when token is not verified

* add changeset

---------

Co-authored-by: Jeffrey Dallatezza <jeffreydallatezza@gmail.com>
2025-04-22 11:36:17 -07:00
Zeke Foppa 49df0456a3 Remove .changeset/pre.json (#177)
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-04-21 11:41:01 -07:00
Zeke Foppa d305d36395 1.1.0 release (#170)
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-04-15 18:52:15 -07:00
John Detter 98267028d6 License Apache2 (#172)
Co-authored-by: John Detter <no-reply@boppygames.gg>
2025-04-14 16:11:43 +01:00
John Detter be2359dc99 Version upgrade to 1.0.3 (#162) 2025-03-14 21:11:05 -07:00
Jeffrey Dallatezza e9ff4677af Reverse byte order when converting to/from hex strings (#161) 2025-03-14 16:00:45 -04:00
Jeffrey Dallatezza c2810e1cda Fix some subscription lifecycle issues. (#158)
* Fix some subscription lifecycle issues.

* remove the subscription after an error.
2025-03-14 11:23:00 -07:00
John Detter 828364b20e Version 1.0.2 (#152)
Co-authored-by: John Detter <no-reply@boppygames.gg>
2025-03-04 13:40:13 -06:00
Jeffrey Dallatezza d20326ee41 Set other url params even if we dont have an authToken. (#151) 2025-03-04 13:24:30 -06:00
John Detter 0d3719bb1d Bump version for release (#148)
Co-authored-by: John Detter <no-reply@boppygames.gg>
2025-02-28 16:47:35 -06:00
Jeffrey Dallatezza 4d68e530fc Handle duplicate rows and delay callbacks (#146)
* Regen the api types from the server.

* fmt the client api code

* Use the multi versions of subscription messages.

* Add ref counting of rows and delay callbacks.

* WIP debugging tests.

* Regen test app

* A lot of changes.

* Use new subscription api.

* remove commented out code.

* Fix update and cleanup.

* Fix path to spacetimedb

* Run tests before checking diff in CI

* Update packages/sdk/tests/db_connection.test.ts

Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>

* Update packages/sdk/tests/db_connection.test.ts

Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>

* Update packages/sdk/tests/db_connection.test.ts

Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>

* Update packages/sdk/tests/db_connection.test.ts

Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>

* Various cleanups.

* Comment out the CI test for the generated code being up to date.

* Regen.

* Add sed command.

---------

Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
2025-02-26 08:50:25 -08:00
Tyler Cloutier 9e21cac90b Disable SpacetimeDB integration test for now (#145) 2025-02-19 16:59:20 -05:00
Zeke Foppa 9bf45ecb9d bump versions to 1.0.0 (#126)
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-02-19 14:11:28 -05:00
Phoebe Goldman 325b72ea75 Import timestamp and duration by file, not from root (#139)
this fixes a circular import or circular definition problem that we don't fully understand.
2025-02-11 17:31:55 -05:00
Noa 143191d940 Reimplemented/rebased the changes Noa submitted (#134)
Co-authored-by: Tyler Cloutier <cloutiertyler@aol.com>
2025-02-11 01:01:46 -05:00
Noa 71561dc220 Switch to Bearer auth (#131) 2025-02-11 00:57:06 -05:00
Tyler Cloutier 10d5fc3270 DBConnection -> DbConnection + some comments (#137) 2025-02-11 00:56:16 -05:00
Tyler Cloutier 41c979a49b Implemented the new mutable subscriptions API (#135)
* Implemented the new subscriptions API

* Fixed the ../index thing

* Fixed the ../index thing for realz

* Fixes for Timestamp and TimeDuration

* Better error handling

* Fixed rebase issues

* lint

* Reduce diff

* lint
2025-02-11 00:45:48 -05:00
Tyler Cloutier 66b028b675 Now emitting UnknownTransaction (#138)
* Now emitting UnknownTransaction if reducer name is empty string or the reducer args are not parseable

* Fixed small bug

* Lint
2025-02-10 18:10:04 -05:00
Phoebe Goldman 107ce37dbe TypeScript SDK: Rename address to connection ID (#133)
* Rename address to connection ID

* Format
2025-02-10 16:02:58 -05:00
james gilles 1e3f3b86fb Add shared ScheduleAt type (#88)
* Add shared ScheduleAt type

* Lint

---------

Co-authored-by: Tyler Cloutier <cloutiertyler@aol.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
2025-02-08 13:29:27 -05:00
Phoebe Goldman 94682dda4f Add Timestamp to the SDK, moving it out of client_api (#114)
* Add `Timestamp` to the SDK, moving it out of `client_api`

Companion to SpacetimeDB#1836

* Add `TimeDuration` class

* Add forgotten return type annotation

* 🤦

* Prettier

* Update `client_api` schema to use `TimeDuration`

* Micros, not nanos

From SpacetimeDB 072c2ea3a3:

Prioritize BSATN and BFLATN compat with 0.12

Timestamp and TimeDuration store `micros: i64`, not `nanos: i64`.
This means that old commitlogs and snapshots should still be compatible,
assuming they don't include timestamps greater than `i64::MAX`,
as previously we used `micros: u64`. This seems unlikely.

* Ran new code gen

* Fixed rebase conflicts

---------

Co-authored-by: Tyler Cloutier <cloutiertyler@aol.com>
2025-02-08 13:26:45 -05:00
Tyler Cloutier 41c8919450 Updates the TypesScript SDK to use the new EventContext variants (#136)
* Updated the quickstart to use the new 1.0 API

* Ran prettier

* Updated CSS

* Removed server code

* Moved out of the client dir

* Updated lockfile

* Added new workflow

* Small fixes

* Updated PR template

* Ran prettier

* Fixes to workflwo

* Workflow fixes

* Fixes the toolchain thing

* Added SpacetimeDB integration test

* Fix workflow hopefully

* Fix workflow

* Prettier

* Updated pull request template to better reflect the reality

* Fixed path in workflow

* Prettier after codegen

* Regenerate

* Say yes to deleting data

* Updated codegen to latest master of SpacetimeDB

* debug actions

* Formatting

* Implemented EventContext update

* Removed unused imports

* Fix merge marker
2025-02-08 00:42:57 -05:00
Tyler Cloutier 453cb9d509 Updated the quickstart to use the new 1.0 API (#130)
* Updated the quickstart to use the new 1.0 API

* Ran prettier

* Updated CSS

* Removed server code

* Moved out of the client dir

* Updated lockfile

* Added new workflow

* Small fixes

* Updated PR template

* Ran prettier

* Fixes to workflwo

* Workflow fixes

* Fixes the toolchain thing

* Added SpacetimeDB integration test

* Fix workflow hopefully

* Fix workflow

* Prettier

* Updated pull request template to better reflect the reality

* Fixed path in workflow

* Prettier after codegen

* Regenerate

* Say yes to deleting data

* Updated codegen to latest master of SpacetimeDB

* debug actions

* Formatting

* add README steps

* Ran lints

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-02-07 21:29:07 -05:00
Phoebe Goldman bfe5b66abc Add subscribeToAllTables method (#129) 2025-01-23 21:38:09 -05:00
Phoebe Goldman bd923299ec Amend withCredentials to withToken (#128)
* Amend `withCredentials` to `withToken`

`withCredentials` was designed for our old auth model,
where tokens were always issued by the SpacetimeDB host alongside an `Identity`,
and therefore the bearer always knew their `Identity`.

In our new auth model,
a client may have a valid auth-able JWT but not know what `Identity` it will result in,
as the `Identity` is computed based on the hash of some of the token's contents,
and this hashing algorithm is not included in our client SDKs.
As such, this PR revises `withCredentials` to `withToken`, which just accepts the token.

* TypeScript puts ? on variables, not types

* Prettier
2025-01-22 17:31:40 -05:00
github-actions[bot] 3eefd091b5 Version Packages (rc1) (#115)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-11-07 02:17:32 +05:30
Mazdak Farrokhzad 9086eaf86e Companion to SpacetimeDB#1812 (light tx, ts) (#110)
* support TransactionUpdateLight and CallReducerFlags

* Run generate

* Push creds

* run prettier

* Add changeset

* Turn on withLightMode

---------

Co-authored-by: Puru Vijay <awesomepuruvj@gmail.com>
Co-authored-by: Puru Vijay <47742487+PuruVJ@users.noreply.github.com>
2024-11-06 12:34:46 -08:00
Puru Vijay 2c4da19c84 Update readme for rc1.0 (#123)
* Update readme

* rc1

* Update packages/sdk/README.md

---------

Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
2024-11-06 10:54:45 -08:00