@pluv/io 0.35.0 → 0.35.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.
@@ -1,9 +1,9 @@
1
1
 
2
- > @pluv/io@0.35.0 build /home/runner/work/pluv/pluv/packages/io
2
+ > @pluv/io@0.35.2 build /home/runner/work/pluv/pluv/packages/io
3
3
  > pnpm run version && tsup src/index.ts --format esm,cjs --dts
4
4
 
5
5
 
6
- > @pluv/io@0.35.0 version /home/runner/work/pluv/pluv/packages/io
6
+ > @pluv/io@0.35.2 version /home/runner/work/pluv/pluv/packages/io
7
7
  > genversion ./src/version.generated.ts --esm
8
8
 
9
9
  CLI Building entry: src/index.ts
@@ -13,10 +13,10 @@
13
13
  ESM Build start
14
14
  CJS Build start
15
15
  CJS dist/index.js 45.71 KB
16
- CJS ⚡️ Build success in 171ms
16
+ CJS ⚡️ Build success in 180ms
17
17
  ESM dist/index.mjs 43.53 KB
18
- ESM ⚡️ Build success in 172ms
18
+ ESM ⚡️ Build success in 182ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 2615ms
21
- DTS dist/index.d.mts 29.57 KB
22
- DTS dist/index.d.ts 29.57 KB
20
+ DTS ⚡️ Build success in 2487ms
21
+ DTS dist/index.d.mts 29.63 KB
22
+ DTS dist/index.d.ts 29.63 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @pluv/io
2
2
 
3
+ ## 0.35.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 81cb692: Fixed type inference of the `authorize` option in `createIO` when used as a function.
8
+ - Updated dependencies [81cb692]
9
+ - @pluv/types@0.35.2
10
+ - @pluv/crdt@0.35.2
11
+
12
+ ## 0.35.1
13
+
14
+ ### Patch Changes
15
+
16
+ - @pluv/crdt@0.35.1
17
+ - @pluv/types@0.35.1
18
+
3
19
  ## 0.35.0
4
20
 
5
21
  ### Minor Changes
package/dist/index.d.mts CHANGED
@@ -191,7 +191,7 @@ type ResolvedPluvIOAuthorize<TPlatform extends AbstractPlatform<any, any, any, a
191
191
  } & UndefinedProps<{
192
192
  secret?: string;
193
193
  }, Exclude<"secret", InferPlatformAuthorizeProperties<TPlatform>>>;
194
- type PluvIOAuthorize<TPlatform extends AbstractPlatform<any, any, any, any>, TUser extends BaseUser = any, TContext extends Record<string, unknown> = {}> = ResolvedPluvIOAuthorize<TPlatform, TUser> | ((context: TContext) => ResolvedPluvIOAuthorize<TPlatform, TUser>);
194
+ type PluvIOAuthorize<TPlatform extends AbstractPlatform<any, any, any, any>, TUser extends BaseUser | null = any, TContext extends Record<string, unknown> = {}> = (TUser extends BaseUser ? ResolvedPluvIOAuthorize<TPlatform, TUser> : null) | ((context: TContext) => TUser extends BaseUser ? ResolvedPluvIOAuthorize<TPlatform, TUser> : null);
195
195
  type BasePluvIOListeners<TPlatform extends AbstractPlatform<any, any, any, any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>> = {
196
196
  onRoomDeleted: (event: IORoomListenerEvent<TContext>) => void;
197
197
  onRoomMessage: (event: IORoomMessageEvent<TPlatform, TAuthorize, TContext, TEvents>) => void;
@@ -463,13 +463,13 @@ declare class PluvIO<TPlatform extends AbstractPlatform<any> = AbstractPlatform<
463
463
  private _getIOAuthorize;
464
464
  }
465
465
 
