Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/typescript-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
run_install: true

- name: Get pnpm store directory
working-directory: sdks/typescript
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
Expand All @@ -39,5 +38,4 @@ jobs:
${{ runner.os }}-pnpm-store-

- name: Lint
working-directory: sdks/typescript
run: pnpm lint
2 changes: 1 addition & 1 deletion .github/workflows/typescript-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
run: pnpm build

- name: Run SDK tests
working-directory: sdks/typescript/packages/sdk
working-directory: sdks/typescript
run: pnpm test

# - name: Extract SpacetimeDB branch name from file
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ pnpm-lock.yaml
dist
target
.github
coverage
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ members = [
"sdks/rust/tests/connect_disconnect_client",
"tools/upgrade-version",
"tools/license-check",
"sdks/typescript/packages/test-app/server",
"crates/bindings-typescript/test-app/server",
]
default-members = ["crates/cli", "crates/standalone", "crates/update"]
# cargo feature graph resolver. v3 is default in edition2024 but workspace
Expand Down
41 changes: 0 additions & 41 deletions crates/bindings-typescript/eslint.config.js

This file was deleted.

133 changes: 113 additions & 20 deletions crates/bindings-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,6 @@
"bugs": {
"url": "https://github.com/clockworklabs/SpacetimeDB/issues"
},
"source": "src/index.ts",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "src/index.ts",
"exports": {
".": {
"types": "./src/index.ts",
"source": "./src/index.ts",
"development": "./src/index.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"default": "./dist/index.mjs"
}
},
"files": [
"src",
"dist",
Expand All @@ -33,29 +19,136 @@
"license": "ISC",
"author": "Clockwork Labs",
"type": "module",
"sideEffects": false,
"scripts": {
"build": "tsc",
"format": "prettier --write .",
"lint": "eslint . && prettier . --check",
"build": "tsup",
"format": "prettier . --write --ignore-path ../../.prettierignore",
"lint": "eslint . && prettier . --check --ignore-path ../../.prettierignore",
"test": "vitest run",
"coverage": "vitest run --coverage",
"generate": "cargo run -p spacetimedb-codegen --example regen-typescript-moduledef && prettier --write src/autogen"
"brotli-size": "brotli-size dist/index.js",
"size": "pnpm -s build && size-limit",
"generate:moduledef": "cargo run -p spacetimedb-codegen --example regen-typescript-moduledef && prettier --write src/lib/autogen",
"generate:client-api": "cargo build -p spacetimedb-standalone && cargo run -p spacetimedb-client-api-messages --example get_ws_schema > ws_schema.json && cargo run -p spacetimedb-cli generate --lang typescript --out-dir src/sdk/client_api --module-def ws_schema.json && rm ws_schema.json && find src/sdk/client_api -type f -exec perl -pi -e 's#\\@clockworklabs/spacetimedb-sdk#../../index#g' {} + && prettier --write src/sdk/client_api",
"generate:test-app": "pnpm --filter @clockworklabs/test-app generate",
"generate": "pnpm generate:moduledef && pnpm generate:client-api && pnpm generate:test-app"
},
"source": "src/index.ts",
"main": "dist/index.cjs",
"module": "dist/index.mjs",
"types": "src/index.ts",
"exports": {
".": {
"types": "./src/index.ts",
"source": "./src/index.ts",
"development": "./src/index.ts",
"browser": "./dist/index.browser.mjs",
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"default": "./dist/index.mjs"
},
"./sdk": {
"types": "./src/sdk/index.ts",
"browser": "./dist/sdk/index.browser.mjs",
"import": "./dist/sdk/index.mjs",
"require": "./dist/sdk/index.cjs",
"default": "./dist/sdk/index.mjs"
},
"./server": {
"types": "./src/server/index.ts",
"import": "./dist/server/index.mjs",
"require": "./dist/server/index.cjs",
"default": "./dist/server/index.mjs"
}
},
"size-limit": [
{
"name": "cjs (brotli)",
"path": "dist/index.cjs",
"brotli": true,
"limit": "25 kB"
},
{
"name": "esm (brotli)",
"path": "dist/index.mjs",
"brotli": true,
"limit": "20 kB"
},
{
"name": "esm (gzip)",
"path": "dist/index.mjs",
"gzip": true,
"limit": "25 kB"
},
{
"name": "esm (uncompressed)",
"path": "dist/index.mjs",
"brotli": false,
"limit": "150 kB"
},
{
"name": "esm min (brotli)",
"path": "dist/min/index.mjs",
"brotli": true,
"limit": "10 kB"
},
{
"name": "esm min (gzip)",
"path": "dist/min/index.mjs",
"gzip": true,
"limit": "15 kB"
},
{
"name": "esm min (uncompressed)",
"path": "dist/min/index.mjs",
"brotli": false,
"limit": "60 kB"
},
{
"name": "sdk esm min (brotli)",
"path": "dist/min/sdk/index.browser.mjs",
"brotli": true,
"limit": "10 kB"
},
{
"name": "sdk esm min (gzip)",
"path": "dist/min/sdk/index.browser.mjs",
"gzip": true,
"limit": "15 kB"
},
{
"name": "sdk esm min (uncompressed)",
"path": "dist/min/sdk/index.browser.mjs",
"limit": "10 kB"
}
],
"dependencies": {
"@zxing/text-encoding": "^0.9.0",
"base64-js": "^1.5.1",
"prettier": "^3.3.3"
},
"peerDependencies": {
"undici": "^6.19.2"
},
"peerDependenciesMeta": {
"undici": {
"optional": true
}
},
"devDependencies": {
"@eslint/js": "^9.17.0",
"@size-limit/file": "^11.2.0",
"@typescript-eslint/eslint-plugin": "^8.18.2",
"@typescript-eslint/parser": "^8.18.2",
"@vitest/coverage-v8": "^3.2.4",
"brotli-size-cli": "^1.0.0",
"eslint": "^9.33.0",
"globals": "^15.14.0",
"size-limit": "^11.2.0",
"ts-node": "^10.9.2",
"tsup": "^8.1.0",
"typescript": "^5.9.2",
"typescript-eslint": "^8.18.2",
"vite": "^7.1.3",
"vite": "^7.1.5",
"vitest": "^3.2.4"
}
}
21 changes: 11 additions & 10 deletions crates/bindings-typescript/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
export * from './connection_id';
export * from './algebraic_type';
export * from './algebraic_value';
export { default as BinaryReader } from './binary_reader';
export { default as BinaryWriter } from './binary_writer';
export * from './schedule_at';
export * from './time_duration';
export * from './timestamp';
export * from './utils';
export * from './identity';
export * from './lib/connection_id';
export * from './lib/algebraic_type';
export * from './lib/algebraic_value';
export { default as BinaryReader } from './lib/binary_reader';
export { default as BinaryWriter } from './lib/binary_writer';
export * from './lib/schedule_at';
export * from './lib/time_duration';
export * from './lib/timestamp';
export * from './lib/utils';
export * from './lib/identity';
export * from './sdk';
export { default as t } from './server/type_builders';
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
} from '../../index';
import { SumType } from './sum_type_type';
// Mark import as potentially unused
declare type __keep_SumType = SumType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
} from '../../index';
import { AlgebraicType as AlgebraicTypeType } from './algebraic_type_type';
// Mark import as potentially unused
declare type __keep_AlgebraicTypeType = AlgebraicTypeType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
} from '../../index';
import * as IndexTypeVariants from './index_type_variants';

