@rest-vir/define-service 0.17.2 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,7 +4,7 @@ import { type HasRequiredKeys } from 'type-fest';
|
|
|
4
4
|
import { type NoParam } from '../util/no-param.js';
|
|
5
5
|
import { type BaseSearchParams } from '../util/search-params.js';
|
|
6
6
|
import { type CommonWebSocket, type CommonWebSocketEventMap } from './common-web-socket.js';
|
|
7
|
-
import { type WebSocketDefinition } from './web-socket-definition.js';
|
|
7
|
+
import { type GenericWebSocketDefinition, type WebSocketDefinition } from './web-socket-definition.js';
|
|
8
8
|
/**
|
|
9
9
|
* Location of the WebSocket in question: on a client connecting to a WebSocket host or on the host
|
|
10
10
|
* that's accepting WebSocket connections.
|
|
@@ -171,12 +171,12 @@ export type ClientWebSocket<WebSocketToConnect extends Readonly<SelectFrom<WebSo
|
|
|
171
171
|
* @category Package : @rest-vir/define-service
|
|
172
172
|
* @package [`@rest-vir/define-service`](https://www.npmjs.com/package/@rest-vir/define-service)
|
|
173
173
|
*/
|
|
174
|
-
export type WebSocketListenerParams<EventName extends keyof CommonWebSocketEventMap, WebSocketToConnect extends Readonly<SelectFrom<
|
|
174
|
+
export type WebSocketListenerParams<EventName extends keyof CommonWebSocketEventMap, WebSocketToConnect extends Readonly<SelectFrom<GenericWebSocketDefinition, {
|
|
175
175
|
MessageFromClientType: true;
|
|
176
176
|
MessageFromHostType: true;
|
|
177
177
|
SearchParamsType: true;
|
|
178
178
|
}>> | NoParam, MessageSource extends WebSocketLocation, WebSocketClass extends CommonWebSocket> = {
|
|
179
|
-
webSocketDefinition: WebSocketToConnect extends NoParam ? Readonly<Overwrite<
|
|
179
|
+
webSocketDefinition: WebSocketToConnect extends NoParam ? Readonly<Overwrite<GenericWebSocketDefinition,
|
|
180
180
|
/**
|
|
181
181
|
* This `Overwrite` is needed so that
|
|
182
182
|
* `CollapsedConnectWebSocketParams<ACTUAL_SOCKET>` can be assigned to
|
|
@@ -204,7 +204,7 @@ export type WebSocketListenerParams<EventName extends keyof CommonWebSocketEvent
|
|
|
204
204
|
* @category Package : @rest-vir/define-service
|
|
205
205
|
* @package [`@rest-vir/define-service`](https://www.npmjs.com/package/@rest-vir/define-service)
|
|
206
206
|
*/
|
|
207
|
-
export type ConnectWebSocketListeners<WebSocketToConnect extends Readonly<SelectFrom<
|
|
207
|
+
export type ConnectWebSocketListeners<WebSocketToConnect extends Readonly<SelectFrom<GenericWebSocketDefinition, {
|
|
208
208
|
MessageFromClientType: true;
|
|
209
209
|
MessageFromHostType: true;
|
|
210
210
|
SearchParamsType: true;
|
|
@@ -218,7 +218,7 @@ export type ConnectWebSocketListeners<WebSocketToConnect extends Readonly<Select
|
|
|
218
218
|
* @category Package : @rest-vir/define-service
|
|
219
219
|
* @package [`@rest-vir/define-service`](https://www.npmjs.com/package/@rest-vir/define-service)
|
|
220
220
|
*/
|
|
221
|
-
export type WebSocketListener<EventName extends keyof CommonWebSocketEventMap, WebSocketToConnect extends Readonly<SelectFrom<
|
|
221
|
+
export type WebSocketListener<EventName extends keyof CommonWebSocketEventMap, WebSocketToConnect extends Readonly<SelectFrom<GenericWebSocketDefinition, {
|
|
222
222
|
MessageFromClientType: true;
|
|
223
223
|
MessageFromHostType: true;
|
|
224
224
|
SearchParamsType: true;
|
|
@@ -5,7 +5,6 @@ import { type EndpointPathBase } from '../endpoint/endpoint-path.js';
|
|
|
5
5
|
import { type MinimalService } from '../service/minimal-service.js';
|
|
6
6
|
import { type NoParam } from '../util/no-param.js';
|
|
7
7
|
import { type OriginRequirement } from '../util/origin.js';
|
|
8
|
-
import { type BaseSearchParams } from '../util/search-params.js';
|
|
9
8
|
/**
|
|
10
9
|
* Initialization for a WebSocket within a service definition..
|
|
11
10
|
*
|
|
@@ -89,7 +88,7 @@ export type WithFinalWebSocketProps<Init, WebSocketPath extends EndpointPathBase
|
|
|
89
88
|
protocolsShape: 'protocolsShape' extends keyof Init ? undefined extends Init['protocolsShape'] ? undefined : ShapeDefinition<Init['protocolsShape'], true> | undefined : undefined;
|
|
90
89
|
ProtocolsType: undefined extends Init['protocolsShape'] ? string[] : ShapeToRuntimeType<ShapeDefinition<Init['protocolsShape'], true>, false, true>;
|
|
91
90
|
searchParamsShape: 'searchParamsShape' extends keyof Init ? undefined extends Init['searchParamsShape'] ? undefined : ShapeDefinition<Init['searchParamsShape'], true> | undefined : undefined;
|
|
92
|
-
SearchParamsType:
|
|
91
|
+
SearchParamsType: 'searchParamsShape' extends keyof Init ? ShapeToRuntimeType<ShapeDefinition<Init['searchParamsShape'], true>, false, true> : undefined;
|
|
93
92
|
customProps: 'customProps' extends keyof Init ? Init['customProps'] : undefined;
|
|
94
93
|
}> : never) & {
|
|
95
94
|
path: WebSocketPath;
|