
Security News
AI Slop Is Polluting Bug Bounty Platforms with Fake Vulnerability Reports
AI-generated slop reports are making bug bounty triage harder, wasting maintainer time, and straining trust in vulnerability disclosure programs.
@clockworklabs/spacetimedb-sdk
Advanced tools
This repository contains the TypeScript SDK for SpacetimeDB. The SDK allows to interact with the database server and is prepared to work with code generated from a SpacetimeDB backend code.
The SDK is an NPM package, thus you can use your package manager of choice like NPM or Yarn, for example:
npm install --save @clockworklabs/spacetimedb-sdk
You can use the package in the browser, using a bundler like vite/parcel/rsbuild, in server-side applications like NodeJS, Deno, Bun and in Cloudflare Workers.
NOTE: For usage in NodeJS 18-21, you need to install the
undici
package as a peer dependency:npm install @clockworklabs/spacetimedb-sdk undici
. Node 22 and later are supported out of the box.
In order to connect to a database you have to generate module bindings for your database.
import { DbConnection } from './module_bindings';
const connection = DbConnection.builder()
.withUri('ws://localhost:3000')
.withModuleName('MODULE_NAME')
.onDisconnect(() => {
console.log('disconnected');
})
.onConnectError(() => {
console.log('client_error');
})
.onConnect((connection, identity, _token) => {
console.log(
'Connected to SpacetimeDB with identity:',
identity.toHexString()
);
connection.subscriptionBuilder().subscribe('SELECT * FROM player');
})
.withToken('TOKEN')
.build();
If for some reason you need to disconnect the client:
connection.disconnect();
Typically, you will use the SDK with types generated from a backend DB service. For example, given a table named Player
you can subscribe to player updates like this:
connection.db.player.onInsert((ctx, player) => {
console.log(player);
});
Given a reducer called CreatePlayer
you can call it using a call method:
connection.reducers.createPlayer();
To run the tests, do:
pnpm compile && pnpm test
FAQs
SDK for SpacetimeDB
The npm package @clockworklabs/spacetimedb-sdk receives a total of 232 weekly downloads. As such, @clockworklabs/spacetimedb-sdk popularity was classified as not popular.
We found that @clockworklabs/spacetimedb-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AI-generated slop reports are making bug bounty triage harder, wasting maintainer time, and straining trust in vulnerability disclosure programs.
Research
Security News
The Socket Research team investigates a malicious Python package disguised as a Discord error logger that executes remote commands and exfiltrates data via a covert C2 channel.
Research
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.