@pluv/platform-pluv 0.35.4 → 0.37.0

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,18 +1,18 @@
1
1
 
2
- > @pluv/platform-pluv@0.35.4 build /home/runner/work/pluv/pluv/packages/platform-pluv
2
+ > @pluv/platform-pluv@0.37.0 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
6
6
  CLI Using tsconfig: tsconfig.json
7
- CLI tsup v8.3.6
7
+ CLI tsup v8.4.0
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 119ms
13
- CJS dist/index.js 10.54 KB
14
- CJS ⚡️ Build success in 122ms
11
+ ESM dist/index.mjs 9.79 KB
12
+ ESM ⚡️ Build success in 90ms
13
+ CJS dist/index.js 10.68 KB
14
+ CJS ⚡️ Build success in 90ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 6251ms
17
- DTS dist/index.d.mts 2.86 KB
18
- DTS dist/index.d.ts 2.86 KB
16
+ DTS ⚡️ Build success in 6612ms
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.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5165be0: **BREAKING**
8
+
9
+ Updated the `platformPluv` function to return an entire `createIO` input object. Now `createIO` must be called with `platformPluv`'s return value as an input.
10
+
11
+ ```ts
12
+ // Before
13
+
14
+ import { createIO } from "@pluv/io";
15
+ import { platformPluv } from "@pluv/platform-pluv";
16
+
17
+ export const io = createIO({
18
+ authorize: {
19
+ // ...
20
+ },
21
+ context: {
22
+ // ...
23
+ },
24
+ platform: platformPluv({
25
+ // ...
26
+ }),
27
+ // ...
28
+ });
29
+
30
+ // After
31
+
32
+ import { createIO } from "@pluv/io";
33
+ import { platformPluv } from "@pluv/platform-pluv";
34
+
35
+ export const io = createIO(
36
+ platformPluv({
37
+ authorize: {
38
+ // ...
39
+ },
40
+ context: {
41
+ // ...
42
+ },
43
+ }),
44
+ );
45
+ ```
46
+
47
+ ### Patch Changes
48
+
49
+ - 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).
50
+ - Updated dependencies [9b74abb]
51
+ - @pluv/io@0.37.0
52
+ - @pluv/crdt@0.37.0
53
+ - @pluv/types@0.37.0
54
+
55
+ ## 0.36.0
56
+
57
+ ### Patch Changes
58
+
59
+ - @pluv/crdt@0.36.0
60
+ - @pluv/io@0.36.0
61
+ - @pluv/types@0.36.0
62
+
3
63
  ## 0.35.4
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.35.4",
3
+ "version": "0.37.0",
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.4",
21
- "hono": "^4.7.1",
20
+ "@types/node": "^22.13.7",
21
+ "hono": "^4.7.2",
22
22
  "zod": "^3.24.2",
23
- "@pluv/crdt": "^0.35.4",
24
- "@pluv/io": "^0.35.4",
25
- "@pluv/types": "^0.35.4"
23
+ "@pluv/crdt": "^0.37.0",
24
+ "@pluv/io": "^0.37.0",
25
+ "@pluv/types": "^0.37.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "eslint": "^8.57.1",
29
- "tsup": "^8.3.6",
30
- "typescript": "^5.7.3",
31
- "@pluv/tsconfig": "^0.35.4",
32
- "eslint-config-pluv": "^0.35.4"
29
+ "tsup": "^8.4.0",
30
+ "typescript": "^5.8.2",
31
+ "@pluv/tsconfig": "^0.37.0",
32
+ "eslint-config-pluv": "^0.37.0"
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
  };