Skip to content

Commit

Permalink
Merge pull request #195 from curveball/prep-0.18-alpha0
Browse files Browse the repository at this point in the history
Prep 0.18 alpha0 release.
  • Loading branch information
evert authored Apr 9, 2022
2 parents c364dac + fd8a516 commit a6d93c8
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 4 deletions.
17 changes: 17 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
Changelog
=========

0.18.0.alpha.0 (2022-04-09)
---------------------------

* The `Context` interface has been removed, and the `BaseContext` class is
renamed to `Context`. This is a BC break, but should only be an issue if
you used the `Context` interface directly. `BaseContext` is still
exported but simply aliased to `Context`. This alias will be removed from
a future version. This change should make ite asier to use interface
declaration merging to extend Context.
* The `ws` dependency has been updated to version 8. There are some [breaking
changes][ws8] in this release. The most likely you'll hit is that incoming
messages are now of type `Buffer` instead of `string`. Check out the
[ws changelog][ws8] for more details.


0.17.0 (2022-02-08)
-------------------

Expand Down Expand Up @@ -333,3 +348,5 @@ Happy birthday Mom!
------------------

* First published on npm.js to claim package name.

[ws8]: https://github.com/websockets/ws/releases/tag/8.0.0
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@curveball/core",
"version": "0.17.0",
"version": "0.18.0-alpha.0",
"description": "Curveball is a framework writting in Typescript for Node.js",
"main": "dist/index.js",
"scripts": {
Expand Down
14 changes: 14 additions & 0 deletions src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,17 @@ export class Context<ReqT = any, ResT = any> {

}

/**
* WsContext always has a 'webSocket' property defined.
*/
export type WsContext = Context & {

/**
* WebSocket object.
*
* If the current request is a websocket request, this proprerty will be set
*
* @see https://github.com/websockets/ws#simple-server
*/
webSocket: WebSocket;
};
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { default as Application, invokeMiddlewares, Middleware, middlewareCall } from './application';
export { Context } from './context';
export {
Context,
// For backwards compatibility
Context as BaseContext,
WsContext
} from './context';
import Headers from './headers';
import MemoryRequest from './memory-request';
import MemoryResponse from './memory-response';
Expand Down

0 comments on commit a6d93c8

Please sign in to comment.