diff --git a/waspc/data/Generator/templates/sdk/package.json b/waspc/data/Generator/templates/sdk/package.json index fb0a46e365..6e3b7978e4 100644 --- a/waspc/data/Generator/templates/sdk/package.json +++ b/waspc/data/Generator/templates/sdk/package.json @@ -87,8 +87,6 @@ {=! Used by our code, uncodumented (but accessible) for users. =} {=! Todo(filip): This export becomes problematic once we start supporting different executors =} "./server/jobs/pgBoss/types": "./dist/server/jobs/pgBoss/types.js", - {=! Used by users, documented. =} - "./server/webSocket": "./dist/server/webSocket/index.js", {=! Used by the framework client code, reconsider during refactoring. =} "./client/webSocket/WebSocketProvider": "./dist/client/webSocket/WebSocketProvider.jsx", @@ -110,6 +108,9 @@ {=! Public: { type ServerToClientPayload, type ClientToServerPayload, useSocket, useSocketListener } =} {=! Private: [] =} "./client/webSocket": "./dist/client/webSocket/index.js", + {=! Public: { type WebSocketDefinition, type WaspSocketData } =} + {=! Private: [server, sdk] =} + "./server/webSocket": "./dist/server/webSocket/index.js", "./auth": "./dist/auth/index.js", "./client/auth": "./dist/client/auth/index.js", "./server/auth": "./dist/server/auth/index.js", diff --git a/waspc/data/Generator/templates/sdk/server/webSocket/index.ts b/waspc/data/Generator/templates/sdk/server/webSocket/index.ts index 82a044185b..2fdbd86729 100644 --- a/waspc/data/Generator/templates/sdk/server/webSocket/index.ts +++ b/waspc/data/Generator/templates/sdk/server/webSocket/index.ts @@ -10,6 +10,7 @@ import { type AuthUser } from 'wasp/auth' {=& userWebSocketFn.importStatement =} +// Public API export type WebSocketDefinition< ClientToServerEvents extends EventsMap = DefaultEventsMap, ServerToClientEvents extends EventsMap = DefaultEventsMap, @@ -31,15 +32,19 @@ export type WebSocketDefinition< } ) => Promise | void +// PUBLIC API export interface WaspSocketData { {=# isAuthEnabled =} user?: AuthUser {=/ isAuthEnabled =} } +// PRIVATE API export type ServerType = Parameters[0] +// PRIVATE API export type ClientToServerEvents = Events[0] +// PRIVATE API export type ServerToClientEvents = Events[1] type WebSocketFn = typeof {= userWebSocketFn.importIdentifier =}