@pluv/platform-node 0.35.1 → 0.35.2
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.
- package/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +8 -0
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/package.json +5 -5
- package/src/createPluvHandler.ts +6 -6
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/platform-node@0.35.
|
|
2
|
+
> @pluv/platform-node@0.35.2 build /home/runner/work/pluv/pluv/packages/platform-node
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[32mESM[39m [1mdist/index.mjs [22m[32m8.50 KB[39m
|
|
12
|
-
[32mESM[39m ⚡️ Build success in
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 114ms
|
|
13
13
|
[32mCJS[39m [1mdist/index.js [22m[32m10.26 KB[39m
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 130ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m4.
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m4.
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 5026ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m4.83 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m4.83 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WebSocket, Server as Server$1 } from 'ws';
|
|
2
2
|
export { WebSocket } from 'ws';
|
|
3
3
|
import { AbstractWebSocket, WebSocketSerializedState, AbstractEventMap, AbstractListener, AbstractWebSocketConfig, WebSocketRegistrationMode, AbstractPersistence, AbstractPubSub, AbstractPlatform, ConvertWebSocketConfig, AbstractPlatformConfig, PluvServer, InferInitContextType } from '@pluv/io';
|
|
4
|
-
import { JsonObject, Json, MaybePromise, Maybe, InferIOAuthorizeUser, InferIOAuthorize } from '@pluv/types';
|
|
4
|
+
import { JsonObject, Json, MaybePromise, Maybe, InferIOAuthorizeUser, InferIOAuthorize, BaseUser } from '@pluv/types';
|
|
5
5
|
import { IncomingMessage, Server, ServerResponse } from 'node:http';
|
|
6
6
|
|
|
7
7
|
type NodeWebSocketConfig = AbstractWebSocketConfig;
|
|
@@ -85,15 +85,15 @@ declare class NodePlatform<TMeta extends Record<string, Json> = {}> extends Abst
|
|
|
85
85
|
type AuthorizeFunctionContext<TPluvServer extends PluvServer<any, any, any, any>> = {
|
|
86
86
|
room: string;
|
|
87
87
|
} & InferInitContextType<TPluvServer extends PluvServer<infer IPlatform, any, any, any> ? IPlatform : never>;
|
|
88
|
-
type AuthorizeFunction<TPluvServer extends PluvServer<
|
|
89
|
-
type CreatePluvHandlerConfig<TPluvServer extends PluvServer<
|
|
88
|
+
type AuthorizeFunction<TPluvServer extends PluvServer<any, any, any, any>> = (ctx: AuthorizeFunctionContext<TPluvServer>) => MaybePromise<Maybe<InferIOAuthorizeUser<InferIOAuthorize<TPluvServer>>>>;
|
|
89
|
+
type CreatePluvHandlerConfig<TPluvServer extends PluvServer<any, any, any, any>> = {
|
|
90
90
|
endpoint?: string;
|
|
91
91
|
io: TPluvServer;
|
|
92
92
|
server: Server;
|
|
93
|
-
} & (InferIOAuthorize<TPluvServer
|
|
94
|
-
authorize?: undefined;
|
|
95
|
-
} : {
|
|
93
|
+
} & (InferIOAuthorizeUser<InferIOAuthorize<TPluvServer>> extends BaseUser ? {
|
|
96
94
|
authorize: AuthorizeFunction<TPluvServer>;
|
|
95
|
+
} : {
|
|
96
|
+
authorize?: undefined;
|
|
97
97
|
});
|
|
98
98
|
type RequestHandler = (req: IncomingMessage, res: ServerResponse, next?: () => void) => void;
|
|
99
99
|
interface WebSocketHandlerResult {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WebSocket, Server as Server$1 } from 'ws';
|
|
2
2
|
export { WebSocket } from 'ws';
|
|
3
3
|
import { AbstractWebSocket, WebSocketSerializedState, AbstractEventMap, AbstractListener, AbstractWebSocketConfig, WebSocketRegistrationMode, AbstractPersistence, AbstractPubSub, AbstractPlatform, ConvertWebSocketConfig, AbstractPlatformConfig, PluvServer, InferInitContextType } from '@pluv/io';
|
|
4
|
-
import { JsonObject, Json, MaybePromise, Maybe, InferIOAuthorizeUser, InferIOAuthorize } from '@pluv/types';
|
|
4
|
+
import { JsonObject, Json, MaybePromise, Maybe, InferIOAuthorizeUser, InferIOAuthorize, BaseUser } from '@pluv/types';
|
|
5
5
|
import { IncomingMessage, Server, ServerResponse } from 'node:http';
|
|
6
6
|
|
|
7
7
|
type NodeWebSocketConfig = AbstractWebSocketConfig;
|
|
@@ -85,15 +85,15 @@ declare class NodePlatform<TMeta extends Record<string, Json> = {}> extends Abst
|
|
|
85
85
|
type AuthorizeFunctionContext<TPluvServer extends PluvServer<any, any, any, any>> = {
|
|
86
86
|
room: string;
|
|
87
87
|
} & InferInitContextType<TPluvServer extends PluvServer<infer IPlatform, any, any, any> ? IPlatform : never>;
|
|
88
|
-
type AuthorizeFunction<TPluvServer extends PluvServer<
|
|
89
|
-
type CreatePluvHandlerConfig<TPluvServer extends PluvServer<
|
|
88
|
+
type AuthorizeFunction<TPluvServer extends PluvServer<any, any, any, any>> = (ctx: AuthorizeFunctionContext<TPluvServer>) => MaybePromise<Maybe<InferIOAuthorizeUser<InferIOAuthorize<TPluvServer>>>>;
|
|
89
|
+
type CreatePluvHandlerConfig<TPluvServer extends PluvServer<any, any, any, any>> = {
|
|
90
90
|
endpoint?: string;
|
|
91
91
|
io: TPluvServer;
|
|
92
92
|
server: Server;
|
|
93
|
-
} & (InferIOAuthorize<TPluvServer
|
|
94
|
-
authorize?: undefined;
|
|
95
|
-
} : {
|
|
93
|
+
} & (InferIOAuthorizeUser<InferIOAuthorize<TPluvServer>> extends BaseUser ? {
|
|
96
94
|
authorize: AuthorizeFunction<TPluvServer>;
|
|
95
|
+
} : {
|
|
96
|
+
authorize?: undefined;
|
|
97
97
|
});
|
|
98
98
|
type RequestHandler = (req: IncomingMessage, res: ServerResponse, next?: () => void) => void;
|
|
99
99
|
interface WebSocketHandlerResult {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/platform-node",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.2",
|
|
4
4
|
"description": "@pluv/io adapter for node.js",
|
|
5
5
|
"author": "leedavidcs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
"@types/node": "^22.10.7",
|
|
21
21
|
"@types/ws": "^8.5.13",
|
|
22
22
|
"path-to-regexp": "^8.2.0",
|
|
23
|
-
"@pluv/io": "^0.35.
|
|
24
|
-
"@pluv/types": "^0.35.
|
|
23
|
+
"@pluv/io": "^0.35.2",
|
|
24
|
+
"@pluv/types": "^0.35.2"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"eslint": "^8.57.1",
|
|
28
28
|
"tsup": "^8.3.5",
|
|
29
29
|
"typescript": "^5.7.3",
|
|
30
30
|
"ws": "^8.18.0",
|
|
31
|
-
"@pluv/tsconfig": "^0.35.
|
|
32
|
-
"eslint-config-pluv": "^0.35.
|
|
31
|
+
"@pluv/tsconfig": "^0.35.2",
|
|
32
|
+
"eslint-config-pluv": "^0.35.2"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"ws": "^8.0.0"
|
package/src/createPluvHandler.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { InferInitContextType, PluvServer } from "@pluv/io";
|
|
2
|
-
import type { InferIOAuthorize, InferIOAuthorizeUser, Maybe, MaybePromise } from "@pluv/types";
|
|
2
|
+
import type { BaseUser, InferIOAuthorize, InferIOAuthorizeUser, Maybe, MaybePromise } from "@pluv/types";
|
|
3
3
|
import type { Server as HttpServer, IncomingMessage, ServerResponse } from "node:http";
|
|
4
4
|
import Url from "node:url";
|
|
5
5
|
import { match } from "path-to-regexp";
|
|
@@ -11,17 +11,17 @@ export type AuthorizeFunctionContext<TPluvServer extends PluvServer<any, any, an
|
|
|
11
11
|
room: string;
|
|
12
12
|
} & InferInitContextType<TPluvServer extends PluvServer<infer IPlatform, any, any, any> ? IPlatform : never>;
|
|
13
13
|
|
|
14
|
-
export type AuthorizeFunction<TPluvServer extends PluvServer<
|
|
14
|
+
export type AuthorizeFunction<TPluvServer extends PluvServer<any, any, any, any>> = (
|
|
15
15
|
ctx: AuthorizeFunctionContext<TPluvServer>,
|
|
16
16
|
) => MaybePromise<Maybe<InferIOAuthorizeUser<InferIOAuthorize<TPluvServer>>>>;
|
|
17
17
|
|
|
18
|
-
export type CreatePluvHandlerConfig<TPluvServer extends PluvServer<
|
|
18
|
+
export type CreatePluvHandlerConfig<TPluvServer extends PluvServer<any, any, any, any>> = {
|
|
19
19
|
endpoint?: string;
|
|
20
20
|
io: TPluvServer;
|
|
21
21
|
server: HttpServer;
|
|
22
|
-
} & (InferIOAuthorize<TPluvServer
|
|
23
|
-
? { authorize
|
|
24
|
-
: { authorize
|
|
22
|
+
} & (InferIOAuthorizeUser<InferIOAuthorize<TPluvServer>> extends BaseUser
|
|
23
|
+
? { authorize: AuthorizeFunction<TPluvServer> }
|
|
24
|
+
: { authorize?: undefined });
|
|
25
25
|
|
|
26
26
|
const handle = (ws: WebSocket) => ({
|
|
27
27
|
invalidEndpoint: () => {
|