@pluv/platform-pluv 0.33.0 → 0.34.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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +67 -0
- package/dist/index.d.mts +60 -213
- package/dist/index.d.ts +60 -213
- package/dist/index.js +101 -84
- package/dist/index.mjs +96 -79
- package/package.json +9 -9
- package/src/PluvPlatform.ts +197 -5
- package/src/index.ts +8 -4
- package/src/platformPluv.ts +6 -0
- package/src/types.ts +29 -0
- package/src/PluvIO.ts +0 -221
- package/src/createIO.ts +0 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,5 @@
|
|
|
1
|
-
import { AbstractPlatform,
|
|
2
|
-
import * as hono from 'hono';
|
|
3
|
-
import { BaseUser, InputZodLike, IOLike } from '@pluv/types';
|
|
4
|
-
import { z } from 'zod';
|
|
1
|
+
import { AbstractPlatform, JWTEncodeParams, AbstractWebSocket, ConvertWebSocketConfig, WebSocketSerializedState, AbstractPlatformConfig } from '@pluv/io';
|
|
5
2
|
|
|
6
|
-
declare class PluvPlatform extends AbstractPlatform {
|
|
7
|
-
_registrationMode: WebSocketRegistrationMode;
|
|
8
|
-
acceptWebSocket(webSocket: AbstractWebSocket): Promise<void>;
|
|
9
|
-
convertWebSocket(webSocket: any, config: ConvertWebSocketConfig): AbstractWebSocket;
|
|
10
|
-
getLastPing(webSocket: AbstractWebSocket): number | null;
|
|
11
|
-
getSerializedState(webSocket: any): WebSocketSerializedState | null;
|
|
12
|
-
getSessionId(webSocket: any): string | null;
|
|
13
|
-
getWebSockets(): readonly any[];
|
|
14
|
-
initialize(config: AbstractPlatformConfig<{}>): this;
|
|
15
|
-
parseData(data: string | ArrayBuffer): Record<string, any>;
|
|
16
|
-
randomUUID(): string;
|
|
17
|
-
setSerializedState(webSocket: AbstractWebSocket, state: WebSocketSerializedState): void;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface PluvAuthorize<TUser extends BaseUser> {
|
|
21
|
-
required: true;
|
|
22
|
-
secret: string;
|
|
23
|
-
user: InputZodLike<TUser>;
|
|
24
|
-
}
|
|
25
3
|
interface PluvIOEndpoints {
|
|
26
4
|
createToken: string;
|
|
27
5
|
}
|
|
@@ -29,30 +7,18 @@ type RoomDeletedMessageEventData = {
|
|
|
29
7
|
encodedState: string | null;
|
|
30
8
|
room: string;
|
|
31
9
|
};
|
|
32
|
-
type UserConnectedEventData
|
|
10
|
+
type UserConnectedEventData = {
|
|
33
11
|
encodedState: string | null;
|
|
34
12
|
room: string;
|
|
35
|
-
user:
|
|
13
|
+
user: any;
|
|
36
14
|
};
|
|
37
|
-
type UserDisconnectedEventData
|
|
15
|
+
type UserDisconnectedEventData = {
|
|
38
16
|
encodedState: string | null;
|
|
39
17
|
room: string;
|
|
40
|
-
user:
|
|
41
|
-
};
|
|
42
|
-
type PluvIOListeners<TUser extends BaseUser> = {
|
|
43
|
-
getInitialStorage?: GetInitialStorageFn<{}>;
|
|
44
|
-
onRoomDeleted: (event: RoomDeletedMessageEventData) => void;
|
|
45
|
-
onUserConnected: (event: UserConnectedEventData<TUser>) => void;
|
|
46
|
-
onUserDisconnected: (event: UserDisconnectedEventData<TUser>) => void;
|
|
18
|
+
user: any;
|
|
47
19
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
} & {
|
|
51
|
-
[P in keyof PluvIOListeners<TUser>]?: undefined;
|
|
52
|
-
}) | ({
|
|
53
|
-
webhookSecret: string;
|
|
54
|
-
} & Partial<PluvIOListeners<TUser>>);
|
|
55
|
-
type PluvIOConfig<TUser extends BaseUser> = WebhooksConfig<TUser> & {
|
|
20
|
+
|
|
21
|
+
interface PluvPlatformConfig {
|
|
56
22
|
/**
|
|
57
23
|
* @ignore
|
|
58
24
|
* @readonly
|
|
@@ -61,187 +27,68 @@ type PluvIOConfig<TUser extends BaseUser> = WebhooksConfig<TUser> & {
|
|
|
61
27
|
_defs?: {
|
|
62
28
|
endpoints?: PluvIOEndpoints;
|
|
63
29
|
};
|
|
64
|
-
authorize: {
|
|
65
|
-
user: InputZodLike<TUser>;
|
|
66
|
-
};
|
|
67
30
|
basePath: string;
|
|
68
31
|
publicKey: string;
|
|
69
32
|
secretKey: string;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
33
|
+
webhookSecret?: string;
|
|
34
|
+
}
|
|
35
|
+
declare class PluvPlatform extends AbstractPlatform<any, {}, {}, {
|
|
36
|
+
authorize: {
|
|
37
|
+
required: false;
|
|
38
|
+
secret: false;
|
|
39
|
+
};
|
|
40
|
+
handleMode: "fetch";
|
|
41
|
+
registrationMode: "attached";
|
|
42
|
+
requireAuth: true;
|
|
43
|
+
listeners: {
|
|
44
|
+
onRoomDeleted: true;
|
|
45
|
+
onRoomMessage: false;
|
|
46
|
+
onStorageUpdated: false;
|
|
47
|
+
onUserConnected: true;
|
|
48
|
+
onUserDisconnected: true;
|
|
49
|
+
};
|
|
50
|
+
}> {
|
|
51
|
+
readonly _config: {
|
|
52
|
+
authorize: {
|
|
53
|
+
required: false;
|
|
54
|
+
secret: false;
|
|
55
|
+
};
|
|
56
|
+
handleMode: "fetch";
|
|
57
|
+
registrationMode: "attached";
|
|
58
|
+
requireAuth: true;
|
|
59
|
+
listeners: {
|
|
60
|
+
onRoomDeleted: true;
|
|
61
|
+
onRoomMessage: false;
|
|
62
|
+
onStorageUpdated: false;
|
|
63
|
+
onUserConnected: true;
|
|
64
|
+
onUserDisconnected: true;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
readonly _name = "platformPluv";
|
|
68
|
+
private _authorize;
|
|
73
69
|
private readonly _basePath;
|
|
74
70
|
private readonly _endpoints;
|
|
75
|
-
private
|
|
76
|
-
private
|
|
71
|
+
private _getInitialStorage?;
|
|
72
|
+
private _listeners?;
|
|
77
73
|
private readonly _publicKey;
|
|
78
74
|
private readonly _secretKey;
|
|
79
75
|
private readonly _webhookSecret?;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
76
|
+
_createToken: (params: JWTEncodeParams<any, any>) => Promise<string>;
|
|
77
|
+
constructor(params: PluvPlatformConfig);
|
|
78
|
+
acceptWebSocket(webSocket: AbstractWebSocket): Promise<void>;
|
|
79
|
+
convertWebSocket(webSocket: any, config: ConvertWebSocketConfig): AbstractWebSocket;
|
|
80
|
+
getLastPing(webSocket: AbstractWebSocket): number | null;
|
|
81
|
+
getSerializedState(webSocket: any): WebSocketSerializedState | null;
|
|
82
|
+
getSessionId(webSocket: any): string | null;
|
|
83
|
+
getWebSockets(): readonly any[];
|
|
84
|
+
initialize(config: AbstractPlatformConfig<{}>): this;
|
|
85
|
+
parseData(data: string | ArrayBuffer): Record<string, any>;
|
|
86
|
+
randomUUID(): string;
|
|
87
|
+
setSerializedState(webSocket: AbstractWebSocket, state: WebSocketSerializedState): void;
|
|
88
|
+
validateConfig(config: any): void;
|
|
93
89
|
private _webhooks;
|
|
94
|
-
constructor(options: PluvIOConfig<TUser>);
|
|
95
|
-
createToken(params: JWTEncodeParams<TUser, PluvPlatform>): Promise<string>;
|
|
96
90
|
}
|
|
97
91
|
|
|
98
|
-
declare const
|
|
99
|
-
|
|
100
|
-
declare const ZodEvent: z.ZodDiscriminatedUnion<"event", [z.ZodObject<{
|
|
101
|
-
event: z.ZodLiteral<"initial-storage">;
|
|
102
|
-
data: z.ZodObject<{
|
|
103
|
-
room: z.ZodNullable<z.ZodString>;
|
|
104
|
-
}, "strip", z.ZodTypeAny, {
|
|
105
|
-
room: string | null;
|
|
106
|
-
}, {
|
|
107
|
-
room: string | null;
|
|
108
|
-
}>;
|
|
109
|
-
}, "strip", z.ZodTypeAny, {
|
|
110
|
-
event: "initial-storage";
|
|
111
|
-
data: {
|
|
112
|
-
room: string | null;
|
|
113
|
-
};
|
|
114
|
-
}, {
|
|
115
|
-
event: "initial-storage";
|
|
116
|
-
data: {
|
|
117
|
-
room: string | null;
|
|
118
|
-
};
|
|
119
|
-
}>, z.ZodObject<{
|
|
120
|
-
event: z.ZodLiteral<"room-deleted">;
|
|
121
|
-
data: z.ZodObject<{
|
|
122
|
-
room: z.ZodString;
|
|
123
|
-
storage: z.ZodNullable<z.ZodString>;
|
|
124
|
-
}, "strip", z.ZodTypeAny, {
|
|
125
|
-
room: string;
|
|
126
|
-
storage: string | null;
|
|
127
|
-
}, {
|
|
128
|
-
room: string;
|
|
129
|
-
storage: string | null;
|
|
130
|
-
}>;
|
|
131
|
-
}, "strip", z.ZodTypeAny, {
|
|
132
|
-
event: "room-deleted";
|
|
133
|
-
data: {
|
|
134
|
-
room: string;
|
|
135
|
-
storage: string | null;
|
|
136
|
-
};
|
|
137
|
-
}, {
|
|
138
|
-
event: "room-deleted";
|
|
139
|
-
data: {
|
|
140
|
-
room: string;
|
|
141
|
-
storage: string | null;
|
|
142
|
-
};
|
|
143
|
-
}>, z.ZodObject<{
|
|
144
|
-
event: z.ZodLiteral<"user-connected">;
|
|
145
|
-
data: z.ZodObject<{
|
|
146
|
-
room: z.ZodString;
|
|
147
|
-
storage: z.ZodNullable<z.ZodString>;
|
|
148
|
-
user: z.ZodObject<{
|
|
149
|
-
id: z.ZodString;
|
|
150
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
151
|
-
id: z.ZodString;
|
|
152
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
153
|
-
id: z.ZodString;
|
|
154
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
155
|
-
}, "strip", z.ZodTypeAny, {
|
|
156
|
-
room: string;
|
|
157
|
-
storage: string | null;
|
|
158
|
-
user: {
|
|
159
|
-
id: string;
|
|
160
|
-
} & {
|
|
161
|
-
[k: string]: unknown;
|
|
162
|
-
};
|
|
163
|
-
}, {
|
|
164
|
-
room: string;
|
|
165
|
-
storage: string | null;
|
|
166
|
-
user: {
|
|
167
|
-
id: string;
|
|
168
|
-
} & {
|
|
169
|
-
[k: string]: unknown;
|
|
170
|
-
};
|
|
171
|
-
}>;
|
|
172
|
-
}, "strip", z.ZodTypeAny, {
|
|
173
|
-
event: "user-connected";
|
|
174
|
-
data: {
|
|
175
|
-
room: string;
|
|
176
|
-
storage: string | null;
|
|
177
|
-
user: {
|
|
178
|
-
id: string;
|
|
179
|
-
} & {
|
|
180
|
-
[k: string]: unknown;
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
}, {
|
|
184
|
-
event: "user-connected";
|
|
185
|
-
data: {
|
|
186
|
-
room: string;
|
|
187
|
-
storage: string | null;
|
|
188
|
-
user: {
|
|
189
|
-
id: string;
|
|
190
|
-
} & {
|
|
191
|
-
[k: string]: unknown;
|
|
192
|
-
};
|
|
193
|
-
};
|
|
194
|
-
}>, z.ZodObject<{
|
|
195
|
-
event: z.ZodLiteral<"user-disconnected">;
|
|
196
|
-
data: z.ZodObject<{
|
|
197
|
-
room: z.ZodString;
|
|
198
|
-
storage: z.ZodNullable<z.ZodString>;
|
|
199
|
-
user: z.ZodObject<{
|
|
200
|
-
id: z.ZodString;
|
|
201
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
202
|
-
id: z.ZodString;
|
|
203
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
204
|
-
id: z.ZodString;
|
|
205
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
206
|
-
}, "strip", z.ZodTypeAny, {
|
|
207
|
-
room: string;
|
|
208
|
-
storage: string | null;
|
|
209
|
-
user: {
|
|
210
|
-
id: string;
|
|
211
|
-
} & {
|
|
212
|
-
[k: string]: unknown;
|
|
213
|
-
};
|
|
214
|
-
}, {
|
|
215
|
-
room: string;
|
|
216
|
-
storage: string | null;
|
|
217
|
-
user: {
|
|
218
|
-
id: string;
|
|
219
|
-
} & {
|
|
220
|
-
[k: string]: unknown;
|
|
221
|
-
};
|
|
222
|
-
}>;
|
|
223
|
-
}, "strip", z.ZodTypeAny, {
|
|
224
|
-
event: "user-disconnected";
|
|
225
|
-
data: {
|
|
226
|
-
room: string;
|
|
227
|
-
storage: string | null;
|
|
228
|
-
user: {
|
|
229
|
-
id: string;
|
|
230
|
-
} & {
|
|
231
|
-
[k: string]: unknown;
|
|
232
|
-
};
|
|
233
|
-
};
|
|
234
|
-
}, {
|
|
235
|
-
event: "user-disconnected";
|
|
236
|
-
data: {
|
|
237
|
-
room: string;
|
|
238
|
-
storage: string | null;
|
|
239
|
-
user: {
|
|
240
|
-
id: string;
|
|
241
|
-
} & {
|
|
242
|
-
[k: string]: unknown;
|
|
243
|
-
};
|
|
244
|
-
};
|
|
245
|
-
}>]>;
|
|
92
|
+
declare const platformPluv: (config: PluvPlatformConfig) => PluvPlatform;
|
|
246
93
|
|
|
247
|
-
export {
|
|
94
|
+
export { type PluvIOEndpoints, PluvPlatform, type RoomDeletedMessageEventData, type UserConnectedEventData, type UserDisconnectedEventData, platformPluv };
|
package/dist/index.js
CHANGED
|
@@ -52,16 +52,16 @@ var __async = (__this, __arguments, generator) => {
|
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
// src/index.ts
|
|
55
|
-
var
|
|
56
|
-
__export(
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
var index_exports = {};
|
|
56
|
+
__export(index_exports, {
|
|
57
|
+
PluvPlatform: () => PluvPlatform,
|
|
58
|
+
platformPluv: () => platformPluv
|
|
59
59
|
});
|
|
60
|
-
module.exports = __toCommonJS(
|
|
60
|
+
module.exports = __toCommonJS(index_exports);
|
|
61
61
|
|
|
62
|
-
// src/
|
|
62
|
+
// src/PluvPlatform.ts
|
|
63
|
+
var import_io = require("@pluv/io");
|
|
63
64
|
var import_hono = require("hono");
|
|
64
|
-
var import_vercel = require("hono/vercel");
|
|
65
65
|
|
|
66
66
|
// src/constants.ts
|
|
67
67
|
var SIGNATURE_HEADER = "x-pluv-signature-256";
|
|
@@ -160,11 +160,50 @@ var verifyWebhook = (params) => __async(void 0, null, function* () {
|
|
|
160
160
|
return timingSafeEqual(verificationBytes, signatureBytes);
|
|
161
161
|
});
|
|
162
162
|
|
|
163
|
-
// src/
|
|
164
|
-
var
|
|
165
|
-
constructor(
|
|
163
|
+
// src/PluvPlatform.ts
|
|
164
|
+
var PluvPlatform = class extends import_io.AbstractPlatform {
|
|
165
|
+
constructor(params) {
|
|
166
|
+
super();
|
|
167
|
+
this._config = {
|
|
168
|
+
authorize: {
|
|
169
|
+
required: false,
|
|
170
|
+
secret: false
|
|
171
|
+
},
|
|
172
|
+
handleMode: "fetch",
|
|
173
|
+
registrationMode: "attached",
|
|
174
|
+
requireAuth: true,
|
|
175
|
+
listeners: {
|
|
176
|
+
onRoomDeleted: true,
|
|
177
|
+
onRoomMessage: false,
|
|
178
|
+
onStorageUpdated: false,
|
|
179
|
+
onUserConnected: true,
|
|
180
|
+
onUserDisconnected: true
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
this._name = "platformPluv";
|
|
184
|
+
this._createToken = (params) => __async(this, null, function* () {
|
|
185
|
+
var _a;
|
|
186
|
+
const parsed = this._authorize.user.parse(params.user);
|
|
187
|
+
const res = yield fetch(this._endpoints.createToken, {
|
|
188
|
+
headers: { "content-type": "application/json" },
|
|
189
|
+
method: "post",
|
|
190
|
+
body: JSON.stringify({
|
|
191
|
+
maxAge: (_a = params.maxAge) != null ? _a : null,
|
|
192
|
+
publicKey: this._publicKey,
|
|
193
|
+
room: params.room,
|
|
194
|
+
secretKey: this._secretKey,
|
|
195
|
+
user: parsed
|
|
196
|
+
})
|
|
197
|
+
}).catch(() => null);
|
|
198
|
+
if (!res || !res.ok || res.status !== 200) {
|
|
199
|
+
throw new Error("Authorization failed");
|
|
200
|
+
}
|
|
201
|
+
const token = yield res.text().catch(() => null);
|
|
202
|
+
if (typeof token !== "string") throw new Error("Authorization failed");
|
|
203
|
+
return token;
|
|
204
|
+
});
|
|
166
205
|
this._webhooks = new import_hono.Hono().basePath("/").post("/", (c) => __async(this, null, function* () {
|
|
167
|
-
var _a, _b;
|
|
206
|
+
var _a, _b, _c, _d, _e;
|
|
168
207
|
const signature = c.req.header(SIGNATURE_HEADER);
|
|
169
208
|
if (!this._webhookSecret || !signature) return c.json({ error: "Unauthorized" }, 401);
|
|
170
209
|
const payload = yield c.req.json();
|
|
@@ -186,110 +225,88 @@ var PluvIO = class {
|
|
|
186
225
|
case "room-deleted": {
|
|
187
226
|
const room = data.room;
|
|
188
227
|
const encodedState = data.storage;
|
|
189
|
-
yield Promise.resolve(this._listeners.onRoomDeleted({ encodedState, room }));
|
|
228
|
+
yield Promise.resolve((_c = this._listeners) == null ? void 0 : _c.onRoomDeleted({ encodedState, room }));
|
|
190
229
|
return c.json({ data: { room } }, 200);
|
|
191
230
|
}
|
|
192
231
|
case "user-connected": {
|
|
193
232
|
const room = data.room;
|
|
194
233
|
const encodedState = data.storage;
|
|
195
234
|
const user = data.user;
|
|
196
|
-
yield Promise.resolve(this._listeners.onUserConnected({ encodedState, room, user }));
|
|
235
|
+
yield Promise.resolve((_d = this._listeners) == null ? void 0 : _d.onUserConnected({ encodedState, room, user }));
|
|
197
236
|
}
|
|
198
237
|
case "user-disconnected": {
|
|
199
238
|
const room = data.room;
|
|
200
239
|
const encodedState = data.storage;
|
|
201
240
|
const user = data.user;
|
|
202
|
-
yield Promise.resolve(this._listeners.onUserDisconnected({ encodedState, room, user }));
|
|
241
|
+
yield Promise.resolve((_e = this._listeners) == null ? void 0 : _e.onUserDisconnected({ encodedState, room, user }));
|
|
203
242
|
}
|
|
204
243
|
default:
|
|
205
244
|
return c.json({ data: { ok: true } }, 200);
|
|
206
245
|
}
|
|
207
246
|
}));
|
|
208
|
-
const {
|
|
209
|
-
_defs,
|
|
210
|
-
authorize,
|
|
211
|
-
basePath,
|
|
212
|
-
getInitialStorage,
|
|
213
|
-
onRoomDeleted,
|
|
214
|
-
onUserConnected,
|
|
215
|
-
onUserDisconnected,
|
|
216
|
-
publicKey,
|
|
217
|
-
secretKey,
|
|
218
|
-
webhookSecret
|
|
219
|
-
} = options;
|
|
220
|
-
this._authorize = {
|
|
221
|
-
required: true,
|
|
222
|
-
secret: "",
|
|
223
|
-
user: authorize.user
|
|
224
|
-
};
|
|
247
|
+
const { _defs, basePath, publicKey, secretKey, webhookSecret } = params;
|
|
225
248
|
this._basePath = basePath;
|
|
226
249
|
this._endpoints = __spreadValues({
|
|
227
250
|
createToken: "https://pluv.io/api/room/token"
|
|
228
251
|
}, _defs == null ? void 0 : _defs.endpoints);
|
|
229
|
-
this._getInitialStorage = getInitialStorage;
|
|
230
|
-
this._listeners = {
|
|
231
|
-
onRoomDeleted: (event) => onRoomDeleted == null ? void 0 : onRoomDeleted(event),
|
|
232
|
-
onUserConnected: (event) => onUserConnected == null ? void 0 : onUserConnected(event),
|
|
233
|
-
onUserDisconnected: (event) => onUserDisconnected == null ? void 0 : onUserDisconnected(event)
|
|
234
|
-
};
|
|
235
252
|
this._publicKey = publicKey;
|
|
236
253
|
this._secretKey = secretKey;
|
|
237
254
|
this._webhookSecret = webhookSecret;
|
|
255
|
+
this._fetch = new import_hono.Hono().basePath(this._basePath).route("/", this._webhooks).fetch;
|
|
238
256
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
* @readonly
|
|
242
|
-
* @deprecated Internal use only. Changes to this will never be marked as breaking.
|
|
243
|
-
*/
|
|
244
|
-
get _defs() {
|
|
245
|
-
return {
|
|
246
|
-
authorize: this._authorize,
|
|
247
|
-
context: {},
|
|
248
|
-
events: {},
|
|
249
|
-
get platform() {
|
|
250
|
-
throw new Error("Invalid platform reference");
|
|
251
|
-
}
|
|
252
|
-
};
|
|
257
|
+
acceptWebSocket(webSocket) {
|
|
258
|
+
throw new Error("Not implemented");
|
|
253
259
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
return app.fetch;
|
|
260
|
+
convertWebSocket(webSocket, config) {
|
|
261
|
+
throw new Error("Not implemented");
|
|
257
262
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
return (0, import_vercel.handle)(app);
|
|
263
|
+
getLastPing(webSocket) {
|
|
264
|
+
throw new Error("Not implemented");
|
|
261
265
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
266
|
+
getSerializedState(webSocket) {
|
|
267
|
+
throw new Error("Not implemented");
|
|
268
|
+
}
|
|
269
|
+
getSessionId(webSocket) {
|
|
270
|
+
throw new Error("Not implemented");
|
|
271
|
+
}
|
|
272
|
+
getWebSockets() {
|
|
273
|
+
throw new Error("Not implemented");
|
|
274
|
+
}
|
|
275
|
+
initialize(config) {
|
|
276
|
+
throw new Error("Not implemented");
|
|
277
|
+
}
|
|
278
|
+
parseData(data) {
|
|
279
|
+
throw new Error("Not implemented");
|
|
280
|
+
}
|
|
281
|
+
randomUUID() {
|
|
282
|
+
throw new Error("Not implemented");
|
|
283
|
+
}
|
|
284
|
+
setSerializedState(webSocket, state) {
|
|
285
|
+
throw new Error("Not implemented");
|
|
286
|
+
}
|
|
287
|
+
validateConfig(config) {
|
|
288
|
+
if (!config.authorize) throw new Error("Config `authorize` must be provided to `platformPluv`");
|
|
289
|
+
if (!!config.onRoomMessage) throw new Error("Config `onRoomMessage` is not supported on `platformPluv`");
|
|
290
|
+
if (!!config.onStorageUpdated) throw new Error("Config `onStorageUpdated` is not supported on `platformPluv`");
|
|
291
|
+
if (!!config.authorize.required) {
|
|
292
|
+
throw new Error("Config `authorize.required` is not allowed to be false on `platformPluv`");
|
|
293
|
+
}
|
|
294
|
+
this._authorize = config.authorize;
|
|
295
|
+
this._getInitialStorage = config.getInitialStorage;
|
|
296
|
+
this._listeners = {
|
|
297
|
+
onRoomDeleted: config.onRoomDeleted,
|
|
298
|
+
onUserConnected: config.onUserConnected,
|
|
299
|
+
onUserDisconnected: config.onUserDisconnected
|
|
300
|
+
};
|
|
284
301
|
}
|
|
285
302
|
};
|
|
286
303
|
|
|
287
|
-
// src/
|
|
288
|
-
var
|
|
289
|
-
return new
|
|
304
|
+
// src/platformPluv.ts
|
|
305
|
+
var platformPluv = (config) => {
|
|
306
|
+
return new PluvPlatform(config);
|
|
290
307
|
};
|
|
291
308
|
// Annotate the CommonJS export names for ESM import in node:
|
|
292
309
|
0 && (module.exports = {
|
|
293
|
-
|
|
294
|
-
|
|
310
|
+
PluvPlatform,
|
|
311
|
+
platformPluv
|
|
295
312
|
});
|