Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Companion to SpacetimeDB#1940 #118

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
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;
Centril marked this conversation as resolved.
Show resolved Hide resolved
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
Loading