@pluv/platform-node 5.0.0 → 5.0.1
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/CHANGELOG.md +10 -6
- package/package.json +11 -11
- package/.turbo/turbo-build.log +0 -15
- package/dist/index.d.mts +0 -127
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -234
- package/dist/index.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @pluv/platform-node
|
|
2
2
|
|
|
3
|
+
## 5.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @pluv/crdt@5.0.1
|
|
8
|
+
- @pluv/io@5.0.1
|
|
9
|
+
- @pluv/types@5.0.1
|
|
10
|
+
|
|
3
11
|
## 5.0.0
|
|
4
12
|
|
|
5
13
|
### Major Changes
|
|
@@ -1352,9 +1360,7 @@
|
|
|
1352
1360
|
import { createClient } from "@pluv/react";
|
|
1353
1361
|
import type { io } from "../backend/io";
|
|
1354
1362
|
|
|
1355
|
-
const client = createClient<typeof io>({
|
|
1356
|
-
/* ... */
|
|
1357
|
-
});
|
|
1363
|
+
const client = createClient<typeof io>({/* ... */});
|
|
1358
1364
|
```
|
|
1359
1365
|
|
|
1360
1366
|
### Now:
|
|
@@ -1396,9 +1402,7 @@
|
|
|
1396
1402
|
import type { ioServer } from "../backend/io";
|
|
1397
1403
|
|
|
1398
1404
|
// This users the PluvServer type now
|
|
1399
|
-
const client = createClient<typeof ioServer>({
|
|
1400
|
-
/* ... */
|
|
1401
|
-
});
|
|
1405
|
+
const client = createClient<typeof ioServer>({/* ... */});
|
|
1402
1406
|
```
|
|
1403
1407
|
|
|
1404
1408
|
- `PluvRouter` instances can also be merged via the `mergeRouters` method, which effectively performs an `Object.assign` of the events object and returns a new `PluvRouter` with the correct types:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/platform-node",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "@pluv/io adapter for node.js",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "david@pluv.io",
|
|
@@ -20,20 +20,20 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@
|
|
23
|
+
"@pluv/crdt": "^5.0.1",
|
|
24
|
+
"@pluv/io": "^5.0.1",
|
|
25
|
+
"@pluv/types": "^5.0.1",
|
|
26
|
+
"@types/node": "^26.2.0",
|
|
24
27
|
"@types/ws": "^8.18.1",
|
|
25
|
-
"path-to-regexp": "^8.4.2"
|
|
26
|
-
"@pluv/crdt": "^5.0.0",
|
|
27
|
-
"@pluv/io": "^5.0.0",
|
|
28
|
-
"@pluv/types": "^5.0.0"
|
|
28
|
+
"path-to-regexp": "^8.4.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"
|
|
32
|
-
"
|
|
31
|
+
"@pluv/tsconfig": "^5.0.1",
|
|
32
|
+
"eslint": "^10.9.0",
|
|
33
|
+
"eslint-config-pluv": "^5.0.1",
|
|
34
|
+
"tsdown": "0.22.14",
|
|
33
35
|
"typescript": "^5.9.3",
|
|
34
|
-
"ws": "^8.21.
|
|
35
|
-
"@pluv/tsconfig": "^5.0.0",
|
|
36
|
-
"eslint-config-pluv": "^5.0.0"
|
|
36
|
+
"ws": "^8.21.3"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"ws": "^8.0.0"
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
$ tsdown
|
|
2
|
-
[34mℹ[39m [34mtsdown v0.22.3[39m powered by [38;2;255;126;23mrolldown v1.1.2[39m
|
|
3
|
-
[34mℹ[39m config file: [4m/home/runner/work/pluv/pluv/packages/platform-node/tsdown.config.ts[24m
|
|
4
|
-
[34mℹ[39m entry: [34msrc/index.ts[39m
|
|
5
|
-
[34mℹ[39m target: [34mesnext[39m
|
|
6
|
-
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
7
|
-
[34mℹ[39m Build start
|
|
8
|
-
[34mℹ[39m [2mdist/[22m[1mindex.mjs[22m [2m 5.68 kB[22m [2m│ gzip: 1.94 kB[22m
|
|
9
|
-
[34mℹ[39m [2mdist/[22mindex.mjs.map [2m17.59 kB[22m [2m│ gzip: 4.72 kB[22m
|
|
10
|
-
[34mℹ[39m [2mdist/[22mindex.d.mts.map [2m 2.99 kB[22m [2m│ gzip: 1.03 kB[22m
|
|
11
|
-
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m 5.91 kB[22m [2m│ gzip: 1.59 kB[22m
|
|
12
|
-
[34mℹ[39m 4 files, total: 32.18 kB
|
|
13
|
-
[33m[PLUGIN_TIMINGS] [0mYour build spent significant time in plugin `rolldown-plugin-dts:generate`. See https://rolldown.rs/reference/InputOptions.checks#plugintimings for more details.
|
|
14
|
-
|
|
15
|
-
[32m✔[39m Build complete in [32m3295ms[39m
|
package/dist/index.d.mts
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { AbstractEventMap, AbstractListener, AbstractPersistence, AbstractPlatform, AbstractPlatformConfig, AbstractPubSub, AbstractWebSocket, AbstractWebSocketConfig, ConvertWebSocketConfig, CreateIOParams, PluvContext, PluvIOAuthorize, WebSocketRegistrationMode, WebSocketSerializedState, WebSocketSession } from "@pluv/io";
|
|
2
|
-
import { WebSocket, WebSocket as WebSocket$1 } from "ws";
|
|
3
|
-
import { BaseUser, IOAuthorize, Id, InferIOAuthorizeUser, Json, JsonObject } from "@pluv/types";
|
|
4
|
-
import { IncomingMessage } from "node:http";
|
|
5
|
-
import { CrdtLibraryType, NoopCrdtDocFactory } from "@pluv/crdt";
|
|
6
|
-
|
|
7
|
-
//#region src/utils/identity.d.ts
|
|
8
|
-
declare const identity: <T extends unknown>(x: T) => T;
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region src/utils/toRequest.d.ts
|
|
11
|
-
type ToRequestOptions = {
|
|
12
|
-
origin?: string;
|
|
13
|
-
};
|
|
14
|
-
declare const toRequest: (request: Request | IncomingMessage, options?: ToRequestOptions) => Request;
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/infer.d.ts
|
|
17
|
-
type InferCallback<TMeta extends Record<string, Json> = {}> = (i: typeof identity) => {
|
|
18
|
-
meta?: (io: TMeta) => TMeta;
|
|
19
|
-
};
|
|
20
|
-
declare const infer: <TMeta extends Record<string, Json> = {}>(callback: InferCallback<TMeta>) => InferCallback<TMeta>;
|
|
21
|
-
//#endregion
|
|
22
|
-
//#region src/NodeWebSocket.d.ts
|
|
23
|
-
type NodeWebSocketConfig = AbstractWebSocketConfig;
|
|
24
|
-
declare class NodeWebSocket<TAuthorize extends IOAuthorize<any, any> | null = null> extends AbstractWebSocket<WebSocket$1> {
|
|
25
|
-
private _sessionId;
|
|
26
|
-
private _state;
|
|
27
|
-
private _user;
|
|
28
|
-
set presence(presence: JsonObject | null);
|
|
29
|
-
get readyState(): 0 | 1 | 2 | 3;
|
|
30
|
-
get session(): WebSocketSession<TAuthorize>;
|
|
31
|
-
get sessionId(): string;
|
|
32
|
-
get state(): WebSocketSerializedState;
|
|
33
|
-
set state(state: WebSocketSerializedState);
|
|
34
|
-
set user(user: InferIOAuthorizeUser<TAuthorize>);
|
|
35
|
-
constructor(webSocket: WebSocket$1, config: NodeWebSocketConfig);
|
|
36
|
-
addEventListener<TType extends keyof AbstractEventMap>(type: TType, handler: AbstractListener<TType>): void;
|
|
37
|
-
close(code?: number | undefined, reason?: string | undefined): void;
|
|
38
|
-
send(message: string | ArrayBuffer | ArrayBufferView): void;
|
|
39
|
-
terminate(): void;
|
|
40
|
-
}
|
|
41
|
-
//#endregion
|
|
42
|
-
//#region src/types.d.ts
|
|
43
|
-
type NodeRegisterInput = {
|
|
44
|
-
request: Request | IncomingMessage;
|
|
45
|
-
};
|
|
46
|
-
type NodeAuthorizeContext = {
|
|
47
|
-
request: Request;
|
|
48
|
-
};
|
|
49
|
-
//#endregion
|
|
50
|
-
//#region src/NodePlatform.d.ts
|
|
51
|
-
type NodePlatformRoomContext<TMeta extends Record<string, Json>> = keyof TMeta extends never ? {
|
|
52
|
-
meta?: undefined;
|
|
53
|
-
} : {
|
|
54
|
-
meta: TMeta;
|
|
55
|
-
};
|
|
56
|
-
type NodePlatformConfig<TMeta extends Record<string, Json>> = {
|
|
57
|
-
mode?: WebSocketRegistrationMode;
|
|
58
|
-
origin?: string;
|
|
59
|
-
} & ({
|
|
60
|
-
persistence?: undefined;
|
|
61
|
-
pubSub?: undefined;
|
|
62
|
-
} | {
|
|
63
|
-
persistence: AbstractPersistence;
|
|
64
|
-
pubSub: AbstractPubSub;
|
|
65
|
-
}) & {
|
|
66
|
-
roomContext?: NodePlatformRoomContext<TMeta>;
|
|
67
|
-
};
|
|
68
|
-
declare class NodePlatform<TAuthorize extends IOAuthorize<any, any> | null = null, TMeta extends Record<string, Json> = {}> extends AbstractPlatform<NodeWebSocket<TAuthorize>, NodeRegisterInput, NodePlatformRoomContext<TMeta>, {
|
|
69
|
-
authorize: {
|
|
70
|
-
secret: true;
|
|
71
|
-
};
|
|
72
|
-
handleMode: "io";
|
|
73
|
-
requireAuth: false;
|
|
74
|
-
registrationMode: WebSocketRegistrationMode;
|
|
75
|
-
listeners: {
|
|
76
|
-
onRoomDestroyed: true;
|
|
77
|
-
onRoomMessage: true;
|
|
78
|
-
onStorageDestroyed: true;
|
|
79
|
-
onStorageUpdated: true;
|
|
80
|
-
onUserConnected: true;
|
|
81
|
-
onUserDisconnected: true;
|
|
82
|
-
};
|
|
83
|
-
router: true;
|
|
84
|
-
}> {
|
|
85
|
-
readonly id: `${string}-${string}-${string}-${string}-${string}`;
|
|
86
|
-
readonly _config: {
|
|
87
|
-
authorize: {
|
|
88
|
-
secret: true;
|
|
89
|
-
};
|
|
90
|
-
handleMode: "io";
|
|
91
|
-
registrationMode: WebSocketRegistrationMode;
|
|
92
|
-
requireAuth: false;
|
|
93
|
-
listeners: {
|
|
94
|
-
onRoomDestroyed: true;
|
|
95
|
-
onRoomMessage: true;
|
|
96
|
-
onStorageDestroyed: true;
|
|
97
|
-
onStorageUpdated: true;
|
|
98
|
-
onUserConnected: true;
|
|
99
|
-
onUserDisconnected: true;
|
|
100
|
-
};
|
|
101
|
-
router: true;
|
|
102
|
-
};
|
|
103
|
-
readonly _name = "platformNode";
|
|
104
|
-
readonly origin: string | undefined;
|
|
105
|
-
constructor(config?: NodePlatformConfig<TMeta>);
|
|
106
|
-
acceptWebSocket(webSocket: NodeWebSocket<TAuthorize>): Promise<void>;
|
|
107
|
-
convertWebSocket(webSocket: WebSocket$1, config: ConvertWebSocketConfig): NodeWebSocket<TAuthorize>;
|
|
108
|
-
getLastPing(webSocket: NodeWebSocket<TAuthorize>): number | null;
|
|
109
|
-
getSerializedState(webSocket: WebSocket$1): WebSocketSerializedState | null;
|
|
110
|
-
getSessionId(webSocket: WebSocket$1): string | null;
|
|
111
|
-
getWebSockets(): readonly WebSocket$1[];
|
|
112
|
-
initialize(config: AbstractPlatformConfig<NodePlatformRoomContext<TMeta>>): this;
|
|
113
|
-
parseData(data: string | ArrayBuffer): Record<string, any>;
|
|
114
|
-
randomUUID(): string;
|
|
115
|
-
setSerializedState(webSocket: NodeWebSocket<TAuthorize>, state: WebSocketSerializedState): WebSocketSerializedState;
|
|
116
|
-
}
|
|
117
|
-
//#endregion
|
|
118
|
-
//#region src/platformNode.d.ts
|
|
119
|
-
type PlatformNodeCreateIOParams<TMeta extends Record<string, Json> = {}, TContext extends Record<string, any> = {}, TUser extends BaseUser | null = null, TCrdt extends CrdtLibraryType<any> = CrdtLibraryType<NoopCrdtDocFactory>> = Id<NodePlatformConfig<TMeta> & Omit<CreateIOParams<NodePlatform<IOAuthorize<TUser, TContext>, TMeta>, TContext, TUser, TCrdt>, "authorize" | "context" | "platform"> & {
|
|
120
|
-
authorize?: PluvIOAuthorize<NodePlatform<IOAuthorize<TUser, TContext>, TMeta>, TUser, NodeAuthorizeContext>;
|
|
121
|
-
context?: PluvContext<NodePlatform<IOAuthorize<TUser, any>, TMeta>, TContext>;
|
|
122
|
-
types?: InferCallback<TMeta>;
|
|
123
|
-
}>;
|
|
124
|
-
declare const platformNode: <TMeta extends Record<string, Json> = {}, TContext extends Record<string, any> = {}, TUser extends BaseUser | null = null, TCrdt extends CrdtLibraryType<any> = CrdtLibraryType<NoopCrdtDocFactory>>(config?: PlatformNodeCreateIOParams<TMeta, TContext, TUser, TCrdt>) => CreateIOParams<NodePlatform<IOAuthorize<TUser, TContext>, TMeta>, TContext, TUser, TCrdt>;
|
|
125
|
-
//#endregion
|
|
126
|
-
export { type InferCallback, type NodeAuthorizeContext, type NodePlatform, type NodePlatformConfig, type NodeRegisterInput, type PlatformNodeCreateIOParams, type ToRequestOptions, type WebSocket, infer, platformNode, toRequest };
|
|
127
|
-
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/utils/identity.ts","../src/utils/toRequest.ts","../src/infer.ts","../src/NodeWebSocket.ts","../src/types.ts","../src/NodePlatform.ts","../src/platformNode.ts"],"mappings":";;;;;;;cAAa,QAAA,sBAA+B,CAAA,EAAG,CAAA,KAAI,CAAM;;;KCwC7C,gBAAA;EACR,MAAM;AAAA;AAAA,cAGG,SAAA,GACT,OAAA,EAAS,OAAA,GAAU,eAAA,EACnB,OAAA,GAAS,gBAAA,KACV,OAAA;;;KC5CS,aAAA,eAA4B,MAAA,SAAe,IAAA,WAAe,CAAA,SAAU,QAAA;EAC5E,IAAA,IAAQ,EAAA,EAAI,KAAA,KAAU,KAAA;AAAA;AAAA,cAGb,KAAA,iBAAuB,MAAA,SAAe,IAAA,QAAY,QAAA,EAAU,aAAA,CAAc,KAAA,MAAM,aAA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A,CAAY,YAAA,CAAa,WAAA,CAAY,KAAA,QAAa,KAAA,GAAQ,QAAA;EACpE,KAAA,GAAQ,aAAA,CAAc,KAAA;AAAA;AAAA,cAIrB,YAAA,iBACK,MAAA,SAAe,IAAA,yBACZ,MAAA,kCACH,QAAA,8BACA,eAAA,QAAuB,eAAA,CAAgB,kBAAA,GAErD,MAAA,GAAQ,0BAAA,CAA2B,KAAA,EAAO,QAAA,EAAU,KAAA,EAAO,KAAA,MAC5D,cAAA,CAAe,YAAA,CAAa,WAAA,CAAY,KAAA,EAAO,QAAA,GAAW,KAAA,GAAQ,QAAA,EAAU,KAAA,EAAO,KAAA"}
|
package/dist/index.mjs
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import { AbstractPlatform, AbstractWebSocket } from "@pluv/io";
|
|
2
|
-
import crypto from "node:crypto";
|
|
3
|
-
import { TextDecoder } from "node:util";
|
|
4
|
-
import { Readable } from "node:stream";
|
|
5
|
-
//#region src/infer.ts
|
|
6
|
-
const infer = (callback) => callback;
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region src/NodeWebSocket.ts
|
|
9
|
-
var NodeWebSocket = class extends AbstractWebSocket {
|
|
10
|
-
_sessionId = null;
|
|
11
|
-
_state;
|
|
12
|
-
_user = null;
|
|
13
|
-
set presence(presence) {
|
|
14
|
-
this._state.presence = presence;
|
|
15
|
-
}
|
|
16
|
-
get readyState() {
|
|
17
|
-
return this.webSocket.readyState;
|
|
18
|
-
}
|
|
19
|
-
get session() {
|
|
20
|
-
const sessionId = this.sessionId;
|
|
21
|
-
const state = this._state;
|
|
22
|
-
const user = this._user;
|
|
23
|
-
return {
|
|
24
|
-
...state,
|
|
25
|
-
id: sessionId,
|
|
26
|
-
user,
|
|
27
|
-
webSocket: this
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
get sessionId() {
|
|
31
|
-
if (this._sessionId) return this._sessionId;
|
|
32
|
-
const sessionId = this._sessionId ?? `p_${crypto.randomUUID()}`;
|
|
33
|
-
this._sessionId = sessionId;
|
|
34
|
-
return sessionId;
|
|
35
|
-
}
|
|
36
|
-
get state() {
|
|
37
|
-
return this._state;
|
|
38
|
-
}
|
|
39
|
-
set state(state) {
|
|
40
|
-
this._state = state;
|
|
41
|
-
}
|
|
42
|
-
set user(user) {
|
|
43
|
-
this._user = user;
|
|
44
|
-
}
|
|
45
|
-
constructor(webSocket, config) {
|
|
46
|
-
const { room } = config;
|
|
47
|
-
super(webSocket, config);
|
|
48
|
-
this._state = {
|
|
49
|
-
presence: null,
|
|
50
|
-
quit: false,
|
|
51
|
-
room,
|
|
52
|
-
timers: {
|
|
53
|
-
ping: (/* @__PURE__ */ new Date()).getTime(),
|
|
54
|
-
presence: null
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
addEventListener(type, handler) {
|
|
59
|
-
switch (type) {
|
|
60
|
-
case "close":
|
|
61
|
-
this.webSocket.on("close", async (code, buffer) => {
|
|
62
|
-
const reason = buffer.toString("utf-8");
|
|
63
|
-
await Promise.resolve(handler({
|
|
64
|
-
code,
|
|
65
|
-
reason
|
|
66
|
-
}));
|
|
67
|
-
});
|
|
68
|
-
return;
|
|
69
|
-
case "error":
|
|
70
|
-
this.webSocket.on("error", async (error) => {
|
|
71
|
-
const message = error.message;
|
|
72
|
-
await Promise.resolve(handler({
|
|
73
|
-
error,
|
|
74
|
-
message
|
|
75
|
-
}));
|
|
76
|
-
});
|
|
77
|
-
return;
|
|
78
|
-
case "message":
|
|
79
|
-
this.webSocket.on("message", async (data) => {
|
|
80
|
-
await Promise.resolve(handler({ data }));
|
|
81
|
-
});
|
|
82
|
-
return;
|
|
83
|
-
default:
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
close(code, reason) {
|
|
87
|
-
if (![this.CONNECTING, this.OPEN].some((readyState) => readyState === this.readyState)) return;
|
|
88
|
-
this.webSocket.close(code, reason);
|
|
89
|
-
}
|
|
90
|
-
send(message) {
|
|
91
|
-
if (this.readyState !== this.OPEN) return;
|
|
92
|
-
this.webSocket.send(message, (error) => {
|
|
93
|
-
if (error) throw error;
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
terminate() {
|
|
97
|
-
this.webSocket.terminate();
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
//#endregion
|
|
101
|
-
//#region src/NodePlatform.ts
|
|
102
|
-
var NodePlatform = class NodePlatform extends AbstractPlatform {
|
|
103
|
-
id = crypto.randomUUID();
|
|
104
|
-
_config;
|
|
105
|
-
_name = "platformNode";
|
|
106
|
-
origin;
|
|
107
|
-
constructor(config = {}) {
|
|
108
|
-
const { origin, roomContext, mode = "attached", persistence, pubSub } = config;
|
|
109
|
-
super({
|
|
110
|
-
roomContext,
|
|
111
|
-
...persistence && pubSub ? {
|
|
112
|
-
persistence,
|
|
113
|
-
pubSub
|
|
114
|
-
} : {}
|
|
115
|
-
});
|
|
116
|
-
this.origin = origin;
|
|
117
|
-
this._config = {
|
|
118
|
-
authorize: { secret: true },
|
|
119
|
-
handleMode: "io",
|
|
120
|
-
registrationMode: mode,
|
|
121
|
-
requireAuth: false,
|
|
122
|
-
listeners: {
|
|
123
|
-
onRoomDestroyed: true,
|
|
124
|
-
onRoomMessage: true,
|
|
125
|
-
onStorageDestroyed: true,
|
|
126
|
-
onStorageUpdated: true,
|
|
127
|
-
onUserConnected: true,
|
|
128
|
-
onUserDisconnected: true
|
|
129
|
-
},
|
|
130
|
-
router: true
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
acceptWebSocket(webSocket) {
|
|
134
|
-
return Promise.resolve(void 0);
|
|
135
|
-
}
|
|
136
|
-
convertWebSocket(webSocket, config) {
|
|
137
|
-
const { room } = config;
|
|
138
|
-
return new NodeWebSocket(webSocket, {
|
|
139
|
-
persistence: this.persistence,
|
|
140
|
-
platform: this,
|
|
141
|
-
room
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
getLastPing(webSocket) {
|
|
145
|
-
return null;
|
|
146
|
-
}
|
|
147
|
-
getSerializedState(webSocket) {
|
|
148
|
-
return null;
|
|
149
|
-
}
|
|
150
|
-
getSessionId(webSocket) {
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
getWebSockets() {
|
|
154
|
-
return [];
|
|
155
|
-
}
|
|
156
|
-
initialize(config) {
|
|
157
|
-
return new NodePlatform({
|
|
158
|
-
mode: this._config.registrationMode,
|
|
159
|
-
origin: this.origin,
|
|
160
|
-
persistence: this.persistence.initialize(config.roomContext),
|
|
161
|
-
pubSub: this.pubSub,
|
|
162
|
-
roomContext: config.roomContext
|
|
163
|
-
})._initialize();
|
|
164
|
-
}
|
|
165
|
-
parseData(data) {
|
|
166
|
-
if (typeof data === "string") return JSON.parse(data);
|
|
167
|
-
const decoder = new TextDecoder("utf8");
|
|
168
|
-
return JSON.parse(decoder.decode(data));
|
|
169
|
-
}
|
|
170
|
-
randomUUID() {
|
|
171
|
-
return crypto.randomUUID();
|
|
172
|
-
}
|
|
173
|
-
setSerializedState(webSocket, state) {
|
|
174
|
-
webSocket.state = state;
|
|
175
|
-
return webSocket.state;
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
//#endregion
|
|
179
|
-
//#region src/utils/toRequest.ts
|
|
180
|
-
const getHeader = (incoming, name) => {
|
|
181
|
-
const value = incoming.headers[name];
|
|
182
|
-
if (Array.isArray(value)) return value[0];
|
|
183
|
-
return value;
|
|
184
|
-
};
|
|
185
|
-
const inferOrigin = (incoming) => {
|
|
186
|
-
const host = getHeader(incoming, "x-forwarded-host") ?? getHeader(incoming, "host") ?? "localhost";
|
|
187
|
-
return `${getHeader(incoming, "x-forwarded-proto") ?? (incoming.socket.encrypted ? "https" : "http")}://${host}`;
|
|
188
|
-
};
|
|
189
|
-
const toHeaders = (incoming) => {
|
|
190
|
-
const headers = new Headers();
|
|
191
|
-
for (const [key, value] of Object.entries(incoming.headers)) {
|
|
192
|
-
if (value == null) continue;
|
|
193
|
-
if (Array.isArray(value)) {
|
|
194
|
-
for (const item of value) headers.append(key, item);
|
|
195
|
-
continue;
|
|
196
|
-
}
|
|
197
|
-
headers.append(key, value);
|
|
198
|
-
}
|
|
199
|
-
return headers;
|
|
200
|
-
};
|
|
201
|
-
const toRequest = (request, options = {}) => {
|
|
202
|
-
if (request instanceof Request) return request;
|
|
203
|
-
const origin = options.origin ?? inferOrigin(request);
|
|
204
|
-
const url = new URL(request.url ?? "/", origin);
|
|
205
|
-
const method = request.method ?? "GET";
|
|
206
|
-
const headers = toHeaders(request);
|
|
207
|
-
if (method === "GET" || method === "HEAD") return new Request(url, {
|
|
208
|
-
headers,
|
|
209
|
-
method
|
|
210
|
-
});
|
|
211
|
-
return new Request(url, {
|
|
212
|
-
body: Readable.toWeb(request),
|
|
213
|
-
duplex: "half",
|
|
214
|
-
headers,
|
|
215
|
-
method
|
|
216
|
-
});
|
|
217
|
-
};
|
|
218
|
-
//#endregion
|
|
219
|
-
//#region src/platformNode.ts
|
|
220
|
-
const platformNode = (config = {}) => {
|
|
221
|
-
const { authorize, context, crdt, debug, limits, origin } = config;
|
|
222
|
-
return {
|
|
223
|
-
authorize: typeof authorize === "function" ? (input) => authorize({ request: toRequest(input.request, { origin }) }) : authorize,
|
|
224
|
-
context,
|
|
225
|
-
crdt,
|
|
226
|
-
debug,
|
|
227
|
-
limits,
|
|
228
|
-
platform: () => new NodePlatform(config)
|
|
229
|
-
};
|
|
230
|
-
};
|
|
231
|
-
//#endregion
|
|
232
|
-
export { infer, platformNode, toRequest };
|
|
233
|
-
|
|
234
|
-
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/infer.ts","../src/NodeWebSocket.ts","../src/NodePlatform.ts","../src/utils/toRequest.ts","../src/platformNode.ts"],"sourcesContent":["import type { Json } from \"@pluv/types\";\nimport type { identity } from \"./utils\";\n\nexport type InferCallback<TMeta extends Record<string, Json> = {}> = (i: typeof identity) => {\n meta?: (io: TMeta) => TMeta;\n};\n\nexport const infer = <TMeta extends Record<string, Json> = {}>(callback: InferCallback<TMeta>) =>\n callback;\n","import type {\n AbstractCloseEvent,\n AbstractErrorEvent,\n AbstractEventMap,\n AbstractListener,\n AbstractMessageEvent,\n AbstractWebSocketConfig,\n WebSocketSerializedState,\n WebSocketSession,\n} from \"@pluv/io\";\nimport { AbstractWebSocket } from \"@pluv/io\";\nimport type { InferIOAuthorizeUser, IOAuthorize, JsonObject } from \"@pluv/types\";\nimport crypto from \"node:crypto\";\nimport type { WebSocket } from \"ws\";\n\nexport interface NodeWebSocketEventMap {\n close: AbstractCloseEvent;\n message: AbstractMessageEvent;\n error: AbstractErrorEvent;\n}\n\nexport type NodeWebSocketConfig = AbstractWebSocketConfig;\n\nexport class NodeWebSocket<\n TAuthorize extends IOAuthorize<any, any> | null = null,\n> extends AbstractWebSocket<WebSocket> {\n private _sessionId: string | null = null;\n private _state: WebSocketSerializedState;\n private _user: InferIOAuthorizeUser<TAuthorize> = null as InferIOAuthorizeUser<TAuthorize>;\n\n public set presence(presence: JsonObject | null) {\n this._state.presence = presence;\n }\n\n public get readyState(): 0 | 1 | 2 | 3 {\n return this.webSocket.readyState;\n }\n\n public get session(): WebSocketSession<TAuthorize> {\n const sessionId = this.sessionId;\n const state = this._state;\n const user = this._user;\n\n return {\n ...state,\n id: sessionId,\n user,\n webSocket: this,\n };\n }\n\n public get sessionId(): string {\n if (this._sessionId) return this._sessionId;\n\n const sessionId = this._sessionId ?? `p_${crypto.randomUUID()}`;\n\n this._sessionId = sessionId;\n\n return sessionId;\n }\n\n public get state(): WebSocketSerializedState {\n return this._state;\n }\n\n public set state(state: WebSocketSerializedState) {\n this._state = state;\n }\n\n public set user(user: InferIOAuthorizeUser<TAuthorize>) {\n this._user = user;\n }\n\n constructor(webSocket: WebSocket, config: NodeWebSocketConfig) {\n const { room } = config;\n\n super(webSocket, config);\n\n this._state = {\n presence: null,\n quit: false,\n room,\n timers: {\n ping: new Date().getTime(),\n presence: null,\n },\n };\n }\n\n public addEventListener<TType extends keyof AbstractEventMap>(\n type: TType,\n handler: AbstractListener<TType>,\n ): void {\n switch (type) {\n case \"close\":\n this.webSocket.on(\"close\", async (code, buffer) => {\n const reason = buffer.toString(\"utf-8\");\n\n await Promise.resolve((handler as AbstractListener<\"close\">)({ code, reason }));\n });\n\n return;\n case \"error\":\n this.webSocket.on(\"error\", async (error) => {\n const message = error.message;\n\n await Promise.resolve(\n (handler as AbstractListener<\"error\">)({ error, message }),\n );\n });\n\n return;\n case \"message\":\n this.webSocket.on(\"message\", async (data) => {\n await Promise.resolve((handler as AbstractListener<\"message\">)({ data }));\n });\n\n return;\n default:\n }\n }\n\n public close(code?: number | undefined, reason?: string | undefined): void {\n const canClose = [this.CONNECTING, this.OPEN].some(\n (readyState) => readyState === this.readyState,\n );\n\n if (!canClose) return;\n\n this.webSocket.close(code, reason);\n }\n\n public send(message: string | ArrayBuffer | ArrayBufferView): void {\n if (this.readyState !== this.OPEN) return;\n\n this.webSocket.send(message, (error) => {\n if (error) throw error;\n });\n }\n\n public terminate(): void {\n this.webSocket.terminate();\n }\n}\n","import type {\n AbstractPersistence,\n AbstractPlatformConfig,\n AbstractPubSub,\n ConvertWebSocketConfig,\n WebSocketRegistrationMode,\n WebSocketSerializedState,\n} from \"@pluv/io\";\nimport { AbstractPlatform } from \"@pluv/io\";\nimport type { IOAuthorize, Json } from \"@pluv/types\";\nimport crypto from \"node:crypto\";\nimport { TextDecoder } from \"node:util\";\nimport type { WebSocket } from \"ws\";\nimport { NodeWebSocket } from \"./NodeWebSocket\";\nimport type { NodeRegisterInput } from \"./types\";\n\nexport type NodePlatformRoomContext<TMeta extends Record<string, Json>> = keyof TMeta extends never\n ? { meta?: undefined }\n : { meta: TMeta };\n\nexport type NodePlatformConfig<TMeta extends Record<string, Json>> = {\n mode?: WebSocketRegistrationMode;\n origin?: string;\n} & (\n | { persistence?: undefined; pubSub?: undefined }\n | { persistence: AbstractPersistence; pubSub: AbstractPubSub }\n) & { roomContext?: NodePlatformRoomContext<TMeta> };\n\nexport class NodePlatform<\n TAuthorize extends IOAuthorize<any, any> | null = null,\n TMeta extends Record<string, Json> = {},\n> extends AbstractPlatform<\n NodeWebSocket<TAuthorize>,\n NodeRegisterInput,\n NodePlatformRoomContext<TMeta>,\n {\n authorize: {\n secret: true;\n };\n handleMode: \"io\";\n requireAuth: false;\n registrationMode: WebSocketRegistrationMode;\n listeners: {\n onRoomDestroyed: true;\n onRoomMessage: true;\n onStorageDestroyed: true;\n onStorageUpdated: true;\n onUserConnected: true;\n onUserDisconnected: true;\n };\n router: true;\n }\n> {\n public readonly id = crypto.randomUUID();\n public readonly _config;\n public readonly _name = \"platformNode\";\n public readonly origin: string | undefined;\n\n constructor(config: NodePlatformConfig<TMeta> = {}) {\n const { origin, roomContext, mode = \"attached\", persistence, pubSub } = config;\n\n super({\n roomContext,\n ...(persistence && pubSub ? { persistence, pubSub } : {}),\n });\n\n this.origin = origin;\n\n this._config = {\n authorize: {\n secret: true as const,\n },\n handleMode: \"io\" as const,\n registrationMode: mode,\n requireAuth: false as const,\n listeners: {\n onRoomDestroyed: true as const,\n onRoomMessage: true as const,\n onStorageDestroyed: true as const,\n onStorageUpdated: true as const,\n onUserConnected: true as const,\n onUserDisconnected: true as const,\n },\n router: true as const,\n };\n }\n\n public acceptWebSocket(webSocket: NodeWebSocket<TAuthorize>): Promise<void> {\n return Promise.resolve(undefined);\n }\n\n public convertWebSocket(\n webSocket: WebSocket,\n config: ConvertWebSocketConfig,\n ): NodeWebSocket<TAuthorize> {\n const { room } = config;\n\n return new NodeWebSocket<TAuthorize>(webSocket, {\n persistence: this.persistence,\n platform: this,\n room,\n });\n }\n\n public getLastPing(webSocket: NodeWebSocket<TAuthorize>): number | null {\n return null;\n }\n\n public getSerializedState(webSocket: WebSocket): WebSocketSerializedState | null {\n return null;\n }\n\n public getSessionId(webSocket: WebSocket): string | null {\n return null;\n }\n\n public getWebSockets(): readonly WebSocket[] {\n return [];\n }\n\n public initialize(config: AbstractPlatformConfig<NodePlatformRoomContext<TMeta>>): this {\n return new NodePlatform({\n mode: this._config.registrationMode,\n origin: this.origin,\n persistence: this.persistence.initialize(config.roomContext),\n pubSub: this.pubSub,\n roomContext: config.roomContext,\n } as NodePlatformConfig<TMeta>)._initialize() as this;\n }\n\n public parseData(data: string | ArrayBuffer): Record<string, any> {\n if (typeof data === \"string\") return JSON.parse(data);\n\n const decoder = new TextDecoder(\"utf8\");\n\n return JSON.parse(decoder.decode(data));\n }\n\n public randomUUID(): string {\n return crypto.randomUUID();\n }\n\n public setSerializedState(\n webSocket: NodeWebSocket<TAuthorize>,\n state: WebSocketSerializedState,\n ): WebSocketSerializedState {\n webSocket.state = state;\n\n return webSocket.state;\n }\n}\n","import type { IncomingMessage } from \"node:http\";\nimport { Readable } from \"node:stream\";\n\nconst getHeader = (incoming: IncomingMessage, name: string): string | undefined => {\n const value = incoming.headers[name];\n\n if (Array.isArray(value)) return value[0];\n\n return value;\n};\n\nconst inferOrigin = (incoming: IncomingMessage): string => {\n const host =\n getHeader(incoming, \"x-forwarded-host\") ?? getHeader(incoming, \"host\") ?? \"localhost\";\n const forwardedProto = getHeader(incoming, \"x-forwarded-proto\");\n const protocol =\n forwardedProto ??\n ((incoming.socket as { encrypted?: boolean }).encrypted ? \"https\" : \"http\");\n\n return `${protocol}://${host}`;\n};\n\nconst toHeaders = (incoming: IncomingMessage): Headers => {\n const headers = new Headers();\n\n for (const [key, value] of Object.entries(incoming.headers)) {\n if (value == null) continue;\n\n if (Array.isArray(value)) {\n for (const item of value) headers.append(key, item);\n\n continue;\n }\n\n headers.append(key, value);\n }\n\n return headers;\n};\n\nexport type ToRequestOptions = {\n origin?: string;\n};\n\nexport const toRequest = (\n request: Request | IncomingMessage,\n options: ToRequestOptions = {},\n): Request => {\n if (request instanceof Request) return request;\n\n const origin = options.origin ?? inferOrigin(request);\n const url = new URL(request.url ?? \"/\", origin);\n const method = request.method ?? \"GET\";\n const headers = toHeaders(request);\n\n if (method === \"GET\" || method === \"HEAD\") {\n return new Request(url, {\n headers,\n method,\n });\n }\n\n return new Request(url, {\n body: Readable.toWeb(request) as ReadableStream,\n duplex: \"half\",\n headers,\n method,\n });\n};\n","import type { CrdtLibraryType, NoopCrdtDocFactory } from \"@pluv/crdt\";\nimport type { CreateIOParams, PluvContext, PluvIOAuthorize } from \"@pluv/io\";\nimport type { BaseUser, Id, IOAuthorize, Json } from \"@pluv/types\";\nimport type { IncomingMessage } from \"node:http\";\nimport type { NodePlatformConfig } from \"./NodePlatform\";\nimport { NodePlatform } from \"./NodePlatform\";\nimport type { InferCallback } from \"./infer\";\nimport type { NodeAuthorizeContext } from \"./types\";\nimport { toRequest } from \"./utils/toRequest\";\n\nexport type PlatformNodeCreateIOParams<\n TMeta extends Record<string, Json> = {},\n TContext extends Record<string, any> = {},\n TUser extends BaseUser | null = null,\n TCrdt extends CrdtLibraryType<any> = CrdtLibraryType<NoopCrdtDocFactory>,\n> = Id<\n NodePlatformConfig<TMeta> &\n Omit<\n CreateIOParams<\n NodePlatform<IOAuthorize<TUser, TContext>, TMeta>,\n TContext,\n TUser,\n TCrdt\n >,\n \"authorize\" | \"context\" | \"platform\"\n > & {\n authorize?: PluvIOAuthorize<\n NodePlatform<IOAuthorize<TUser, TContext>, TMeta>,\n TUser,\n NodeAuthorizeContext\n >;\n context?: PluvContext<NodePlatform<IOAuthorize<TUser, any>, TMeta>, TContext>;\n types?: InferCallback<TMeta>;\n }\n>;\n\nexport const platformNode = <\n TMeta extends Record<string, Json> = {},\n TContext extends Record<string, any> = {},\n TUser extends BaseUser | null = null,\n TCrdt extends CrdtLibraryType<any> = CrdtLibraryType<NoopCrdtDocFactory>,\n>(\n config: PlatformNodeCreateIOParams<TMeta, TContext, TUser, TCrdt> = {},\n): CreateIOParams<NodePlatform<IOAuthorize<TUser, TContext>, TMeta>, TContext, TUser, TCrdt> => {\n const { authorize, context, crdt, debug, limits, origin } = config;\n\n const resolvedAuthorize =\n typeof authorize === \"function\"\n ? (input: { request: Request | IncomingMessage }) =>\n authorize({ request: toRequest(input.request, { origin }) })\n : authorize;\n\n return {\n authorize: resolvedAuthorize,\n context,\n crdt,\n debug,\n limits,\n platform: () => new NodePlatform<IOAuthorize<TUser, TContext>, TMeta>(config),\n };\n};\n"],"mappings":";;;;;AAOA,MAAa,SAAkD,aAC3D;;;ACeJ,IAAa,gBAAb,cAEU,kBAA6B;CACnC,aAAoC;CACpC;CACA,QAAkD;CAElD,IAAW,SAAS,UAA6B;EAC7C,KAAK,OAAO,WAAW;CAC3B;CAEA,IAAW,aAA4B;EACnC,OAAO,KAAK,UAAU;CAC1B;CAEA,IAAW,UAAwC;EAC/C,MAAM,YAAY,KAAK;EACvB,MAAM,QAAQ,KAAK;EACnB,MAAM,OAAO,KAAK;EAElB,OAAO;GACH,GAAG;GACH,IAAI;GACJ;GACA,WAAW;EACf;CACJ;CAEA,IAAW,YAAoB;EAC3B,IAAI,KAAK,YAAY,OAAO,KAAK;EAEjC,MAAM,YAAY,KAAK,cAAc,KAAK,OAAO,WAAW;EAE5D,KAAK,aAAa;EAElB,OAAO;CACX;CAEA,IAAW,QAAkC;EACzC,OAAO,KAAK;CAChB;CAEA,IAAW,MAAM,OAAiC;EAC9C,KAAK,SAAS;CAClB;CAEA,IAAW,KAAK,MAAwC;EACpD,KAAK,QAAQ;CACjB;CAEA,YAAY,WAAsB,QAA6B;EAC3D,MAAM,EAAE,SAAS;EAEjB,MAAM,WAAW,MAAM;EAEvB,KAAK,SAAS;GACV,UAAU;GACV,MAAM;GACN;GACA,QAAQ;IACJ,uBAAM,IAAI,KAAK,EAAA,CAAE,QAAQ;IACzB,UAAU;GACd;EACJ;CACJ;CAEA,iBACI,MACA,SACI;EACJ,QAAQ,MAAR;GACI,KAAK;IACD,KAAK,UAAU,GAAG,SAAS,OAAO,MAAM,WAAW;KAC/C,MAAM,SAAS,OAAO,SAAS,OAAO;KAEtC,MAAM,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