Skip to content

Commit a374814

Browse files
committed
websocket: receive ids, not names
1 parent 93dea53 commit a374814

27 files changed

+331
-86
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
2+
// WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD.
3+
4+
import {
5+
// @ts-ignore
6+
Address,
7+
// @ts-ignore
8+
AlgebraicType,
9+
// @ts-ignore
10+
AlgebraicValue,
11+
// @ts-ignore
12+
BinaryReader,
13+
// @ts-ignore
14+
BinaryWriter,
15+
// @ts-ignore
16+
CallReducerFlags,
17+
// @ts-ignore
18+
DBConnectionBuilder,
19+
// @ts-ignore
20+
DBConnectionImpl,
21+
// @ts-ignore
22+
DBContext,
23+
// @ts-ignore
24+
Event,
25+
// @ts-ignore
26+
EventContextInterface,
27+
// @ts-ignore
28+
Identity,
29+
// @ts-ignore
30+
ProductType,
31+
// @ts-ignore
32+
ProductTypeElement,
33+
// @ts-ignore
34+
SumType,
35+
// @ts-ignore
36+
SumTypeVariant,
37+
// @ts-ignore
38+
TableCache,
39+
// @ts-ignore
40+
deepEqual,
41+
} from '..';
42+
// @ts-ignore
43+
import { IdentityToken as __IdentityToken } from './identity_token_type';
44+
// @ts-ignore
45+
import { IdsToNames as __IdsToNames } from './ids_to_names_type';
46+
47+
export type AfterConnecting = {
48+
identityToken: __IdentityToken;
49+
idsToNames: __IdsToNames;
50+
};
51+
52+
/**
53+
* A namespace for generated helper functions.
54+
*/
55+
export namespace AfterConnecting {
56+
/**
57+
* A function which returns this type represented as an AlgebraicType.
58+
* This function is derived from the AlgebraicType used to generate this type.
59+
*/
60+
export function getTypeScriptAlgebraicType(): AlgebraicType {
61+
return AlgebraicType.createProductType([
62+
new ProductTypeElement(
63+
'identityToken',
64+
__IdentityToken.getTypeScriptAlgebraicType()
65+
),
66+
new ProductTypeElement(
67+
'idsToNames',
68+
__IdsToNames.getTypeScriptAlgebraicType()
69+
),
70+
]);
71+
}
72+
73+
export function serialize(
74+
writer: BinaryWriter,
75+
value: AfterConnecting
76+
): void {
77+
AfterConnecting.getTypeScriptAlgebraicType().serialize(writer, value);
78+
}
79+
80+
export function deserialize(reader: BinaryReader): AfterConnecting {
81+
return AfterConnecting.getTypeScriptAlgebraicType().deserialize(reader);
82+
}
83+
}

packages/sdk/src/client_api/bsatn_row_list_type.ts

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
// @ts-ignore
1414
BinaryWriter,
1515
// @ts-ignore
16+
CallReducerFlags,
17+
// @ts-ignore
1618
DBConnectionBuilder,
1719
// @ts-ignore
1820
DBConnectionImpl,

