Regen the api types from the server.

This commit is contained in:
Jeffrey Dallatezza
2025-02-19 10:16:03 -08:00
parent 4d9cc5921e
commit 3f2db9f6fe
32 changed files with 775 additions and 732 deletions
@@ -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);
}
}
@@ -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);
}
}
@@ -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;
@@ -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;
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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<Reducer>) => {
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<RemoteTables, RemoteReducers, SetReducerFlags> { }
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<RemoteTables, RemoteReducers, SetReducerFlags> {
static builder = (): DbConnectionBuilder<DbConnection, ErrorContext, SubscriptionEventContext> => {
return new DBConnectionBuilder<DBConnection, ErrorContext, SubscriptionEventContext>(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<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>;
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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;
@@ -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;
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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);
}
}
@@ -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;