@pluv/io 0.35.1 → 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.
- package/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +9 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +5 -5
- package/src/createIO.ts +7 -6
- package/src/types.ts +4 -2
- package/src/version.generated.ts +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/io@0.35.
|
|
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.
|
|
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
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
[34mESM[39m Build start
|
|
14
14
|
[34mCJS[39m Build start
|
|
15
15
|
[32mCJS[39m [1mdist/index.js [22m[32m45.71 KB[39m
|
|
16
|
-
[32mCJS[39m ⚡️ Build success in
|
|
16
|
+
[32mCJS[39m ⚡️ Build success in 180ms
|
|
17
17
|
[32mESM[39m [1mdist/index.mjs [22m[32m43.53 KB[39m
|
|
18
|
-
[32mESM[39m ⚡️ Build success in
|
|
18
|
+
[32mESM[39m ⚡️ Build success in 182ms
|
|
19
19
|
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in
|
|
21
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m29.
|
|
22
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m29.
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 2487ms
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m29.63 KB[39m
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m29.63 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
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
|
+
|
|
3
12
|
## 0.35.1
|
|
4
13
|
|
|
5
14
|
### Patch 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> = {},
|
|
467
|
-
authorize?:
|
|
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> = {},
|
|
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> = {},
|
|
467
|
-
authorize?:
|
|
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> = {},
|
|
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
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/io",
|
|
3
|
-
"version": "0.35.
|
|
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.
|
|
25
|
-
"@pluv/types": "^0.35.
|
|
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
31
|
"typescript": "^5.7.3",
|
|
32
|
-
"@pluv/tsconfig": "^0.35.
|
|
33
|
-
"eslint-config-pluv": "^0.35.
|
|
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
|
-
|
|
9
|
+
TUser extends BaseUser | null = null,
|
|
9
10
|
> = {
|
|
10
|
-
authorize?:
|
|
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
|
-
|
|
21
|
+
TUser extends BaseUser | null = null,
|
|
21
22
|
>(
|
|
22
|
-
params: CreateIOParams<TPlatform, TContext,
|
|
23
|
-
): PluvIO<TPlatform,
|
|
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,
|
|
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
|
-
> =
|
|
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>,
|
package/src/version.generated.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '0.35.
|
|
2
|
+
export const version = '0.35.2'
|