From 0b39e46df930a7550115e066612354dfac16070b Mon Sep 17 00:00:00 2001 From: Stanislav Muhametsin <346799+stazz@users.noreply.github.com> Date: Tue, 13 Feb 2024 22:23:49 +0200 Subject: [PATCH] #20 Enabling support for contextless endpoints. --- server/package.json | 4 ++-- server/src/middleware.ts | 3 +-- server/src/server.ts | 3 +-- server/yarn.lock | 8 ++++---- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/server/package.json b/server/package.json index 01eb6bf..1cdff09 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "@ty-ras/server-express", - "version": "2.1.1", + "version": "2.2.0", "author": { "name": "Stanislav Muhametsin", "email": "346799+stazz@users.noreply.github.com", @@ -31,7 +31,7 @@ } }, "dependencies": { - "@ty-ras/server": "^2.2.1" + "@ty-ras/server": "^2.3.0" }, "peerDependencies": { "express": "^4.18.2" diff --git a/server/src/middleware.ts b/server/src/middleware.ts index 617354c..e3db071 100644 --- a/server/src/middleware.ts +++ b/server/src/middleware.ts @@ -2,7 +2,6 @@ * @file This file contains helper function to create Express middleware callback. */ -import * as ep from "@ty-ras/endpoint"; import * as server from "@ty-ras/server"; import type * as express from "express"; import type * as context from "./context.types"; @@ -16,7 +15,7 @@ import * as internal from "./internal"; * @returns The Koa middleware which will serve the given endpoints. */ export const createMiddleware = ( - endpoints: ReadonlyArray>, + endpoints: server.ServerEndpoints, createState?: context.CreateState, events?: server.ServerEventHandler< server.GetContext, diff --git a/server/src/server.ts b/server/src/server.ts index 5e61179..17286ab 100644 --- a/server/src/server.ts +++ b/server/src/server.ts @@ -2,7 +2,6 @@ * @file This file exposes function to create Node HTTP 1 or 2 server serving giving TyRAS {@link ep.AppEndpoint}s. */ -import * as ep from "@ty-ras/endpoint"; import * as server from "@ty-ras/server"; import * as express from "express"; import type * as ctx from "./context.types"; @@ -34,7 +33,7 @@ export interface ServerCreationOptions { /** * The TyRAS {@link ep.AppEndpoint}s to server via returned HTTP server. */ - endpoints: ReadonlyArray>; + endpoints: server.ServerEndpoints; /** * The callback to create endpoint-specific state objects. diff --git a/server/yarn.lock b/server/yarn.lock index 82231f7..c334450 100644 --- a/server/yarn.lock +++ b/server/yarn.lock @@ -445,10 +445,10 @@ dependencies: "@ty-ras/endpoint" "^2.0.0" -"@ty-ras/server@^2.2.1": - version "2.2.1" - resolved "https://registry.yarnpkg.com/@ty-ras/server/-/server-2.2.1.tgz#747995863d54ad828191e2cdb6f528231c24939b" - integrity sha512-Qy22YPpjcqrBP698d2Sm5LqmX39hq3aLuOngTRxKhD0kU2y4GooKgrMDCmaKkfteP/0fqoqZG4c20ukeTtPqcg== +"@ty-ras/server@^2.3.0": + version "2.3.0" + resolved "https://registry.yarnpkg.com/@ty-ras/server/-/server-2.3.0.tgz#f168669b29f777130823bf583341f83f0ade8ec0" + integrity sha512-0DhQqHHwyfDP2YJQhbxl+TAs4yDXKaBAVgs53+nCS0lr0M7Surc1MZ9AUeDQtcZJKc8FkWhUhUpt9aOQjZ89EA== dependencies: "@ty-ras/endpoint" "^2.0.0"