@pluv/platform-node 0.35.0 → 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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @pluv/platform-node@0.35.0 build /home/runner/work/pluv/pluv/packages/platform-node
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
  CLI Building entry: src/index.ts
@@ -9,10 +9,10 @@
9
9
  ESM Build start
10
10
  CJS Build start
11
11
  ESM dist/index.mjs 8.50 KB
12
- ESM ⚡️ Build success in 62ms
12
+ ESM ⚡️ Build success in 114ms
13
13
  CJS dist/index.js 10.26 KB
14
- CJS ⚡️ Build success in 73ms
14
+ CJS ⚡️ Build success in 130ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 5740ms
17
- DTS dist/index.d.mts 4.81 KB
18
- DTS dist/index.d.ts 4.81 KB
16
+ DTS ⚡️ Build success in 5026ms
17
+ DTS dist/index.d.mts 4.83 KB
18
+ DTS dist/index.d.ts 4.83 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @pluv/platform-node
2
2
 
3
+ ## 0.35.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [81cb692]
8
+ - @pluv/types@0.35.2
9
+ - @pluv/io@0.35.2
10
+
11
+ ## 0.35.1
12
+
13
+ ### Patch Changes
14
+
15
+ - @pluv/io@0.35.1
16
+ - @pluv/types@0.35.1
17
+
3
18
  ## 0.35.0
4
19
 
5
20
  ### Patch Changes
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<NodePlatform, any, any, any>> = (ctx: AuthorizeFunctionContext<TPluvServer>) => MaybePromise<Maybe<InferIOAuthorizeUser<InferIOAuthorize<TPluvServer>>>>;
89
- type CreatePluvHandlerConfig<TPluvServer extends PluvServer<NodePlatform, any, any, any>> = {
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> extends null ? {
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<NodePlatform, any, any, any>> = (ctx: AuthorizeFunctionContext<TPluvServer>) => MaybePromise<Maybe<InferIOAuthorizeUser<InferIOAuthorize<TPluvServer>>>>;
89
- type CreatePluvHandlerConfig<TPluvServer extends PluvServer<NodePlatform, any, any, any>> = {
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> extends null ? {
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.0",
3
+ "version": "0.35.2",
4
4
  "description": "@pluv/io adapter for node.js",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -17,19 +17,19 @@
17
17
  "access": "public"
18
18
  },
19
19
  "dependencies": {
20
- "@types/node": "^22.10.5",
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.0",
24
- "@pluv/types": "^0.35.0"
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
- "typescript": "^5.7.2",
29
+ "typescript": "^5.7.3",
30
30
  "ws": "^8.18.0",
31
- "@pluv/tsconfig": "^0.35.0",
32
- "eslint-config-pluv": "^0.35.0"
31
+ "@pluv/tsconfig": "^0.35.2",
32
+ "eslint-config-pluv": "^0.35.2"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "ws": "^8.0.0"
@@ -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<NodePlatform, any, any, any>> = (
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<NodePlatform, any, any, any>> = {
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> extends null
23
- ? { authorize?: undefined }
24
- : { authorize: AuthorizeFunction<TPluvServer> });
22
+ } & (InferIOAuthorizeUser<InferIOAuthorize<TPluvServer>> extends BaseUser
23
+ ? { authorize: AuthorizeFunction<TPluvServer> }
24
+ : { authorize?: undefined });
25
25
 
26
26
  const handle = (ws: WebSocket) => ({
27
27
  invalidEndpoint: () => {