Skip to content

Commit

Permalink
websocket: receive ids, not names
Browse files Browse the repository at this point in the history
  • Loading branch information
Centril committed Nov 12, 2024
1 parent 93dea53 commit 56e00e9
Show file tree
Hide file tree
Showing 27 changed files with 330 additions and 85 deletions.
83 changes: 83 additions & 0 deletions packages/sdk/src/client_api/after_connecting_type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD.

import {
// @ts-ignore
Address,
// @ts-ignore
AlgebraicType,
// @ts-ignore
AlgebraicValue,
// @ts-ignore
BinaryReader,
// @ts-ignore
BinaryWriter,
// @ts-ignore
CallReducerFlags,
// @ts-ignore
DBConnectionBuilder,
// @ts-ignore
DBConnectionImpl,
// @ts-ignore
DBContext,
// @ts-ignore
Event,
// @ts-ignore
EventContextInterface,
// @ts-ignore
Identity,
// @ts-ignore
ProductType,
// @ts-ignore
ProductTypeElement,
// @ts-ignore
SumType,
// @ts-ignore
SumTypeVariant,
// @ts-ignore
TableCache,
// @ts-ignore
deepEqual,
} from '..';
// @ts-ignore
import { IdentityToken as __IdentityToken } from './identity_token_type';
// @ts-ignore
import { IdsToNames as __IdsToNames } from './ids_to_names_type';

export type AfterConnecting = {
identityToken: __IdentityToken;
idsToNames: __IdsToNames;
};

