@pluv/platform-pluv 2.1.0 → 2.2.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 +18 -0
- package/dist/index.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +10 -4
- package/dist/index.mjs +10 -4
- package/package.json +7 -7
- package/src/PluvPlatform.ts +9 -10
- package/src/platformPluv.ts +1 -1
- package/src/types.ts +6 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/platform-pluv@2.1
|
|
2
|
+
> @pluv/platform-pluv@2.2.1 build /home/runner/work/pluv/pluv/packages/platform-pluv
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
[34mCLI[39m Target: es6
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
11
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m12.42 KB[39m
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 107ms
|
|
13
|
+
[32mCJS[39m [1mdist/index.js [22m[32m14.25 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 108ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m3.
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 6238ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m3.65 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.65 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @pluv/platform-pluv
|
|
2
2
|
|
|
3
|
+
## 2.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6563957: Fix `createToken` throwing a TypeError.
|
|
8
|
+
- @pluv/crdt@2.2.1
|
|
9
|
+
- @pluv/io@2.2.1
|
|
10
|
+
- @pluv/types@2.2.1
|
|
11
|
+
|
|
12
|
+
## 2.2.0
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [cb660cd]
|
|
17
|
+
- @pluv/io@2.2.0
|
|
18
|
+
- @pluv/crdt@2.2.0
|
|
19
|
+
- @pluv/types@2.2.0
|
|
20
|
+
|
|
3
21
|
## 2.1.0
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -57,7 +57,6 @@ declare class PluvPlatform<TContext extends Record<string, any> = {}, TUser exte
|
|
|
57
57
|
};
|
|
58
58
|
readonly _name = "platformPluv";
|
|
59
59
|
private readonly _app;
|
|
60
|
-
private _authorize;
|
|
61
60
|
private readonly _basePath;
|
|
62
61
|
private readonly _context;
|
|
63
62
|
private readonly _endpoints;
|
package/dist/index.d.ts
CHANGED
|
@@ -57,7 +57,6 @@ declare class PluvPlatform<TContext extends Record<string, any> = {}, TUser exte
|
|
|
57
57
|
};
|
|
58
58
|
readonly _name = "platformPluv";
|
|
59
59
|
private readonly _app;
|
|
60
|
-
private _authorize;
|
|
61
60
|
private readonly _basePath;
|
|
62
61
|
private readonly _context;
|
|
63
62
|
private readonly _endpoints;
|
package/dist/index.js
CHANGED
|
@@ -238,7 +238,7 @@ var PluvPlatform = class extends import_io.AbstractPlatform {
|
|
|
238
238
|
this._name = "platformPluv";
|
|
239
239
|
this._createToken = (params) => __async(this, null, function* () {
|
|
240
240
|
var _a;
|
|
241
|
-
const parsed =
|
|
241
|
+
const parsed = params.authorize.user.parse(params.user);
|
|
242
242
|
const [endpoints, publicKey, secretKey] = yield Promise.all([
|
|
243
243
|
typeof this._endpoints === "object" ? this._endpoints : this._endpoints(),
|
|
244
244
|
typeof this._publicKey === "string" ? this._publicKey : this._publicKey(),
|
|
@@ -302,7 +302,13 @@ var PluvPlatform = class extends import_io.AbstractPlatform {
|
|
|
302
302
|
const encodedState = data.storage;
|
|
303
303
|
const user = data.user;
|
|
304
304
|
yield Promise.resolve(
|
|
305
|
-
(_f = this._listeners) == null ? void 0 : _f.onUserConnected({
|
|
305
|
+
(_f = this._listeners) == null ? void 0 : _f.onUserConnected({
|
|
306
|
+
context,
|
|
307
|
+
encodedState,
|
|
308
|
+
platform: this,
|
|
309
|
+
room,
|
|
310
|
+
user
|
|
311
|
+
})
|
|
306
312
|
);
|
|
307
313
|
return createSuccessResponse(c, { event, room });
|
|
308
314
|
}
|
|
@@ -314,6 +320,7 @@ var PluvPlatform = class extends import_io.AbstractPlatform {
|
|
|
314
320
|
(_g = this._listeners) == null ? void 0 : _g.onUserDisconnected({
|
|
315
321
|
context,
|
|
316
322
|
encodedState,
|
|
323
|
+
platform: this,
|
|
317
324
|
room,
|
|
318
325
|
user
|
|
319
326
|
})
|
|
@@ -379,7 +386,6 @@ var PluvPlatform = class extends import_io.AbstractPlatform {
|
|
|
379
386
|
throw new Error("Config `onRoomMessage` is not supported on `platformPluv`");
|
|
380
387
|
if (!!config.onStorageUpdated)
|
|
381
388
|
throw new Error("Config `onStorageUpdated` is not supported on `platformPluv`");
|
|
382
|
-
this._authorize = config.authorize;
|
|
383
389
|
this._getInitialStorage = config.getInitialStorage;
|
|
384
390
|
this._listeners = {
|
|
385
391
|
onRoomDeleted: (event) => {
|
|
@@ -406,7 +412,7 @@ var platformPluv = (config) => {
|
|
|
406
412
|
context,
|
|
407
413
|
crdt,
|
|
408
414
|
debug,
|
|
409
|
-
platform: new PluvPlatform(config)
|
|
415
|
+
platform: () => new PluvPlatform(config)
|
|
410
416
|
};
|
|
411
417
|
};
|
|
412
418
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.mjs
CHANGED
|
@@ -208,7 +208,7 @@ var PluvPlatform = class extends AbstractPlatform {
|
|
|
208
208
|
this._name = "platformPluv";
|
|
209
209
|
this._createToken = (params) => __async(this, null, function* () {
|
|
210
210
|
var _a;
|
|
211
|
-
const parsed =
|
|
211
|
+
const parsed = params.authorize.user.parse(params.user);
|
|
212
212
|
const [endpoints, publicKey, secretKey] = yield Promise.all([
|
|
213
213
|
typeof this._endpoints === "object" ? this._endpoints : this._endpoints(),
|
|
214
214
|
typeof this._publicKey === "string" ? this._publicKey : this._publicKey(),
|
|
@@ -272,7 +272,13 @@ var PluvPlatform = class extends AbstractPlatform {
|
|
|
272
272
|
const encodedState = data.storage;
|
|
273
273
|
const user = data.user;
|
|
274
274
|
yield Promise.resolve(
|
|
275
|
-
(_f = this._listeners) == null ? void 0 : _f.onUserConnected({
|
|
275
|
+
(_f = this._listeners) == null ? void 0 : _f.onUserConnected({
|
|
276
|
+
context,
|
|
277
|
+
encodedState,
|
|
278
|
+
platform: this,
|
|
279
|
+
room,
|
|
280
|
+
user
|
|
281
|
+
})
|
|
276
282
|
);
|
|
277
283
|
return createSuccessResponse(c, { event, room });
|
|
278
284
|
}
|
|
@@ -284,6 +290,7 @@ var PluvPlatform = class extends AbstractPlatform {
|
|
|
284
290
|
(_g = this._listeners) == null ? void 0 : _g.onUserDisconnected({
|
|
285
291
|
context,
|
|
286
292
|
encodedState,
|
|
293
|
+
platform: this,
|
|
287
294
|
room,
|
|
288
295
|
user
|
|
289
296
|
})
|
|
@@ -349,7 +356,6 @@ var PluvPlatform = class extends AbstractPlatform {
|
|
|
349
356
|
throw new Error("Config `onRoomMessage` is not supported on `platformPluv`");
|
|
350
357
|
if (!!config.onStorageUpdated)
|
|
351
358
|
throw new Error("Config `onStorageUpdated` is not supported on `platformPluv`");
|
|
352
|
-
this._authorize = config.authorize;
|
|
353
359
|
this._getInitialStorage = config.getInitialStorage;
|
|
354
360
|
this._listeners = {
|
|
355
361
|
onRoomDeleted: (event) => {
|
|
@@ -376,7 +382,7 @@ var platformPluv = (config) => {
|
|
|
376
382
|
context,
|
|
377
383
|
crdt,
|
|
378
384
|
debug,
|
|
379
|
-
platform: new PluvPlatform(config)
|
|
385
|
+
platform: () => new PluvPlatform(config)
|
|
380
386
|
};
|
|
381
387
|
};
|
|
382
388
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/platform-pluv",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "@pluv/io adapter for pluv.io",
|
|
5
5
|
"author": "leedavidcs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,20 +17,20 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@types/node": "^22.15.
|
|
20
|
+
"@types/node": "^22.15.18",
|
|
21
21
|
"fast-json-stable-stringify": "^2.1.0",
|
|
22
22
|
"hono": "^4.7.9",
|
|
23
23
|
"zod": "^3.24.4",
|
|
24
|
-
"@pluv/crdt": "^2.1
|
|
25
|
-
"@pluv/
|
|
26
|
-
"@pluv/
|
|
24
|
+
"@pluv/crdt": "^2.2.1",
|
|
25
|
+
"@pluv/io": "^2.2.1",
|
|
26
|
+
"@pluv/types": "^2.2.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"eslint": "^9.26.0",
|
|
30
30
|
"tsup": "^8.4.0",
|
|
31
31
|
"typescript": "^5.8.3",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
32
|
+
"eslint-config-pluv": "^2.2.1",
|
|
33
|
+
"@pluv/tsconfig": "^2.2.1"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|
package/src/PluvPlatform.ts
CHANGED
|
@@ -81,7 +81,6 @@ export class PluvPlatform<
|
|
|
81
81
|
public readonly _name = "platformPluv";
|
|
82
82
|
|
|
83
83
|
private readonly _app: Hono;
|
|
84
|
-
private _authorize: any;
|
|
85
84
|
private readonly _basePath: string;
|
|
86
85
|
private readonly _context: any;
|
|
87
86
|
private readonly _endpoints: PluvIOEndpoints | (() => MaybePromise<PluvIOEndpoints>);
|
|
@@ -92,7 +91,7 @@ export class PluvPlatform<
|
|
|
92
91
|
private readonly _webhookSecret?: WebhookSecret;
|
|
93
92
|
|
|
94
93
|
public _createToken = async (params: JWTEncodeParams<any, any>): Promise<string> => {
|
|
95
|
-
const parsed =
|
|
94
|
+
const parsed = params.authorize.user.parse(params.user);
|
|
96
95
|
|
|
97
96
|
const [endpoints, publicKey, secretKey] = await Promise.all([
|
|
98
97
|
typeof this._endpoints === "object" ? this._endpoints : this._endpoints(),
|
|
@@ -192,13 +191,6 @@ export class PluvPlatform<
|
|
|
192
191
|
if (!!config.onStorageUpdated)
|
|
193
192
|
throw new Error("Config `onStorageUpdated` is not supported on `platformPluv`");
|
|
194
193
|
|
|
195
|
-
/**
|
|
196
|
-
* !HACK
|
|
197
|
-
* @description Assign these on the validation step, because we know this will happen on the
|
|
198
|
-
* server constructor internally.
|
|
199
|
-
* @date December 16, 2024
|
|
200
|
-
*/
|
|
201
|
-
this._authorize = config.authorize;
|
|
202
194
|
this._getInitialStorage = config.getInitialStorage;
|
|
203
195
|
this._listeners = {
|
|
204
196
|
onRoomDeleted: (event) => config.onRoomDeleted?.(event),
|
|
@@ -265,7 +257,13 @@ export class PluvPlatform<
|
|
|
265
257
|
const user = data.user as any;
|
|
266
258
|
|
|
267
259
|
await Promise.resolve(
|
|
268
|
-
this._listeners?.onUserConnected({
|
|
260
|
+
this._listeners?.onUserConnected({
|
|
261
|
+
context,
|
|
262
|
+
encodedState,
|
|
263
|
+
platform: this,
|
|
264
|
+
room,
|
|
265
|
+
user,
|
|
266
|
+
}),
|
|
269
267
|
);
|
|
270
268
|
|
|
271
269
|
return createSuccessResponse(c, { event, room });
|
|
@@ -279,6 +277,7 @@ export class PluvPlatform<
|
|
|
279
277
|
this._listeners?.onUserDisconnected({
|
|
280
278
|
context,
|
|
281
279
|
encodedState,
|
|
280
|
+
platform: this,
|
|
282
281
|
room,
|
|
283
282
|
user,
|
|
284
283
|
}),
|
package/src/platformPluv.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
BaseUser,
|
|
3
3
|
GetInitialStorageFn,
|
|
4
|
-
IORoomListenerEvent,
|
|
5
4
|
IOUserConnectedEvent,
|
|
6
5
|
IOUserDisconnectedEvent,
|
|
7
6
|
} from "@pluv/io";
|
|
@@ -21,6 +20,12 @@ export interface PluvIOEndpoints {
|
|
|
21
20
|
createToken: string;
|
|
22
21
|
}
|
|
23
22
|
|
|
23
|
+
export type IORoomListenerEvent<TContext extends Record<string, any>> = {
|
|
24
|
+
context: TContext;
|
|
25
|
+
encodedState: string | null;
|
|
26
|
+
room: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
24
29
|
export type PluvIOListeners<
|
|
25
30
|
TContext extends Record<string, any> = {},
|
|
26
31
|
TUser extends BaseUser = BaseUser,
|