@pluv/platform-pluv 0.36.0 → 0.37.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @pluv/platform-pluv@0.36.0 build /home/runner/work/pluv/pluv/packages/platform-pluv
2
+ > @pluv/platform-pluv@0.37.1 build /home/runner/work/pluv/pluv/packages/platform-pluv
3
3
  > tsup src/index.ts --format esm,cjs --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,11 +8,11 @@
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- ESM dist/index.mjs 9.65 KB
12
- ESM ⚡️ Build success in 85ms
13
- CJS dist/index.js 10.54 KB
14
- CJS ⚡️ Build success in 85ms
11
+ CJS dist/index.js 10.68 KB
12
+ CJS ⚡️ Build success in 89ms
13
+ ESM dist/index.mjs 9.79 KB
14
+ ESM ⚡️ Build success in 92ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 6483ms
17
- DTS dist/index.d.mts 2.86 KB
18
- DTS dist/index.d.ts 2.86 KB
16
+ DTS ⚡️ Build success in 6951ms
17
+ DTS dist/index.d.mts 3.54 KB
18
+ DTS dist/index.d.ts 3.54 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,65 @@
1
1
  # @pluv/platform-pluv
2
2
 
3
+ ## 0.37.1
4
+
5
+ ### Patch Changes
6
+
7
+ - @pluv/crdt@0.37.1
8
+ - @pluv/io@0.37.1
9
+ - @pluv/types@0.37.1
10
+
11
+ ## 0.37.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 5165be0: **BREAKING**
16
+
17
+ Updated the `platformPluv` function to return an entire `createIO` input object. Now `createIO` must be called with `platformPluv`'s return value as an input.
18
+
19
+ ```ts
20
+ // Before
21
+
22
+ import { createIO } from "@pluv/io";
23
+ import { platformPluv } from "@pluv/platform-pluv";
24
+
25
+ export const io = createIO({
26
+ authorize: {
27
+ // ...
28
+ },
29
+ context: {
30
+ // ...
31
+ },
32
+ platform: platformPluv({
33
+ // ...
34
+ }),
35
+ // ...
36
+ });
37
+
38
+ // After
39
+
40
+ import { createIO } from "@pluv/io";
41
+ import { platformPluv } from "@pluv/platform-pluv";
42
+
43
+ export const io = createIO(
44
+ platformPluv({
45
+ authorize: {
46
+ // ...
47
+ },
48
+ context: {
49
+ // ...
50
+ },
51
+ }),
52
+ );
53
+ ```
54
+
55
+ ### Patch Changes
56
+
57
+ - 9b74abb: Improved type inference when calling `PluvIO.server` to not include options that are always undefined (i.e. are not allowed by the specified platform).
58
+ - Updated dependencies [9b74abb]
59
+ - @pluv/io@0.37.0
60
+ - @pluv/crdt@0.37.0
61
+ - @pluv/types@0.37.0
62
+
3
63
  ## 0.36.0
4
64
 
5
65
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
- import { AbstractPlatform, JWTEncodeParams, AbstractWebSocket, ConvertWebSocketConfig, WebSocketSerializedState, AbstractPlatformConfig } from '@pluv/io';
1
+ import { AbstractPlatform, JWTEncodeParams, AbstractWebSocket, ConvertWebSocketConfig, WebSocketSerializedState, AbstractPlatformConfig, CreateIOParams, PluvIOAuthorize, InferInitContextType, PluvContext } from '@pluv/io';
2
+ import { BaseUser, Id } from '@pluv/types';
2
3
 