/**
* A namespace for generated helper functions.
*/
export namespace AfterConnecting {
/**
* A function which returns this type represented as an AlgebraicType.
* This function is derived from the AlgebraicType used to generate this type.
*/
export function getTypeScriptAlgebraicType(): AlgebraicType {
return AlgebraicType.createProductType([
new ProductTypeElement(
'identityToken',
__IdentityToken.getTypeScriptAlgebraicType()
),
new ProductTypeElement(
'idsToNames',
__IdsToNames.getTypeScriptAlgebraicType()
),
]);
}

export function serialize(
writer: BinaryWriter,
value: AfterConnecting
): void {
AfterConnecting.getTypeScriptAlgebraicType().serialize(writer, value);
}

export function deserialize(reader: BinaryReader): AfterConnecting {
return AfterConnecting.getTypeScriptAlgebraicType().deserialize(reader);
}
}
2 changes: 2 additions & 0 deletions packages/sdk/src/client_api/bsatn_row_list_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
// @ts-ignore
BinaryWriter,
// @ts-ignore
CallReducerFlags,
// @ts-ignore
DBConnectionBuilder,
// @ts-ignore
DBConnectionImpl,
Expand Down
6 changes: 4 additions & 2 deletions packages/sdk/src/client_api/call_reducer_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
// @ts-ignore
BinaryWriter,
// @ts-ignore
CallReducerFlags,
// @ts-ignore
DBConnectionBuilder,
// @ts-ignore
DBConnectionImpl,
Expand All @@ -38,7 +40,7 @@ import {
deepEqual,
} from '..';
export type CallReducer = {
reducer: string;
reducerId: number;
args: Uint8Array;
requestId: number;
flags: number;
Expand All @@ -54,7 +56,7 @@ export namespace CallReducer {
*/
export function getTypeScriptAlgebraicType(): AlgebraicType {
return AlgebraicType.createProductType([
new ProductTypeElement('reducer', AlgebraicType.createStringType()),
new ProductTypeElement('reducerId', AlgebraicType.createU32Type()),
new ProductTypeElement(
'args',
AlgebraicType.createArrayType(AlgebraicType.createU8Type())
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/client_api/client_message_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
// @ts-ignore
BinaryWriter,
// @ts-ignore
CallReducerFlags,
// @ts-ignore
DBConnectionBuilder,
// @ts-ignore
DBConnectionImpl,
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/client_api/compressable_query_update_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
// @ts-ignore
BinaryWriter,
// @ts-ignore
CallReducerFlags,
// @ts-ignore
DBConnectionBuilder,
// @ts-ignore
DBConnectionImpl,
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/client_api/database_update_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
// @ts-ignore
BinaryWriter,
// @ts-ignore
CallReducerFlags,
// @ts-ignore
DBConnectionBuilder,
// @ts-ignore
DBConnectionImpl,
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/client_api/energy_quanta_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
// @ts-ignore
BinaryWriter,
// @ts-ignore
CallReducerFlags,
// @ts-ignore
DBConnectionBuilder,
// @ts-ignore
DBConnectionImpl,
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/client_api/identity_token_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
// @ts-ignore
BinaryWriter,
// @ts-ignore
CallReducerFlags,
// @ts-ignore
DBConnectionBuilder,
// @ts-ignore
DBConnectionImpl,
Expand Down
85 changes: 85 additions & 0 deletions packages/sdk/src/client_api/ids_to_names_type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
// WILL NOT BE SAVED. MODIFY TABLES IN RUST INSTEAD.

import {
// @ts-ignore
Address,
// @ts-ignore
AlgebraicType,
// @ts-ignore
AlgebraicValue,
// @ts-ignore
BinaryReader,
// @ts-ignore
BinaryWriter,
// @ts-ignore
CallReducerFlags,
// @ts-ignore
DBConnectionBuilder,
// @ts-ignore
DBConnectionImpl,
// @ts-ignore
DBContext,
// @ts-ignore
Event,
// @ts-ignore
EventContextInterface,
// @ts-ignore
Identity,
// @ts-ignore
ProductType,
// @ts-ignore
ProductTypeElement,
// @ts-ignore
SumType,
// @ts-ignore
SumTypeVariant,
// @ts-ignore
TableCache,
// @ts-ignore
deepEqual,
} from '..';
export type IdsToNames = {
reducerIds: number[];
reducerNames: string[];
tableIds: number[];
tableNames: string[];
};

/**
* A namespace for generated helper functions.
*/
export namespace IdsToNames {
/**
* A function which returns this type represented as an AlgebraicType.
* This function is derived from the AlgebraicType used to generate this type.
*/
export function getTypeScriptAlgebraicType(): AlgebraicType {
return AlgebraicType.createProductType([
new ProductTypeElement(
'reducerIds',
AlgebraicType.createArrayType(AlgebraicType.createU32Type())
),
new ProductTypeElement(
'reducerNames',
AlgebraicType.createArrayType(AlgebraicType.createStringType())
),
new ProductTypeElement(
'tableIds',
AlgebraicType.createArrayType(AlgebraicType.createU32Type())
),
new ProductTypeElement(
'tableNames',
AlgebraicType.createArrayType(AlgebraicType.createStringType())
),
]);
}

export function serialize(writer: BinaryWriter, value: IdsToNames): void {
IdsToNames.getTypeScriptAlgebraicType().serialize(writer, value);
}

export function deserialize(reader: BinaryReader): IdsToNames {
return IdsToNames.getTypeScriptAlgebraicType().deserialize(reader);
}
}
4 changes: 4 additions & 0 deletions packages/sdk/src/client_api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ import {
// Import and reexport all table handle types

// Import and reexport all types
import { AfterConnecting } from './after_connecting_type.ts';
export { AfterConnecting };
import { BsatnRowList } from './bsatn_row_list_type.ts';
export { BsatnRowList };
import { CallReducer } from './call_reducer_type.ts';
Expand All @@ -59,6 +61,8 @@ import { EnergyQuanta } from './energy_quanta_type.ts';
export { EnergyQuanta };
import { IdentityToken } from './identity_token_type.ts';
export { IdentityToken };
import { IdsToNames } from './ids_to_names_type.ts';
export { IdsToNames };
import { InitialSubscription } from './initial_subscription_type.ts';
export { InitialSubscription };
import { OneOffQuery } from './one_off_query_type.ts';
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/client_api/initial_subscription_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
// @ts-ignore
BinaryWriter,
// @ts-ignore
CallReducerFlags,
// @ts-ignore
DBConnectionBuilder,
// @ts-ignore
DBConnectionImpl,
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/client_api/one_off_query_response_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
// @ts-ignore
BinaryWriter,
// @ts-ignore
CallReducerFlags,
// @ts-ignore
DBConnectionBuilder,
// @ts-ignore
DBConnectionImpl,
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/client_api/one_off_query_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
// @ts-ignore
BinaryWriter,
// @ts-ignore
CallReducerFlags,
// @ts-ignore
DBConnectionBuilder,
// @ts-ignore
DBConnectionImpl,
Expand Down
6 changes: 4 additions & 2 deletions packages/sdk/src/client_api/one_off_table_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
// @ts-ignore
BinaryWriter,
// @ts-ignore
CallReducerFlags,
// @ts-ignore
DBConnectionBuilder,
// @ts-ignore
DBConnectionImpl,
Expand Down Expand Up @@ -41,7 +43,7 @@ import {
import { BsatnRowList as __BsatnRowList } from './bsatn_row_list_type';

export type OneOffTable = {
tableName: string;
tableId: number;
rows: __BsatnRowList;
};

Expand All @@ -55,7 +57,7 @@ export namespace OneOffTable {
*/
export function getTypeScriptAlgebraicType(): AlgebraicType {
return AlgebraicType.createProductType([
new ProductTypeElement('tableName', AlgebraicType.createStringType()),
new ProductTypeElement('tableId', AlgebraicType.createU32Type()),
new ProductTypeElement(
'rows',
__BsatnRowList.getTypeScriptAlgebraicType()
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/client_api/query_update_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
// @ts-ignore
BinaryWriter,
// @ts-ignore
CallReducerFlags,
// @ts-ignore
DBConnectionBuilder,
// @ts-ignore
DBConnectionImpl,
Expand Down
9 changes: 7 additions & 2 deletions packages/sdk/src/client_api/reducer_call_info_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
// @ts-ignore
BinaryWriter,
// @ts-ignore
CallReducerFlags,
// @ts-ignore
DBConnectionBuilder,
// @ts-ignore
DBConnectionImpl,
Expand All @@ -38,8 +40,8 @@ import {
deepEqual,
} from '..';
export type ReducerCallInfo = {
reducerName: string;
reducerId: number;
reducerName: void;
args: Uint8Array;
requestId: number;
};
Expand All @@ -54,8 +56,11 @@ export namespace ReducerCallInfo {
*/
export function getTypeScriptAlgebraicType(): AlgebraicType {
return AlgebraicType.createProductType([
new ProductTypeElement('reducerName', AlgebraicType.createStringType()),
new ProductTypeElement('reducerId', AlgebraicType.createU32Type()),
new ProductTypeElement(
'reducerName',
AlgebraicType.createProductType([])
),
new ProductTypeElement(
'args',
AlgebraicType.createArrayType(AlgebraicType.createU8Type())
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/client_api/row_size_hint_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
// @ts-ignore
BinaryWriter,
// @ts-ignore
CallReducerFlags,
// @ts-ignore
DBConnectionBuilder,
// @ts-ignore
DBConnectionImpl,
Expand Down
Loading

0 comments on commit 56e00e9

Please sign in to comment.