packages/sdk/src/client_api/call_reducer_type.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
// @ts-ignore
1414
BinaryWriter,
1515
// @ts-ignore
16+
CallReducerFlags,
17+
// @ts-ignore
1618
DBConnectionBuilder,
1719
// @ts-ignore
1820
DBConnectionImpl,
@@ -38,7 +40,7 @@ import {
3840
deepEqual,
3941
} from '..';
4042
export type CallReducer = {
41-
reducer: string;
43+
reducerId: number;
4244
args: Uint8Array;
4345
requestId: number;
4446
flags: number;
@@ -54,7 +56,7 @@ export namespace CallReducer {
5456
*/
5557
export function getTypeScriptAlgebraicType(): AlgebraicType {
5658
return AlgebraicType.createProductType([
57-
new ProductTypeElement('reducer', AlgebraicType.createStringType()),
59+
new ProductTypeElement('reducerId', AlgebraicType.createU32Type()),
5860
new ProductTypeElement(
5961
'args',
6062
AlgebraicType.createArrayType(AlgebraicType.createU8Type())

packages/sdk/src/client_api/client_message_type.ts

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
// @ts-ignore
1414
BinaryWriter,
1515
// @ts-ignore
16+
CallReducerFlags,
17+
// @ts-ignore
1618
DBConnectionBuilder,
1719
// @ts-ignore
1820
DBConnectionImpl,

packages/sdk/src/client_api/compressable_query_update_type.ts

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
// @ts-ignore
1414
BinaryWriter,
1515
// @ts-ignore
16+
CallReducerFlags,
17+
// @ts-ignore
1618
DBConnectionBuilder,
1719
// @ts-ignore
1820
DBConnectionImpl,

packages/sdk/src/client_api/database_update_type.ts

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
// @ts-ignore
1414
BinaryWriter,
1515
// @ts-ignore
16+
CallReducerFlags,
17+
// @ts-ignore
1618
DBConnectionBuilder,
1719
// @ts-ignore
1820
DBConnectionImpl,

packages/sdk/src/client_api/energy_quanta_type.ts

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
// @ts-ignore
1414
BinaryWriter,
1515
// @ts-ignore
16+
CallReducerFlags,
17+
// @ts-ignore
1618
DBConnectionBuilder,
1719
// @ts-ignore
1820
DBConnectionImpl,

packages/sdk/src/client_api/identity_token_type.ts

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
// @ts-ignore
1414
BinaryWriter,
1515
// @ts-ignore
16+
CallReducerFlags,
17+
// @ts-ignore
1618
DBConnectionBuilder,
1719
// @ts-ignore
1820
DBConnectionImpl,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
2+
// WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD.
3+
4+
import {
5+
// @ts-ignore
6+
Address,
7+
// @ts-ignore
8+
AlgebraicType,
9+
// @ts-ignore
10+
AlgebraicValue,
11+
// @ts-ignore
12+
BinaryReader,
13+
// @ts-ignore
14+
BinaryWriter,
15+
// @ts-ignore
16+
CallReducerFlags,
17+
// @ts-ignore
18+
DBConnectionBuilder,
19+
// @ts-ignore
20+
DBConnectionImpl,
21+
// @ts-ignore
22+
DBContext,
23+
// @ts-ignore
24+
Event,
25+
// @ts-ignore
26+
EventContextInterface,
27+
// @ts-ignore
28+
Identity,
29+
// @ts-ignore
30+
ProductType,
31+
// @ts-ignore
32+
ProductTypeElement,
33+
// @ts-ignore
34+
SumType,
35+
// @ts-ignore
36+
SumTypeVariant,
37+
// @ts-ignore
38+
TableCache,
39+
// @ts-ignore
40+
deepEqual,
41+
} from '..';
42+
export type IdsToNames = {
43+
reducerIds: number[];
44+
reducerNames: string[];
45+
tableIds: number[];
46+
tableNames: string[];
47+
};
48+
49+
/**
50+
* A namespace for generated helper functions.
51+
*/
52+
export namespace IdsToNames {
53+
/**
54+
* A function which returns this type represented as an AlgebraicType.
55+
* This function is derived from the AlgebraicType used to generate this type.
56+
*/
57+
export function getTypeScriptAlgebraicType(): AlgebraicType {
58+
return AlgebraicType.createProductType([
59+
new ProductTypeElement(
60+
'reducerIds',
61+
AlgebraicType.createArrayType(AlgebraicType.createU32Type())
62+
),
63+
new ProductTypeElement(
64+
'reducerNames',
65+
AlgebraicType.createArrayType(AlgebraicType.createStringType())
66+
),
67+
new ProductTypeElement(
68+
'tableIds',
69+
AlgebraicType.createArrayType(AlgebraicType.createU32Type())
70+
),
71+
new ProductTypeElement(
72+
'tableNames',
73+
AlgebraicType.createArrayType(AlgebraicType.createStringType())
74+
),
75+
]);
76+
}
77+
78+
export function serialize(writer: BinaryWriter, value: IdsToNames): void {
79+
IdsToNames.getTypeScriptAlgebraicType().serialize(writer, value);
80+
}
81+
82+
export function deserialize(reader: BinaryReader): IdsToNames {
83+
return IdsToNames.getTypeScriptAlgebraicType().deserialize(reader);
84+
}
85+
}

packages/sdk/src/client_api/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ import {
4545
// Import and reexport all table handle types
4646

4747
// Import and reexport all types
48+
import { AfterConnecting } from './after_connecting_type.ts';
49+
export { AfterConnecting };
4850
import { BsatnRowList } from './bsatn_row_list_type.ts';
4951
export { BsatnRowList };
5052
import { CallReducer } from './call_reducer_type.ts';
@@ -59,6 +61,8 @@ import { EnergyQuanta } from './energy_quanta_type.ts';
5961
export { EnergyQuanta };
6062
import { IdentityToken } from './identity_token_type.ts';
6163
export { IdentityToken };
64+
import { IdsToNames } from './ids_to_names_type.ts';
65+
export { IdsToNames };
6266
import { InitialSubscription } from './initial_subscription_type.ts';
6367
export { InitialSubscription };
6468
import { OneOffQuery } from './one_off_query_type.ts';

packages/sdk/src/client_api/initial_subscription_type.ts

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
// @ts-ignore
1414
BinaryWriter,
1515
// @ts-ignore
16+
CallReducerFlags,
17+
// @ts-ignore
1618
DBConnectionBuilder,
1719
// @ts-ignore
1820
DBConnectionImpl,

packages/sdk/src/client_api/one_off_query_response_type.ts

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
// @ts-ignore
1414
BinaryWriter,
1515
// @ts-ignore
16+
CallReducerFlags,
17+
// @ts-ignore
1618
DBConnectionBuilder,
1719
// @ts-ignore
1820
DBConnectionImpl,

packages/sdk/src/client_api/one_off_query_type.ts

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
// @ts-ignore
1414
BinaryWriter,
1515
// @ts-ignore
16+
CallReducerFlags,
17+
// @ts-ignore
1618
DBConnectionBuilder,
1719
// @ts-ignore
1820
DBConnectionImpl,

packages/sdk/src/client_api/one_off_table_type.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
// @ts-ignore
1414
BinaryWriter,
1515
// @ts-ignore
16+
CallReducerFlags,
17+
// @ts-ignore
1618
DBConnectionBuilder,
1719
// @ts-ignore
1820
DBConnectionImpl,
@@ -41,7 +43,7 @@ import {
4143
import { BsatnRowList as __BsatnRowList } from './bsatn_row_list_type';
4244

4345
export type OneOffTable = {
44-
tableName: string;
46+
tableId: number;
4547
rows: __BsatnRowList;
4648
};
4749

@@ -55,7 +57,7 @@ export namespace OneOffTable {
5557
*/
5658
export function getTypeScriptAlgebraicType(): AlgebraicType {
5759
return AlgebraicType.createProductType([
58-
new ProductTypeElement('tableName', AlgebraicType.createStringType()),
60+
new ProductTypeElement('tableId', AlgebraicType.createU32Type()),
5961
new ProductTypeElement(
6062
'rows',
6163
__BsatnRowList.getTypeScriptAlgebraicType()

packages/sdk/src/client_api/query_update_type.ts

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
// @ts-ignore
1414
BinaryWriter,
1515
// @ts-ignore
16+
CallReducerFlags,
17+
// @ts-ignore
1618
DBConnectionBuilder,
1719
// @ts-ignore
1820
DBConnectionImpl,

packages/sdk/src/client_api/reducer_call_info_type.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
// @ts-ignore
1414
BinaryWriter,
1515
// @ts-ignore
16+
CallReducerFlags,
17+
// @ts-ignore
1618
DBConnectionBuilder,
1719
// @ts-ignore
1820
DBConnectionImpl,
@@ -38,8 +40,8 @@ import {
3840
deepEqual,
3941
} from '..';
4042
export type ReducerCallInfo = {
41-
reducerName: string;
4243
reducerId: number;
44+
reducerName: void;
4345
args: Uint8Array;
4446
requestId: number;
4547
};
@@ -54,8 +56,11 @@ export namespace ReducerCallInfo {
5456
*/
5557
export function getTypeScriptAlgebraicType(): AlgebraicType {
5658
return AlgebraicType.createProductType([
57-
new ProductTypeElement('reducerName', AlgebraicType.createStringType()),
5859
new ProductTypeElement('reducerId', AlgebraicType.createU32Type()),
60+
new ProductTypeElement(
61+
'reducerName',
62+
AlgebraicType.createProductType([])
63+
),
5964
new ProductTypeElement(
6065
'args',
6166
AlgebraicType.createArrayType(AlgebraicType.createU8Type())

packages/sdk/src/client_api/row_size_hint_type.ts

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
// @ts-ignore
1414
BinaryWriter,
1515
// @ts-ignore
16+
CallReducerFlags,
17+
// @ts-ignore
1618
DBConnectionBuilder,
1719
// @ts-ignore
1820
DBConnectionImpl,

0 commit comments

Comments
 (0)