express-yaschema-ws-api-handler
Advanced tools
Comparing version 2.2.8 to 2.2.9
@@ -19,3 +19,3 @@ "use strict"; | ||
const ws_1 = __importDefault(require("ws")); | ||
const yaschema_1 = require("yaschema"); | ||
const yaschema_api_1 = require("yaschema-api"); | ||
const yaschema_ws_api_1 = require("yaschema-ws-api"); | ||
@@ -29,6 +29,2 @@ const on_command_request_validation_error_js_1 = require("../config/on-command-request-validation-error.js"); | ||
const shutdown_js_1 = require("../shutdown.js"); | ||
const anyStringSerializableTypeSchema = yaschema_1.schema.oneOf3(yaschema_1.schema.number().setAllowedSerializationForms(['number', 'string']), yaschema_1.schema.boolean().setAllowedSerializationForms(['boolean', 'string']), yaschema_1.schema.string()); | ||
const anyReqQuerySchema = yaschema_1.schema | ||
.record(yaschema_1.schema.string(), yaschema_1.schema.oneOf(anyStringSerializableTypeSchema, yaschema_1.schema.array({ items: anyStringSerializableTypeSchema }))) | ||
.optional(); | ||
const registerWsApiHandler = (app, api, { requestValidationMode = (0, validation_mode_js_1.getDefaultRequestValidationMode)(), responseValidationMode = (0, validation_mode_js_1.getDefaultResponseValidationMode)() }, requestHandlers, eventHandlers = {}) => { | ||
@@ -39,3 +35,3 @@ const expressWsHandler = (ws, req, next) => __awaiter(void 0, void 0, void 0, function* () { | ||
const connectionId = (0, uuid_1.v4)(); | ||
const reqQuery = yield ((_b = (_a = api.schemas.connection) === null || _a === void 0 ? void 0 : _a.query) !== null && _b !== void 0 ? _b : anyReqQuerySchema).deserializeAsync(req.query, { | ||
const reqQuery = yield ((_b = (_a = api.schemas.connection) === null || _a === void 0 ? void 0 : _a.query) !== null && _b !== void 0 ? _b : yaschema_api_1.anyReqQuerySchema).deserializeAsync(req.query, { | ||
validation: requestValidationMode | ||
@@ -42,0 +38,0 @@ }); |
import type WebSocket from 'ws'; | ||
import type { AnyBody, GenericWsApi } from 'yaschema-ws-api'; | ||
import type { AnyBody } from 'yaschema-api'; | ||
import type { GenericWsApi } from 'yaschema-ws-api'; | ||
interface OnCommandRequestValidationErrorHandlerArgs { | ||
@@ -4,0 +5,0 @@ api: GenericWsApi; |
@@ -1,2 +0,3 @@ | ||
import type { AnyBody, GenericWsApi } from 'yaschema-ws-api'; | ||
import type { AnyBody } from 'yaschema-api'; | ||
import type { GenericWsApi } from 'yaschema-ws-api'; | ||
interface OnCommandResponseValidationErrorHandlerArgs { | ||
@@ -3,0 +4,0 @@ api: GenericWsApi; |
import type { Express } from 'express'; | ||
import type { WithWebsocketMethod } from 'express-ws'; | ||
import type { Schema, ValidationMode } from 'yaschema'; | ||
import type { AnyQuery, WsApi } from 'yaschema-ws-api'; | ||
import type { AnyQuery } from 'yaschema-api'; | ||
import type { WsApi } from 'yaschema-ws-api'; | ||
import type { WsApiEventHandlers } from './types/WsApiEventHandlers'; | ||
@@ -6,0 +7,0 @@ import type { WsApiRequestHandlers } from './types/WsApiRequestHandlers'; |
@@ -1,4 +0,5 @@ | ||
import type { AnyCommands, AnyQuery } from 'yaschema-ws-api'; | ||
import type { AnyQuery } from 'yaschema-api'; | ||
import type { AnyCommands } from 'yaschema-ws-api'; | ||
import type { WsApiRequestHandler } from './WsApiRequestHandler'; | ||
export type GenericWsApiRequestHandler = WsApiRequestHandler<AnyCommands, AnyCommands, string, AnyQuery>; | ||
//# sourceMappingURL=GenericWsApiRequestHandler.d.ts.map |
import type { NextFunction, Request } from 'express'; | ||
import type WebSocket from 'ws'; | ||
import type { AnyCommands, AnyQuery } from 'yaschema-ws-api'; | ||
import type { AnyQuery } from 'yaschema-api'; | ||
import type { AnyCommands } from 'yaschema-ws-api'; | ||
import type { WsApiResponders } from './WsApiResponders'; | ||
@@ -5,0 +6,0 @@ export type WsApiConnectionChangeHandler<ResponseCommandsT extends AnyCommands, QueryT extends AnyQuery> = (args: { |
import type { NextFunction, Request } from 'express'; | ||
import type WebSocket from 'ws'; | ||
import type { AnyCommands, AnyQuery } from 'yaschema-ws-api'; | ||
import type { AnyQuery } from 'yaschema-api'; | ||
import type { AnyCommands } from 'yaschema-ws-api'; | ||
import type { WsApiResponders } from './WsApiResponders'; | ||
@@ -5,0 +6,0 @@ export type WsApiErrorHandler<ResponseCommandsT extends AnyCommands, QueryT extends AnyQuery> = (args: { |
@@ -1,2 +0,3 @@ | ||
import type { AnyCommands, AnyQuery } from 'yaschema-ws-api'; | ||
import type { AnyQuery } from 'yaschema-api'; | ||
import type { AnyCommands } from 'yaschema-ws-api'; | ||
import type { WsApiConnectionChangeHandler } from './WsApiConnectionChangeHandler'; | ||
@@ -3,0 +4,0 @@ import type { WsApiErrorHandler } from './WsApiErrorHandler'; |
import type { NextFunction, Request } from 'express'; | ||
import type WebSocket from 'ws'; | ||
import type { AnyCommands, AnyQuery } from 'yaschema-ws-api'; | ||
import type { AnyQuery } from 'yaschema-api'; | ||
import type { AnyCommands } from 'yaschema-ws-api'; | ||
import type { WsApiResponders } from './WsApiResponders'; | ||
@@ -5,0 +6,0 @@ export type WsApiMessageReceiptHandler<ResponseCommandsT extends AnyCommands, QueryT extends AnyQuery> = (args: { |
import type { NextFunction, Request } from 'express'; | ||
import type WebSocket from 'ws'; | ||
import type { AnyCommands, AnyQuery } from 'yaschema-ws-api'; | ||
import type { AnyQuery } from 'yaschema-api'; | ||
import type { AnyCommands } from 'yaschema-ws-api'; | ||
import type { WsApiResponders } from './WsApiResponders'; | ||
@@ -5,0 +6,0 @@ export type WsApiRequestHandler<RequestCommandsT extends AnyCommands, ResponseCommandsT extends AnyCommands, CommandNameT extends keyof RequestCommandsT & string, QueryT extends AnyQuery, ExtraArgsT extends Record<string, any> = Record<string, never>> = (args: { |
import type { Schema } from 'yaschema'; | ||
import type { AnyQuery } from 'yaschema-ws-api'; | ||
import type { AnyQuery } from 'yaschema-api'; | ||
import type { WsApiRequestHandler } from './WsApiRequestHandler'; | ||
@@ -4,0 +4,0 @@ export type WsApiRequestHandlers<RequestCommandsT extends Record<string, Schema>, ResponseCommandsT extends Record<string, Schema>, QueryT extends AnyQuery> = { |
{ | ||
"name": "express-yaschema-ws-api-handler", | ||
"version": "2.2.8", | ||
"version": "2.2.9", | ||
"description": "Express handler support for yaschema-ws-api", | ||
@@ -39,7 +39,7 @@ "keywords": [ | ||
"express-ws": "^5.0.2", | ||
"express-yaschema-api-handler": "^2.8.2", | ||
"express-yaschema-api-handler": "^2.8.3", | ||
"uuid": "^10.0.0", | ||
"yaschema": "^3.6.0", | ||
"yaschema-api": "^3.7.1", | ||
"yaschema-ws-api": "^2.3.5" | ||
"yaschema-api": "^3.8.1", | ||
"yaschema-ws-api": "^2.5.0" | ||
}, | ||
@@ -77,4 +77,4 @@ "devDependencies": { | ||
"typescript": "5.6.2", | ||
"yaschema-ws-api-client": "^2.2.6" | ||
"yaschema-ws-api-client": "^2.2.7" | ||
} | ||
} |
import type WebSocket from 'ws'; | ||
import type { AnyBody, GenericWsApi } from 'yaschema-ws-api'; | ||
import type { AnyBody } from 'yaschema-api'; | ||
import type { GenericWsApi } from 'yaschema-ws-api'; | ||
@@ -4,0 +5,0 @@ interface OnCommandRequestValidationErrorHandlerArgs { |
@@ -1,2 +0,3 @@ | ||
import type { AnyBody, GenericWsApi } from 'yaschema-ws-api'; | ||
import type { AnyBody } from 'yaschema-api'; | ||
import type { GenericWsApi } from 'yaschema-ws-api'; | ||
@@ -3,0 +4,0 @@ interface OnCommandResponseValidationErrorHandlerArgs { |
@@ -7,4 +7,5 @@ import type { Express, NextFunction, Request } from 'express'; | ||
import type { Schema, ValidationMode } from 'yaschema'; | ||
import { schema } from 'yaschema'; | ||
import type { AnyQuery, GenericWsApi, WsApi } from 'yaschema-ws-api'; | ||
import type { AnyQuery } from 'yaschema-api'; | ||
import { anyReqQuerySchema } from 'yaschema-api'; | ||
import type { GenericWsApi, WsApi } from 'yaschema-ws-api'; | ||
import { genericCommandSchema } from 'yaschema-ws-api'; | ||
@@ -25,12 +26,2 @@ | ||
const anyStringSerializableTypeSchema = schema.oneOf3( | ||
schema.number().setAllowedSerializationForms(['number', 'string']), | ||
schema.boolean().setAllowedSerializationForms(['boolean', 'string']), | ||
schema.string() | ||
); | ||
const anyReqQuerySchema = schema | ||
.record(schema.string(), schema.oneOf(anyStringSerializableTypeSchema, schema.array({ items: anyStringSerializableTypeSchema }))) | ||
.optional(); | ||
export interface WsApiHandlerOptions { | ||
@@ -37,0 +28,0 @@ requestValidationMode?: ValidationMode; |
@@ -1,2 +0,3 @@ | ||
import type { AnyCommands, AnyQuery } from 'yaschema-ws-api'; | ||
import type { AnyQuery } from 'yaschema-api'; | ||
import type { AnyCommands } from 'yaschema-ws-api'; | ||
@@ -3,0 +4,0 @@ import type { WsApiRequestHandler } from './WsApiRequestHandler'; |
import type { NextFunction, Request } from 'express'; | ||
import type WebSocket from 'ws'; | ||
import type { AnyCommands, AnyQuery } from 'yaschema-ws-api'; | ||
import type { AnyQuery } from 'yaschema-api'; | ||
import type { AnyCommands } from 'yaschema-ws-api'; | ||
@@ -5,0 +6,0 @@ import type { WsApiResponders } from './WsApiResponders'; |
import type { NextFunction, Request } from 'express'; | ||
import type WebSocket from 'ws'; | ||
import type { AnyCommands, AnyQuery } from 'yaschema-ws-api'; | ||
import type { AnyQuery } from 'yaschema-api'; | ||
import type { AnyCommands } from 'yaschema-ws-api'; | ||
@@ -5,0 +6,0 @@ import type { WsApiResponders } from './WsApiResponders'; |
@@ -1,2 +0,3 @@ | ||
import type { AnyCommands, AnyQuery } from 'yaschema-ws-api'; | ||
import type { AnyQuery } from 'yaschema-api'; | ||
import type { AnyCommands } from 'yaschema-ws-api'; | ||
@@ -3,0 +4,0 @@ import type { WsApiConnectionChangeHandler } from './WsApiConnectionChangeHandler'; |
import type { NextFunction, Request } from 'express'; | ||
import type WebSocket from 'ws'; | ||
import type { AnyCommands, AnyQuery } from 'yaschema-ws-api'; | ||
import type { AnyQuery } from 'yaschema-api'; | ||
import type { AnyCommands } from 'yaschema-ws-api'; | ||
@@ -5,0 +6,0 @@ import type { WsApiResponders } from './WsApiResponders'; |
import type { NextFunction, Request } from 'express'; | ||
import type WebSocket from 'ws'; | ||
import type { AnyCommands, AnyQuery } from 'yaschema-ws-api'; | ||
import type { AnyQuery } from 'yaschema-api'; | ||
import type { AnyCommands } from 'yaschema-ws-api'; | ||
@@ -5,0 +6,0 @@ import type { WsApiResponders } from './WsApiResponders'; |
import type { Schema } from 'yaschema'; | ||
import type { AnyQuery } from 'yaschema-ws-api'; | ||
import type { AnyQuery } from 'yaschema-api'; | ||
@@ -4,0 +4,0 @@ import type { WsApiRequestHandler } from './WsApiRequestHandler'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
144974
Updatedyaschema-api@^3.8.1
Updatedyaschema-ws-api@^2.5.0