diff --git a/sdks/typescript/packages/sdk/src/client_api/bsatn_row_list_type.ts b/sdks/typescript/packages/sdk/src/client_api/bsatn_row_list_type.ts index 800837cc87..c34d2ba810 100644 --- a/sdks/typescript/packages/sdk/src/client_api/bsatn_row_list_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/bsatn_row_list_type.ts @@ -29,12 +29,12 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; -import { RowSizeHint as __RowSizeHint } from './row_size_hint_type'; +} from "../index"; +import { RowSizeHint as __RowSizeHint } from "./row_size_hint_type"; export type BsatnRowList = { - sizeHint: __RowSizeHint; - rowsData: Uint8Array; + sizeHint: __RowSizeHint, + rowsData: Uint8Array, }; /** @@ -42,19 +42,13 @@ export type BsatnRowList = { */ export namespace BsatnRowList { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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( - 'sizeHint', - __RowSizeHint.getTypeScriptAlgebraicType() - ), - new ProductTypeElement( - 'rowsData', - AlgebraicType.createArrayType(AlgebraicType.createU8Type()) - ), + new ProductTypeElement("sizeHint", __RowSizeHint.getTypeScriptAlgebraicType()), + new ProductTypeElement("rowsData", AlgebraicType.createArrayType(AlgebraicType.createU8Type())), ]); } @@ -65,4 +59,7 @@ export namespace BsatnRowList { export function deserialize(reader: BinaryReader): BsatnRowList { return BsatnRowList.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/call_reducer_type.ts b/sdks/typescript/packages/sdk/src/client_api/call_reducer_type.ts index d3bc69d59e..2bf2a58af3 100644 --- a/sdks/typescript/packages/sdk/src/client_api/call_reducer_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/call_reducer_type.ts @@ -29,12 +29,12 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; +} from "../index"; export type CallReducer = { - reducer: string; - args: Uint8Array; - requestId: number; - flags: number; + reducer: string, + args: Uint8Array, + requestId: number, + flags: number, }; /** @@ -42,18 +42,15 @@ export type CallReducer = { */ export namespace CallReducer { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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('reducer', AlgebraicType.createStringType()), - new ProductTypeElement( - 'args', - AlgebraicType.createArrayType(AlgebraicType.createU8Type()) - ), - new ProductTypeElement('requestId', AlgebraicType.createU32Type()), - new ProductTypeElement('flags', AlgebraicType.createU8Type()), + new ProductTypeElement("reducer", AlgebraicType.createStringType()), + new ProductTypeElement("args", AlgebraicType.createArrayType(AlgebraicType.createU8Type())), + new ProductTypeElement("requestId", AlgebraicType.createU32Type()), + new ProductTypeElement("flags", AlgebraicType.createU8Type()), ]); } @@ -64,4 +61,7 @@ export namespace CallReducer { export function deserialize(reader: BinaryReader): CallReducer { return CallReducer.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/client_message_type.ts b/sdks/typescript/packages/sdk/src/client_api/client_message_type.ts index 04e1048c01..3e9e93a26c 100644 --- a/sdks/typescript/packages/sdk/src/client_api/client_message_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/client_message_type.ts @@ -29,26 +29,27 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; -import { CallReducer as __CallReducer } from './call_reducer_type'; -import { Subscribe as __Subscribe } from './subscribe_type'; -import { OneOffQuery as __OneOffQuery } from './one_off_query_type'; -import { SubscribeSingle as __SubscribeSingle } from './subscribe_single_type'; -import { Unsubscribe as __Unsubscribe } from './unsubscribe_type'; +} from "../index"; +import { CallReducer as __CallReducer } from "./call_reducer_type"; +import { Subscribe as __Subscribe } from "./subscribe_type"; +import { OneOffQuery as __OneOffQuery } from "./one_off_query_type"; +import { SubscribeSingle as __SubscribeSingle } from "./subscribe_single_type"; +import { SubscribeMulti as __SubscribeMulti } from "./subscribe_multi_type"; +import { Unsubscribe as __Unsubscribe } from "./unsubscribe_type"; +import { UnsubscribeMulti as __UnsubscribeMulti } from "./unsubscribe_multi_type"; // A namespace for generated variants and helper functions. export namespace ClientMessage { // These are the generated variant types for each variant of the tagged union. // One type is generated per variant and will be used in the `value` field of // the tagged union. - export type CallReducer = { tag: 'CallReducer'; value: __CallReducer }; - export type Subscribe = { tag: 'Subscribe'; value: __Subscribe }; - export type OneOffQuery = { tag: 'OneOffQuery'; value: __OneOffQuery }; - export type SubscribeSingle = { - tag: 'SubscribeSingle'; - value: __SubscribeSingle; - }; - export type Unsubscribe = { tag: 'Unsubscribe'; value: __Unsubscribe }; + export type CallReducer = { tag: "CallReducer", value: __CallReducer }; + export type Subscribe = { tag: "Subscribe", value: __Subscribe }; + export type OneOffQuery = { tag: "OneOffQuery", value: __OneOffQuery }; + export type SubscribeSingle = { tag: "SubscribeSingle", value: __SubscribeSingle }; + export type SubscribeMulti = { tag: "SubscribeMulti", value: __SubscribeMulti }; + export type Unsubscribe = { tag: "Unsubscribe", value: __Unsubscribe }; + export type UnsubscribeMulti = { tag: "UnsubscribeMulti", value: __UnsubscribeMulti }; // Helper functions for constructing each variant of the tagged union. // ``` @@ -56,64 +57,38 @@ export namespace ClientMessage { // assert!(foo.tag === "A"); // assert!(foo.value === 42); // ``` - export const CallReducer = (value: __CallReducer): ClientMessage => ({ - tag: 'CallReducer', - value, - }); - export const Subscribe = (value: __Subscribe): ClientMessage => ({ - tag: 'Subscribe', - value, - }); - export const OneOffQuery = (value: __OneOffQuery): ClientMessage => ({ - tag: 'OneOffQuery', - value, - }); - export const SubscribeSingle = (value: __SubscribeSingle): ClientMessage => ({ - tag: 'SubscribeSingle', - value, - }); - export const Unsubscribe = (value: __Unsubscribe): ClientMessage => ({ - tag: 'Unsubscribe', - value, - }); + export const CallReducer = (value: __CallReducer): ClientMessage => ({ tag: "CallReducer", value }); + export const Subscribe = (value: __Subscribe): ClientMessage => ({ tag: "Subscribe", value }); + export const OneOffQuery = (value: __OneOffQuery): ClientMessage => ({ tag: "OneOffQuery", value }); + export const SubscribeSingle = (value: __SubscribeSingle): ClientMessage => ({ tag: "SubscribeSingle", value }); + export const SubscribeMulti = (value: __SubscribeMulti): ClientMessage => ({ tag: "SubscribeMulti", value }); + export const Unsubscribe = (value: __Unsubscribe): ClientMessage => ({ tag: "Unsubscribe", value }); + export const UnsubscribeMulti = (value: __UnsubscribeMulti): ClientMessage => ({ tag: "UnsubscribeMulti", value }); export function getTypeScriptAlgebraicType(): AlgebraicType { return AlgebraicType.createSumType([ - new SumTypeVariant( - 'CallReducer', - __CallReducer.getTypeScriptAlgebraicType() - ), - new SumTypeVariant('Subscribe', __Subscribe.getTypeScriptAlgebraicType()), - new SumTypeVariant( - 'OneOffQuery', - __OneOffQuery.getTypeScriptAlgebraicType() - ), - new SumTypeVariant( - 'SubscribeSingle', - __SubscribeSingle.getTypeScriptAlgebraicType() - ), - new SumTypeVariant( - 'Unsubscribe', - __Unsubscribe.getTypeScriptAlgebraicType() - ), + new SumTypeVariant("CallReducer", __CallReducer.getTypeScriptAlgebraicType()), + new SumTypeVariant("Subscribe", __Subscribe.getTypeScriptAlgebraicType()), + new SumTypeVariant("OneOffQuery", __OneOffQuery.getTypeScriptAlgebraicType()), + new SumTypeVariant("SubscribeSingle", __SubscribeSingle.getTypeScriptAlgebraicType()), + new SumTypeVariant("SubscribeMulti", __SubscribeMulti.getTypeScriptAlgebraicType()), + new SumTypeVariant("Unsubscribe", __Unsubscribe.getTypeScriptAlgebraicType()), + new SumTypeVariant("UnsubscribeMulti", __UnsubscribeMulti.getTypeScriptAlgebraicType()), ]); } export function serialize(writer: BinaryWriter, value: ClientMessage): void { - ClientMessage.getTypeScriptAlgebraicType().serialize(writer, value); + ClientMessage.getTypeScriptAlgebraicType().serialize(writer, value); } export function deserialize(reader: BinaryReader): ClientMessage { - return ClientMessage.getTypeScriptAlgebraicType().deserialize(reader); + return ClientMessage.getTypeScriptAlgebraicType().deserialize(reader); } + } // The tagged union or sum type for the algebraic type `ClientMessage`. -export type ClientMessage = - | ClientMessage.CallReducer - | ClientMessage.Subscribe - | ClientMessage.OneOffQuery - | ClientMessage.SubscribeSingle - | ClientMessage.Unsubscribe; +export type ClientMessage = ClientMessage.CallReducer | ClientMessage.Subscribe | ClientMessage.OneOffQuery | ClientMessage.SubscribeSingle | ClientMessage.SubscribeMulti | ClientMessage.Unsubscribe | ClientMessage.UnsubscribeMulti; export default ClientMessage; + diff --git a/sdks/typescript/packages/sdk/src/client_api/compressable_query_update_type.ts b/sdks/typescript/packages/sdk/src/client_api/compressable_query_update_type.ts index a172741917..2afc22f612 100644 --- a/sdks/typescript/packages/sdk/src/client_api/compressable_query_update_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/compressable_query_update_type.ts @@ -29,17 +29,17 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; -import { QueryUpdate as __QueryUpdate } from './query_update_type'; +} from "../index"; +import { QueryUpdate as __QueryUpdate } from "./query_update_type"; // A namespace for generated variants and helper functions. export namespace CompressableQueryUpdate { // These are the generated variant types for each variant of the tagged union. // One type is generated per variant and will be used in the `value` field of // the tagged union. - export type Uncompressed = { tag: 'Uncompressed'; value: __QueryUpdate }; - export type Brotli = { tag: 'Brotli'; value: Uint8Array }; - export type Gzip = { tag: 'Gzip'; value: Uint8Array }; + export type Uncompressed = { tag: "Uncompressed", value: __QueryUpdate }; + export type Brotli = { tag: "Brotli", value: Uint8Array }; + export type Gzip = { tag: "Gzip", value: Uint8Array }; // Helper functions for constructing each variant of the tagged union. // ``` @@ -47,56 +47,30 @@ export namespace CompressableQueryUpdate { // assert!(foo.tag === "A"); // assert!(foo.value === 42); // ``` - export const Uncompressed = ( - value: __QueryUpdate - ): CompressableQueryUpdate => ({ tag: 'Uncompressed', value }); - export const Brotli = (value: Uint8Array): CompressableQueryUpdate => ({ - tag: 'Brotli', - value, - }); - export const Gzip = (value: Uint8Array): CompressableQueryUpdate => ({ - tag: 'Gzip', - value, - }); + export const Uncompressed = (value: __QueryUpdate): CompressableQueryUpdate => ({ tag: "Uncompressed", value }); + export const Brotli = (value: Uint8Array): CompressableQueryUpdate => ({ tag: "Brotli", value }); + export const Gzip = (value: Uint8Array): CompressableQueryUpdate => ({ tag: "Gzip", value }); export function getTypeScriptAlgebraicType(): AlgebraicType { return AlgebraicType.createSumType([ - new SumTypeVariant( - 'Uncompressed', - __QueryUpdate.getTypeScriptAlgebraicType() - ), - new SumTypeVariant( - 'Brotli', - AlgebraicType.createArrayType(AlgebraicType.createU8Type()) - ), - new SumTypeVariant( - 'Gzip', - AlgebraicType.createArrayType(AlgebraicType.createU8Type()) - ), + new SumTypeVariant("Uncompressed", __QueryUpdate.getTypeScriptAlgebraicType()), + new SumTypeVariant("Brotli", AlgebraicType.createArrayType(AlgebraicType.createU8Type())), + new SumTypeVariant("Gzip", AlgebraicType.createArrayType(AlgebraicType.createU8Type())), ]); } - export function serialize( - writer: BinaryWriter, - value: CompressableQueryUpdate - ): void { - CompressableQueryUpdate.getTypeScriptAlgebraicType().serialize( - writer, - value - ); + export function serialize(writer: BinaryWriter, value: CompressableQueryUpdate): void { + CompressableQueryUpdate.getTypeScriptAlgebraicType().serialize(writer, value); } export function deserialize(reader: BinaryReader): CompressableQueryUpdate { - return CompressableQueryUpdate.getTypeScriptAlgebraicType().deserialize( - reader - ); + return CompressableQueryUpdate.getTypeScriptAlgebraicType().deserialize(reader); } + } // The tagged union or sum type for the algebraic type `CompressableQueryUpdate`. -export type CompressableQueryUpdate = - | CompressableQueryUpdate.Uncompressed - | CompressableQueryUpdate.Brotli - | CompressableQueryUpdate.Gzip; +export type CompressableQueryUpdate = CompressableQueryUpdate.Uncompressed | CompressableQueryUpdate.Brotli | CompressableQueryUpdate.Gzip; export default CompressableQueryUpdate; + diff --git a/sdks/typescript/packages/sdk/src/client_api/database_update_type.ts b/sdks/typescript/packages/sdk/src/client_api/database_update_type.ts index 3a133f50b6..ce37e95004 100644 --- a/sdks/typescript/packages/sdk/src/client_api/database_update_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/database_update_type.ts @@ -29,11 +29,11 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; -import { TableUpdate as __TableUpdate } from './table_update_type'; +} from "../index"; +import { TableUpdate as __TableUpdate } from "./table_update_type"; export type DatabaseUpdate = { - tables: __TableUpdate[]; + tables: __TableUpdate[], }; /** @@ -41,17 +41,12 @@ export type DatabaseUpdate = { */ export namespace DatabaseUpdate { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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( - 'tables', - AlgebraicType.createArrayType( - __TableUpdate.getTypeScriptAlgebraicType() - ) - ), + new ProductTypeElement("tables", AlgebraicType.createArrayType(__TableUpdate.getTypeScriptAlgebraicType())), ]); } @@ -62,4 +57,7 @@ export namespace DatabaseUpdate { export function deserialize(reader: BinaryReader): DatabaseUpdate { return DatabaseUpdate.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/energy_quanta_type.ts b/sdks/typescript/packages/sdk/src/client_api/energy_quanta_type.ts index 686ca504d8..41d9809589 100644 --- a/sdks/typescript/packages/sdk/src/client_api/energy_quanta_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/energy_quanta_type.ts @@ -29,9 +29,9 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; +} from "../index"; export type EnergyQuanta = { - quanta: bigint; + quanta: bigint, }; /** @@ -39,12 +39,12 @@ export type EnergyQuanta = { */ export namespace EnergyQuanta { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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('quanta', AlgebraicType.createU128Type()), + new ProductTypeElement("quanta", AlgebraicType.createU128Type()), ]); } @@ -55,4 +55,7 @@ export namespace EnergyQuanta { export function deserialize(reader: BinaryReader): EnergyQuanta { return EnergyQuanta.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/identity_token_type.ts b/sdks/typescript/packages/sdk/src/client_api/identity_token_type.ts index 11dd455da0..579e327fdb 100644 --- a/sdks/typescript/packages/sdk/src/client_api/identity_token_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/identity_token_type.ts @@ -29,11 +29,11 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; +} from "../index"; export type IdentityToken = { - identity: Identity; - token: string; - connectionId: ConnectionId; + identity: Identity, + token: string, + connectionId: ConnectionId, }; /** @@ -41,17 +41,14 @@ export type IdentityToken = { */ export namespace IdentityToken { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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('identity', AlgebraicType.createIdentityType()), - new ProductTypeElement('token', AlgebraicType.createStringType()), - new ProductTypeElement( - 'connectionId', - AlgebraicType.createConnectionIdType() - ), + new ProductTypeElement("identity", AlgebraicType.createIdentityType()), + new ProductTypeElement("token", AlgebraicType.createStringType()), + new ProductTypeElement("connectionId", AlgebraicType.createConnectionIdType()), ]); } @@ -62,4 +59,7 @@ export namespace IdentityToken { export function deserialize(reader: BinaryReader): IdentityToken { return IdentityToken.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/index.ts b/sdks/typescript/packages/sdk/src/client_api/index.ts index 9bddeebb0c..71eb43e2e7 100644 --- a/sdks/typescript/packages/sdk/src/client_api/index.ts +++ b/sdks/typescript/packages/sdk/src/client_api/index.ts @@ -29,71 +29,81 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; +} from "../index"; // Import and reexport all reducer arg types // Import and reexport all table handle types // Import and reexport all types -import { BsatnRowList } from './bsatn_row_list_type.ts'; +import { BsatnRowList } from "./bsatn_row_list_type.ts"; export { BsatnRowList }; -import { CallReducer } from './call_reducer_type.ts'; +import { CallReducer } from "./call_reducer_type.ts"; export { CallReducer }; -import { ClientMessage } from './client_message_type.ts'; +import { ClientMessage } from "./client_message_type.ts"; export { ClientMessage }; -import { CompressableQueryUpdate } from './compressable_query_update_type.ts'; +import { CompressableQueryUpdate } from "./compressable_query_update_type.ts"; export { CompressableQueryUpdate }; -import { DatabaseUpdate } from './database_update_type.ts'; +import { DatabaseUpdate } from "./database_update_type.ts"; export { DatabaseUpdate }; -import { EnergyQuanta } from './energy_quanta_type.ts'; +import { EnergyQuanta } from "./energy_quanta_type.ts"; export { EnergyQuanta }; -import { IdentityToken } from './identity_token_type.ts'; +import { IdentityToken } from "./identity_token_type.ts"; export { IdentityToken }; -import { InitialSubscription } from './initial_subscription_type.ts'; +import { InitialSubscription } from "./initial_subscription_type.ts"; export { InitialSubscription }; -import { OneOffQuery } from './one_off_query_type.ts'; +import { OneOffQuery } from "./one_off_query_type.ts"; export { OneOffQuery }; -import { OneOffQueryResponse } from './one_off_query_response_type.ts'; +import { OneOffQueryResponse } from "./one_off_query_response_type.ts"; export { OneOffQueryResponse }; -import { OneOffTable } from './one_off_table_type.ts'; +import { OneOffTable } from "./one_off_table_type.ts"; export { OneOffTable }; -import { QueryId } from './query_id_type.ts'; +import { QueryId } from "./query_id_type.ts"; export { QueryId }; -import { QueryUpdate } from './query_update_type.ts'; +import { QueryUpdate } from "./query_update_type.ts"; export { QueryUpdate }; -import { ReducerCallInfo } from './reducer_call_info_type.ts'; +import { ReducerCallInfo } from "./reducer_call_info_type.ts"; export { ReducerCallInfo }; -import { RowSizeHint } from './row_size_hint_type.ts'; +import { RowSizeHint } from "./row_size_hint_type.ts"; export { RowSizeHint }; -import { ServerMessage } from './server_message_type.ts'; +import { ServerMessage } from "./server_message_type.ts"; export { ServerMessage }; -import { Subscribe } from './subscribe_type.ts'; +import { Subscribe } from "./subscribe_type.ts"; export { Subscribe }; -import { SubscribeApplied } from './subscribe_applied_type.ts'; +import { SubscribeApplied } from "./subscribe_applied_type.ts"; export { SubscribeApplied }; -import { SubscribeRows } from './subscribe_rows_type.ts'; +import { SubscribeMulti } from "./subscribe_multi_type.ts"; +export { SubscribeMulti }; +import { SubscribeMultiApplied } from "./subscribe_multi_applied_type.ts"; +export { SubscribeMultiApplied }; +import { SubscribeRows } from "./subscribe_rows_type.ts"; export { SubscribeRows }; -import { SubscribeSingle } from './subscribe_single_type.ts'; +import { SubscribeSingle } from "./subscribe_single_type.ts"; export { SubscribeSingle }; -import { SubscriptionError } from './subscription_error_type.ts'; +import { SubscriptionError } from "./subscription_error_type.ts"; export { SubscriptionError }; -import { TableUpdate } from './table_update_type.ts'; +import { TableUpdate } from "./table_update_type.ts"; export { TableUpdate }; -import { TransactionUpdate } from './transaction_update_type.ts'; +import { TransactionUpdate } from "./transaction_update_type.ts"; export { TransactionUpdate }; -import { TransactionUpdateLight } from './transaction_update_light_type.ts'; +import { TransactionUpdateLight } from "./transaction_update_light_type.ts"; export { TransactionUpdateLight }; -import { Unsubscribe } from './unsubscribe_type.ts'; +import { Unsubscribe } from "./unsubscribe_type.ts"; export { Unsubscribe }; -import { UnsubscribeApplied } from './unsubscribe_applied_type.ts'; +import { UnsubscribeApplied } from "./unsubscribe_applied_type.ts"; export { UnsubscribeApplied }; -import { UpdateStatus } from './update_status_type.ts'; -export { UpdateStatus, Timestamp }; +import { UnsubscribeMulti } from "./unsubscribe_multi_type.ts"; +export { UnsubscribeMulti }; +import { UnsubscribeMultiApplied } from "./unsubscribe_multi_applied_type.ts"; +export { UnsubscribeMultiApplied }; +import { UpdateStatus } from "./update_status_type.ts"; +export { UpdateStatus }; const REMOTE_MODULE = { - tables: {}, - reducers: {}, + tables: { + }, + reducers: { + }, // Constructors which are used by the DbConnectionImpl to // extract type information from the generated RemoteModule. // @@ -104,85 +114,48 @@ const REMOTE_MODULE = { eventContextConstructor: (imp: DbConnectionImpl, event: Event) => { return { ...(imp as DbConnection), - event, - }; + event + } }, dbViewConstructor: (imp: DbConnectionImpl) => { return new RemoteTables(imp); }, - reducersConstructor: ( - imp: DbConnectionImpl, - setReducerFlags: SetReducerFlags - ) => { + reducersConstructor: (imp: DbConnectionImpl, setReducerFlags: SetReducerFlags) => { return new RemoteReducers(imp, setReducerFlags); }, setReducerFlagsConstructor: () => { return new SetReducerFlags(); - }, -}; - -// A type representing all the possible variants of a reducer. -export type Reducer = never; - -export class RemoteReducers { - constructor( - private connection: DbConnectionImpl, - private setCallReducerFlags: SetReducerFlags - ) {} + } } -export class SetReducerFlags {} +// A type representing all the possible variants of a reducer. +export type Reducer = never +; + +export class RemoteReducers { + constructor(private connection: DbConnectionImpl, private setCallReducerFlags: SetReducerFlags) {} + +} + +export class SetReducerFlags { +} export class RemoteTables { constructor(private connection: DbConnectionImpl) {} } -export class SubscriptionBuilder extends SubscriptionBuilderImpl< - RemoteTables, - RemoteReducers, - SetReducerFlags -> {} +export class SubscriptionBuilder extends SubscriptionBuilderImpl { } -export class DbConnection extends DbConnectionImpl< - RemoteTables, - RemoteReducers, - SetReducerFlags -> { - static builder = (): DbConnectionBuilder< - DbConnection, - ErrorContext, - SubscriptionEventContext - > => { - return new DbConnectionBuilder< - DbConnection, - ErrorContext, - SubscriptionEventContext - >(REMOTE_MODULE, (imp: DbConnectionImpl) => imp as DbConnection); - }; +export class DbConnection extends DbConnectionImpl { + static builder = (): DbConnectionBuilder => { + return new DBConnectionBuilder(REMOTE_MODULE, (imp: DBConnectionImpl) => imp as DBConnection); + } subscriptionBuilder = (): SubscriptionBuilder => { return new SubscriptionBuilder(this); - }; + } } -export type EventContext = EventContextInterface< - RemoteTables, - RemoteReducers, - SetReducerFlags, - Reducer ->; -export type ReducerEventContext = ReducerEventContextInterface< - RemoteTables, - RemoteReducers, - SetReducerFlags, - Reducer ->; -export type SubscriptionEventContext = SubscriptionEventContextInterface< - RemoteTables, - RemoteReducers, - SetReducerFlags ->; -export type ErrorContext = ErrorContextInterface< - RemoteTables, - RemoteReducers, - SetReducerFlags ->; +export type EventContext = EventContextInterface; +export type ReducerEventContext = ReducerEventContextInterface; +export type SubscriptionEventContext = SubscriptionEventContextInterface; +export type ErrorContext = ErrorContextInterface; diff --git a/sdks/typescript/packages/sdk/src/client_api/initial_subscription_type.ts b/sdks/typescript/packages/sdk/src/client_api/initial_subscription_type.ts index 266ac6833e..88682a88e8 100644 --- a/sdks/typescript/packages/sdk/src/client_api/initial_subscription_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/initial_subscription_type.ts @@ -29,13 +29,13 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; -import { DatabaseUpdate as __DatabaseUpdate } from './database_update_type'; +} from "../index"; +import { DatabaseUpdate as __DatabaseUpdate } from "./database_update_type"; export type InitialSubscription = { - databaseUpdate: __DatabaseUpdate; - requestId: number; - totalHostExecutionDuration: TimeDuration; + databaseUpdate: __DatabaseUpdate, + requestId: number, + totalHostExecutionDuration: TimeDuration, }; /** @@ -43,31 +43,25 @@ export type InitialSubscription = { */ export namespace InitialSubscription { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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( - 'databaseUpdate', - __DatabaseUpdate.getTypeScriptAlgebraicType() - ), - new ProductTypeElement('requestId', AlgebraicType.createU32Type()), - new ProductTypeElement( - 'totalHostExecutionDuration', - AlgebraicType.createTimeDurationType() - ), + new ProductTypeElement("databaseUpdate", __DatabaseUpdate.getTypeScriptAlgebraicType()), + new ProductTypeElement("requestId", AlgebraicType.createU32Type()), + new ProductTypeElement("totalHostExecutionDuration", AlgebraicType.createTimeDurationType()), ]); } - export function serialize( - writer: BinaryWriter, - value: InitialSubscription - ): void { + export function serialize(writer: BinaryWriter, value: InitialSubscription): void { InitialSubscription.getTypeScriptAlgebraicType().serialize(writer, value); } export function deserialize(reader: BinaryReader): InitialSubscription { return InitialSubscription.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/one_off_query_response_type.ts b/sdks/typescript/packages/sdk/src/client_api/one_off_query_response_type.ts index 885f980936..9dd29c0664 100644 --- a/sdks/typescript/packages/sdk/src/client_api/one_off_query_response_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/one_off_query_response_type.ts @@ -29,14 +29,14 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; -import { OneOffTable as __OneOffTable } from './one_off_table_type'; +} from "../index"; +import { OneOffTable as __OneOffTable } from "./one_off_table_type"; export type OneOffQueryResponse = { - messageId: Uint8Array; - error: string | undefined; - tables: __OneOffTable[]; - totalHostExecutionDuration: TimeDuration; + messageId: Uint8Array, + error: string | undefined, + tables: __OneOffTable[], + totalHostExecutionDuration: TimeDuration, }; /** @@ -44,40 +44,26 @@ export type OneOffQueryResponse = { */ export namespace OneOffQueryResponse { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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( - 'messageId', - AlgebraicType.createArrayType(AlgebraicType.createU8Type()) - ), - new ProductTypeElement( - 'error', - AlgebraicType.createOptionType(AlgebraicType.createStringType()) - ), - new ProductTypeElement( - 'tables', - AlgebraicType.createArrayType( - __OneOffTable.getTypeScriptAlgebraicType() - ) - ), - new ProductTypeElement( - 'totalHostExecutionDuration', - AlgebraicType.createTimeDurationType() - ), + new ProductTypeElement("messageId", AlgebraicType.createArrayType(AlgebraicType.createU8Type())), + new ProductTypeElement("error", AlgebraicType.createOptionType(AlgebraicType.createStringType())), + new ProductTypeElement("tables", AlgebraicType.createArrayType(__OneOffTable.getTypeScriptAlgebraicType())), + new ProductTypeElement("totalHostExecutionDuration", AlgebraicType.createTimeDurationType()), ]); } - export function serialize( - writer: BinaryWriter, - value: OneOffQueryResponse - ): void { + export function serialize(writer: BinaryWriter, value: OneOffQueryResponse): void { OneOffQueryResponse.getTypeScriptAlgebraicType().serialize(writer, value); } export function deserialize(reader: BinaryReader): OneOffQueryResponse { return OneOffQueryResponse.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/one_off_query_type.ts b/sdks/typescript/packages/sdk/src/client_api/one_off_query_type.ts index 8fb2fdc881..0c47930cd4 100644 --- a/sdks/typescript/packages/sdk/src/client_api/one_off_query_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/one_off_query_type.ts @@ -29,10 +29,10 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; +} from "../index"; export type OneOffQuery = { - messageId: Uint8Array; - queryString: string; + messageId: Uint8Array, + queryString: string, }; /** @@ -40,16 +40,13 @@ export type OneOffQuery = { */ export namespace OneOffQuery { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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( - 'messageId', - AlgebraicType.createArrayType(AlgebraicType.createU8Type()) - ), - new ProductTypeElement('queryString', AlgebraicType.createStringType()), + new ProductTypeElement("messageId", AlgebraicType.createArrayType(AlgebraicType.createU8Type())), + new ProductTypeElement("queryString", AlgebraicType.createStringType()), ]); } @@ -60,4 +57,7 @@ export namespace OneOffQuery { export function deserialize(reader: BinaryReader): OneOffQuery { return OneOffQuery.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/one_off_table_type.ts b/sdks/typescript/packages/sdk/src/client_api/one_off_table_type.ts index 32c8abb64b..cbf9ee2cf9 100644 --- a/sdks/typescript/packages/sdk/src/client_api/one_off_table_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/one_off_table_type.ts @@ -29,12 +29,12 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; -import { BsatnRowList as __BsatnRowList } from './bsatn_row_list_type'; +} from "../index"; +import { BsatnRowList as __BsatnRowList } from "./bsatn_row_list_type"; export type OneOffTable = { - tableName: string; - rows: __BsatnRowList; + tableName: string, + rows: __BsatnRowList, }; /** @@ -42,16 +42,13 @@ export type OneOffTable = { */ export namespace OneOffTable { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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('tableName', AlgebraicType.createStringType()), - new ProductTypeElement( - 'rows', - __BsatnRowList.getTypeScriptAlgebraicType() - ), + new ProductTypeElement("tableName", AlgebraicType.createStringType()), + new ProductTypeElement("rows", __BsatnRowList.getTypeScriptAlgebraicType()), ]); } @@ -62,4 +59,7 @@ export namespace OneOffTable { export function deserialize(reader: BinaryReader): OneOffTable { return OneOffTable.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/query_id_type.ts b/sdks/typescript/packages/sdk/src/client_api/query_id_type.ts index 1f41bf5e3a..07b716f697 100644 --- a/sdks/typescript/packages/sdk/src/client_api/query_id_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/query_id_type.ts @@ -29,9 +29,9 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; +} from "../index"; export type QueryId = { - id: number; + id: number, }; /** @@ -39,12 +39,12 @@ export type QueryId = { */ export namespace QueryId { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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('id', AlgebraicType.createU32Type()), + new ProductTypeElement("id", AlgebraicType.createU32Type()), ]); } @@ -55,4 +55,7 @@ export namespace QueryId { export function deserialize(reader: BinaryReader): QueryId { return QueryId.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/query_update_type.ts b/sdks/typescript/packages/sdk/src/client_api/query_update_type.ts index 10e0147f04..083d027b73 100644 --- a/sdks/typescript/packages/sdk/src/client_api/query_update_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/query_update_type.ts @@ -29,12 +29,12 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; -import { BsatnRowList as __BsatnRowList } from './bsatn_row_list_type'; +} from "../index"; +import { BsatnRowList as __BsatnRowList } from "./bsatn_row_list_type"; export type QueryUpdate = { - deletes: __BsatnRowList; - inserts: __BsatnRowList; + deletes: __BsatnRowList, + inserts: __BsatnRowList, }; /** @@ -42,19 +42,13 @@ export type QueryUpdate = { */ export namespace QueryUpdate { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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( - 'deletes', - __BsatnRowList.getTypeScriptAlgebraicType() - ), - new ProductTypeElement( - 'inserts', - __BsatnRowList.getTypeScriptAlgebraicType() - ), + new ProductTypeElement("deletes", __BsatnRowList.getTypeScriptAlgebraicType()), + new ProductTypeElement("inserts", __BsatnRowList.getTypeScriptAlgebraicType()), ]); } @@ -65,4 +59,7 @@ export namespace QueryUpdate { export function deserialize(reader: BinaryReader): QueryUpdate { return QueryUpdate.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/reducer_call_info_type.ts b/sdks/typescript/packages/sdk/src/client_api/reducer_call_info_type.ts index 337fb073e2..653ea6c326 100644 --- a/sdks/typescript/packages/sdk/src/client_api/reducer_call_info_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/reducer_call_info_type.ts @@ -29,12 +29,12 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; +} from "../index"; export type ReducerCallInfo = { - reducerName: string; - reducerId: number; - args: Uint8Array; - requestId: number; + reducerName: string, + reducerId: number, + args: Uint8Array, + requestId: number, }; /** @@ -42,29 +42,26 @@ export type ReducerCallInfo = { */ export namespace ReducerCallInfo { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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('reducerName', AlgebraicType.createStringType()), - new ProductTypeElement('reducerId', AlgebraicType.createU32Type()), - new ProductTypeElement( - 'args', - AlgebraicType.createArrayType(AlgebraicType.createU8Type()) - ), - new ProductTypeElement('requestId', AlgebraicType.createU32Type()), + new ProductTypeElement("reducerName", AlgebraicType.createStringType()), + new ProductTypeElement("reducerId", AlgebraicType.createU32Type()), + new ProductTypeElement("args", AlgebraicType.createArrayType(AlgebraicType.createU8Type())), + new ProductTypeElement("requestId", AlgebraicType.createU32Type()), ]); } - export function serialize( - writer: BinaryWriter, - value: ReducerCallInfo - ): void { + export function serialize(writer: BinaryWriter, value: ReducerCallInfo): void { ReducerCallInfo.getTypeScriptAlgebraicType().serialize(writer, value); } export function deserialize(reader: BinaryReader): ReducerCallInfo { return ReducerCallInfo.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/row_size_hint_type.ts b/sdks/typescript/packages/sdk/src/client_api/row_size_hint_type.ts index 7f6830bcc5..eca0c0911f 100644 --- a/sdks/typescript/packages/sdk/src/client_api/row_size_hint_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/row_size_hint_type.ts @@ -29,14 +29,14 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; +} from "../index"; // A namespace for generated variants and helper functions. export namespace RowSizeHint { // These are the generated variant types for each variant of the tagged union. // One type is generated per variant and will be used in the `value` field of // the tagged union. - export type FixedSize = { tag: 'FixedSize'; value: number }; - export type RowOffsets = { tag: 'RowOffsets'; value: bigint[] }; + export type FixedSize = { tag: "FixedSize", value: number }; + export type RowOffsets = { tag: "RowOffsets", value: bigint[] }; // Helper functions for constructing each variant of the tagged union. // ``` @@ -44,35 +44,28 @@ export namespace RowSizeHint { // assert!(foo.tag === "A"); // assert!(foo.value === 42); // ``` - export const FixedSize = (value: number): RowSizeHint => ({ - tag: 'FixedSize', - value, - }); - export const RowOffsets = (value: bigint[]): RowSizeHint => ({ - tag: 'RowOffsets', - value, - }); + export const FixedSize = (value: number): RowSizeHint => ({ tag: "FixedSize", value }); + export const RowOffsets = (value: bigint[]): RowSizeHint => ({ tag: "RowOffsets", value }); export function getTypeScriptAlgebraicType(): AlgebraicType { return AlgebraicType.createSumType([ - new SumTypeVariant('FixedSize', AlgebraicType.createU16Type()), - new SumTypeVariant( - 'RowOffsets', - AlgebraicType.createArrayType(AlgebraicType.createU64Type()) - ), + new SumTypeVariant("FixedSize", AlgebraicType.createU16Type()), + new SumTypeVariant("RowOffsets", AlgebraicType.createArrayType(AlgebraicType.createU64Type())), ]); } export function serialize(writer: BinaryWriter, value: RowSizeHint): void { - RowSizeHint.getTypeScriptAlgebraicType().serialize(writer, value); + RowSizeHint.getTypeScriptAlgebraicType().serialize(writer, value); } export function deserialize(reader: BinaryReader): RowSizeHint { - return RowSizeHint.getTypeScriptAlgebraicType().deserialize(reader); + return RowSizeHint.getTypeScriptAlgebraicType().deserialize(reader); } + } // The tagged union or sum type for the algebraic type `RowSizeHint`. export type RowSizeHint = RowSizeHint.FixedSize | RowSizeHint.RowOffsets; export default RowSizeHint; + diff --git a/sdks/typescript/packages/sdk/src/client_api/server_message_type.ts b/sdks/typescript/packages/sdk/src/client_api/server_message_type.ts index 32f47616ea..99b5009923 100644 --- a/sdks/typescript/packages/sdk/src/client_api/server_message_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/server_message_type.ts @@ -29,50 +29,33 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; -import { InitialSubscription as __InitialSubscription } from './initial_subscription_type'; -import { TransactionUpdate as __TransactionUpdate } from './transaction_update_type'; -import { TransactionUpdateLight as __TransactionUpdateLight } from './transaction_update_light_type'; -import { IdentityToken as __IdentityToken } from './identity_token_type'; -import { OneOffQueryResponse as __OneOffQueryResponse } from './one_off_query_response_type'; -import { SubscribeApplied as __SubscribeApplied } from './subscribe_applied_type'; -import { UnsubscribeApplied as __UnsubscribeApplied } from './unsubscribe_applied_type'; -import { SubscriptionError as __SubscriptionError } from './subscription_error_type'; +} from "../index"; +import { InitialSubscription as __InitialSubscription } from "./initial_subscription_type"; +import { TransactionUpdate as __TransactionUpdate } from "./transaction_update_type"; +import { TransactionUpdateLight as __TransactionUpdateLight } from "./transaction_update_light_type"; +import { IdentityToken as __IdentityToken } from "./identity_token_type"; +import { OneOffQueryResponse as __OneOffQueryResponse } from "./one_off_query_response_type"; +import { SubscribeApplied as __SubscribeApplied } from "./subscribe_applied_type"; +import { UnsubscribeApplied as __UnsubscribeApplied } from "./unsubscribe_applied_type"; +import { SubscriptionError as __SubscriptionError } from "./subscription_error_type"; +import { SubscribeMultiApplied as __SubscribeMultiApplied } from "./subscribe_multi_applied_type"; +import { UnsubscribeMultiApplied as __UnsubscribeMultiApplied } from "./unsubscribe_multi_applied_type"; // A namespace for generated variants and helper functions. export namespace ServerMessage { // These are the generated variant types for each variant of the tagged union. // One type is generated per variant and will be used in the `value` field of // the tagged union. - export type InitialSubscription = { - tag: 'InitialSubscription'; - value: __InitialSubscription; - }; - export type TransactionUpdate = { - tag: 'TransactionUpdate'; - value: __TransactionUpdate; - }; - export type TransactionUpdateLight = { - tag: 'TransactionUpdateLight'; - value: __TransactionUpdateLight; - }; - export type IdentityToken = { tag: 'IdentityToken'; value: __IdentityToken }; - export type OneOffQueryResponse = { - tag: 'OneOffQueryResponse'; - value: __OneOffQueryResponse; - }; - export type SubscribeApplied = { - tag: 'SubscribeApplied'; - value: __SubscribeApplied; - }; - export type UnsubscribeApplied = { - tag: 'UnsubscribeApplied'; - value: __UnsubscribeApplied; - }; - export type SubscriptionError = { - tag: 'SubscriptionError'; - value: __SubscriptionError; - }; + export type InitialSubscription = { tag: "InitialSubscription", value: __InitialSubscription }; + export type TransactionUpdate = { tag: "TransactionUpdate", value: __TransactionUpdate }; + export type TransactionUpdateLight = { tag: "TransactionUpdateLight", value: __TransactionUpdateLight }; + export type IdentityToken = { tag: "IdentityToken", value: __IdentityToken }; + export type OneOffQueryResponse = { tag: "OneOffQueryResponse", value: __OneOffQueryResponse }; + export type SubscribeApplied = { tag: "SubscribeApplied", value: __SubscribeApplied }; + export type UnsubscribeApplied = { tag: "UnsubscribeApplied", value: __UnsubscribeApplied }; + export type SubscriptionError = { tag: "SubscriptionError", value: __SubscriptionError }; + export type SubscribeMultiApplied = { tag: "SubscribeMultiApplied", value: __SubscribeMultiApplied }; + export type UnsubscribeMultiApplied = { tag: "UnsubscribeMultiApplied", value: __UnsubscribeMultiApplied }; // Helper functions for constructing each variant of the tagged union. // ``` @@ -80,87 +63,44 @@ export namespace ServerMessage { // assert!(foo.tag === "A"); // assert!(foo.value === 42); // ``` - export const InitialSubscription = ( - value: __InitialSubscription - ): ServerMessage => ({ tag: 'InitialSubscription', value }); - export const TransactionUpdate = ( - value: __TransactionUpdate - ): ServerMessage => ({ tag: 'TransactionUpdate', value }); - export const TransactionUpdateLight = ( - value: __TransactionUpdateLight - ): ServerMessage => ({ tag: 'TransactionUpdateLight', value }); - export const IdentityToken = (value: __IdentityToken): ServerMessage => ({ - tag: 'IdentityToken', - value, - }); - export const OneOffQueryResponse = ( - value: __OneOffQueryResponse - ): ServerMessage => ({ tag: 'OneOffQueryResponse', value }); - export const SubscribeApplied = ( - value: __SubscribeApplied - ): ServerMessage => ({ tag: 'SubscribeApplied', value }); - export const UnsubscribeApplied = ( - value: __UnsubscribeApplied - ): ServerMessage => ({ tag: 'UnsubscribeApplied', value }); - export const SubscriptionError = ( - value: __SubscriptionError - ): ServerMessage => ({ tag: 'SubscriptionError', value }); + export const InitialSubscription = (value: __InitialSubscription): ServerMessage => ({ tag: "InitialSubscription", value }); + export const TransactionUpdate = (value: __TransactionUpdate): ServerMessage => ({ tag: "TransactionUpdate", value }); + export const TransactionUpdateLight = (value: __TransactionUpdateLight): ServerMessage => ({ tag: "TransactionUpdateLight", value }); + export const IdentityToken = (value: __IdentityToken): ServerMessage => ({ tag: "IdentityToken", value }); + export const OneOffQueryResponse = (value: __OneOffQueryResponse): ServerMessage => ({ tag: "OneOffQueryResponse", value }); + export const SubscribeApplied = (value: __SubscribeApplied): ServerMessage => ({ tag: "SubscribeApplied", value }); + export const UnsubscribeApplied = (value: __UnsubscribeApplied): ServerMessage => ({ tag: "UnsubscribeApplied", value }); + export const SubscriptionError = (value: __SubscriptionError): ServerMessage => ({ tag: "SubscriptionError", value }); + export const SubscribeMultiApplied = (value: __SubscribeMultiApplied): ServerMessage => ({ tag: "SubscribeMultiApplied", value }); + export const UnsubscribeMultiApplied = (value: __UnsubscribeMultiApplied): ServerMessage => ({ tag: "UnsubscribeMultiApplied", value }); export function getTypeScriptAlgebraicType(): AlgebraicType { return AlgebraicType.createSumType([ - new SumTypeVariant( - 'InitialSubscription', - __InitialSubscription.getTypeScriptAlgebraicType() - ), - new SumTypeVariant( - 'TransactionUpdate', - __TransactionUpdate.getTypeScriptAlgebraicType() - ), - new SumTypeVariant( - 'TransactionUpdateLight', - __TransactionUpdateLight.getTypeScriptAlgebraicType() - ), - new SumTypeVariant( - 'IdentityToken', - __IdentityToken.getTypeScriptAlgebraicType() - ), - new SumTypeVariant( - 'OneOffQueryResponse', - __OneOffQueryResponse.getTypeScriptAlgebraicType() - ), - new SumTypeVariant( - 'SubscribeApplied', - __SubscribeApplied.getTypeScriptAlgebraicType() - ), - new SumTypeVariant( - 'UnsubscribeApplied', - __UnsubscribeApplied.getTypeScriptAlgebraicType() - ), - new SumTypeVariant( - 'SubscriptionError', - __SubscriptionError.getTypeScriptAlgebraicType() - ), + new SumTypeVariant("InitialSubscription", __InitialSubscription.getTypeScriptAlgebraicType()), + new SumTypeVariant("TransactionUpdate", __TransactionUpdate.getTypeScriptAlgebraicType()), + new SumTypeVariant("TransactionUpdateLight", __TransactionUpdateLight.getTypeScriptAlgebraicType()), + new SumTypeVariant("IdentityToken", __IdentityToken.getTypeScriptAlgebraicType()), + new SumTypeVariant("OneOffQueryResponse", __OneOffQueryResponse.getTypeScriptAlgebraicType()), + new SumTypeVariant("SubscribeApplied", __SubscribeApplied.getTypeScriptAlgebraicType()), + new SumTypeVariant("UnsubscribeApplied", __UnsubscribeApplied.getTypeScriptAlgebraicType()), + new SumTypeVariant("SubscriptionError", __SubscriptionError.getTypeScriptAlgebraicType()), + new SumTypeVariant("SubscribeMultiApplied", __SubscribeMultiApplied.getTypeScriptAlgebraicType()), + new SumTypeVariant("UnsubscribeMultiApplied", __UnsubscribeMultiApplied.getTypeScriptAlgebraicType()), ]); } export function serialize(writer: BinaryWriter, value: ServerMessage): void { - ServerMessage.getTypeScriptAlgebraicType().serialize(writer, value); + ServerMessage.getTypeScriptAlgebraicType().serialize(writer, value); } export function deserialize(reader: BinaryReader): ServerMessage { - return ServerMessage.getTypeScriptAlgebraicType().deserialize(reader); + return ServerMessage.getTypeScriptAlgebraicType().deserialize(reader); } + } // The tagged union or sum type for the algebraic type `ServerMessage`. -export type ServerMessage = - | ServerMessage.InitialSubscription - | ServerMessage.TransactionUpdate - | ServerMessage.TransactionUpdateLight - | ServerMessage.IdentityToken - | ServerMessage.OneOffQueryResponse - | ServerMessage.SubscribeApplied - | ServerMessage.UnsubscribeApplied - | ServerMessage.SubscriptionError; +export type ServerMessage = ServerMessage.InitialSubscription | ServerMessage.TransactionUpdate | ServerMessage.TransactionUpdateLight | ServerMessage.IdentityToken | ServerMessage.OneOffQueryResponse | ServerMessage.SubscribeApplied | ServerMessage.UnsubscribeApplied | ServerMessage.SubscriptionError | ServerMessage.SubscribeMultiApplied | ServerMessage.UnsubscribeMultiApplied; export default ServerMessage; + diff --git a/sdks/typescript/packages/sdk/src/client_api/subscribe_applied_type.ts b/sdks/typescript/packages/sdk/src/client_api/subscribe_applied_type.ts index fbd3dfb9c5..a16c7f2731 100644 --- a/sdks/typescript/packages/sdk/src/client_api/subscribe_applied_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/subscribe_applied_type.ts @@ -29,15 +29,15 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; -import { QueryId as __QueryId } from './query_id_type'; -import { SubscribeRows as __SubscribeRows } from './subscribe_rows_type'; +} from "../index"; +import { QueryId as __QueryId } from "./query_id_type"; +import { SubscribeRows as __SubscribeRows } from "./subscribe_rows_type"; export type SubscribeApplied = { - requestId: number; - totalHostExecutionDurationMicros: bigint; - queryId: __QueryId; - rows: __SubscribeRows; + requestId: number, + totalHostExecutionDurationMicros: bigint, + queryId: __QueryId, + rows: __SubscribeRows, }; /** @@ -45,32 +45,26 @@ export type SubscribeApplied = { */ export namespace SubscribeApplied { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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('requestId', AlgebraicType.createU32Type()), - new ProductTypeElement( - 'totalHostExecutionDurationMicros', - AlgebraicType.createU64Type() - ), - new ProductTypeElement('queryId', __QueryId.getTypeScriptAlgebraicType()), - new ProductTypeElement( - 'rows', - __SubscribeRows.getTypeScriptAlgebraicType() - ), + new ProductTypeElement("requestId", AlgebraicType.createU32Type()), + new ProductTypeElement("totalHostExecutionDurationMicros", AlgebraicType.createU64Type()), + new ProductTypeElement("queryId", __QueryId.getTypeScriptAlgebraicType()), + new ProductTypeElement("rows", __SubscribeRows.getTypeScriptAlgebraicType()), ]); } - export function serialize( - writer: BinaryWriter, - value: SubscribeApplied - ): void { + export function serialize(writer: BinaryWriter, value: SubscribeApplied): void { SubscribeApplied.getTypeScriptAlgebraicType().serialize(writer, value); } export function deserialize(reader: BinaryReader): SubscribeApplied { return SubscribeApplied.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/subscribe_multi_applied_type.ts b/sdks/typescript/packages/sdk/src/client_api/subscribe_multi_applied_type.ts new file mode 100644 index 0000000000..fa49960053 --- /dev/null +++ b/sdks/typescript/packages/sdk/src/client_api/subscribe_multi_applied_type.ts @@ -0,0 +1,70 @@ +// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE +// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. + +/* eslint-disable */ +/* tslint:disable */ +// @ts-nocheck +import { + AlgebraicType, + AlgebraicValue, + BinaryReader, + BinaryWriter, + CallReducerFlags, + ConnectionId, + DbConnectionBuilder, + DbConnectionImpl, + DbContext, + ErrorContextInterface, + Event, + EventContextInterface, + Identity, + ProductType, + ProductTypeElement, + ReducerEventContextInterface, + SubscriptionBuilderImpl, + SubscriptionEventContextInterface, + SumType, + SumTypeVariant, + TableCache, + TimeDuration, + Timestamp, + deepEqual, +} from "../index"; +import { QueryId as __QueryId } from "./query_id_type"; +import { DatabaseUpdate as __DatabaseUpdate } from "./database_update_type"; + +export type SubscribeMultiApplied = { + requestId: number, + totalHostExecutionDurationMicros: bigint, + queryId: __QueryId, + update: __DatabaseUpdate, +}; + +/** + * A namespace for generated helper functions. + */ +export namespace SubscribeMultiApplied { + /** + * 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("requestId", AlgebraicType.createU32Type()), + new ProductTypeElement("totalHostExecutionDurationMicros", AlgebraicType.createU64Type()), + new ProductTypeElement("queryId", __QueryId.getTypeScriptAlgebraicType()), + new ProductTypeElement("update", __DatabaseUpdate.getTypeScriptAlgebraicType()), + ]); + } + + export function serialize(writer: BinaryWriter, value: SubscribeMultiApplied): void { + SubscribeMultiApplied.getTypeScriptAlgebraicType().serialize(writer, value); + } + + export function deserialize(reader: BinaryReader): SubscribeMultiApplied { + return SubscribeMultiApplied.getTypeScriptAlgebraicType().deserialize(reader); + } + +} + + diff --git a/sdks/typescript/packages/sdk/src/client_api/subscribe_multi_type.ts b/sdks/typescript/packages/sdk/src/client_api/subscribe_multi_type.ts new file mode 100644 index 0000000000..cac0d7ec16 --- /dev/null +++ b/sdks/typescript/packages/sdk/src/client_api/subscribe_multi_type.ts @@ -0,0 +1,67 @@ +// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE +// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. + +/* eslint-disable */ +/* tslint:disable */ +// @ts-nocheck +import { + AlgebraicType, + AlgebraicValue, + BinaryReader, + BinaryWriter, + CallReducerFlags, + ConnectionId, + DbConnectionBuilder, + DbConnectionImpl, + DbContext, + ErrorContextInterface, + Event, + EventContextInterface, + Identity, + ProductType, + ProductTypeElement, + ReducerEventContextInterface, + SubscriptionBuilderImpl, + SubscriptionEventContextInterface, + SumType, + SumTypeVariant, + TableCache, + TimeDuration, + Timestamp, + deepEqual, +} from "../index"; +import { QueryId as __QueryId } from "./query_id_type"; + +export type SubscribeMulti = { + queryStrings: string[], + requestId: number, + queryId: __QueryId, +}; + +/** + * A namespace for generated helper functions. + */ +export namespace SubscribeMulti { + /** + * 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("queryStrings", AlgebraicType.createArrayType(AlgebraicType.createStringType())), + new ProductTypeElement("requestId", AlgebraicType.createU32Type()), + new ProductTypeElement("queryId", __QueryId.getTypeScriptAlgebraicType()), + ]); + } + + export function serialize(writer: BinaryWriter, value: SubscribeMulti): void { + SubscribeMulti.getTypeScriptAlgebraicType().serialize(writer, value); + } + + export function deserialize(reader: BinaryReader): SubscribeMulti { + return SubscribeMulti.getTypeScriptAlgebraicType().deserialize(reader); + } + +} + + diff --git a/sdks/typescript/packages/sdk/src/client_api/subscribe_rows_type.ts b/sdks/typescript/packages/sdk/src/client_api/subscribe_rows_type.ts index b1c6d6295e..a22e6181d7 100644 --- a/sdks/typescript/packages/sdk/src/client_api/subscribe_rows_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/subscribe_rows_type.ts @@ -29,13 +29,13 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; -import { TableUpdate as __TableUpdate } from './table_update_type'; +} from "../index"; +import { TableUpdate as __TableUpdate } from "./table_update_type"; export type SubscribeRows = { - tableId: number; - tableName: string; - tableRows: __TableUpdate; + tableId: number, + tableName: string, + tableRows: __TableUpdate, }; /** @@ -43,17 +43,14 @@ export type SubscribeRows = { */ export namespace SubscribeRows { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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('tableId', AlgebraicType.createU32Type()), - new ProductTypeElement('tableName', AlgebraicType.createStringType()), - new ProductTypeElement( - 'tableRows', - __TableUpdate.getTypeScriptAlgebraicType() - ), + new ProductTypeElement("tableId", AlgebraicType.createU32Type()), + new ProductTypeElement("tableName", AlgebraicType.createStringType()), + new ProductTypeElement("tableRows", __TableUpdate.getTypeScriptAlgebraicType()), ]); } @@ -64,4 +61,7 @@ export namespace SubscribeRows { export function deserialize(reader: BinaryReader): SubscribeRows { return SubscribeRows.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/subscribe_single_type.ts b/sdks/typescript/packages/sdk/src/client_api/subscribe_single_type.ts index 2f564678c7..ff2ca46c39 100644 --- a/sdks/typescript/packages/sdk/src/client_api/subscribe_single_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/subscribe_single_type.ts @@ -29,13 +29,13 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; -import { QueryId as __QueryId } from './query_id_type'; +} from "../index"; +import { QueryId as __QueryId } from "./query_id_type"; export type SubscribeSingle = { - query: string; - requestId: number; - queryId: __QueryId; + query: string, + requestId: number, + queryId: __QueryId, }; /** @@ -43,25 +43,25 @@ export type SubscribeSingle = { */ export namespace SubscribeSingle { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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('query', AlgebraicType.createStringType()), - new ProductTypeElement('requestId', AlgebraicType.createU32Type()), - new ProductTypeElement('queryId', __QueryId.getTypeScriptAlgebraicType()), + new ProductTypeElement("query", AlgebraicType.createStringType()), + new ProductTypeElement("requestId", AlgebraicType.createU32Type()), + new ProductTypeElement("queryId", __QueryId.getTypeScriptAlgebraicType()), ]); } - export function serialize( - writer: BinaryWriter, - value: SubscribeSingle - ): void { + export function serialize(writer: BinaryWriter, value: SubscribeSingle): void { SubscribeSingle.getTypeScriptAlgebraicType().serialize(writer, value); } export function deserialize(reader: BinaryReader): SubscribeSingle { return SubscribeSingle.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/subscribe_type.ts b/sdks/typescript/packages/sdk/src/client_api/subscribe_type.ts index cb6e4edb6a..954d75c8d4 100644 --- a/sdks/typescript/packages/sdk/src/client_api/subscribe_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/subscribe_type.ts @@ -29,10 +29,10 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; +} from "../index"; export type Subscribe = { - queryStrings: string[]; - requestId: number; + queryStrings: string[], + requestId: number, }; /** @@ -40,16 +40,13 @@ export type Subscribe = { */ export namespace Subscribe { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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( - 'queryStrings', - AlgebraicType.createArrayType(AlgebraicType.createStringType()) - ), - new ProductTypeElement('requestId', AlgebraicType.createU32Type()), + new ProductTypeElement("queryStrings", AlgebraicType.createArrayType(AlgebraicType.createStringType())), + new ProductTypeElement("requestId", AlgebraicType.createU32Type()), ]); } @@ -60,4 +57,7 @@ export namespace Subscribe { export function deserialize(reader: BinaryReader): Subscribe { return Subscribe.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/subscription_error_type.ts b/sdks/typescript/packages/sdk/src/client_api/subscription_error_type.ts index d8e0a792ee..60eca4e03c 100644 --- a/sdks/typescript/packages/sdk/src/client_api/subscription_error_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/subscription_error_type.ts @@ -29,13 +29,13 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; +} from "../index"; export type SubscriptionError = { - totalHostExecutionDurationMicros: bigint; - requestId: number | undefined; - queryId: number | undefined; - tableId: number | undefined; - error: string; + totalHostExecutionDurationMicros: bigint, + requestId: number | undefined, + queryId: number | undefined, + tableId: number | undefined, + error: string, }; /** @@ -43,39 +43,27 @@ export type SubscriptionError = { */ export namespace SubscriptionError { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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( - 'totalHostExecutionDurationMicros', - AlgebraicType.createU64Type() - ), - new ProductTypeElement( - 'requestId', - AlgebraicType.createOptionType(AlgebraicType.createU32Type()) - ), - new ProductTypeElement( - 'queryId', - AlgebraicType.createOptionType(AlgebraicType.createU32Type()) - ), - new ProductTypeElement( - 'tableId', - AlgebraicType.createOptionType(AlgebraicType.createU32Type()) - ), - new ProductTypeElement('error', AlgebraicType.createStringType()), + new ProductTypeElement("totalHostExecutionDurationMicros", AlgebraicType.createU64Type()), + new ProductTypeElement("requestId", AlgebraicType.createOptionType(AlgebraicType.createU32Type())), + new ProductTypeElement("queryId", AlgebraicType.createOptionType(AlgebraicType.createU32Type())), + new ProductTypeElement("tableId", AlgebraicType.createOptionType(AlgebraicType.createU32Type())), + new ProductTypeElement("error", AlgebraicType.createStringType()), ]); } - export function serialize( - writer: BinaryWriter, - value: SubscriptionError - ): void { + export function serialize(writer: BinaryWriter, value: SubscriptionError): void { SubscriptionError.getTypeScriptAlgebraicType().serialize(writer, value); } export function deserialize(reader: BinaryReader): SubscriptionError { return SubscriptionError.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/table_update_type.ts b/sdks/typescript/packages/sdk/src/client_api/table_update_type.ts index cc4999cb9f..790616eb25 100644 --- a/sdks/typescript/packages/sdk/src/client_api/table_update_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/table_update_type.ts @@ -29,14 +29,14 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; -import { CompressableQueryUpdate as __CompressableQueryUpdate } from './compressable_query_update_type'; +} from "../index"; +import { CompressableQueryUpdate as __CompressableQueryUpdate } from "./compressable_query_update_type"; export type TableUpdate = { - tableId: number; - tableName: string; - numRows: bigint; - updates: __CompressableQueryUpdate[]; + tableId: number, + tableName: string, + numRows: bigint, + updates: __CompressableQueryUpdate[], }; /** @@ -44,20 +44,15 @@ export type TableUpdate = { */ export namespace TableUpdate { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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('tableId', AlgebraicType.createU32Type()), - new ProductTypeElement('tableName', AlgebraicType.createStringType()), - new ProductTypeElement('numRows', AlgebraicType.createU64Type()), - new ProductTypeElement( - 'updates', - AlgebraicType.createArrayType( - __CompressableQueryUpdate.getTypeScriptAlgebraicType() - ) - ), + new ProductTypeElement("tableId", AlgebraicType.createU32Type()), + new ProductTypeElement("tableName", AlgebraicType.createStringType()), + new ProductTypeElement("numRows", AlgebraicType.createU64Type()), + new ProductTypeElement("updates", AlgebraicType.createArrayType(__CompressableQueryUpdate.getTypeScriptAlgebraicType())), ]); } @@ -68,4 +63,7 @@ export namespace TableUpdate { export function deserialize(reader: BinaryReader): TableUpdate { return TableUpdate.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/transaction_update_light_type.ts b/sdks/typescript/packages/sdk/src/client_api/transaction_update_light_type.ts index 567fe4b332..1d20c39e3e 100644 --- a/sdks/typescript/packages/sdk/src/client_api/transaction_update_light_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/transaction_update_light_type.ts @@ -29,12 +29,12 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; -import { DatabaseUpdate as __DatabaseUpdate } from './database_update_type'; +} from "../index"; +import { DatabaseUpdate as __DatabaseUpdate } from "./database_update_type"; export type TransactionUpdateLight = { - requestId: number; - update: __DatabaseUpdate; + requestId: number, + update: __DatabaseUpdate, }; /** @@ -42,32 +42,24 @@ export type TransactionUpdateLight = { */ export namespace TransactionUpdateLight { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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('requestId', AlgebraicType.createU32Type()), - new ProductTypeElement( - 'update', - __DatabaseUpdate.getTypeScriptAlgebraicType() - ), + new ProductTypeElement("requestId", AlgebraicType.createU32Type()), + new ProductTypeElement("update", __DatabaseUpdate.getTypeScriptAlgebraicType()), ]); } - export function serialize( - writer: BinaryWriter, - value: TransactionUpdateLight - ): void { - TransactionUpdateLight.getTypeScriptAlgebraicType().serialize( - writer, - value - ); + export function serialize(writer: BinaryWriter, value: TransactionUpdateLight): void { + TransactionUpdateLight.getTypeScriptAlgebraicType().serialize(writer, value); } export function deserialize(reader: BinaryReader): TransactionUpdateLight { - return TransactionUpdateLight.getTypeScriptAlgebraicType().deserialize( - reader - ); + return TransactionUpdateLight.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/transaction_update_type.ts b/sdks/typescript/packages/sdk/src/client_api/transaction_update_type.ts index 6391ba98d6..0090aef307 100644 --- a/sdks/typescript/packages/sdk/src/client_api/transaction_update_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/transaction_update_type.ts @@ -29,19 +29,19 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; -import { UpdateStatus as __UpdateStatus } from './update_status_type'; -import { ReducerCallInfo as __ReducerCallInfo } from './reducer_call_info_type'; -import { EnergyQuanta as __EnergyQuanta } from './energy_quanta_type'; +} from "../index"; +import { UpdateStatus as __UpdateStatus } from "./update_status_type"; +import { ReducerCallInfo as __ReducerCallInfo } from "./reducer_call_info_type"; +import { EnergyQuanta as __EnergyQuanta } from "./energy_quanta_type"; export type TransactionUpdate = { - status: __UpdateStatus; - timestamp: Timestamp; - callerIdentity: Identity; - callerConnectionId: ConnectionId; - reducerCall: __ReducerCallInfo; - energyQuantaUsed: __EnergyQuanta; - totalHostExecutionDuration: TimeDuration; + status: __UpdateStatus, + timestamp: Timestamp, + callerIdentity: Identity, + callerConnectionId: ConnectionId, + reducerCall: __ReducerCallInfo, + energyQuantaUsed: __EnergyQuanta, + totalHostExecutionDuration: TimeDuration, }; /** @@ -49,47 +49,29 @@ export type TransactionUpdate = { */ export namespace TransactionUpdate { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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( - 'status', - __UpdateStatus.getTypeScriptAlgebraicType() - ), - new ProductTypeElement('timestamp', AlgebraicType.createTimestampType()), - new ProductTypeElement( - 'callerIdentity', - AlgebraicType.createIdentityType() - ), - new ProductTypeElement( - 'callerConnectionId', - AlgebraicType.createConnectionIdType() - ), - new ProductTypeElement( - 'reducerCall', - __ReducerCallInfo.getTypeScriptAlgebraicType() - ), - new ProductTypeElement( - 'energyQuantaUsed', - __EnergyQuanta.getTypeScriptAlgebraicType() - ), - new ProductTypeElement( - 'totalHostExecutionDuration', - AlgebraicType.createTimeDurationType() - ), + new ProductTypeElement("status", __UpdateStatus.getTypeScriptAlgebraicType()), + new ProductTypeElement("timestamp", AlgebraicType.createTimestampType()), + new ProductTypeElement("callerIdentity", AlgebraicType.createIdentityType()), + new ProductTypeElement("callerConnectionId", AlgebraicType.createConnectionIdType()), + new ProductTypeElement("reducerCall", __ReducerCallInfo.getTypeScriptAlgebraicType()), + new ProductTypeElement("energyQuantaUsed", __EnergyQuanta.getTypeScriptAlgebraicType()), + new ProductTypeElement("totalHostExecutionDuration", AlgebraicType.createTimeDurationType()), ]); } - export function serialize( - writer: BinaryWriter, - value: TransactionUpdate - ): void { + export function serialize(writer: BinaryWriter, value: TransactionUpdate): void { TransactionUpdate.getTypeScriptAlgebraicType().serialize(writer, value); } export function deserialize(reader: BinaryReader): TransactionUpdate { return TransactionUpdate.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/unsubscribe_applied_type.ts b/sdks/typescript/packages/sdk/src/client_api/unsubscribe_applied_type.ts index ab63a797d5..f285012a85 100644 --- a/sdks/typescript/packages/sdk/src/client_api/unsubscribe_applied_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/unsubscribe_applied_type.ts @@ -29,15 +29,15 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; -import { QueryId as __QueryId } from './query_id_type'; -import { SubscribeRows as __SubscribeRows } from './subscribe_rows_type'; +} from "../index"; +import { QueryId as __QueryId } from "./query_id_type"; +import { SubscribeRows as __SubscribeRows } from "./subscribe_rows_type"; export type UnsubscribeApplied = { - requestId: number; - totalHostExecutionDurationMicros: bigint; - queryId: __QueryId; - rows: __SubscribeRows; + requestId: number, + totalHostExecutionDurationMicros: bigint, + queryId: __QueryId, + rows: __SubscribeRows, }; /** @@ -45,32 +45,26 @@ export type UnsubscribeApplied = { */ export namespace UnsubscribeApplied { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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('requestId', AlgebraicType.createU32Type()), - new ProductTypeElement( - 'totalHostExecutionDurationMicros', - AlgebraicType.createU64Type() - ), - new ProductTypeElement('queryId', __QueryId.getTypeScriptAlgebraicType()), - new ProductTypeElement( - 'rows', - __SubscribeRows.getTypeScriptAlgebraicType() - ), + new ProductTypeElement("requestId", AlgebraicType.createU32Type()), + new ProductTypeElement("totalHostExecutionDurationMicros", AlgebraicType.createU64Type()), + new ProductTypeElement("queryId", __QueryId.getTypeScriptAlgebraicType()), + new ProductTypeElement("rows", __SubscribeRows.getTypeScriptAlgebraicType()), ]); } - export function serialize( - writer: BinaryWriter, - value: UnsubscribeApplied - ): void { + export function serialize(writer: BinaryWriter, value: UnsubscribeApplied): void { UnsubscribeApplied.getTypeScriptAlgebraicType().serialize(writer, value); } export function deserialize(reader: BinaryReader): UnsubscribeApplied { return UnsubscribeApplied.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/unsubscribe_multi_applied_type.ts b/sdks/typescript/packages/sdk/src/client_api/unsubscribe_multi_applied_type.ts new file mode 100644 index 0000000000..09eb195c36 --- /dev/null +++ b/sdks/typescript/packages/sdk/src/client_api/unsubscribe_multi_applied_type.ts @@ -0,0 +1,70 @@ +// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE +// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. + +/* eslint-disable */ +/* tslint:disable */ +// @ts-nocheck +import { + AlgebraicType, + AlgebraicValue, + BinaryReader, + BinaryWriter, + CallReducerFlags, + ConnectionId, + DbConnectionBuilder, + DbConnectionImpl, + DbContext, + ErrorContextInterface, + Event, + EventContextInterface, + Identity, + ProductType, + ProductTypeElement, + ReducerEventContextInterface, + SubscriptionBuilderImpl, + SubscriptionEventContextInterface, + SumType, + SumTypeVariant, + TableCache, + TimeDuration, + Timestamp, + deepEqual, +} from "../index"; +import { QueryId as __QueryId } from "./query_id_type"; +import { DatabaseUpdate as __DatabaseUpdate } from "./database_update_type"; + +export type UnsubscribeMultiApplied = { + requestId: number, + totalHostExecutionDurationMicros: bigint, + queryId: __QueryId, + update: __DatabaseUpdate, +}; + +/** + * A namespace for generated helper functions. + */ +export namespace UnsubscribeMultiApplied { + /** + * 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("requestId", AlgebraicType.createU32Type()), + new ProductTypeElement("totalHostExecutionDurationMicros", AlgebraicType.createU64Type()), + new ProductTypeElement("queryId", __QueryId.getTypeScriptAlgebraicType()), + new ProductTypeElement("update", __DatabaseUpdate.getTypeScriptAlgebraicType()), + ]); + } + + export function serialize(writer: BinaryWriter, value: UnsubscribeMultiApplied): void { + UnsubscribeMultiApplied.getTypeScriptAlgebraicType().serialize(writer, value); + } + + export function deserialize(reader: BinaryReader): UnsubscribeMultiApplied { + return UnsubscribeMultiApplied.getTypeScriptAlgebraicType().deserialize(reader); + } + +} + + diff --git a/sdks/typescript/packages/sdk/src/client_api/unsubscribe_multi_type.ts b/sdks/typescript/packages/sdk/src/client_api/unsubscribe_multi_type.ts new file mode 100644 index 0000000000..915062e82e --- /dev/null +++ b/sdks/typescript/packages/sdk/src/client_api/unsubscribe_multi_type.ts @@ -0,0 +1,65 @@ +// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE +// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. + +/* eslint-disable */ +/* tslint:disable */ +// @ts-nocheck +import { + AlgebraicType, + AlgebraicValue, + BinaryReader, + BinaryWriter, + CallReducerFlags, + ConnectionId, + DbConnectionBuilder, + DbConnectionImpl, + DbContext, + ErrorContextInterface, + Event, + EventContextInterface, + Identity, + ProductType, + ProductTypeElement, + ReducerEventContextInterface, + SubscriptionBuilderImpl, + SubscriptionEventContextInterface, + SumType, + SumTypeVariant, + TableCache, + TimeDuration, + Timestamp, + deepEqual, +} from "../index"; +import { QueryId as __QueryId } from "./query_id_type"; + +export type UnsubscribeMulti = { + requestId: number, + queryId: __QueryId, +}; + +/** + * A namespace for generated helper functions. + */ +export namespace UnsubscribeMulti { + /** + * 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("requestId", AlgebraicType.createU32Type()), + new ProductTypeElement("queryId", __QueryId.getTypeScriptAlgebraicType()), + ]); + } + + export function serialize(writer: BinaryWriter, value: UnsubscribeMulti): void { + UnsubscribeMulti.getTypeScriptAlgebraicType().serialize(writer, value); + } + + export function deserialize(reader: BinaryReader): UnsubscribeMulti { + return UnsubscribeMulti.getTypeScriptAlgebraicType().deserialize(reader); + } + +} + + diff --git a/sdks/typescript/packages/sdk/src/client_api/unsubscribe_type.ts b/sdks/typescript/packages/sdk/src/client_api/unsubscribe_type.ts index 368f68c4d8..ea1c51ef40 100644 --- a/sdks/typescript/packages/sdk/src/client_api/unsubscribe_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/unsubscribe_type.ts @@ -29,12 +29,12 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; -import { QueryId as __QueryId } from './query_id_type'; +} from "../index"; +import { QueryId as __QueryId } from "./query_id_type"; export type Unsubscribe = { - requestId: number; - queryId: __QueryId; + requestId: number, + queryId: __QueryId, }; /** @@ -42,13 +42,13 @@ export type Unsubscribe = { */ export namespace Unsubscribe { /** - * A function which returns this type represented as an AlgebraicType. - * This function is derived from the AlgebraicType used to generate this type. - */ + * 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('requestId', AlgebraicType.createU32Type()), - new ProductTypeElement('queryId', __QueryId.getTypeScriptAlgebraicType()), + new ProductTypeElement("requestId", AlgebraicType.createU32Type()), + new ProductTypeElement("queryId", __QueryId.getTypeScriptAlgebraicType()), ]); } @@ -59,4 +59,7 @@ export namespace Unsubscribe { export function deserialize(reader: BinaryReader): Unsubscribe { return Unsubscribe.getTypeScriptAlgebraicType().deserialize(reader); } + } + + diff --git a/sdks/typescript/packages/sdk/src/client_api/update_status_type.ts b/sdks/typescript/packages/sdk/src/client_api/update_status_type.ts index 68aa8865f5..368a52d359 100644 --- a/sdks/typescript/packages/sdk/src/client_api/update_status_type.ts +++ b/sdks/typescript/packages/sdk/src/client_api/update_status_type.ts @@ -29,17 +29,17 @@ import { TimeDuration, Timestamp, deepEqual, -} from '../index'; -import { DatabaseUpdate as __DatabaseUpdate } from './database_update_type'; +} from "../index"; +import { DatabaseUpdate as __DatabaseUpdate } from "./database_update_type"; // A namespace for generated variants and helper functions. export namespace UpdateStatus { // These are the generated variant types for each variant of the tagged union. // One type is generated per variant and will be used in the `value` field of // the tagged union. - export type Committed = { tag: 'Committed'; value: __DatabaseUpdate }; - export type Failed = { tag: 'Failed'; value: string }; - export type OutOfEnergy = { tag: 'OutOfEnergy' }; + export type Committed = { tag: "Committed", value: __DatabaseUpdate }; + export type Failed = { tag: "Failed", value: string }; + export type OutOfEnergy = { tag: "OutOfEnergy" }; // Helper functions for constructing each variant of the tagged union. // ``` @@ -47,40 +47,30 @@ export namespace UpdateStatus { // assert!(foo.tag === "A"); // assert!(foo.value === 42); // ``` - export const Committed = (value: __DatabaseUpdate): UpdateStatus => ({ - tag: 'Committed', - value, - }); - export const Failed = (value: string): UpdateStatus => ({ - tag: 'Failed', - value, - }); - export const OutOfEnergy = { tag: 'OutOfEnergy' }; + export const Committed = (value: __DatabaseUpdate): UpdateStatus => ({ tag: "Committed", value }); + export const Failed = (value: string): UpdateStatus => ({ tag: "Failed", value }); + export const OutOfEnergy = { tag: "OutOfEnergy" }; export function getTypeScriptAlgebraicType(): AlgebraicType { return AlgebraicType.createSumType([ - new SumTypeVariant( - 'Committed', - __DatabaseUpdate.getTypeScriptAlgebraicType() - ), - new SumTypeVariant('Failed', AlgebraicType.createStringType()), - new SumTypeVariant('OutOfEnergy', AlgebraicType.createProductType([])), + new SumTypeVariant("Committed", __DatabaseUpdate.getTypeScriptAlgebraicType()), + new SumTypeVariant("Failed", AlgebraicType.createStringType()), + new SumTypeVariant("OutOfEnergy", AlgebraicType.createProductType([])), ]); } export function serialize(writer: BinaryWriter, value: UpdateStatus): void { - UpdateStatus.getTypeScriptAlgebraicType().serialize(writer, value); + UpdateStatus.getTypeScriptAlgebraicType().serialize(writer, value); } export function deserialize(reader: BinaryReader): UpdateStatus { - return UpdateStatus.getTypeScriptAlgebraicType().deserialize(reader); + return UpdateStatus.getTypeScriptAlgebraicType().deserialize(reader); } + } // The tagged union or sum type for the algebraic type `UpdateStatus`. -export type UpdateStatus = - | UpdateStatus.Committed - | UpdateStatus.Failed - | UpdateStatus.OutOfEnergy; +export type UpdateStatus = UpdateStatus.Committed | UpdateStatus.Failed | UpdateStatus.OutOfEnergy; export default UpdateStatus; +