@pluv/platform-node 5.0.1 → 5.0.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/dist/index.d.mts +126 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +233 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +9 -6
- package/CHANGELOG.md +0 -1893
- package/eslint.config.mjs +0 -4
- package/src/NodePlatform.ts +0 -151
- package/src/NodeWebSocket.ts +0 -144
- package/src/index.ts +0 -9
- package/src/infer.ts +0 -9
- package/src/platformNode.ts +0 -61
- package/src/types.ts +0 -5
- package/src/utils/identity.ts +0 -1
- package/src/utils/index.ts +0 -3
- package/src/utils/toRequest.ts +0 -69
- package/tsconfig.json +0 -8
- package/tsdown.config.ts +0 -14
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
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
|
+
//#region src/utils/identity.d.ts
|
|
7
|
+
declare const identity: <T extends unknown>(x: T) => T;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/utils/toRequest.d.ts
|
|
10
|
+
type ToRequestOptions = {
|
|
11
|
+
origin?: string;
|
|
12
|
+
};
|
|
13
|
+
declare const toRequest: (request: Request | IncomingMessage, options?: ToRequestOptions) => Request;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/infer.d.ts
|
|
16
|
+
type InferCallback<TMeta extends Record<string, Json> = {}> = (i: typeof identity) => {
|
|
17
|
+
meta?: (io: TMeta) => TMeta;
|
|
18
|
+
};
|
|
19
|
+
declare const infer: <TMeta extends Record<string, Json> = {}>(callback: InferCallback<TMeta>) => InferCallback<TMeta>;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/NodeWebSocket.d.ts
|
|
22
|
+
type NodeWebSocketConfig = AbstractWebSocketConfig;
|
|
23
|
+
declare class NodeWebSocket<TAuthorize extends IOAuthorize<any, any> | null = null> extends AbstractWebSocket<WebSocket$1> {
|
|
24
|
+
private _sessionId;
|
|
25
|
+
private _state;
|
|
26
|
+
private _user;
|
|
27
|
+
set presence(presence: JsonObject | null);
|
|
28
|
+
get readyState(): 0 | 1 | 2 | 3;
|
|
29
|
+
get session(): WebSocketSession<TAuthorize>;
|
|
30
|
+
get sessionId(): string;
|
|
31
|
+
get state(): WebSocketSerializedState;
|
|
32
|
+
set state(state: WebSocketSerializedState);
|
|
33
|
+
set user(user: InferIOAuthorizeUser<TAuthorize>);
|
|
34
|
+
constructor(webSocket: WebSocket$1, config: NodeWebSocketConfig);
|
|
35
|
+
addEventListener<TType extends keyof AbstractEventMap>(type: TType, handler: AbstractListener<TType>): void;
|
|
36
|
+
close(code?: number | undefined, reason?: string | undefined): void;
|
|
37
|
+
send(message: string | ArrayBuffer | ArrayBufferView): void;
|
|
38
|
+
terminate(): void;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/types.d.ts
|
|
42
|
+
type NodeRegisterInput = {
|
|
43
|
+
request: Request | IncomingMessage;
|
|
44
|
+
};
|
|
45
|
+
type NodeAuthorizeContext = {
|
|
46
|
+
request: Request;
|
|
47
|
+
};
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/NodePlatform.d.ts
|
|
50
|
+
type NodePlatformRoomContext<TMeta extends Record<string, Json>> = keyof TMeta extends never ? {
|
|
51
|
+
meta?: undefined;
|
|
52
|
+
} : {
|
|
53
|
+
meta: TMeta;
|
|
54
|
+
};
|
|
55
|
+
type NodePlatformConfig<TMeta extends Record<string, Json>> = {
|
|
56
|
+
mode?: WebSocketRegistrationMode;
|
|
57
|
+
origin?: string;
|
|
58
|
+
} & ({
|
|
59
|
+
persistence?: undefined;
|
|
60
|
+
pubSub?: undefined;
|
|
61
|
+
} | {
|
|
62
|
+
persistence: AbstractPersistence;
|
|
63
|
+
pubSub: AbstractPubSub;
|
|
64
|
+
}) & {
|
|
65
|
+
roomContext?: NodePlatformRoomContext<TMeta>;
|
|
66
|
+
};
|
|
67
|
+
declare class NodePlatform<TAuthorize extends IOAuthorize<any, any> | null = null, TMeta extends Record<string, Json> = {}> extends AbstractPlatform<NodeWebSocket<TAuthorize>, NodeRegisterInput, NodePlatformRoomContext<TMeta>, {
|
|
68
|
+
authorize: {
|
|
69
|
+
secret: true;
|
|
70
|
+
};
|
|
71
|
+
handleMode: "io";
|
|
72
|
+
requireAuth: false;
|
|
73
|
+
registrationMode: WebSocketRegistrationMode;
|
|
74
|
+
listeners: {
|
|
75
|
+
onRoomDestroyed: true;
|
|
76
|
+
onRoomMessage: true;
|
|
77
|
+
onStorageDestroyed: true;
|
|
78
|
+
onStorageUpdated: true;
|
|
79
|
+
onUserConnected: true;
|
|
80
|
+
onUserDisconnected: true;
|
|
81
|
+
};
|
|
82
|
+
router: true;
|
|
83
|
+
}> {
|
|
84
|
+
readonly id: `${string}-${string}-${string}-${string}-${string}`;
|
|
85
|
+
readonly _config: {
|
|
86
|
+
authorize: {
|
|
87
|
+
secret: true;
|
|
88
|
+
};
|
|
89
|
+
handleMode: "io";
|
|
90
|
+
registrationMode: WebSocketRegistrationMode;
|
|
91
|
+
requireAuth: false;
|
|
92
|
+
listeners: {
|
|
93
|
+
onRoomDestroyed: true;
|
|
94
|
+
onRoomMessage: true;
|
|
95
|
+
onStorageDestroyed: true;
|
|
96
|
+
onStorageUpdated: true;
|
|
97
|
+
onUserConnected: true;
|
|
98
|
+
onUserDisconnected: true;
|
|
99
|
+
};
|
|
100
|
+
router: true;
|
|
101
|
+
};
|
|
102
|
+
readonly _name = "platformNode";
|
|
103
|
+
readonly origin: string | undefined;
|
|
104
|
+
constructor(config?: NodePlatformConfig<TMeta>);
|
|
105
|
+
acceptWebSocket(webSocket: NodeWebSocket<TAuthorize>): Promise<void>;
|
|
106
|
+
convertWebSocket(webSocket: WebSocket$1, config: ConvertWebSocketConfig): NodeWebSocket<TAuthorize>;
|
|
107
|
+
getLastPing(webSocket: NodeWebSocket<TAuthorize>): number | null;
|
|
108
|
+
getSerializedState(webSocket: WebSocket$1): WebSocketSerializedState | null;
|
|
109
|
+
getSessionId(webSocket: WebSocket$1): string | null;
|
|
110
|
+
getWebSockets(): readonly WebSocket$1[];
|
|
111
|
+
initialize(config: AbstractPlatformConfig<NodePlatformRoomContext<TMeta>>): this;
|
|
112
|
+
parseData(data: string | ArrayBuffer): Record<string, any>;
|
|
113
|
+
randomUUID(): string;
|
|
114
|
+
setSerializedState(webSocket: NodeWebSocket<TAuthorize>, state: WebSocketSerializedState): WebSocketSerializedState;
|
|
115
|
+
}
|
|
116
|
+
//#endregion
|
|
117
|
+
//#region src/platformNode.d.ts
|
|
118
|
+
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"> & {
|
|
119
|
+
authorize?: PluvIOAuthorize<NodePlatform<IOAuthorize<TUser, TContext>, TMeta>, TUser, NodeAuthorizeContext>;
|
|
120
|
+
context?: PluvContext<NodePlatform<IOAuthorize<TUser, any>, TMeta>, TContext>;
|
|
121
|
+
types?: InferCallback<TMeta>;
|
|
122
|
+
}>;
|
|
123
|
+
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>;
|
|
124
|
+
//#endregion
|
|
125
|
+
export { type InferCallback, type NodeAuthorizeContext, type NodePlatform, type NodePlatformConfig, type NodeRegisterInput, type PlatformNodeCreateIOParams, type ToRequestOptions, type WebSocket, infer, platformNode, toRequest };
|
|
126
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
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,WAAY,mBAAmB,GAAG,MAAI;;;KCwCvC;EACR;;cAGS,YACT,SAAS,UAAU,iBACnB,UAAS,qBACV;;;KC5CS,cAAc,cAAc,eAAe,eAAe,UAAU;EAC5E,QAAQ,IAAI,UAAU;;cAGb,QAAS,cAAc,eAAe,YAAY,UAAU,cAAc,WAAM,cAAA;;;KCcjF,sBAAsB;cAErB,cACT,mBAAmB,6CACb,kBAAkB;UAChB;UACA;UACA;MAEG,SAAS,UAAU;MAInB;MAIA,WAAW,iBAAiB;MAa5B;MAUA,SAAS;MAIT,MAAM,OAAO;MAIb,KAAK,MAAM,qBAAqB;EAI/B,YAAA,WAAW,aAAW,QAAQ;EAgBnC,iBAAiB,oBAAoB,kBACxC,MAAM,OACN,SAAS,iBAAiB;EA+BvB,MAAM,2BAA2B;EAUjC,KAAK,kBAAkB,cAAc;EAQrC;;;;KC1IC;EAAsB,SAAS,UAAU;;KAEzC;EAAyB,SAAS;;;;KCYlC,wBAAwB,cAAc,eAAe,eAAe;EACxE;;EACA,MAAM;;KAEF,mBAAmB,cAAc,eAAe;EACxD,OAAO;EACP;;EAEI;EAAyB;;EACzB,aAAa;EAAqB,QAAQ;;EAC5C,cAAc,wBAAwB;;cAE/B,aACT,mBAAmB,qCACnB,cAAc,eAAe,oBACvB,iBACN,cAAc,aACd,mBACA,wBAAwB;EAEpB;IACI;;EAEJ;EACA;EACA,kBAAkB;EAClB;IACI;IACA;IACA;IACA;IACA;IACA;;EAEJ;;WAGY;WACA;;;;;;;;;;;;;;;;;WACA;WACA;EAEJ,YAAA,SAAQ,mBAAmB;EA6BhC,gBAAgB,WAAW,cAAc,cAAc;EAIvD,iBACH,WAAW,aACX,QAAQ,yBACT,cAAc;EAUV,YAAY,WAAW,cAAc;EAIrC,mBAAmB,WAAW,cAAY;EAI1C,aAAa,WAAW;EAIxB,0BAA0B;EAI1B,WAAW,QAAQ,uBAAuB,wBAAwB;EAUlE,UAAU,eAAe,cAAc;EAQvC;EAIA,mBACH,WAAW,cAAc,aACzB,OAAO,2BACR;;;;KCvIK,2BACR,cAAc,eAAe,YAC7B,iBAAiB,0BACjB,cAAc,wBACd,cAAc,uBAAuB,gBAAgB,uBACrD,GACA,mBAAmB,SACf,KACI,eACI,aAAa,YAAY,OAAO,WAAW,QAC3C,UACA,OACA;EAIJ,YAAY,gBACR,aAAa,YAAY,OAAO,WAAW,QAC3C,OACA;EAEJ,UAAU,YAAY,aAAa,YAAY,aAAa,QAAQ;EACpE,QAAQ,cAAc;;cAIrB,eACT,cAAc,eAAe,YAC7B,iBAAiB,0BACjB,cAAc,wBACd,cAAc,uBAAuB,gBAAgB,qBAErD,SAAQ,2BAA2B,OAAO,UAAU,OAAO,WAC5D,eAAe,aAAa,YAAY,OAAO,WAAW,QAAQ,UAAU,OAAO"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,233 @@
|
|
|
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
|
+
}
|
|
84
|
+
}
|
|
85
|
+
close(code, reason) {
|
|
86
|
+
if (![this.CONNECTING, this.OPEN].some((readyState) => readyState === this.readyState)) return;
|
|
87
|
+
this.webSocket.close(code, reason);
|
|
88
|
+
}
|
|
89
|
+
send(message) {
|
|
90
|
+
if (this.readyState !== this.OPEN) return;
|
|
91
|
+
this.webSocket.send(message, (error) => {
|
|
92
|
+
if (error) throw error;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
terminate() {
|
|
96
|
+
this.webSocket.terminate();
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/NodePlatform.ts
|
|
101
|
+
var NodePlatform = class NodePlatform extends AbstractPlatform {
|
|
102
|
+
id = crypto.randomUUID();
|
|
103
|
+
_config;
|
|
104
|
+
_name = "platformNode";
|
|
105
|
+
origin;
|
|
106
|
+
constructor(config = {}) {
|
|
107
|
+
const { origin, roomContext, mode = "attached", persistence, pubSub } = config;
|
|
108
|
+
super({
|
|
109
|
+
roomContext,
|
|
110
|
+
...persistence && pubSub ? {
|
|
111
|
+
persistence,
|
|
112
|
+
pubSub
|
|
113
|
+
} : {}
|
|
114
|
+
});
|
|
115
|
+
this.origin = origin;
|
|
116
|
+
this._config = {
|
|
117
|
+
authorize: { secret: true },
|
|
118
|
+
handleMode: "io",
|
|
119
|
+
registrationMode: mode,
|
|
120
|
+
requireAuth: false,
|
|
121
|
+
listeners: {
|
|
122
|
+
onRoomDestroyed: true,
|
|
123
|
+
onRoomMessage: true,
|
|
124
|
+
onStorageDestroyed: true,
|
|
125
|
+
onStorageUpdated: true,
|
|
126
|
+
onUserConnected: true,
|
|
127
|
+
onUserDisconnected: true
|
|
128
|
+
},
|
|
129
|
+
router: true
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
acceptWebSocket(webSocket) {
|
|
133
|
+
return Promise.resolve(void 0);
|
|
134
|
+
}
|
|
135
|
+
convertWebSocket(webSocket, config) {
|
|
136
|
+
const { room } = config;
|
|
137
|
+
return new NodeWebSocket(webSocket, {
|
|
138
|
+
persistence: this.persistence,
|
|
139
|
+
platform: this,
|
|
140
|
+
room
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
getLastPing(webSocket) {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
getSerializedState(webSocket) {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
getSessionId(webSocket) {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
getWebSockets() {
|
|
153
|
+
return [];
|
|
154
|
+
}
|
|
155
|
+
initialize(config) {
|
|
156
|
+
return new NodePlatform({
|
|
157
|
+
mode: this._config.registrationMode,
|
|
158
|
+
origin: this.origin,
|
|
159
|
+
persistence: this.persistence.initialize(config.roomContext),
|
|
160
|
+
pubSub: this.pubSub,
|
|
161
|
+
roomContext: config.roomContext
|
|
162
|
+
})._initialize();
|
|
163
|
+
}
|
|
164
|
+
parseData(data) {
|
|
165
|
+
if (typeof data === "string") return JSON.parse(data);
|
|
166
|
+
const decoder = new TextDecoder("utf8");
|
|
167
|
+
return JSON.parse(decoder.decode(data));
|
|
168
|
+
}
|
|
169
|
+
randomUUID() {
|
|
170
|
+
return crypto.randomUUID();
|
|
171
|
+
}
|
|
172
|
+
setSerializedState(webSocket, state) {
|
|
173
|
+
webSocket.state = state;
|
|
174
|
+
return webSocket.state;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/utils/toRequest.ts
|
|
179
|
+
const getHeader = (incoming, name) => {
|
|
180
|
+
const value = incoming.headers[name];
|
|
181
|
+
if (Array.isArray(value)) return value[0];
|
|
182
|
+
return value;
|
|
183
|
+
};
|
|
184
|
+
const inferOrigin = (incoming) => {
|
|
185
|
+
const host = getHeader(incoming, "x-forwarded-host") ?? getHeader(incoming, "host") ?? "localhost";
|
|
186
|
+
return `${getHeader(incoming, "x-forwarded-proto") ?? (incoming.socket.encrypted ? "https" : "http")}://${host}`;
|
|
187
|
+
};
|
|
188
|
+
const toHeaders = (incoming) => {
|
|
189
|
+
const headers = new Headers();
|
|
190
|
+
for (const [key, value] of Object.entries(incoming.headers)) {
|
|
191
|
+
if (value == null) continue;
|
|
192
|
+
if (Array.isArray(value)) {
|
|
193
|
+
for (const item of value) headers.append(key, item);
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
headers.append(key, value);
|
|
197
|
+
}
|
|
198
|
+
return headers;
|
|
199
|
+
};
|
|
200
|
+
const toRequest = (request, options = {}) => {
|
|
201
|
+
if (request instanceof Request) return request;
|
|
202
|
+
const origin = options.origin ?? inferOrigin(request);
|
|
203
|
+
const url = new URL(request.url ?? "/", origin);
|
|
204
|
+
const method = request.method ?? "GET";
|
|
205
|
+
const headers = toHeaders(request);
|
|
206
|
+
if (method === "GET" || method === "HEAD") return new Request(url, {
|
|
207
|
+
headers,
|
|
208
|
+
method
|
|
209
|
+
});
|
|
210
|
+
return new Request(url, {
|
|
211
|
+
body: Readable.toWeb(request),
|
|
212
|
+
duplex: "half",
|
|
213
|
+
headers,
|
|
214
|
+
method
|
|
215
|
+
});
|
|
216
|
+
};
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region src/platformNode.ts
|
|
219
|
+
const platformNode = (config = {}) => {
|
|
220
|
+
const { authorize, context, crdt, debug, limits, origin } = config;
|
|
221
|
+
return {
|
|
222
|
+
authorize: typeof authorize === "function" ? (input) => authorize({ request: toRequest(input.request, { origin }) }) : authorize,
|
|
223
|
+
context,
|
|
224
|
+
crdt,
|
|
225
|
+
debug,
|
|
226
|
+
limits,
|
|
227
|
+
platform: () => new NodePlatform(config)
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
//#endregion
|
|
231
|
+
export { infer, platformNode, toRequest };
|
|
232
|
+
|
|
233
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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;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SAAS,MAAM,OAAO;EAC5B,QAAQ;EACR;EACA;CACJ,CAAC;AACL;;;AChCA,MAAa,gBAMT,SAAoE,CAAC,MACuB;CAC5F,MAAM,EAAE,WAAW,SAAS,MAAM,OAAO,QAAQ,WAAW;CAQ5D,OAAO;EACH,WANA,OAAO,cAAc,cACd,UACG,UAAU,EAAE,SAAS,UAAU,MAAM,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC,IAC/D;EAIN;EACA;EACA;EACA;EACA,gBAAgB,IAAI,aAAkD,MAAM;CAChF;AACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/platform-node",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"description": "@pluv/io adapter for node.js",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "david@pluv.io",
|
|
@@ -16,21 +16,24 @@
|
|
|
16
16
|
},
|
|
17
17
|
"type": "module",
|
|
18
18
|
"types": "./dist/index.d.mts",
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
19
22
|
"publishConfig": {
|
|
20
23
|
"access": "public"
|
|
21
24
|
},
|
|
22
25
|
"dependencies": {
|
|
23
|
-
"@pluv/crdt": "^5.0.
|
|
24
|
-
"@pluv/io": "^5.0.
|
|
25
|
-
"@pluv/types": "^5.0.
|
|
26
|
+
"@pluv/crdt": "^5.0.2",
|
|
27
|
+
"@pluv/io": "^5.0.2",
|
|
28
|
+
"@pluv/types": "^5.0.2",
|
|
26
29
|
"@types/node": "^26.2.0",
|
|
27
30
|
"@types/ws": "^8.18.1",
|
|
28
31
|
"path-to-regexp": "^8.4.2"
|
|
29
32
|
},
|
|
30
33
|
"devDependencies": {
|
|
31
|
-
"@pluv/tsconfig": "^5.0.
|
|
34
|
+
"@pluv/tsconfig": "^5.0.2",
|
|
32
35
|
"eslint": "^10.9.0",
|
|
33
|
-
"eslint-config-pluv": "^5.0.
|
|
36
|
+
"eslint-config-pluv": "^5.0.2",
|
|
34
37
|
"tsdown": "0.22.14",
|
|
35
38
|
"typescript": "^5.9.3",
|
|
36
39
|
"ws": "^8.21.3"
|