466
- type CreateIOParams<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TContext extends Record<string, any> = {}, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null = null> = {
467
- authorize?: TAuthorize;
466
+ type CreateIOParams<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TContext extends Record<string, any> = {}, TUser extends BaseUser | null = null> = {
467
+ authorize?: PluvIOAuthorize<TPlatform, TUser, InferInitContextType<TPlatform>>;
468
468
  context?: PluvContext<TPlatform, TContext>;
469
469
  crdt?: CrdtLibraryType;
470
470
  debug?: boolean;
471
471
  platform: TPlatform;
472
472
  };
473
- declare const createIO: <TPlatform extends AbstractPlatform<any> = AbstractPlatform<any, {}, {}, PlatformConfig>, TContext extends Record<string, any> = {}, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null = null>(params: CreateIOParams<TPlatform, TContext, TAuthorize>) => PluvIO<TPlatform, TAuthorize, TContext>;
473
+ declare const createIO: <TPlatform extends AbstractPlatform<any> = AbstractPlatform<any, {}, {}, PlatformConfig>, TContext extends Record<string, any> = {}, TUser extends BaseUser | null = null>(params: CreateIOParams<TPlatform, TContext, TUser>) => PluvIO<TPlatform, PluvIOAuthorize<TPlatform, TUser, InferInitContextType<TPlatform>>, TContext>;
474
474
 
475
475
  export { type AbstractCloseEvent, type AbstractErrorEvent, type AbstractEvent, type AbstractEventMap, type AbstractListener, type AbstractMessageEvent, AbstractPersistence, AbstractPlatform, type AbstractPlatformConfig, AbstractPubSub, AbstractWebSocket, type AbstractWebSocketConfig, type AbstractWebSocketHandleErrorParams, type AuthorizeModule, type AuthorizeParams, type ConvertWebSocketConfig, type CrdtLibraryType, type CreateIOParams, type CreateRoomOptions, type GetInitialStorageFn, type HandleMode, type IOPubSubEventMessage, IORoom, type IORoomListenerEvent, type IORoomMessageEvent, type IOStorageUpdatedEvent, type IOUserConnectedEvent, type IOUserDisconnectedEvent, type InferIORoom, type InferInitContextType, type InferPlatformWebSocketType, type InferRoomContextType, type JWT, type JWTEncodeParams, type MergedRouter, type PlatformConfig, PluvIO, type PluvIOConfig, type PluvIOListeners, PluvProcedure, type PluvProcedureConfig, PluvRouter, type PluvRouterEventConfig, PluvServer, type PluvServerConfig, type ServerConfig, type WebSocketRegistrationMode, type WebSocketSerializedState, type WebSocketSession, authorize, createIO };
package/dist/index.d.ts CHANGED
@@ -191,7 +191,7 @@ type ResolvedPluvIOAuthorize<TPlatform extends AbstractPlatform<any, any, any, a
191
191
  } & UndefinedProps<{
192
192
  secret?: string;
193
193
  }, Exclude<"secret", InferPlatformAuthorizeProperties<TPlatform>>>;
194
- type PluvIOAuthorize<TPlatform extends AbstractPlatform<any, any, any, any>, TUser extends BaseUser = any, TContext extends Record<string, unknown> = {}> = ResolvedPluvIOAuthorize<TPlatform, TUser> | ((context: TContext) => ResolvedPluvIOAuthorize<TPlatform, TUser>);
194
+ type PluvIOAuthorize<TPlatform extends AbstractPlatform<any, any, any, any>, TUser extends BaseUser | null = any, TContext extends Record<string, unknown> = {}> = (TUser extends BaseUser ? ResolvedPluvIOAuthorize<TPlatform, TUser> : null) | ((context: TContext) => TUser extends BaseUser ? ResolvedPluvIOAuthorize<TPlatform, TUser> : null);
195
195
  type BasePluvIOListeners<TPlatform extends AbstractPlatform<any, any, any, any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null, TContext extends Record<string, any>, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>> = {
196
196
  onRoomDeleted: (event: IORoomListenerEvent<TContext>) => void;
197
197
  onRoomMessage: (event: IORoomMessageEvent<TPlatform, TAuthorize, TContext, TEvents>) => void;
@@ -463,13 +463,13 @@ declare class PluvIO<TPlatform extends AbstractPlatform<any> = AbstractPlatform<
463
463
  private _getIOAuthorize;
464
464
  }
