mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-05-06 07:26:43 -04:00
Reorganize types generated for typescript clients (#4258)
NOTE: Cherry-picking https://github.com/clockworklabs/SpacetimeDB/pull/4127 from the `2.0-breaking-changes` branch. ## Original PR Description This changes generated types in ts client bindings. We currently generate a few different types of types: reducer args, procedure args, rows, and user defined types. To avoid potential conflicts between these types (for example, if a user defined a type called `FooRow`, and also had a tabled named `foo`, we would end up with two types named `FooRow`), this puts each set of types in a different file and namespace. We also stopped exporting the `xxxRow` types, because there is always another type generated for those. We now have a `types` directory, which has an `index.ts` with user defined types, along with `reducers.ts` and `procedures.ts` for the types generated for reducer/procedure parameters. ``` import type * as Types from './module_bindings/types'; var currentMessages: Types.Message[] = []; ``` or ``` import { type Message } from './module_bindings/types'; var currentMessages: Message[] = []; ``` This has a couple other changes: - For procedure and reducer types, this adds a suffix of `Args`, since we may want types for the return values in the future. - For all of the types, instead of exposing the schema object, we are now giving the typescript type (e.g. `export type Message = __Infer<typeof MessageRow>;`). I couldn't think of a reason for users to want the schema object, so this should save users from needing to do all of the `Infer` boilerplate. This is a breaking change for v2. 2. This only changes typescript, and it should generally make thing easier to use. --------- Co-authored-by: Jeffrey Dallatezza <jeffreydallatezza@gmail.com>
This commit is contained in:
+6
-74
@@ -1,7 +1,7 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
// This was generated using spacetimedb cli version 1.11.3 (commit f9bca6a8df856d950360b40cbce744fcbffc9a63).
|
||||
// This was generated using spacetimedb cli version 1.12.0 (commit e2920b5e361495b16bd50e2899024ca680d52e8b).
|
||||
|
||||
/* eslint-disable */
|
||||
/* tslint:disable */
|
||||
@@ -33,81 +33,13 @@ import {
|
||||
type SubscriptionHandleImpl as __SubscriptionHandleImpl,
|
||||
} from '../../index';
|
||||
|
||||
// Import and reexport all reducer arg types
|
||||
// Import all reducer arg schemas
|
||||
|
||||
// Import and reexport all procedure arg types
|
||||
// Import all procedure arg schemas
|
||||
|
||||
// Import and reexport all table handle types
|
||||
// Import all table schema definitions
|
||||
|
||||
// Import and reexport all types
|
||||
import BsatnRowList from './bsatn_row_list_type';
|
||||
export { BsatnRowList };
|
||||
import CallProcedure from './call_procedure_type';
|
||||
export { CallProcedure };
|
||||
import CallReducer from './call_reducer_type';
|
||||
export { CallReducer };
|
||||
import ClientMessage from './client_message_type';
|
||||
export { ClientMessage };
|
||||
import CompressableQueryUpdate from './compressable_query_update_type';
|
||||
export { CompressableQueryUpdate };
|
||||
import DatabaseUpdate from './database_update_type';
|
||||
export { DatabaseUpdate };
|
||||
import EnergyQuanta from './energy_quanta_type';
|
||||
export { EnergyQuanta };
|
||||
import IdentityToken from './identity_token_type';
|
||||
export { IdentityToken };
|
||||
import InitialSubscription from './initial_subscription_type';
|
||||
export { InitialSubscription };
|
||||
import OneOffQuery from './one_off_query_type';
|
||||
export { OneOffQuery };
|
||||
import OneOffQueryResponse from './one_off_query_response_type';
|
||||
export { OneOffQueryResponse };
|
||||
import OneOffTable from './one_off_table_type';
|
||||
export { OneOffTable };
|
||||
import ProcedureResult from './procedure_result_type';
|
||||
export { ProcedureResult };
|
||||
import ProcedureStatus from './procedure_status_type';
|
||||
export { ProcedureStatus };
|
||||
import QueryId from './query_id_type';
|
||||
export { QueryId };
|
||||
import QueryUpdate from './query_update_type';
|
||||
export { QueryUpdate };
|
||||
import ReducerCallInfo from './reducer_call_info_type';
|
||||
export { ReducerCallInfo };
|
||||
import RowSizeHint from './row_size_hint_type';
|
||||
export { RowSizeHint };
|
||||
import ServerMessage from './server_message_type';
|
||||
export { ServerMessage };
|
||||
import Subscribe from './subscribe_type';
|
||||
export { Subscribe };
|
||||
import SubscribeApplied from './subscribe_applied_type';
|
||||
export { SubscribeApplied };
|
||||
import SubscribeMulti from './subscribe_multi_type';
|
||||
export { SubscribeMulti };
|
||||
import SubscribeMultiApplied from './subscribe_multi_applied_type';
|
||||
export { SubscribeMultiApplied };
|
||||
import SubscribeRows from './subscribe_rows_type';
|
||||
export { SubscribeRows };
|
||||
import SubscribeSingle from './subscribe_single_type';
|
||||
export { SubscribeSingle };
|
||||
import SubscriptionError from './subscription_error_type';
|
||||
export { SubscriptionError };
|
||||
import TableUpdate from './table_update_type';
|
||||
export { TableUpdate };
|
||||
import TransactionUpdate from './transaction_update_type';
|
||||
export { TransactionUpdate };
|
||||
import TransactionUpdateLight from './transaction_update_light_type';
|
||||
export { TransactionUpdateLight };
|
||||
import Unsubscribe from './unsubscribe_type';
|
||||
export { Unsubscribe };
|
||||
import UnsubscribeApplied from './unsubscribe_applied_type';
|
||||
export { UnsubscribeApplied };
|
||||
import UnsubscribeMulti from './unsubscribe_multi_type';
|
||||
export { UnsubscribeMulti };
|
||||
import UnsubscribeMultiApplied from './unsubscribe_multi_applied_type';
|
||||
export { UnsubscribeMultiApplied };
|
||||
import UpdateStatus from './update_status_type';
|
||||
export { UpdateStatus };
|
||||
/** Type-only namespace exports for generated type groups. */
|
||||
|
||||
/** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */
|
||||
const tablesSchema = __schema();
|
||||
@@ -121,7 +53,7 @@ const proceduresSchema = __procedures();
|
||||
/** The remote SpacetimeDB module schema, both runtime and type information. */
|
||||
const REMOTE_MODULE = {
|
||||
versionInfo: {
|
||||
cliVersion: '1.11.3' as const,
|
||||
cliVersion: '1.12.0' as const,
|
||||
},
|
||||
tables: tablesSchema.schemaType.tables,
|
||||
reducers: reducersSchema.reducersType.reducers,
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from '../../lib/type_builders';
|
||||
|
||||
// Import all procedure arg schemas
|
||||
@@ -0,0 +1,8 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from '../../lib/type_builders';
|
||||
|
||||
// Import all reducer arg schemas
|
||||
@@ -0,0 +1,8 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from '../../lib/type_builders';
|
||||
|
||||
// Import all table schema definitions
|
||||
@@ -0,0 +1,77 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from '../../lib/type_builders';
|
||||
|
||||
// Import all non-reducer types
|
||||
import BsatnRowList from './bsatn_row_list_type';
|
||||
import CallProcedure from './call_procedure_type';
|
||||
import CallReducer from './call_reducer_type';
|
||||
import ClientMessage from './client_message_type';
|
||||
import CompressableQueryUpdate from './compressable_query_update_type';
|
||||
import DatabaseUpdate from './database_update_type';
|
||||
import EnergyQuanta from './energy_quanta_type';
|
||||
import IdentityToken from './identity_token_type';
|
||||
import InitialSubscription from './initial_subscription_type';
|
||||
import OneOffQuery from './one_off_query_type';
|
||||
import OneOffQueryResponse from './one_off_query_response_type';
|
||||
import OneOffTable from './one_off_table_type';
|
||||
import ProcedureResult from './procedure_result_type';
|
||||
import ProcedureStatus from './procedure_status_type';
|
||||
import QueryId from './query_id_type';
|
||||
import QueryUpdate from './query_update_type';
|
||||
import ReducerCallInfo from './reducer_call_info_type';
|
||||
import RowSizeHint from './row_size_hint_type';
|
||||
import ServerMessage from './server_message_type';
|
||||
import Subscribe from './subscribe_type';
|
||||
import SubscribeApplied from './subscribe_applied_type';
|
||||
import SubscribeMulti from './subscribe_multi_type';
|
||||
import SubscribeMultiApplied from './subscribe_multi_applied_type';
|
||||
import SubscribeRows from './subscribe_rows_type';
|
||||
import SubscribeSingle from './subscribe_single_type';
|
||||
import SubscriptionError from './subscription_error_type';
|
||||
import TableUpdate from './table_update_type';
|
||||
import TransactionUpdate from './transaction_update_type';
|
||||
import TransactionUpdateLight from './transaction_update_light_type';
|
||||
import Unsubscribe from './unsubscribe_type';
|
||||
import UnsubscribeApplied from './unsubscribe_applied_type';
|
||||
import UnsubscribeMulti from './unsubscribe_multi_type';
|
||||
import UnsubscribeMultiApplied from './unsubscribe_multi_applied_type';
|
||||
import UpdateStatus from './update_status_type';
|
||||
|
||||
export type BsatnRowList = __Infer<typeof BsatnRowList>;
|
||||
export type CallProcedure = __Infer<typeof CallProcedure>;
|
||||
export type CallReducer = __Infer<typeof CallReducer>;
|
||||
export type ClientMessage = __Infer<typeof ClientMessage>;
|
||||
export type CompressableQueryUpdate = __Infer<typeof CompressableQueryUpdate>;
|
||||
export type DatabaseUpdate = __Infer<typeof DatabaseUpdate>;
|
||||
export type EnergyQuanta = __Infer<typeof EnergyQuanta>;
|
||||
export type IdentityToken = __Infer<typeof IdentityToken>;
|
||||
export type InitialSubscription = __Infer<typeof InitialSubscription>;
|
||||
export type OneOffQuery = __Infer<typeof OneOffQuery>;
|
||||
export type OneOffQueryResponse = __Infer<typeof OneOffQueryResponse>;
|
||||
export type OneOffTable = __Infer<typeof OneOffTable>;
|
||||
export type ProcedureResult = __Infer<typeof ProcedureResult>;
|
||||
export type ProcedureStatus = __Infer<typeof ProcedureStatus>;
|
||||
export type QueryId = __Infer<typeof QueryId>;
|
||||
export type QueryUpdate = __Infer<typeof QueryUpdate>;
|
||||
export type ReducerCallInfo = __Infer<typeof ReducerCallInfo>;
|
||||
export type RowSizeHint = __Infer<typeof RowSizeHint>;
|
||||
export type ServerMessage = __Infer<typeof ServerMessage>;
|
||||
export type Subscribe = __Infer<typeof Subscribe>;
|
||||
export type SubscribeApplied = __Infer<typeof SubscribeApplied>;
|
||||
export type SubscribeMulti = __Infer<typeof SubscribeMulti>;
|
||||
export type SubscribeMultiApplied = __Infer<typeof SubscribeMultiApplied>;
|
||||
export type SubscribeRows = __Infer<typeof SubscribeRows>;
|
||||
export type SubscribeSingle = __Infer<typeof SubscribeSingle>;
|
||||
export type SubscriptionError = __Infer<typeof SubscriptionError>;
|
||||
export type TableUpdate = __Infer<typeof TableUpdate>;
|
||||
export type TransactionUpdate = __Infer<typeof TransactionUpdate>;
|
||||
export type TransactionUpdateLight = __Infer<typeof TransactionUpdateLight>;
|
||||
export type Unsubscribe = __Infer<typeof Unsubscribe>;
|
||||
export type UnsubscribeApplied = __Infer<typeof UnsubscribeApplied>;
|
||||
export type UnsubscribeMulti = __Infer<typeof UnsubscribeMulti>;
|
||||
export type UnsubscribeMultiApplied = __Infer<typeof UnsubscribeMultiApplied>;
|
||||
export type UpdateStatus = __Infer<typeof UpdateStatus>;
|
||||
@@ -0,0 +1,77 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from '../../../lib/type_builders';
|
||||
|
||||
// Import all non-reducer types
|
||||
import BsatnRowList from '../bsatn_row_list_type';
|
||||
import CallProcedure from '../call_procedure_type';
|
||||
import CallReducer from '../call_reducer_type';
|
||||
import ClientMessage from '../client_message_type';
|
||||
import CompressableQueryUpdate from '../compressable_query_update_type';
|
||||
import DatabaseUpdate from '../database_update_type';
|
||||
import EnergyQuanta from '../energy_quanta_type';
|
||||
import IdentityToken from '../identity_token_type';
|
||||
import InitialSubscription from '../initial_subscription_type';
|
||||
import OneOffQuery from '../one_off_query_type';
|
||||
import OneOffQueryResponse from '../one_off_query_response_type';
|
||||
import OneOffTable from '../one_off_table_type';
|
||||
import ProcedureResult from '../procedure_result_type';
|
||||
import ProcedureStatus from '../procedure_status_type';
|
||||
import QueryId from '../query_id_type';
|
||||
import QueryUpdate from '../query_update_type';
|
||||
import ReducerCallInfo from '../reducer_call_info_type';
|
||||
import RowSizeHint from '../row_size_hint_type';
|
||||
import ServerMessage from '../server_message_type';
|
||||
import Subscribe from '../subscribe_type';
|
||||
import SubscribeApplied from '../subscribe_applied_type';
|
||||
import SubscribeMulti from '../subscribe_multi_type';
|
||||
import SubscribeMultiApplied from '../subscribe_multi_applied_type';
|
||||
import SubscribeRows from '../subscribe_rows_type';
|
||||
import SubscribeSingle from '../subscribe_single_type';
|
||||
import SubscriptionError from '../subscription_error_type';
|
||||
import TableUpdate from '../table_update_type';
|
||||
import TransactionUpdate from '../transaction_update_type';
|
||||
import TransactionUpdateLight from '../transaction_update_light_type';
|
||||
import Unsubscribe from '../unsubscribe_type';
|
||||
import UnsubscribeApplied from '../unsubscribe_applied_type';
|
||||
import UnsubscribeMulti from '../unsubscribe_multi_type';
|
||||
import UnsubscribeMultiApplied from '../unsubscribe_multi_applied_type';
|
||||
import UpdateStatus from '../update_status_type';
|
||||
|
||||
export type BsatnRowList = __Infer<typeof BsatnRowList>;
|
||||
export type CallProcedure = __Infer<typeof CallProcedure>;
|
||||
export type CallReducer = __Infer<typeof CallReducer>;
|
||||
export type ClientMessage = __Infer<typeof ClientMessage>;
|
||||
export type CompressableQueryUpdate = __Infer<typeof CompressableQueryUpdate>;
|
||||
export type DatabaseUpdate = __Infer<typeof DatabaseUpdate>;
|
||||
export type EnergyQuanta = __Infer<typeof EnergyQuanta>;
|
||||
export type IdentityToken = __Infer<typeof IdentityToken>;
|
||||
export type InitialSubscription = __Infer<typeof InitialSubscription>;
|
||||
export type OneOffQuery = __Infer<typeof OneOffQuery>;
|
||||
export type OneOffQueryResponse = __Infer<typeof OneOffQueryResponse>;
|
||||
export type OneOffTable = __Infer<typeof OneOffTable>;
|
||||
export type ProcedureResult = __Infer<typeof ProcedureResult>;
|
||||
export type ProcedureStatus = __Infer<typeof ProcedureStatus>;
|
||||
export type QueryId = __Infer<typeof QueryId>;
|
||||
export type QueryUpdate = __Infer<typeof QueryUpdate>;
|
||||
export type ReducerCallInfo = __Infer<typeof ReducerCallInfo>;
|
||||
export type RowSizeHint = __Infer<typeof RowSizeHint>;
|
||||
export type ServerMessage = __Infer<typeof ServerMessage>;
|
||||
export type Subscribe = __Infer<typeof Subscribe>;
|
||||
export type SubscribeApplied = __Infer<typeof SubscribeApplied>;
|
||||
export type SubscribeMulti = __Infer<typeof SubscribeMulti>;
|
||||
export type SubscribeMultiApplied = __Infer<typeof SubscribeMultiApplied>;
|
||||
export type SubscribeRows = __Infer<typeof SubscribeRows>;
|
||||
export type SubscribeSingle = __Infer<typeof SubscribeSingle>;
|
||||
export type SubscriptionError = __Infer<typeof SubscriptionError>;
|
||||
export type TableUpdate = __Infer<typeof TableUpdate>;
|
||||
export type TransactionUpdate = __Infer<typeof TransactionUpdate>;
|
||||
export type TransactionUpdateLight = __Infer<typeof TransactionUpdateLight>;
|
||||
export type Unsubscribe = __Infer<typeof Unsubscribe>;
|
||||
export type UnsubscribeApplied = __Infer<typeof UnsubscribeApplied>;
|
||||
export type UnsubscribeMulti = __Infer<typeof UnsubscribeMulti>;
|
||||
export type UnsubscribeMultiApplied = __Infer<typeof UnsubscribeMultiApplied>;
|
||||
export type UpdateStatus = __Infer<typeof UpdateStatus>;
|
||||
@@ -0,0 +1,8 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from '../../../lib/type_builders';
|
||||
|
||||
// Import all procedure arg schemas
|
||||
@@ -0,0 +1,8 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from '../../../lib/type_builders';
|
||||
|
||||
// Import all reducer arg schemas
|
||||
@@ -1,7 +1,7 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
// This was generated using spacetimedb cli version 1.11.3 (commit f9bca6a8df856d950360b40cbce744fcbffc9a63).
|
||||
// This was generated using spacetimedb cli version 1.12.0 (commit e2920b5e361495b16bd50e2899024ca680d52e8b).
|
||||
|
||||
/* eslint-disable */
|
||||
/* tslint:disable */
|
||||
@@ -33,29 +33,17 @@ import {
|
||||
type SubscriptionHandleImpl as __SubscriptionHandleImpl,
|
||||
} from '../../../src/index';
|
||||
|
||||
// Import and reexport all reducer arg types
|
||||
// Import all reducer arg schemas
|
||||
import CreatePlayerReducer from './create_player_reducer';
|
||||
export { CreatePlayerReducer };
|
||||
|
||||
// Import and reexport all procedure arg types
|
||||
// Import all procedure arg schemas
|
||||
|
||||
// Import and reexport all table handle types
|
||||
// Import all table schema definitions
|
||||
import PlayerRow from './player_table';
|
||||
export { PlayerRow };
|
||||
import UnindexedPlayerRow from './unindexed_player_table';
|
||||
export { UnindexedPlayerRow };
|
||||
import UserRow from './user_table';
|
||||
export { UserRow };
|
||||
|
||||
// Import and reexport all types
|
||||
import Player from './player_type';
|
||||
export { Player };
|
||||
import Point from './point_type';
|
||||
export { Point };
|
||||
import UnindexedPlayer from './unindexed_player_type';
|
||||
export { UnindexedPlayer };
|
||||
import User from './user_type';
|
||||
export { User };
|
||||
/** Type-only namespace exports for generated type groups. */
|
||||
|
||||
/** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */
|
||||
const tablesSchema = __schema(
|
||||
@@ -112,7 +100,7 @@ const proceduresSchema = __procedures();
|
||||
/** The remote SpacetimeDB module schema, both runtime and type information. */
|
||||
const REMOTE_MODULE = {
|
||||
versionInfo: {
|
||||
cliVersion: '1.11.3' as const,
|
||||
cliVersion: '1.12.0' as const,
|
||||
},
|
||||
tables: tablesSchema.schemaType.tables,
|
||||
reducers: reducersSchema.reducersType.reducers,
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from '../../../src/index';
|
||||
|
||||
// Import all procedure arg schemas
|
||||
@@ -0,0 +1,11 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from '../../../src/index';
|
||||
|
||||
// Import all reducer arg schemas
|
||||
import CreatePlayerReducer from './create_player_reducer';
|
||||
|
||||
export type CreatePlayerArgs = __Infer<typeof CreatePlayerReducer>;
|
||||
@@ -0,0 +1,17 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from '../../../src/index';
|
||||
|
||||
// Import all non-reducer types
|
||||
import Player from './player_type';
|
||||
import Point from './point_type';
|
||||
import UnindexedPlayer from './unindexed_player_type';
|
||||
import User from './user_type';
|
||||
|
||||
export type Player = __Infer<typeof Player>;
|
||||
export type Point = __Infer<typeof Point>;
|
||||
export type UnindexedPlayer = __Infer<typeof UnindexedPlayer>;
|
||||
export type User = __Infer<typeof User>;
|
||||
@@ -0,0 +1,17 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from '../../../../src/index';
|
||||
|
||||
// Import all non-reducer types
|
||||
import Player from '../player_type';
|
||||
import Point from '../point_type';
|
||||
import UnindexedPlayer from '../unindexed_player_type';
|
||||
import User from '../user_type';
|
||||
|
||||
export type Player = __Infer<typeof Player>;
|
||||
export type Point = __Infer<typeof Point>;
|
||||
export type UnindexedPlayer = __Infer<typeof UnindexedPlayer>;
|
||||
export type User = __Infer<typeof User>;
|
||||
@@ -0,0 +1,8 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from '../../../../src/index';
|
||||
|
||||
// Import all procedure arg schemas
|
||||
@@ -0,0 +1,11 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from '../../../../src/index';
|
||||
|
||||
// Import all reducer arg schemas
|
||||
import CreatePlayerReducer from '../create_player_reducer';
|
||||
|
||||
export type CreatePlayerParams = __Infer<typeof CreatePlayerReducer>;
|
||||
@@ -1,14 +1,15 @@
|
||||
import {
|
||||
CreatePlayerReducer,
|
||||
DbConnection,
|
||||
Player,
|
||||
User,
|
||||
} from '../test-app/src/module_bindings';
|
||||
import { DbConnection } from '../test-app/src/module_bindings';
|
||||
import CreatePlayerReducer from '../test-app/src/module_bindings/create_player_reducer';
|
||||
import Player from '../test-app/src/module_bindings/player_table';
|
||||
import User from '../test-app/src/module_bindings/user_table';
|
||||
import { beforeEach, describe, expect, test } from 'vitest';
|
||||
import { ConnectionId, type Infer } from '../src';
|
||||
import { Timestamp } from '../src';
|
||||
import { TimeDuration } from '../src';
|
||||
import * as ws from '../src/sdk/client_api';
|
||||
import CompressableQueryUpdate from '../src/sdk/client_api/compressable_query_update_type';
|
||||
import RowSizeHint from '../src/sdk/client_api/row_size_hint_type';
|
||||
import ServerMessage from '../src/sdk/client_api/server_message_type';
|
||||
import UpdateStatus from '../src/sdk/client_api/update_status_type';
|
||||
import type { ReducerEvent } from '../src/sdk/db_connection_impl';
|
||||
import { Identity } from '../src';
|
||||
import WebsocketTestAdapter from '../src/sdk/websocket_test_adapter';
|
||||
@@ -109,7 +110,7 @@ describe('DbConnection', () => {
|
||||
await client['wsPromise'];
|
||||
wsAdapter.acceptConnection();
|
||||
|
||||
const tokenMessage = ws.ServerMessage.IdentityToken({
|
||||
const tokenMessage = ServerMessage.IdentityToken({
|
||||
identity: anIdentity,
|
||||
token: 'a-token',
|
||||
connectionId: ConnectionId.random(),
|
||||
@@ -138,7 +139,7 @@ describe('DbConnection', () => {
|
||||
]);
|
||||
wsAdapter.acceptConnection();
|
||||
|
||||
const tokenMessage = ws.ServerMessage.IdentityToken({
|
||||
const tokenMessage = ServerMessage.IdentityToken({
|
||||
identity: anIdentity,
|
||||
token: 'a-token',
|
||||
connectionId: ConnectionId.random(),
|
||||
@@ -190,8 +191,8 @@ describe('DbConnection', () => {
|
||||
}
|
||||
);
|
||||
|
||||
const subscriptionMessage: Infer<typeof ws.ServerMessage> =
|
||||
ws.ServerMessage.InitialSubscription({
|
||||
const subscriptionMessage: Infer<typeof ServerMessage> =
|
||||
ServerMessage.InitialSubscription({
|
||||
databaseUpdate: {
|
||||
tables: [
|
||||
{
|
||||
@@ -199,13 +200,13 @@ describe('DbConnection', () => {
|
||||
tableName: 'player',
|
||||
numRows: BigInt(1),
|
||||
updates: [
|
||||
ws.CompressableQueryUpdate.Uncompressed({
|
||||
CompressableQueryUpdate.Uncompressed({
|
||||
deletes: {
|
||||
sizeHint: ws.RowSizeHint.FixedSize(0), // not used
|
||||
sizeHint: RowSizeHint.FixedSize(0), // not used
|
||||
rowsData: new Uint8Array(),
|
||||
},
|
||||
inserts: {
|
||||
sizeHint: ws.RowSizeHint.FixedSize(0), // not used
|
||||
sizeHint: RowSizeHint.FixedSize(0), // not used
|
||||
rowsData: encodePlayer({
|
||||
id: 1,
|
||||
userId: anIdentity,
|
||||
@@ -235,21 +236,21 @@ describe('DbConnection', () => {
|
||||
expect(inserts[0].player.id).toEqual(1);
|
||||
expect(inserts[0].reducerEvent).toEqual(undefined);
|
||||
|
||||
const transactionUpdate = ws.ServerMessage.TransactionUpdate({
|
||||
status: ws.UpdateStatus.Committed({
|
||||
const transactionUpdate = ServerMessage.TransactionUpdate({
|
||||
status: UpdateStatus.Committed({
|
||||
tables: [
|
||||
{
|
||||
tableId: 35,
|
||||
tableName: 'player',
|
||||
numRows: BigInt(2),
|
||||
updates: [
|
||||
ws.CompressableQueryUpdate.Uncompressed({
|
||||
CompressableQueryUpdate.Uncompressed({
|
||||
deletes: {
|
||||
sizeHint: ws.RowSizeHint.FixedSize(0), // not used
|
||||
sizeHint: RowSizeHint.FixedSize(0), // not used
|
||||
rowsData: new Uint8Array(),
|
||||
},
|
||||
inserts: {
|
||||
sizeHint: ws.RowSizeHint.FixedSize(0), // not used
|
||||
sizeHint: RowSizeHint.FixedSize(0), // not used
|
||||
rowsData: encodePlayer({
|
||||
id: 2,
|
||||
userId: anIdentity,
|
||||
@@ -321,22 +322,22 @@ describe('DbConnection', () => {
|
||||
updatePromise.resolve();
|
||||
});
|
||||
|
||||
const transactionUpdate = ws.ServerMessage.TransactionUpdate({
|
||||
status: ws.UpdateStatus.Committed({
|
||||
const transactionUpdate = ServerMessage.TransactionUpdate({
|
||||
status: UpdateStatus.Committed({
|
||||
tables: [
|
||||
{
|
||||
tableId: 35,
|
||||
tableName: 'player',
|
||||
numRows: BigInt(1),
|
||||
updates: [
|
||||
ws.CompressableQueryUpdate.Uncompressed({
|
||||
CompressableQueryUpdate.Uncompressed({
|
||||
deletes: {
|
||||
sizeHint: ws.RowSizeHint.FixedSize(0), // not used
|
||||
sizeHint: RowSizeHint.FixedSize(0), // not used
|
||||
rowsData: new Uint8Array(),
|
||||
},
|
||||
// FIXME: this test is evil: an initial subscription can never contain deletes or updates.
|
||||
inserts: {
|
||||
sizeHint: ws.RowSizeHint.FixedSize(0), // not used
|
||||
sizeHint: RowSizeHint.FixedSize(0), // not used
|
||||
rowsData: new Uint8Array([
|
||||
...encodePlayer({
|
||||
id: 1,
|
||||
@@ -397,22 +398,22 @@ describe('DbConnection', () => {
|
||||
updatePromise.resolve();
|
||||
});
|
||||
|
||||
const transactionUpdate = ws.ServerMessage.TransactionUpdate({
|
||||
status: ws.UpdateStatus.Committed({
|
||||
const transactionUpdate = ServerMessage.TransactionUpdate({
|
||||
status: UpdateStatus.Committed({
|
||||
tables: [
|
||||
{
|
||||
tableId: 35,
|
||||
tableName: 'player',
|
||||
numRows: BigInt(1),
|
||||
updates: [
|
||||
ws.CompressableQueryUpdate.Uncompressed({
|
||||
CompressableQueryUpdate.Uncompressed({
|
||||
deletes: {
|
||||
sizeHint: ws.RowSizeHint.FixedSize(0), // not used
|
||||
sizeHint: RowSizeHint.FixedSize(0), // not used
|
||||
rowsData: new Uint8Array(),
|
||||
},
|
||||
// FIXME: this test is evil: an initial subscription can never contain deletes or updates.
|
||||
inserts: {
|
||||
sizeHint: ws.RowSizeHint.FixedSize(0), // not used
|
||||
sizeHint: RowSizeHint.FixedSize(0), // not used
|
||||
rowsData: new Uint8Array([
|
||||
...encodePlayer({
|
||||
id: 2,
|
||||
@@ -458,7 +459,7 @@ describe('DbConnection', () => {
|
||||
await client['wsPromise'];
|
||||
wsAdapter.acceptConnection();
|
||||
|
||||
const tokenMessage = ws.ServerMessage.IdentityToken({
|
||||
const tokenMessage = ServerMessage.IdentityToken({
|
||||
identity: Identity.fromString(
|
||||
'0000000000000000000000000000000000000000000000000000000000000069'
|
||||
),
|
||||
@@ -498,7 +499,7 @@ describe('DbConnection', () => {
|
||||
update1Promise.resolve();
|
||||
});
|
||||
|
||||
const subscriptionMessage = ws.ServerMessage.InitialSubscription({
|
||||
const subscriptionMessage = ServerMessage.InitialSubscription({
|
||||
databaseUpdate: {
|
||||
tables: [
|
||||
{
|
||||
@@ -507,13 +508,13 @@ describe('DbConnection', () => {
|
||||
numRows: BigInt(1),
|
||||
updates: [
|
||||
// pgoldman 2024-06-25: This is weird, `InitialSubscription`s aren't supposed to contain deletes or updates.
|
||||
ws.CompressableQueryUpdate.Uncompressed({
|
||||
CompressableQueryUpdate.Uncompressed({
|
||||
deletes: {
|
||||
sizeHint: ws.RowSizeHint.FixedSize(0), // not used
|
||||
sizeHint: RowSizeHint.FixedSize(0), // not used
|
||||
rowsData: new Uint8Array([]),
|
||||
},
|
||||
inserts: {
|
||||
sizeHint: ws.RowSizeHint.FixedSize(0), // not used
|
||||
sizeHint: RowSizeHint.FixedSize(0), // not used
|
||||
rowsData: new Uint8Array([...encodeUser(initialUser)]),
|
||||
},
|
||||
}),
|
||||
@@ -531,22 +532,22 @@ describe('DbConnection', () => {
|
||||
await initialInsertPromise.promise;
|
||||
console.log('First insert is done');
|
||||
|
||||
const transactionUpdate = ws.ServerMessage.TransactionUpdate({
|
||||
status: ws.UpdateStatus.Committed({
|
||||
const transactionUpdate = ServerMessage.TransactionUpdate({
|
||||
status: UpdateStatus.Committed({
|
||||
tables: [
|
||||
{
|
||||
tableId: 35,
|
||||
tableName: 'user',
|
||||
numRows: BigInt(1),
|
||||
updates: [
|
||||
ws.CompressableQueryUpdate.Uncompressed({
|
||||
CompressableQueryUpdate.Uncompressed({
|
||||
deletes: {
|
||||
sizeHint: ws.RowSizeHint.FixedSize(0), // not used
|
||||
sizeHint: RowSizeHint.FixedSize(0), // not used
|
||||
rowsData: new Uint8Array([...encodeUser(initialUser)]),
|
||||
},
|
||||
// FIXME: this test is evil: an initial subscription can never contain deletes or updates.
|
||||
inserts: {
|
||||
sizeHint: ws.RowSizeHint.FixedSize(0), // not used
|
||||
sizeHint: RowSizeHint.FixedSize(0), // not used
|
||||
rowsData: new Uint8Array([...encodeUser(updatedUser)]),
|
||||
},
|
||||
}),
|
||||
@@ -594,22 +595,22 @@ describe('DbConnection', () => {
|
||||
username: 'sally',
|
||||
};
|
||||
const binary = [...encodeUser(user1)].concat([...encodeUser(user2)]);
|
||||
const transactionUpdate = ws.ServerMessage.TransactionUpdate({
|
||||
status: ws.UpdateStatus.Committed({
|
||||
const transactionUpdate = ServerMessage.TransactionUpdate({
|
||||
status: UpdateStatus.Committed({
|
||||
tables: [
|
||||
{
|
||||
tableId: 35,
|
||||
tableName: 'user',
|
||||
numRows: BigInt(1),
|
||||
updates: [
|
||||
ws.CompressableQueryUpdate.Uncompressed({
|
||||
CompressableQueryUpdate.Uncompressed({
|
||||
deletes: {
|
||||
sizeHint: ws.RowSizeHint.FixedSize(0), // not used
|
||||
sizeHint: RowSizeHint.FixedSize(0), // not used
|
||||
rowsData: new Uint8Array([]),
|
||||
},
|
||||
// FIXME: this test is evil: an initial subscription can never contain deletes or updates.
|
||||
inserts: {
|
||||
sizeHint: ws.RowSizeHint.FixedSize(0), // not used
|
||||
sizeHint: RowSizeHint.FixedSize(0), // not used
|
||||
rowsData: new Uint8Array(binary),
|
||||
},
|
||||
}),
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import BinaryWriter from '../src/lib/binary_writer';
|
||||
import { Identity } from '../src/lib/identity';
|
||||
import type { Infer } from '../src/lib/type_builders';
|
||||
import { Player, Point, User } from '../test-app/src/module_bindings';
|
||||
import PlayerRow from '../test-app/src/module_bindings/player_table';
|
||||
import UserRow from '../test-app/src/module_bindings/user_table';
|
||||
import Point from '../test-app/src/module_bindings/point_type';
|
||||
|
||||
export const anIdentity = Identity.fromString(
|
||||
'0000000000000000000000000000000000000000000000000000000000000069'
|
||||
@@ -13,15 +15,15 @@ export const sallyIdentity = Identity.fromString(
|
||||
'000000000000000000000000000000000000000000000000000000000006a111'
|
||||
);
|
||||
|
||||
export function encodePlayer(value: Infer<typeof Player>): Uint8Array {
|
||||
export function encodePlayer(value: Infer<typeof PlayerRow>): Uint8Array {
|
||||
const writer = new BinaryWriter(1024);
|
||||
Player.serialize(writer, value);
|
||||
PlayerRow.serialize(writer, value);
|
||||
return writer.getBuffer();
|
||||
}
|
||||
|
||||
export function encodeUser(value: Infer<typeof User>): Uint8Array {
|
||||
export function encodeUser(value: Infer<typeof UserRow>): Uint8Array {
|
||||
const writer = new BinaryWriter(1024);
|
||||
User.serialize(writer, value);
|
||||
UserRow.serialize(writer, value);
|
||||
return writer.getBuffer();
|
||||
}
|
||||
|
||||
|
||||
@@ -197,10 +197,12 @@ pub async fn exec_ex(
|
||||
let fname = Path::new(&filename);
|
||||
// If a generator asks for a file in a subdirectory, create the subdirectory first.
|
||||
if let Some(parent) = fname.parent().filter(|p| !p.as_os_str().is_empty()) {
|
||||
println!("Creating directory {}", out_dir.join(parent).display());
|
||||
fs::create_dir_all(out_dir.join(parent))?;
|
||||
}
|
||||
let path = out_dir.join(fname);
|
||||
if !path.exists() || fs::read_to_string(&path)? != code {
|
||||
println!("Writing file {}", path.display());
|
||||
fs::write(&path, code)?;
|
||||
}
|
||||
paths.insert(path);
|
||||
|
||||
@@ -45,6 +45,10 @@ fn main() -> anyhow::Result<()> {
|
||||
if filename == "index.ts" {
|
||||
return Ok(());
|
||||
}
|
||||
// We don't need the convenience types.
|
||||
if filename.starts_with("types/") {
|
||||
return Ok(());
|
||||
}
|
||||
let code = regex_replace!(&code, r#"from "spacetimedb";"#, r#"from "../../lib/type_builders";"#);
|
||||
|
||||
// Elide types which are related to client-side only things
|
||||
|
||||
@@ -210,44 +210,39 @@ impl Lang for TypeScript {
|
||||
print_file_header(out, true, false);
|
||||
|
||||
writeln!(out);
|
||||
writeln!(out, "// Import and reexport all reducer arg types");
|
||||
writeln!(out, "// Import all reducer arg schemas");
|
||||
for reducer in iter_reducers(module) {
|
||||
if !is_reducer_invokable(reducer) {
|
||||
// Skip system-defined reducers
|
||||
continue;
|
||||
}
|
||||
let reducer_name = &reducer.name;
|
||||
let reducer_module_name = reducer_module_name(reducer_name);
|
||||
let args_type = reducer_args_type_name(reducer_name);
|
||||
writeln!(out, "import {args_type} from \"./{reducer_module_name}\";");
|
||||
writeln!(out, "export {{ {args_type} }};");
|
||||
}
|
||||
|
||||
writeln!(out);
|
||||
writeln!(out, "// Import and reexport all procedure arg types");
|
||||
writeln!(out, "// Import all procedure arg schemas");
|
||||
for procedure in iter_procedures(module) {
|
||||
let procedure_name = &procedure.name;
|
||||
let procedure_module_name = procedure_module_name(procedure_name);
|
||||
let args_type = procedure_args_type_name(&procedure.name);
|
||||
writeln!(out, "import * as {args_type} from \"./{procedure_module_name}\";");
|
||||
writeln!(out, "export {{ {args_type} }};");
|
||||
}
|
||||
|
||||
writeln!(out);
|
||||
writeln!(out, "// Import and reexport all table handle types");
|
||||
writeln!(out, "// Import all table schema definitions");
|
||||
for (table_name, _) in iter_table_names_and_types(module) {
|
||||
let table_module_name = table_module_name(table_name);
|
||||
let table_name_pascalcase = table_name.deref().to_case(Case::Pascal);
|
||||
// TODO: This really shouldn't be necessary. We could also have `table()` accept
|
||||
// `__t.object(...)`s.
|
||||
writeln!(out, "import {table_name_pascalcase}Row from \"./{table_module_name}\";");
|
||||
writeln!(out, "export {{ {table_name_pascalcase}Row }};");
|
||||
}
|
||||
|
||||
writeln!(out);
|
||||
writeln!(out, "// Import and reexport all types");
|
||||
for ty in iter_types(module) {
|
||||
let type_name = collect_case(Case::Pascal, ty.name.name_segments());
|
||||
let type_module_name = type_module_name(&ty.name);
|
||||
writeln!(out, "import {type_name} from \"./{type_module_name}\";");
|
||||
writeln!(out, "export {{ {type_name} }};");
|
||||
}
|
||||
writeln!(out, "/** Type-only namespace exports for generated type groups. */");
|
||||
|
||||
writeln!(out);
|
||||
writeln!(out, "/** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */");
|
||||
@@ -446,10 +441,128 @@ impl Lang for TypeScript {
|
||||
writeln!(out, "}}");
|
||||
out.newline();
|
||||
|
||||
vec![OutputFile {
|
||||
let index_file = OutputFile {
|
||||
filename: "index.ts".to_string(),
|
||||
code: output.into_inner(),
|
||||
}]
|
||||
};
|
||||
|
||||
let reducers_file = generate_reducers_file(module);
|
||||
let procedures_file = generate_procedures_file(module);
|
||||
let types_file = generate_types_file(module);
|
||||
|
||||
vec![index_file, reducers_file, procedures_file, types_file]
|
||||
}
|
||||
}
|
||||
|
||||
fn generate_reducers_file(module: &ModuleDef) -> OutputFile {
|
||||
let mut output = CodeIndenter::new(String::new(), INDENT);
|
||||
let out = &mut output;
|
||||
|
||||
print_auto_generated_file_comment(out);
|
||||
print_lint_suppression(out);
|
||||
writeln!(out, "import {{ type Infer as __Infer }} from \"spacetimedb\";");
|
||||
|
||||
writeln!(out);
|
||||
writeln!(out, "// Import all reducer arg schemas");
|
||||
for reducer in iter_reducers(module) {
|
||||
let reducer_name = &reducer.name;
|
||||
let reducer_module_name = reducer_module_name(reducer_name);
|
||||
let args_type = reducer_args_type_name(&reducer.name);
|
||||
writeln!(out, "import {args_type} from \"../{reducer_module_name}\";");
|
||||
}
|
||||
|
||||
writeln!(out);
|
||||
for reducer in iter_reducers(module) {
|
||||
let reducer_name_pascalcase = reducer.name.deref().to_case(Case::Pascal);
|
||||
let args_type = reducer_args_type_name(&reducer.name);
|
||||
writeln!(
|
||||
out,
|
||||
"export type {reducer_name_pascalcase}Params = __Infer<typeof {args_type}>;"
|
||||
);
|
||||
}
|
||||
out.newline();
|
||||
|
||||
OutputFile {
|
||||
filename: "types/reducers.ts".to_string(),
|
||||
code: output.into_inner(),
|
||||
}
|
||||
}
|
||||
|
||||
fn generate_procedures_file(module: &ModuleDef) -> OutputFile {
|
||||
let mut output = CodeIndenter::new(String::new(), INDENT);
|
||||
let out = &mut output;
|
||||
|
||||
print_auto_generated_file_comment(out);
|
||||
print_lint_suppression(out);
|
||||
writeln!(out, "import {{ type Infer as __Infer }} from \"spacetimedb\";");
|
||||
|
||||
writeln!(out);
|
||||
writeln!(out, "// Import all procedure arg schemas");
|
||||
for procedure in iter_procedures(module) {
|
||||
let procedure_name = &procedure.name;
|
||||
let procedure_module_name = procedure_module_name(procedure_name);
|
||||
let args_type = procedure_args_type_name(&procedure.name);
|
||||
writeln!(out, "import * as {args_type} from \"../{procedure_module_name}\";");
|
||||
}
|
||||
|
||||
writeln!(out);
|
||||
for procedure in iter_procedures(module) {
|
||||
let procedure_name_pascalcase = procedure.name.deref().to_case(Case::Pascal);
|
||||
let args_type = procedure_args_type_name(&procedure.name);
|
||||
writeln!(
|
||||
out,
|
||||
"export type {procedure_name_pascalcase}Args = __Infer<typeof {args_type}.params>;"
|
||||
);
|
||||
writeln!(
|
||||
out,
|
||||
"export type {procedure_name_pascalcase}Result = __Infer<typeof {args_type}.returnType>;"
|
||||
);
|
||||
}
|
||||
out.newline();
|
||||
|
||||
OutputFile {
|
||||
filename: "types/procedures.ts".to_string(),
|
||||
code: output.into_inner(),
|
||||
}
|
||||
}
|
||||
|
||||
fn generate_types_file(module: &ModuleDef) -> OutputFile {
|
||||
let mut output = CodeIndenter::new(String::new(), INDENT);
|
||||
let out = &mut output;
|
||||
|
||||
print_auto_generated_file_comment(out);
|
||||
print_lint_suppression(out);
|
||||
writeln!(out, "import {{ type Infer as __Infer }} from \"spacetimedb\";");
|
||||
|
||||
let reducer_type_names = module
|
||||
.reducers()
|
||||
.map(|reducer| reducer.name.deref().to_case(Case::Pascal))
|
||||
.collect::<BTreeSet<_>>();
|
||||
|
||||
writeln!(out);
|
||||
writeln!(out, "// Import all non-reducer types");
|
||||
for ty in iter_types(module) {
|
||||
let type_name = collect_case(Case::Pascal, ty.name.name_segments());
|
||||
if reducer_type_names.contains(&type_name) {
|
||||
continue;
|
||||
}
|
||||
let type_module_name = type_module_name(&ty.name);
|
||||
writeln!(out, "import {type_name} from \"../{type_module_name}\";");
|
||||
}
|
||||
|
||||
writeln!(out);
|
||||
for ty in iter_types(module) {
|
||||
let type_name = collect_case(Case::Pascal, ty.name.name_segments());
|
||||
if reducer_type_names.contains(&type_name) {
|
||||
continue;
|
||||
}
|
||||
writeln!(out, "export type {type_name} = __Infer<typeof {type_name}>;");
|
||||
}
|
||||
out.newline();
|
||||
|
||||
OutputFile {
|
||||
filename: "types/index.ts".to_string(),
|
||||
code: output.into_inner(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -239,107 +239,43 @@ import {
|
||||
type SubscriptionHandleImpl as __SubscriptionHandleImpl,
|
||||
} from "spacetimedb";
|
||||
|
||||
// Import and reexport all reducer arg types
|
||||
// Import all reducer arg schemas
|
||||
import AddReducer from "./add_reducer";
|
||||
export { AddReducer };
|
||||
import AddPlayerReducer from "./add_player_reducer";
|
||||
export { AddPlayerReducer };
|
||||
import AddPrivateReducer from "./add_private_reducer";
|
||||
export { AddPrivateReducer };
|
||||
import AssertCallerIdentityIsModuleIdentityReducer from "./assert_caller_identity_is_module_identity_reducer";
|
||||
export { AssertCallerIdentityIsModuleIdentityReducer };
|
||||
import DeletePlayerReducer from "./delete_player_reducer";
|
||||
export { DeletePlayerReducer };
|
||||
import DeletePlayersByNameReducer from "./delete_players_by_name_reducer";
|
||||
export { DeletePlayersByNameReducer };
|
||||
import ListOverAgeReducer from "./list_over_age_reducer";
|
||||
export { ListOverAgeReducer };
|
||||
import LogModuleIdentityReducer from "./log_module_identity_reducer";
|
||||
export { LogModuleIdentityReducer };
|
||||
import QueryPrivateReducer from "./query_private_reducer";
|
||||
export { QueryPrivateReducer };
|
||||
import SayHelloReducer from "./say_hello_reducer";
|
||||
export { SayHelloReducer };
|
||||
import TestReducer from "./test_reducer";
|
||||
export { TestReducer };
|
||||
import TestBtreeIndexArgsReducer from "./test_btree_index_args_reducer";
|
||||
export { TestBtreeIndexArgsReducer };
|
||||
|
||||
// Import and reexport all procedure arg types
|
||||
// Import all procedure arg schemas
|
||||
import * as GetMySchemaViaHttpProcedure from "./get_my_schema_via_http_procedure";
|
||||
export { GetMySchemaViaHttpProcedure };
|
||||
import * as ReturnValueProcedure from "./return_value_procedure";
|
||||
export { ReturnValueProcedure };
|
||||
import * as SleepOneSecondProcedure from "./sleep_one_second_procedure";
|
||||
export { SleepOneSecondProcedure };
|
||||
import * as WithTxProcedure from "./with_tx_procedure";
|
||||
export { WithTxProcedure };
|
||||
|
||||
// Import and reexport all table handle types
|
||||
// Import all table schema definitions
|
||||
import HasSpecialStuffRow from "./has_special_stuff_table";
|
||||
export { HasSpecialStuffRow };
|
||||
import LoggedOutPlayerRow from "./logged_out_player_table";
|
||||
export { LoggedOutPlayerRow };
|
||||
import MyPlayerRow from "./my_player_table";
|
||||
export { MyPlayerRow };
|
||||
import PersonRow from "./person_table";
|
||||
export { PersonRow };
|
||||
import PkMultiIdentityRow from "./pk_multi_identity_table";
|
||||
export { PkMultiIdentityRow };
|
||||
import PlayerRow from "./player_table";
|
||||
export { PlayerRow };
|
||||
import PointsRow from "./points_table";
|
||||
export { PointsRow };
|
||||
import PrivateTableRow from "./private_table_table";
|
||||
export { PrivateTableRow };
|
||||
import RepeatingTestArgRow from "./repeating_test_arg_table";
|
||||
export { RepeatingTestArgRow };
|
||||
import TableToRemoveRow from "./table_to_remove_table";
|
||||
export { TableToRemoveRow };
|
||||
import TestARow from "./test_a_table";
|
||||
export { TestARow };
|
||||
import TestDRow from "./test_d_table";
|
||||
export { TestDRow };
|
||||
import TestERow from "./test_e_table";
|
||||
export { TestERow };
|
||||
import TestFRow from "./test_f_table";
|
||||
export { TestFRow };
|
||||
|
||||
// Import and reexport all types
|
||||
import Baz from "./baz_type";
|
||||
export { Baz };
|
||||
import Foobar from "./foobar_type";
|
||||
export { Foobar };
|
||||
import HasSpecialStuff from "./has_special_stuff_type";
|
||||
export { HasSpecialStuff };
|
||||
import Person from "./person_type";
|
||||
export { Person };
|
||||
import PkMultiIdentity from "./pk_multi_identity_type";
|
||||
export { PkMultiIdentity };
|
||||
import Player from "./player_type";
|
||||
export { Player };
|
||||
import Point from "./point_type";
|
||||
export { Point };
|
||||
import PrivateTable from "./private_table_type";
|
||||
export { PrivateTable };
|
||||
import RemoveTable from "./remove_table_type";
|
||||
export { RemoveTable };
|
||||
import RepeatingTestArg from "./repeating_test_arg_type";
|
||||
export { RepeatingTestArg };
|
||||
import TestA from "./test_a_type";
|
||||
export { TestA };
|
||||
import TestB from "./test_b_type";
|
||||
export { TestB };
|
||||
import TestD from "./test_d_type";
|
||||
export { TestD };
|
||||
import TestE from "./test_e_type";
|
||||
export { TestE };
|
||||
import TestFoobar from "./test_foobar_type";
|
||||
export { TestFoobar };
|
||||
import NamespaceTestC from "./namespace_test_c_type";
|
||||
export { NamespaceTestC };
|
||||
import NamespaceTestF from "./namespace_test_f_type";
|
||||
export { NamespaceTestF };
|
||||
/** Type-only namespace exports for generated type groups. */
|
||||
|
||||
/** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */
|
||||
const tablesSchema = __schema(
|
||||
@@ -1258,6 +1194,112 @@ export default {
|
||||
return NamespaceTestF;
|
||||
},
|
||||
};
|
||||
'''
|
||||
"types/index.ts" = '''
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from "spacetimedb";
|
||||
|
||||
// Import all non-reducer types
|
||||
import Baz from "../baz_type";
|
||||
import Foobar from "../foobar_type";
|
||||
import HasSpecialStuff from "../has_special_stuff_type";
|
||||
import Person from "../person_type";
|
||||
import PkMultiIdentity from "../pk_multi_identity_type";
|
||||
import Player from "../player_type";
|
||||
import Point from "../point_type";
|
||||
import PrivateTable from "../private_table_type";
|
||||
import RemoveTable from "../remove_table_type";
|
||||
import RepeatingTestArg from "../repeating_test_arg_type";
|
||||
import TestA from "../test_a_type";
|
||||
import TestB from "../test_b_type";
|
||||
import TestD from "../test_d_type";
|
||||
import TestE from "../test_e_type";
|
||||
import TestFoobar from "../test_foobar_type";
|
||||
import NamespaceTestC from "../namespace_test_c_type";
|
||||
import NamespaceTestF from "../namespace_test_f_type";
|
||||
|
||||
export type Baz = __Infer<typeof Baz>;
|
||||
export type Foobar = __Infer<typeof Foobar>;
|
||||
export type HasSpecialStuff = __Infer<typeof HasSpecialStuff>;
|
||||
export type Person = __Infer<typeof Person>;
|
||||
export type PkMultiIdentity = __Infer<typeof PkMultiIdentity>;
|
||||
export type Player = __Infer<typeof Player>;
|
||||
export type Point = __Infer<typeof Point>;
|
||||
export type PrivateTable = __Infer<typeof PrivateTable>;
|
||||
export type RemoveTable = __Infer<typeof RemoveTable>;
|
||||
export type RepeatingTestArg = __Infer<typeof RepeatingTestArg>;
|
||||
export type TestA = __Infer<typeof TestA>;
|
||||
export type TestB = __Infer<typeof TestB>;
|
||||
export type TestD = __Infer<typeof TestD>;
|
||||
export type TestE = __Infer<typeof TestE>;
|
||||
export type TestFoobar = __Infer<typeof TestFoobar>;
|
||||
export type NamespaceTestC = __Infer<typeof NamespaceTestC>;
|
||||
export type NamespaceTestF = __Infer<typeof NamespaceTestF>;
|
||||
|
||||
'''
|
||||
"types/procedures.ts" = '''
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from "spacetimedb";
|
||||
|
||||
// Import all procedure arg schemas
|
||||
import * as GetMySchemaViaHttpProcedure from "../get_my_schema_via_http_procedure";
|
||||
import * as ReturnValueProcedure from "../return_value_procedure";
|
||||
import * as SleepOneSecondProcedure from "../sleep_one_second_procedure";
|
||||
import * as WithTxProcedure from "../with_tx_procedure";
|
||||
|
||||
export type GetMySchemaViaHttpArgs = __Infer<typeof GetMySchemaViaHttpProcedure.params>;
|
||||
export type GetMySchemaViaHttpResult = __Infer<typeof GetMySchemaViaHttpProcedure.returnType>;
|
||||
export type ReturnValueArgs = __Infer<typeof ReturnValueProcedure.params>;
|
||||
export type ReturnValueResult = __Infer<typeof ReturnValueProcedure.returnType>;
|
||||
export type SleepOneSecondArgs = __Infer<typeof SleepOneSecondProcedure.params>;
|
||||
export type SleepOneSecondResult = __Infer<typeof SleepOneSecondProcedure.returnType>;
|
||||
export type WithTxArgs = __Infer<typeof WithTxProcedure.params>;
|
||||
export type WithTxResult = __Infer<typeof WithTxProcedure.returnType>;
|
||||
|
||||
'''
|
||||
"types/reducers.ts" = '''
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from "spacetimedb";
|
||||
|
||||
// Import all reducer arg schemas
|
||||
import AddReducer from "../add_reducer";
|
||||
import AddPlayerReducer from "../add_player_reducer";
|
||||
import AddPrivateReducer from "../add_private_reducer";
|
||||
import AssertCallerIdentityIsModuleIdentityReducer from "../assert_caller_identity_is_module_identity_reducer";
|
||||
import DeletePlayerReducer from "../delete_player_reducer";
|
||||
import DeletePlayersByNameReducer from "../delete_players_by_name_reducer";
|
||||
import ListOverAgeReducer from "../list_over_age_reducer";
|
||||
import LogModuleIdentityReducer from "../log_module_identity_reducer";
|
||||
import QueryPrivateReducer from "../query_private_reducer";
|
||||
import SayHelloReducer from "../say_hello_reducer";
|
||||
import TestReducer from "../test_reducer";
|
||||
import TestBtreeIndexArgsReducer from "../test_btree_index_args_reducer";
|
||||
|
||||
export type AddParams = __Infer<typeof AddReducer>;
|
||||
export type AddPlayerParams = __Infer<typeof AddPlayerReducer>;
|
||||
export type AddPrivateParams = __Infer<typeof AddPrivateReducer>;
|
||||
export type AssertCallerIdentityIsModuleIdentityParams = __Infer<typeof AssertCallerIdentityIsModuleIdentityReducer>;
|
||||
export type DeletePlayerParams = __Infer<typeof DeletePlayerReducer>;
|
||||
export type DeletePlayersByNameParams = __Infer<typeof DeletePlayersByNameReducer>;
|
||||
export type ListOverAgeParams = __Infer<typeof ListOverAgeReducer>;
|
||||
export type LogModuleIdentityParams = __Infer<typeof LogModuleIdentityReducer>;
|
||||
export type QueryPrivateParams = __Infer<typeof QueryPrivateReducer>;
|
||||
export type SayHelloParams = __Infer<typeof SayHelloReducer>;
|
||||
export type TestParams = __Infer<typeof TestReducer>;
|
||||
export type TestBtreeIndexArgsParams = __Infer<typeof TestBtreeIndexArgsReducer>;
|
||||
|
||||
'''
|
||||
"with_tx_procedure.ts" = '''
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@
|
||||
},
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"run-all": "pnpm -F ./crates/bindings-typescript -F ./crates/bindings-typescript/examples/quickstart-chat -F ./crates/bindings-typescript/examples/quickstart-chat -F ./crates/bindings-typescript/test-app -F ./docs run",
|
||||
"run-all": "pnpm -r -F ./crates/bindings-typescript -F ./crates/bindings-typescript/examples/quickstart-chat -F ./crates/bindings-typescript/test-app -F ./docs -F \"./templates/**\" run",
|
||||
"format": "pnpm run-all format && prettier eslint.config.js --write",
|
||||
"lint": "pnpm run-all lint && prettier eslint.config.js --check",
|
||||
"build": "pnpm run-all build",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
// This was generated using spacetimedb cli version 1.11.2 (commit 13a0172567170d9b8c87d2aa71de3246c21acb8c).
|
||||
// This was generated using spacetimedb cli version 1.12.0 (commit 8d9a0a040ece2b8b579b050d8b1dac87d801e98e).
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
// This was generated using spacetimedb cli version 1.11.2 (commit 13a0172567170d9b8c87d2aa71de3246c21acb8c).
|
||||
// This was generated using spacetimedb cli version 1.12.0 (commit a71a24e539214a8e2dd4b9416ee6201ef57232f8).
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
// This was generated using spacetimedb cli version 1.11.2 (commit 13a0172567170d9b8c87d2aa71de3246c21acb8c).
|
||||
// This was generated using spacetimedb cli version 1.12.0 (commit 8d9a0a040ece2b8b579b050d8b1dac87d801e98e).
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
// This was generated using spacetimedb cli version 1.11.2 (commit 13a0172567170d9b8c87d2aa71de3246c21acb8c).
|
||||
// This was generated using spacetimedb cli version 1.12.0 (commit 8d9a0a040ece2b8b579b050d8b1dac87d801e98e).
|
||||
|
||||
#![allow(unused, clippy::all)]
|
||||
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
|
||||
|
||||
+6
-25
@@ -1,7 +1,7 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
// This was generated using spacetimedb cli version 1.11.3 (commit f9bca6a8df856d950360b40cbce744fcbffc9a63).
|
||||
// This was generated using spacetimedb cli version 1.12.0 (commit e2920b5e361495b16bd50e2899024ca680d52e8b).
|
||||
|
||||
/* eslint-disable */
|
||||
/* tslint:disable */
|
||||
@@ -33,35 +33,16 @@ import {
|
||||
type SubscriptionHandleImpl as __SubscriptionHandleImpl,
|
||||
} from 'spacetimedb';
|
||||
|
||||
// Import and reexport all reducer arg types
|
||||
import OnConnectReducer from './on_connect_reducer';
|
||||
export { OnConnectReducer };
|
||||
import OnDisconnectReducer from './on_disconnect_reducer';
|
||||
export { OnDisconnectReducer };
|
||||
// Import all reducer arg schemas
|
||||
import AddReducer from './add_reducer';
|
||||
export { AddReducer };
|
||||
import SayHelloReducer from './say_hello_reducer';
|
||||
export { SayHelloReducer };
|
||||
|
||||
// Import and reexport all procedure arg types
|
||||
// Import all procedure arg schemas
|
||||
|
||||
// Import and reexport all table handle types
|
||||
// Import all table schema definitions
|
||||
import PersonRow from './person_table';
|
||||
export { PersonRow };
|
||||
|
||||
// Import and reexport all types
|
||||
import Add from './add_type';
|
||||
export { Add };
|
||||
import Init from './init_type';
|
||||
export { Init };
|
||||
import OnConnect from './on_connect_type';
|
||||
export { OnConnect };
|
||||
import OnDisconnect from './on_disconnect_type';
|
||||
export { OnDisconnect };
|
||||
import Person from './person_type';
|
||||
export { Person };
|
||||
import SayHello from './say_hello_type';
|
||||
export { SayHello };
|
||||
/** Type-only namespace exports for generated type groups. */
|
||||
|
||||
/** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */
|
||||
const tablesSchema = __schema(
|
||||
@@ -87,7 +68,7 @@ const proceduresSchema = __procedures();
|
||||
/** The remote SpacetimeDB module schema, both runtime and type information. */
|
||||
const REMOTE_MODULE = {
|
||||
versionInfo: {
|
||||
cliVersion: '1.11.3' as const,
|
||||
cliVersion: '1.12.0' as const,
|
||||
},
|
||||
tables: tablesSchema.schemaType.tables,
|
||||
reducers: reducersSchema.reducersType.reducers,
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all procedure arg schemas
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all reducer arg schemas
|
||||
import OnConnectReducer from './on_connect_reducer';
|
||||
import OnDisconnectReducer from './on_disconnect_reducer';
|
||||
import AddReducer from './add_reducer';
|
||||
import SayHelloReducer from './say_hello_reducer';
|
||||
|
||||
export type OnConnectArgs = __Infer<typeof OnConnectReducer>;
|
||||
export type OnDisconnectArgs = __Infer<typeof OnDisconnectReducer>;
|
||||
export type AddArgs = __Infer<typeof AddReducer>;
|
||||
export type SayHelloArgs = __Infer<typeof SayHelloReducer>;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all non-reducer types
|
||||
import Person from './person_type';
|
||||
|
||||
export type Person = __Infer<typeof Person>;
|
||||
@@ -0,0 +1,11 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all non-reducer types
|
||||
import Person from '../person_type';
|
||||
|
||||
export type Person = __Infer<typeof Person>;
|
||||
@@ -0,0 +1,8 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all procedure arg schemas
|
||||
@@ -0,0 +1,17 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all reducer arg schemas
|
||||
import OnConnectReducer from '../on_connect_reducer';
|
||||
import OnDisconnectReducer from '../on_disconnect_reducer';
|
||||
import AddReducer from '../add_reducer';
|
||||
import SayHelloReducer from '../say_hello_reducer';
|
||||
|
||||
export type OnConnectParams = __Infer<typeof OnConnectReducer>;
|
||||
export type OnDisconnectParams = __Infer<typeof OnDisconnectReducer>;
|
||||
export type AddParams = __Infer<typeof AddReducer>;
|
||||
export type SayHelloParams = __Infer<typeof SayHelloReducer>;
|
||||
@@ -1,6 +1,7 @@
|
||||
import React, { useState } from 'react';
|
||||
import './App.css';
|
||||
import { tables, reducers, Message } from './module_bindings';
|
||||
import { tables, reducers } from './module_bindings';
|
||||
import type * as Types from './module_bindings/types';
|
||||
import {
|
||||
useSpacetimeDB,
|
||||
useTable,
|
||||
@@ -8,7 +9,7 @@ import {
|
||||
eq,
|
||||
useReducer,
|
||||
} from 'spacetimedb/react';
|
||||
import { Identity, Infer, Timestamp } from 'spacetimedb';
|
||||
import { Identity, Timestamp } from 'spacetimedb';
|
||||
|
||||
export type PrettyMessage = {
|
||||
senderName: string;
|
||||
@@ -20,9 +21,7 @@ export type PrettyMessage = {
|
||||
function App() {
|
||||
const [newName, setNewName] = useState('');
|
||||
const [settingName, setSettingName] = useState(false);
|
||||
const [systemMessages, setSystemMessages] = useState(
|
||||
[] as Infer<typeof Message>[]
|
||||
);
|
||||
const [systemMessages, setSystemMessages] = useState([] as Types.Message[]);
|
||||
const [newMessage, setNewMessage] = useState('');
|
||||
|
||||
const { identity, isActive: connected } = useSpacetimeDB();
|
||||
|
||||
+5
-27
@@ -1,7 +1,7 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
// This was generated using spacetimedb cli version 1.12.0 (commit 4a6228fec73c9fefa0ee32ceebf06c91933453ab).
|
||||
// This was generated using spacetimedb cli version 1.12.0 (commit e2920b5e361495b16bd50e2899024ca680d52e8b).
|
||||
|
||||
/* eslint-disable */
|
||||
/* tslint:disable */
|
||||
@@ -33,39 +33,17 @@ import {
|
||||
type SubscriptionHandleImpl as __SubscriptionHandleImpl,
|
||||
} from 'spacetimedb';
|
||||
|
||||
// Import and reexport all reducer arg types
|
||||
// Import all reducer arg schemas
|
||||
import SetNameReducer from './set_name_reducer';
|
||||
export { SetNameReducer };
|
||||
import SendMessageReducer from './send_message_reducer';
|
||||
export { SendMessageReducer };
|
||||
import OnConnectReducer from './on_connect_reducer';
|
||||
export { OnConnectReducer };
|
||||
import OnDisconnectReducer from './on_disconnect_reducer';
|
||||
export { OnDisconnectReducer };
|
||||
|
||||
// Import and reexport all procedure arg types
|
||||
// Import all procedure arg schemas
|
||||
|
||||
// Import and reexport all table handle types
|
||||
// Import all table schema definitions
|
||||
import MessageRow from './message_table';
|
||||
export { MessageRow };
|
||||
import UserRow from './user_table';
|
||||
export { UserRow };
|
||||
|
||||
// Import and reexport all types
|
||||
import Init from './init_type';
|
||||
export { Init };
|
||||
import Message from './message_type';
|
||||
export { Message };
|
||||
import OnConnect from './on_connect_type';
|
||||
export { OnConnect };
|
||||
import OnDisconnect from './on_disconnect_type';
|
||||
export { OnDisconnect };
|
||||
import SendMessage from './send_message_type';
|
||||
export { SendMessage };
|
||||
import SetName from './set_name_type';
|
||||
export { SetName };
|
||||
import User from './user_type';
|
||||
export { User };
|
||||
/** Type-only namespace exports for generated type groups. */
|
||||
|
||||
/** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */
|
||||
const tablesSchema = __schema(
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all procedure arg schemas
|
||||
@@ -0,0 +1,17 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all reducer arg schemas
|
||||
import SetNameReducer from './set_name_reducer';
|
||||
import SendMessageReducer from './send_message_reducer';
|
||||
import OnConnectReducer from './on_connect_reducer';
|
||||
import OnDisconnectReducer from './on_disconnect_reducer';
|
||||
|
||||
export type SetNameArgs = __Infer<typeof SetNameReducer>;
|
||||
export type SendMessageArgs = __Infer<typeof SendMessageReducer>;
|
||||
export type OnConnectArgs = __Infer<typeof OnConnectReducer>;
|
||||
export type OnDisconnectArgs = __Infer<typeof OnDisconnectReducer>;
|
||||
@@ -0,0 +1,13 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all non-reducer types
|
||||
import Message from './message_type';
|
||||
import User from './user_type';
|
||||
|
||||
export type Message = __Infer<typeof Message>;
|
||||
export type User = __Infer<typeof User>;
|
||||
@@ -0,0 +1,13 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all non-reducer types
|
||||
import Message from '../message_type';
|
||||
import User from '../user_type';
|
||||
|
||||
export type Message = __Infer<typeof Message>;
|
||||
export type User = __Infer<typeof User>;
|
||||
@@ -0,0 +1,8 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all procedure arg schemas
|
||||
@@ -0,0 +1,17 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all reducer arg schemas
|
||||
import SetNameReducer from '../set_name_reducer';
|
||||
import SendMessageReducer from '../send_message_reducer';
|
||||
import OnConnectReducer from '../on_connect_reducer';
|
||||
import OnDisconnectReducer from '../on_disconnect_reducer';
|
||||
|
||||
export type SetNameParams = __Infer<typeof SetNameReducer>;
|
||||
export type SendMessageParams = __Infer<typeof SendMessageReducer>;
|
||||
export type OnConnectParams = __Infer<typeof OnConnectReducer>;
|
||||
export type OnDisconnectParams = __Infer<typeof OnDisconnectReducer>;
|
||||
+6
-25
@@ -1,7 +1,7 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
// This was generated using spacetimedb cli version 1.11.3 (commit f9bca6a8df856d950360b40cbce744fcbffc9a63).
|
||||
// This was generated using spacetimedb cli version 1.12.0 (commit e2920b5e361495b16bd50e2899024ca680d52e8b).
|
||||
|
||||
/* eslint-disable */
|
||||
/* tslint:disable */
|
||||
@@ -33,35 +33,16 @@ import {
|
||||
type SubscriptionHandleImpl as __SubscriptionHandleImpl,
|
||||
} from 'spacetimedb';
|
||||
|
||||
// Import and reexport all reducer arg types
|
||||
import OnConnectReducer from './on_connect_reducer';
|
||||
export { OnConnectReducer };
|
||||
import OnDisconnectReducer from './on_disconnect_reducer';
|
||||
export { OnDisconnectReducer };
|
||||
// Import all reducer arg schemas
|
||||
import AddReducer from './add_reducer';
|
||||
export { AddReducer };
|
||||
import SayHelloReducer from './say_hello_reducer';
|
||||
export { SayHelloReducer };
|
||||
|
||||
// Import and reexport all procedure arg types
|
||||
// Import all procedure arg schemas
|
||||
|
||||
// Import and reexport all table handle types
|
||||
// Import all table schema definitions
|
||||
import PersonRow from './person_table';
|
||||
export { PersonRow };
|
||||
|
||||
// Import and reexport all types
|
||||
import Add from './add_type';
|
||||
export { Add };
|
||||
import Init from './init_type';
|
||||
export { Init };
|
||||
import OnConnect from './on_connect_type';
|
||||
export { OnConnect };
|
||||
import OnDisconnect from './on_disconnect_type';
|
||||
export { OnDisconnect };
|
||||
import Person from './person_type';
|
||||
export { Person };
|
||||
import SayHello from './say_hello_type';
|
||||
export { SayHello };
|
||||
/** Type-only namespace exports for generated type groups. */
|
||||
|
||||
/** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */
|
||||
const tablesSchema = __schema(
|
||||
@@ -87,7 +68,7 @@ const proceduresSchema = __procedures();
|
||||
/** The remote SpacetimeDB module schema, both runtime and type information. */
|
||||
const REMOTE_MODULE = {
|
||||
versionInfo: {
|
||||
cliVersion: '1.11.3' as const,
|
||||
cliVersion: '1.12.0' as const,
|
||||
},
|
||||
tables: tablesSchema.schemaType.tables,
|
||||
reducers: reducersSchema.reducersType.reducers,
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all procedure arg schemas
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all reducer arg schemas
|
||||
import OnConnectReducer from './on_connect_reducer';
|
||||
import OnDisconnectReducer from './on_disconnect_reducer';
|
||||
import AddReducer from './add_reducer';
|
||||
import SayHelloReducer from './say_hello_reducer';
|
||||
|
||||
export type OnConnectArgs = __Infer<typeof OnConnectReducer>;
|
||||
export type OnDisconnectArgs = __Infer<typeof OnDisconnectReducer>;
|
||||
export type AddArgs = __Infer<typeof AddReducer>;
|
||||
export type SayHelloArgs = __Infer<typeof SayHelloReducer>;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all non-reducer types
|
||||
import Person from './person_type';
|
||||
|
||||
export type Person = __Infer<typeof Person>;
|
||||
@@ -0,0 +1,11 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all non-reducer types
|
||||
import Person from '../person_type';
|
||||
|
||||
export type Person = __Infer<typeof Person>;
|
||||
@@ -0,0 +1,8 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all procedure arg schemas
|
||||
@@ -0,0 +1,17 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all reducer arg schemas
|
||||
import OnConnectReducer from '../on_connect_reducer';
|
||||
import OnDisconnectReducer from '../on_disconnect_reducer';
|
||||
import AddReducer from '../add_reducer';
|
||||
import SayHelloReducer from '../say_hello_reducer';
|
||||
|
||||
export type OnConnectParams = __Infer<typeof OnConnectReducer>;
|
||||
export type OnDisconnectParams = __Infer<typeof OnDisconnectReducer>;
|
||||
export type AddParams = __Infer<typeof AddReducer>;
|
||||
export type SayHelloParams = __Infer<typeof SayHelloReducer>;
|
||||
+12
-25
@@ -1,7 +1,7 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
// This was generated using spacetimedb cli version 1.11.3 (commit 02449737ca3b29e7e39679fccbef541a50f32094).
|
||||
// This was generated using spacetimedb cli version 1.12.0 (commit e2920b5e361495b16bd50e2899024ca680d52e8b).
|
||||
|
||||
/* eslint-disable */
|
||||
/* tslint:disable */
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
TypeBuilder as __TypeBuilder,
|
||||
Uuid as __Uuid,
|
||||
convertToAccessorMap as __convertToAccessorMap,
|
||||
makeQueryBuilder as __makeQueryBuilder,
|
||||
procedureSchema as __procedureSchema,
|
||||
procedures as __procedures,
|
||||
reducerSchema as __reducerSchema,
|
||||
@@ -25,41 +26,23 @@ import {
|
||||
type Event as __Event,
|
||||
type EventContextInterface as __EventContextInterface,
|
||||
type Infer as __Infer,
|
||||
type QueryBuilder as __QueryBuilder,
|
||||
type ReducerEventContextInterface as __ReducerEventContextInterface,
|
||||
type RemoteModule as __RemoteModule,
|
||||
type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,
|
||||
type SubscriptionHandleImpl as __SubscriptionHandleImpl,
|
||||
} from 'spacetimedb';
|
||||
|
||||
// Import and reexport all reducer arg types
|
||||
import OnConnectReducer from './on_connect_reducer';
|
||||
export { OnConnectReducer };
|
||||
import OnDisconnectReducer from './on_disconnect_reducer';
|
||||
export { OnDisconnectReducer };
|
||||
// Import all reducer arg schemas
|
||||
import AddReducer from './add_reducer';
|
||||
export { AddReducer };
|
||||
import SayHelloReducer from './say_hello_reducer';
|
||||
export { SayHelloReducer };
|
||||
|
||||
// Import and reexport all procedure arg types
|
||||
// Import all procedure arg schemas
|
||||
|
||||
// Import and reexport all table handle types
|
||||
// Import all table schema definitions
|
||||
import PersonRow from './person_table';
|
||||
export { PersonRow };
|
||||
|
||||
// Import and reexport all types
|
||||
import Add from './add_type';
|
||||
export { Add };
|
||||
import Init from './init_type';
|
||||
export { Init };
|
||||
import OnConnect from './on_connect_type';
|
||||
export { OnConnect };
|
||||
import OnDisconnect from './on_disconnect_type';
|
||||
export { OnDisconnect };
|
||||
import Person from './person_type';
|
||||
export { Person };
|
||||
import SayHello from './say_hello_type';
|
||||
export { SayHello };
|
||||
/** Type-only namespace exports for generated type groups. */
|
||||
|
||||
/** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */
|
||||
const tablesSchema = __schema(
|
||||
@@ -85,7 +68,7 @@ const proceduresSchema = __procedures();
|
||||
/** The remote SpacetimeDB module schema, both runtime and type information. */
|
||||
const REMOTE_MODULE = {
|
||||
versionInfo: {
|
||||
cliVersion: '1.11.3' as const,
|
||||
cliVersion: '1.12.0' as const,
|
||||
},
|
||||
tables: tablesSchema.schemaType.tables,
|
||||
reducers: reducersSchema.reducersType.reducers,
|
||||
@@ -99,6 +82,10 @@ const REMOTE_MODULE = {
|
||||
/** The tables available in this remote SpacetimeDB module. */
|
||||
export const tables = __convertToAccessorMap(tablesSchema.schemaType.tables);
|
||||
|
||||
/** A typed query builder for this remote SpacetimeDB module. */
|
||||
export const query: __QueryBuilder<typeof tablesSchema.schemaType> =
|
||||
__makeQueryBuilder(tablesSchema.schemaType);
|
||||
|
||||
/** The reducers available in this remote SpacetimeDB module. */
|
||||
export const reducers = __convertToAccessorMap(
|
||||
reducersSchema.reducersType.reducers
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all non-reducer types
|
||||
import Person from '../person_type';
|
||||
|
||||
export type Person = __Infer<typeof Person>;
|
||||
@@ -0,0 +1,8 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all procedure arg schemas
|
||||
@@ -0,0 +1,17 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all reducer arg schemas
|
||||
import OnConnectReducer from '../on_connect_reducer';
|
||||
import OnDisconnectReducer from '../on_disconnect_reducer';
|
||||
import AddReducer from '../add_reducer';
|
||||
import SayHelloReducer from '../say_hello_reducer';
|
||||
|
||||
export type OnConnectParams = __Infer<typeof OnConnectReducer>;
|
||||
export type OnDisconnectParams = __Infer<typeof OnDisconnectReducer>;
|
||||
export type AddParams = __Infer<typeof AddReducer>;
|
||||
export type SayHelloParams = __Infer<typeof SayHelloReducer>;
|
||||
@@ -0,0 +1,15 @@
|
||||
// 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 */
|
||||
import {
|
||||
TypeBuilder as __TypeBuilder,
|
||||
t as __t,
|
||||
type AlgebraicTypeType as __AlgebraicTypeType,
|
||||
type Infer as __Infer,
|
||||
} from 'spacetimedb';
|
||||
|
||||
export default __t.object('CustomType', {
|
||||
name: __t.string(),
|
||||
});
|
||||
+12
-25
@@ -1,7 +1,7 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE
|
||||
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
|
||||
|
||||
// This was generated using spacetimedb cli version 1.11.2 (commit 5508f620e2fd5a4d8a3b7aaf5303776d127f5cbd).
|
||||
// This was generated using spacetimedb cli version 1.12.0 (commit e2920b5e361495b16bd50e2899024ca680d52e8b).
|
||||
|
||||
/* eslint-disable */
|
||||
/* tslint:disable */
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
TypeBuilder as __TypeBuilder,
|
||||
Uuid as __Uuid,
|
||||
convertToAccessorMap as __convertToAccessorMap,
|
||||
makeQueryBuilder as __makeQueryBuilder,
|
||||
procedureSchema as __procedureSchema,
|
||||
procedures as __procedures,
|
||||
reducerSchema as __reducerSchema,
|
||||
@@ -25,41 +26,23 @@ import {
|
||||
type Event as __Event,
|
||||
type EventContextInterface as __EventContextInterface,
|
||||
type Infer as __Infer,
|
||||
type QueryBuilder as __QueryBuilder,
|
||||
type ReducerEventContextInterface as __ReducerEventContextInterface,
|
||||
type RemoteModule as __RemoteModule,
|
||||
type SubscriptionEventContextInterface as __SubscriptionEventContextInterface,
|
||||
type SubscriptionHandleImpl as __SubscriptionHandleImpl,
|
||||
} from 'spacetimedb';
|
||||
|
||||
// Import and reexport all reducer arg types
|
||||
import OnConnectReducer from './on_connect_reducer';
|
||||
export { OnConnectReducer };
|
||||
import OnDisconnectReducer from './on_disconnect_reducer';
|
||||
export { OnDisconnectReducer };
|
||||
// Import all reducer arg schemas
|
||||
import AddReducer from './add_reducer';
|
||||
export { AddReducer };
|
||||
import SayHelloReducer from './say_hello_reducer';
|
||||
export { SayHelloReducer };
|
||||
|
||||
// Import and reexport all procedure arg types
|
||||
// Import all procedure arg schemas
|
||||
|
||||
// Import and reexport all table handle types
|
||||
// Import all table schema definitions
|
||||
import PersonRow from './person_table';
|
||||
export { PersonRow };
|
||||
|
||||
// Import and reexport all types
|
||||
import Add from './add_type';
|
||||
export { Add };
|
||||
import Init from './init_type';
|
||||
export { Init };
|
||||
import OnConnect from './on_connect_type';
|
||||
export { OnConnect };
|
||||
import OnDisconnect from './on_disconnect_type';
|
||||
export { OnDisconnect };
|
||||
import Person from './person_type';
|
||||
export { Person };
|
||||
import SayHello from './say_hello_type';
|
||||
export { SayHello };
|
||||
/** Type-only namespace exports for generated type groups. */
|
||||
|
||||
/** The schema information for all tables in this module. This is defined the same was as the tables would have been defined in the server. */
|
||||
const tablesSchema = __schema(
|
||||
@@ -85,7 +68,7 @@ const proceduresSchema = __procedures();
|
||||
/** The remote SpacetimeDB module schema, both runtime and type information. */
|
||||
const REMOTE_MODULE = {
|
||||
versionInfo: {
|
||||
cliVersion: '1.11.2' as const,
|
||||
cliVersion: '1.12.0' as const,
|
||||
},
|
||||
tables: tablesSchema.schemaType.tables,
|
||||
reducers: reducersSchema.reducersType.reducers,
|
||||
@@ -99,6 +82,10 @@ const REMOTE_MODULE = {
|
||||
/** The tables available in this remote SpacetimeDB module. */
|
||||
export const tables = __convertToAccessorMap(tablesSchema.schemaType.tables);
|
||||
|
||||
/** A typed query builder for this remote SpacetimeDB module. */
|
||||
export const query: __QueryBuilder<typeof tablesSchema.schemaType> =
|
||||
__makeQueryBuilder(tablesSchema.schemaType);
|
||||
|
||||
/** The reducers available in this remote SpacetimeDB module. */
|
||||
export const reducers = __convertToAccessorMap(
|
||||
reducersSchema.reducersType.reducers
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all procedure arg schemas
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all reducer arg schemas
|
||||
import OnConnectReducer from './on_connect_reducer';
|
||||
import OnDisconnectReducer from './on_disconnect_reducer';
|
||||
import AddReducer from './add_reducer';
|
||||
import SayHelloReducer from './say_hello_reducer';
|
||||
|
||||
export type OnConnectArgs = __Infer<typeof OnConnectReducer>;
|
||||
export type OnDisconnectArgs = __Infer<typeof OnDisconnectReducer>;
|
||||
export type AddArgs = __Infer<typeof AddReducer>;
|
||||
export type SayHelloArgs = __Infer<typeof SayHelloReducer>;
|
||||
@@ -0,0 +1,18 @@
|
||||
// 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 */
|
||||
import {
|
||||
TypeBuilder as __TypeBuilder,
|
||||
t as __t,
|
||||
type AlgebraicTypeType as __AlgebraicTypeType,
|
||||
type Infer as __Infer,
|
||||
} from 'spacetimedb';
|
||||
import CustomType from './custom_type_type';
|
||||
|
||||
export default __t.object('Testtable', {
|
||||
get idk() {
|
||||
return CustomType;
|
||||
},
|
||||
});
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all non-reducer types
|
||||
import Person from './person_type';
|
||||
|
||||
export type Person = __Infer<typeof Person>;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all non-reducer types
|
||||
import Person from '../person_type';
|
||||
|
||||
export type Person = __Infer<typeof Person>;
|
||||
@@ -0,0 +1,8 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all procedure arg schemas
|
||||
@@ -0,0 +1,17 @@
|
||||
// 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 */
|
||||
import { type Infer as __Infer } from 'spacetimedb';
|
||||
|
||||
// Import all reducer arg schemas
|
||||
import OnConnectReducer from '../on_connect_reducer';
|
||||
import OnDisconnectReducer from '../on_disconnect_reducer';
|
||||
import AddReducer from '../add_reducer';
|
||||
import SayHelloReducer from '../say_hello_reducer';
|
||||
|
||||
export type OnConnectParams = __Infer<typeof OnConnectReducer>;
|
||||
export type OnDisconnectParams = __Infer<typeof OnDisconnectReducer>;
|
||||
export type AddParams = __Infer<typeof AddReducer>;
|
||||
export type SayHelloParams = __Infer<typeof SayHelloReducer>;
|
||||
@@ -94,13 +94,25 @@ pub fn replace_in_tree(
|
||||
continue;
|
||||
}
|
||||
|
||||
// Determine depth relative to root, in case we need to add ../
|
||||
let rel_parent = path
|
||||
.parent()
|
||||
.and_then(|p| p.strip_prefix(&root).ok())
|
||||
.unwrap_or_else(|| Path::new(""));
|
||||
let depth = rel_parent.components().count();
|
||||
|
||||
// Decide which replacement to use for this file
|
||||
let is_index_ts = path.file_name().and_then(|n| n.to_str()) == Some("index.ts");
|
||||
let is_index_ts = depth == 0 && path.file_name().and_then(|n| n.to_str()) == Some("index.ts");
|
||||
let repl = if is_index_ts {
|
||||
replacement_index_ts
|
||||
} else {
|
||||
replacement_other_ts
|
||||
};
|
||||
let repl = if depth > 0 {
|
||||
format!("{}{}", "../".repeat(depth), repl)
|
||||
} else {
|
||||
repl.to_string()
|
||||
};
|
||||
|
||||
let bytes = match fs::read(path) {
|
||||
Ok(b) => b,
|
||||
|
||||
Reference in New Issue
Block a user