// The tagged union or sum type for the algebraic type `IndexType`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
} from '../../index';

export type BTree = { tag: 'BTree' };
export type Hash = { tag: 'Hash' };
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
} from '../../index';
import * as LifecycleVariants from './lifecycle_variants';

// The tagged union or sum type for the algebraic type `Lifecycle`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
} from '../../index';

export type Init = { tag: 'Init' };
export type OnConnect = { tag: 'OnConnect' };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
} from '../../index';
import { TypeAlias } from './type_alias_type';
// Mark import as potentially unused
declare type __keep_TypeAlias = TypeAlias;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
} from '../../index';
import { TypeAlias as TypeAliasType } from './type_alias_type';
// Mark import as potentially unused
declare type __keep_TypeAliasType = TypeAliasType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
} from '../../index';
import { AlgebraicType } from './algebraic_type_type';
// Mark import as potentially unused
declare type __keep_AlgebraicType = AlgebraicType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
} from '../../index';
import { ProductTypeElement } from './product_type_element_type';
// Mark import as potentially unused
declare type __keep_ProductTypeElement = ProductTypeElement;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
} from '../../index';
import { AlgebraicType } from './algebraic_type_type';
// Mark import as potentially unused
declare type __keep_AlgebraicType = AlgebraicType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
} from '../../index';

export type RawColumnDefaultValueV9 = {
table: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
} from '../../index';
import { RawUniqueConstraintDataV9 } from './raw_unique_constraint_data_v_9_type';
// Mark import as potentially unused
declare type __keep_RawUniqueConstraintDataV9 = RawUniqueConstraintDataV9;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
deepEqual as __deepEqual,
type AlgebraicType as __AlgebraicTypeType,
type AlgebraicTypeVariants as __AlgebraicTypeVariants,
} from '../index';
} from '../../index';
import { RawUniqueConstraintDataV9 as RawUniqueConstraintDataV9Type } from './raw_unique_constraint_data_v_9_type';
// Mark import as potentially unused
declare type __keep_RawUniqueConstraintDataV9Type =
Expand Down
Loading
Loading