3
4
  interface PluvIOEndpoints {
4
5
  createToken: string;
@@ -46,6 +47,7 @@ declare class PluvPlatform extends AbstractPlatform<any, {}, {}, {
46
47
  onUserConnected: true;
47
48
  onUserDisconnected: true;
48
49
  };
50
+ router: false;
49
51
  }> {
50
52
  readonly _config: {
51
53
  authorize: {
@@ -61,6 +63,7 @@ declare class PluvPlatform extends AbstractPlatform<any, {}, {}, {
61
63
  onUserConnected: true;
62
64
  onUserDisconnected: true;
63
65
  };
66
+ router: false;
64
67
  };
65
68
  readonly _name = "platformPluv";
66
69
  private _authorize;
@@ -87,6 +90,10 @@ declare class PluvPlatform extends AbstractPlatform<any, {}, {}, {
87
90
  private _webhooks;
88
91
  }
89
92
 
90
- declare const platformPluv: (config: PluvPlatformConfig) => PluvPlatform;
93
+ type PlatformPluvCreateIOParams<TContext extends Record<string, any> = {}, TUser extends BaseUser = BaseUser> = Id<PluvPlatformConfig & Omit<CreateIOParams<PluvPlatform, TContext, TUser>, "authorize" | "context" | "platform"> & {
94
+ authorize: PluvIOAuthorize<PluvPlatform, TUser, InferInitContextType<PluvPlatform>>;
95
+ context?: PluvContext<PluvPlatform, TContext>;
96
+ }>;
97
+ declare const platformPluv: <TContext extends Record<string, any> = {}, TUser extends BaseUser = BaseUser>(config: PlatformPluvCreateIOParams<TContext, TUser>) => CreateIOParams<PluvPlatform, TContext, TUser>;
91
98
 
92
- export { type PluvIOEndpoints, PluvPlatform, type RoomDeletedMessageEventData, type UserConnectedEventData, type UserDisconnectedEventData, platformPluv };
99
+ export { type PlatformPluvCreateIOParams, type PluvIOEndpoints, PluvPlatform, type RoomDeletedMessageEventData, type UserConnectedEventData, type UserDisconnectedEventData, platformPluv };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { AbstractPlatform, JWTEncodeParams, AbstractWebSocket, ConvertWebSocketConfig, WebSocketSerializedState, AbstractPlatformConfig } from '@pluv/io';
1
+ import { AbstractPlatform, JWTEncodeParams, AbstractWebSocket, ConvertWebSocketConfig, WebSocketSerializedState, AbstractPlatformConfig, CreateIOParams, PluvIOAuthorize, InferInitContextType, PluvContext } from '@pluv/io';
2
+ import { BaseUser, Id } from '@pluv/types';
2
3
 
3
4
  interface PluvIOEndpoints {
4
5
  createToken: string;
@@ -46,6 +47,7 @@ declare class PluvPlatform extends AbstractPlatform<any, {}, {}, {
46
47
  onUserConnected: true;
47
48
  onUserDisconnected: true;
48
49
  };
50
+ router: false;
49
51
  }> {
50
52
  readonly _config: {
51
53
  authorize: {
@@ -61,6 +63,7 @@ declare class PluvPlatform extends AbstractPlatform<any, {}, {}, {
61
63
  onUserConnected: true;
62
64
  onUserDisconnected: true;
63
65
  };
66
+ router: false;
64
67
  };
65
68
  readonly _name = "platformPluv";
66
69
  private _authorize;
@@ -87,6 +90,10 @@ declare class PluvPlatform extends AbstractPlatform<any, {}, {}, {
87
90
  private _webhooks;
88
91
  }
89
92
 
90
- declare const platformPluv: (config: PluvPlatformConfig) => PluvPlatform;
93
+ type PlatformPluvCreateIOParams<TContext extends Record<string, any> = {}, TUser extends BaseUser = BaseUser> = Id<PluvPlatformConfig & Omit<CreateIOParams<PluvPlatform, TContext, TUser>, "authorize" | "context" | "platform"> & {
94
+ authorize: PluvIOAuthorize<PluvPlatform, TUser, InferInitContextType<PluvPlatform>>;
95
+ context?: PluvContext<PluvPlatform, TContext>;
96
+ }>;
97
+ declare const platformPluv: <TContext extends Record<string, any> = {}, TUser extends BaseUser = BaseUser>(config: PlatformPluvCreateIOParams<TContext, TUser>) => CreateIOParams<PluvPlatform, TContext, TUser>;
91
98
 
92
- export { type PluvIOEndpoints, PluvPlatform, type RoomDeletedMessageEventData, type UserConnectedEventData, type UserDisconnectedEventData, platformPluv };
99
+ export { type PlatformPluvCreateIOParams, type PluvIOEndpoints, PluvPlatform, type RoomDeletedMessageEventData, type UserConnectedEventData, type UserDisconnectedEventData, platformPluv };
package/dist/index.js CHANGED
@@ -177,7 +177,8 @@ var PluvPlatform = class extends import_io.AbstractPlatform {
177
177
  onStorageUpdated: false,
178
178
  onUserConnected: true,
179
179
  onUserDisconnected: true
180
- }
180
+ },
181
+ router: false
181
182
  };
182
183
  this._name = "platformPluv";
183
184
  this._createToken = (params) => __async(this, null, function* () {
@@ -299,7 +300,14 @@ var PluvPlatform = class extends import_io.AbstractPlatform {
299
300
 
300
301
  // src/platformPluv.ts
301
302
  var platformPluv = (config) => {
302
- return new PluvPlatform(config);
303
+ const { authorize, context, crdt, debug } = config;
304
+ return {
305
+ authorize,
306
+ context,
307
+ crdt,
308
+ debug,
309
+ platform: new PluvPlatform(config)
310
+ };
303
311
  };
304
312
  // Annotate the CommonJS export names for ESM import in node:
305
313
  0 && (module.exports = {
package/dist/index.mjs CHANGED
@@ -159,7 +159,8 @@ var PluvPlatform = class extends AbstractPlatform {
159
159
  onStorageUpdated: false,
160
160
  onUserConnected: true,
161
161
  onUserDisconnected: true
162
- }
162
+ },
163
+ router: false
163
164
  };
164
165
  this._name = "platformPluv";
165
166
  this._createToken = (params) => __async(this, null, function* () {
@@ -281,7 +282,14 @@ var PluvPlatform = class extends AbstractPlatform {
281
282
 
282
283
  // src/platformPluv.ts
283
284
  var platformPluv = (config) => {
284
- return new PluvPlatform(config);
285
+ const { authorize, context, crdt, debug } = config;
286
+ return {
287
+ authorize,
288
+ context,
289
+ crdt,
290
+ debug,
291
+ platform: new PluvPlatform(config)
292
+ };
285
293
  };
286
294
  export {
287
295
  PluvPlatform,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/platform-pluv",
3
- "version": "0.36.0",
3
+ "version": "0.37.1",
4
4
  "description": "@pluv/io adapter for pluv.io",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -17,19 +17,19 @@
17
17
  "access": "public"
18
18
  },
19
19
  "dependencies": {
20
- "@types/node": "^22.13.5",
20
+ "@types/node": "^22.13.7",
21
21
  "hono": "^4.7.2",
22
22
  "zod": "^3.24.2",
23
- "@pluv/crdt": "^0.36.0",
24
- "@pluv/io": "^0.36.0",
25
- "@pluv/types": "^0.36.0"
23
+ "@pluv/crdt": "^0.37.1",
24
+ "@pluv/io": "^0.37.1",
25
+ "@pluv/types": "^0.37.1"
26
26
  },
27
27
  "devDependencies": {
28
28
  "eslint": "^8.57.1",
29
29
  "tsup": "^8.4.0",
30
- "typescript": "^5.7.3",
31
- "@pluv/tsconfig": "^0.36.0",
32
- "eslint-config-pluv": "^0.36.0"
30
+ "typescript": "^5.8.2",
31
+ "@pluv/tsconfig": "^0.37.1",
32
+ "eslint-config-pluv": "^0.37.1"
33
33
  },
34
34
  "scripts": {
35
35
  "build": "tsup src/index.ts --format esm,cjs --dts",
@@ -46,6 +46,7 @@ export class PluvPlatform extends AbstractPlatform<
46
46
  onUserConnected: true;
47
47
  onUserDisconnected: true;
48
48
  };
49
+ router: false;
49
50
  }
50
51
  > {
51
52
  public readonly _config = {
@@ -62,6 +63,7 @@ export class PluvPlatform extends AbstractPlatform<
62
63
  onUserConnected: true as const,
63
64
  onUserDisconnected: true as const,
64
65
  },
66
+ router: false as const,
65
67
  };
66
68
  public readonly _name = "platformPluv";
67
69
 
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { platformPluv } from "./platformPluv";
2
+ export type { PlatformPluvCreateIOParams } from "./platformPluv";
2
3
  export { PluvPlatform } from "./PluvPlatform";
3
4
  export type {
4
5
  PluvIOEndpoints,
@@ -1,6 +1,29 @@
1
+ import type { CreateIOParams, InferInitContextType, PluvContext, PluvIOAuthorize } from "@pluv/io";
2
+ import type { BaseUser, Id } from "@pluv/types";
1
3
  import type { PluvPlatformConfig } from "./PluvPlatform";
2
4
  import { PluvPlatform } from "./PluvPlatform";
3
5
 
4
- export const platformPluv = (config: PluvPlatformConfig) => {
5
- return new PluvPlatform(config);
6
+ export type PlatformPluvCreateIOParams<
7
+ TContext extends Record<string, any> = {},
8
+ TUser extends BaseUser = BaseUser,
9
+ > = Id<
10
+ PluvPlatformConfig &
11
+ Omit<CreateIOParams<PluvPlatform, TContext, TUser>, "authorize" | "context" | "platform"> & {
12
+ authorize: PluvIOAuthorize<PluvPlatform, TUser, InferInitContextType<PluvPlatform>>;
13
+ context?: PluvContext<PluvPlatform, TContext>;
14
+ }
15
+ >;
16
+
17
+ export const platformPluv = <TContext extends Record<string, any> = {}, TUser extends BaseUser = BaseUser>(
18
+ config: PlatformPluvCreateIOParams<TContext, TUser>,
19
+ ): CreateIOParams<PluvPlatform, TContext, TUser> => {
20
+ const { authorize, context, crdt, debug } = config;
21
+
22
+ return {
23
+ authorize,
24
+ context,
25
+ crdt,
26
+ debug,
27
+ platform: new PluvPlatform(config),
28
+ };
6
29
  };