465
465
 
466
- type CreateIOParams<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TContext extends Record<string, any> = {}, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null = null> = {
467
- authorize?: TAuthorize;
466
+ type CreateIOParams<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TContext extends Record<string, any> = {}, TUser extends BaseUser | null = null> = {
467
+ authorize?: PluvIOAuthorize<TPlatform, TUser, InferInitContextType<TPlatform>>;
468
468
  context?: PluvContext<TPlatform, TContext>;
469
469
  crdt?: CrdtLibraryType;
470
470
  debug?: boolean;
471
471
  platform: TPlatform;
472
472
  };
473
- declare const createIO: <TPlatform extends AbstractPlatform<any> = AbstractPlatform<any, {}, {}, PlatformConfig>, TContext extends Record<string, any> = {}, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null = null>(params: CreateIOParams<TPlatform, TContext, TAuthorize>) => PluvIO<TPlatform, TAuthorize, TContext>;
473
+ declare const createIO: <TPlatform extends AbstractPlatform<any> = AbstractPlatform<any, {}, {}, PlatformConfig>, TContext extends Record<string, any> = {}, TUser extends BaseUser | null = null>(params: CreateIOParams<TPlatform, TContext, TUser>) => PluvIO<TPlatform, PluvIOAuthorize<TPlatform, TUser, InferInitContextType<TPlatform>>, TContext>;
474
474
 
475
475
  export { type AbstractCloseEvent, type AbstractErrorEvent, type AbstractEvent, type AbstractEventMap, type AbstractListener, type AbstractMessageEvent, AbstractPersistence, AbstractPlatform, type AbstractPlatformConfig, AbstractPubSub, AbstractWebSocket, type AbstractWebSocketConfig, type AbstractWebSocketHandleErrorParams, type AuthorizeModule, type AuthorizeParams, type ConvertWebSocketConfig, type CrdtLibraryType, type CreateIOParams, type CreateRoomOptions, type GetInitialStorageFn, type HandleMode, type IOPubSubEventMessage, IORoom, type IORoomListenerEvent, type IORoomMessageEvent, type IOStorageUpdatedEvent, type IOUserConnectedEvent, type IOUserDisconnectedEvent, type InferIORoom, type InferInitContextType, type InferPlatformWebSocketType, type InferRoomContextType, type JWT, type JWTEncodeParams, type MergedRouter, type PlatformConfig, PluvIO, type PluvIOConfig, type PluvIOListeners, PluvProcedure, type PluvProcedureConfig, PluvRouter, type PluvRouterEventConfig, PluvServer, type PluvServerConfig, type ServerConfig, type WebSocketRegistrationMode, type WebSocketSerializedState, type WebSocketSession, authorize, createIO };
package/dist/index.js CHANGED
@@ -998,7 +998,7 @@ var IORoom = class {
998
998
  };
999
999
 
1000
1000
  // src/version.generated.ts
1001
- var version = "0.35.0";
1001
+ var version = "0.35.2";
1002
1002
 
1003
1003
  // src/PluvServer.ts
1004
1004
  var PluvServer = class {
package/dist/index.mjs CHANGED
@@ -956,7 +956,7 @@ var IORoom = class {
956
956
  };
957
957
 
958
958
  // src/version.generated.ts
959
- var version = "0.35.0";
959
+ var version = "0.35.2";
960
960
 
961
961
  // src/PluvServer.ts
962
962
  var PluvServer = class {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/io",
3
- "version": "0.35.0",
3
+ "version": "0.35.2",
4
4
  "description": "@pluv/io server-side websocket manager",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -21,16 +21,16 @@
21
21
  "jose": "^5.9.6",
22
22
  "kleur": "^4.1.5",
23
23
  "wonka": "^6.3.4",
24
- "@pluv/crdt": "^0.35.0",
25
- "@pluv/types": "^0.35.0"
24
+ "@pluv/crdt": "^0.35.2",
25
+ "@pluv/types": "^0.35.2"
26
26
  },
27
27
  "devDependencies": {
28
28
  "eslint": "^8.57.1",
29
29
  "genversion": "^3.2.0",
30
30
  "tsup": "^8.3.5",
31
- "typescript": "^5.7.2",
32
- "@pluv/tsconfig": "^0.35.0",
33
- "eslint-config-pluv": "^0.35.0"
31
+ "typescript": "^5.7.3",
32
+ "@pluv/tsconfig": "^0.35.2",
33
+ "eslint-config-pluv": "^0.35.2"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "pnpm run version && tsup src/index.ts --format esm,cjs --dts",
package/src/createIO.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { BaseUser } from "@pluv/types";
1
2
  import type { AbstractPlatform, InferInitContextType } from "./AbstractPlatform";
2
3
  import { PluvIO } from "./PluvIO";
3
4
  import type { CrdtLibraryType, PluvContext, PluvIOAuthorize } from "./types";
@@ -5,9 +6,9 @@ import type { CrdtLibraryType, PluvContext, PluvIOAuthorize } from "./types";
5
6
  export type CreateIOParams<
6
7
  TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>,
7
8
  TContext extends Record<string, any> = {},
8
- TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null = null,
9
+ TUser extends BaseUser | null = null,
9
10
  > = {
10
- authorize?: TAuthorize;
11
+ authorize?: PluvIOAuthorize<TPlatform, TUser, InferInitContextType<TPlatform>>;
11
12
  context?: PluvContext<TPlatform, TContext>;
12
13
  crdt?: CrdtLibraryType;
13
14
  debug?: boolean;
@@ -17,13 +18,13 @@ export type CreateIOParams<
17
18
  export const createIO = <
18
19
  TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>,
19
20
  TContext extends Record<string, any> = {},
20
- TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null = null,
21
+ TUser extends BaseUser | null = null,
21
22
  >(
22
- params: CreateIOParams<TPlatform, TContext, TAuthorize>,
23
- ): PluvIO<TPlatform, TAuthorize, TContext> => {
23
+ params: CreateIOParams<TPlatform, TContext, TUser>,
24
+ ): PluvIO<TPlatform, PluvIOAuthorize<TPlatform, TUser, InferInitContextType<TPlatform>>, TContext> => {
24
25
  const { authorize, context, crdt, debug, platform } = params;
25
26
 
26
- return new PluvIO<TPlatform, TAuthorize, TContext>({
27
+ return new PluvIO<TPlatform, PluvIOAuthorize<TPlatform, TUser, InferInitContextType<TPlatform>>, TContext>({
27
28
  authorize,
28
29
  context,
29
30
  crdt,
package/src/types.ts CHANGED
@@ -140,9 +140,11 @@ export type ResolvedPluvIOAuthorize<
140
140
 
141
141
  export type PluvIOAuthorize<
142
142
  TPlatform extends AbstractPlatform<any, any, any, any>,
143
- TUser extends BaseUser = any,
143
+ TUser extends BaseUser | null = any,
144
144
  TContext extends Record<string, unknown> = {},
145
- > = ResolvedPluvIOAuthorize<TPlatform, TUser> | ((context: TContext) => ResolvedPluvIOAuthorize<TPlatform, TUser>);
145
+ > =
146
+ | (TUser extends BaseUser ? ResolvedPluvIOAuthorize<TPlatform, TUser> : null)
147
+ | ((context: TContext) => TUser extends BaseUser ? ResolvedPluvIOAuthorize<TPlatform, TUser> : null);
146
148
 
147
149
  export type BasePluvIOListeners<
148
150
  TPlatform extends AbstractPlatform<any, any, any, any>,
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '0.35.0'
2
+ export const version = '0.35.2'