@pluv/io 3.1.0 → 3.1.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 +9 -9
- package/CHANGELOG.md +8 -0
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +5 -5
- package/dist/index.mjs +5 -5
- package/package.json +5 -5
- package/src/PluvIO.ts +29 -12
- package/src/version.generated.ts +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/io@3.1.
|
|
2
|
+
> @pluv/io@3.1.1 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@3.1.
|
|
6
|
+
> @pluv/io@3.1.1 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
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
[34mCLI[39m Target: es6
|
|
13
13
|
[34mESM[39m Build start
|
|
14
14
|
[34mCJS[39m Build start
|
|
15
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m52.
|
|
16
|
-
[32mESM[39m ⚡️ Build success in
|
|
17
|
-
[32mCJS[39m [1mdist/index.js [22m[32m54.
|
|
18
|
-
[32mCJS[39m ⚡️ Build success in
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m52.51 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 116ms
|
|
17
|
+
[32mCJS[39m [1mdist/index.js [22m[32m54.68 KB[39m
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 119ms
|
|
19
19
|
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in
|
|
21
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m33.
|
|
22
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m33.
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 4316ms
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m33.94 KB[39m
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m33.94 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractCrdtDocFactory, CrdtLibraryType as CrdtLibraryType$1, NoopCrdtDocFactory } from '@pluv/crdt';
|
|
2
2
|
export { CrdtLibraryType } from '@pluv/crdt';
|
|
3
|
-
import { JsonObject, IOAuthorize, InferIOAuthorizeUser, MaybePromise, IOEventMessage, EventRecord, ProcedureLike, InputZodLike, IORouterLike, BaseUser, UndefinedProps, CrdtDocLike, Id, InferEventMessage, InferEventsOutput, Maybe, IOLike, InferIOOutput, CrdtLibraryType, InferIOInput, InferIOAuthorize } from '@pluv/types';
|
|
3
|
+
import { JsonObject, IOAuthorize, InferIOAuthorizeUser, MaybePromise, IOEventMessage, EventRecord, ProcedureLike, InputZodLike, IORouterLike, BaseUser, UndefinedProps, CrdtDocLike, Id, InferEventMessage, InferEventsOutput, Maybe, IOLike, InferIOOutput, CrdtLibraryType, InferIOInput, InferIOAuthorize, HasRequiredProperty } from '@pluv/types';
|
|
4
4
|
export { BaseUser, EventMessage, EventRecord, IOEventMessage } from '@pluv/types';
|
|
5
5
|
|
|
6
6
|
declare abstract class AbstractPersistence {
|
|
@@ -494,9 +494,10 @@ type ResolvedServerConfig<TPlatform extends AbstractPlatform<any> = AbstractPlat
|
|
|
494
494
|
} : {
|
|
495
495
|
getInitialStorage: GetInitialStorageFn<TContext>;
|
|
496
496
|
});
|
|
497
|
-
type
|
|
497
|
+
type BaseServerConfig<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null = any, TContext extends Record<string, any> = {}, TCrdt extends CrdtLibraryType$1<any> = CrdtLibraryType$1<NoopCrdtDocFactory>, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {}> = {
|
|
498
498
|
[P in keyof ResolvedServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents> as ResolvedServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>[P] extends undefined ? never : P]: ResolvedServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>[P];
|
|
499
499
|
};
|
|
500
|
+
type ServerConfig<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null = any, TContext extends Record<string, any> = {}, TCrdt extends CrdtLibraryType$1<any> = CrdtLibraryType$1<NoopCrdtDocFactory>, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {}> = HasRequiredProperty<BaseServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>> extends true ? [BaseServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>] : [BaseServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>?];
|
|
500
501
|
declare class PluvIO<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null = any, TContext extends Record<string, any> = {}, TCrdt extends CrdtLibraryType$1<any> = CrdtLibraryType$1<any>> {
|
|
501
502
|
readonly version: string;
|
|
502
503
|
private readonly _authorize;
|
|
@@ -510,7 +511,7 @@ declare class PluvIO<TPlatform extends AbstractPlatform<any> = AbstractPlatform<
|
|
|
510
511
|
createToken(params: JWTEncodeParams<InferIOAuthorizeUser<TAuthorize>, TPlatform>): Promise<string>;
|
|
511
512
|
mergeRouters<TRouters extends PluvRouter<TPlatform, TAuthorize, TContext, any>[]>(...routers: TRouters): MergedRouter<TRouters>;
|
|
512
513
|
router<TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>>(events: TEvents): PluvRouter<TPlatform, TAuthorize, TContext, TEvents>;
|
|
513
|
-
server<TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {}>(config
|
|
514
|
+
server<TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {}>(...config: ServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>): PluvServer<TPlatform, TAuthorize, TContext, TCrdt, TEvents>;
|
|
514
515
|
private _getIOAuthorize;
|
|
515
516
|
}
|
|
516
517
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractCrdtDocFactory, CrdtLibraryType as CrdtLibraryType$1, NoopCrdtDocFactory } from '@pluv/crdt';
|
|
2
2
|
export { CrdtLibraryType } from '@pluv/crdt';
|
|
3
|
-
import { JsonObject, IOAuthorize, InferIOAuthorizeUser, MaybePromise, IOEventMessage, EventRecord, ProcedureLike, InputZodLike, IORouterLike, BaseUser, UndefinedProps, CrdtDocLike, Id, InferEventMessage, InferEventsOutput, Maybe, IOLike, InferIOOutput, CrdtLibraryType, InferIOInput, InferIOAuthorize } from '@pluv/types';
|
|
3
|
+
import { JsonObject, IOAuthorize, InferIOAuthorizeUser, MaybePromise, IOEventMessage, EventRecord, ProcedureLike, InputZodLike, IORouterLike, BaseUser, UndefinedProps, CrdtDocLike, Id, InferEventMessage, InferEventsOutput, Maybe, IOLike, InferIOOutput, CrdtLibraryType, InferIOInput, InferIOAuthorize, HasRequiredProperty } from '@pluv/types';
|
|
4
4
|
export { BaseUser, EventMessage, EventRecord, IOEventMessage } from '@pluv/types';
|
|
5
5
|
|
|
6
6
|
declare abstract class AbstractPersistence {
|
|
@@ -494,9 +494,10 @@ type ResolvedServerConfig<TPlatform extends AbstractPlatform<any> = AbstractPlat
|
|
|
494
494
|
} : {
|
|
495
495
|
getInitialStorage: GetInitialStorageFn<TContext>;
|
|
496
496
|
});
|
|
497
|
-
type
|
|
497
|
+
type BaseServerConfig<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null = any, TContext extends Record<string, any> = {}, TCrdt extends CrdtLibraryType$1<any> = CrdtLibraryType$1<NoopCrdtDocFactory>, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {}> = {
|
|
498
498
|
[P in keyof ResolvedServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents> as ResolvedServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>[P] extends undefined ? never : P]: ResolvedServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>[P];
|
|
499
499
|
};
|
|
500
|
+
type ServerConfig<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null = any, TContext extends Record<string, any> = {}, TCrdt extends CrdtLibraryType$1<any> = CrdtLibraryType$1<NoopCrdtDocFactory>, TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {}> = HasRequiredProperty<BaseServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>> extends true ? [BaseServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>] : [BaseServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>?];
|
|
500
501
|
declare class PluvIO<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends PluvIOAuthorize<TPlatform, any, InferInitContextType<TPlatform>> | null = any, TContext extends Record<string, any> = {}, TCrdt extends CrdtLibraryType$1<any> = CrdtLibraryType$1<any>> {
|
|
501
502
|
readonly version: string;
|
|
502
503
|
private readonly _authorize;
|
|
@@ -510,7 +511,7 @@ declare class PluvIO<TPlatform extends AbstractPlatform<any> = AbstractPlatform<
|
|
|
510
511
|
createToken(params: JWTEncodeParams<InferIOAuthorizeUser<TAuthorize>, TPlatform>): Promise<string>;
|
|
511
512
|
mergeRouters<TRouters extends PluvRouter<TPlatform, TAuthorize, TContext, any>[]>(...routers: TRouters): MergedRouter<TRouters>;
|
|
512
513
|
router<TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext>>(events: TEvents): PluvRouter<TPlatform, TAuthorize, TContext, TEvents>;
|
|
513
|
-
server<TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {}>(config
|
|
514
|
+
server<TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {}>(...config: ServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>): PluvServer<TPlatform, TAuthorize, TContext, TCrdt, TEvents>;
|
|
514
515
|
private _getIOAuthorize;
|
|
515
516
|
}
|
|
516
517
|
|
package/dist/index.js
CHANGED
|
@@ -1170,7 +1170,7 @@ var IORoom = class {
|
|
|
1170
1170
|
};
|
|
1171
1171
|
|
|
1172
1172
|
// src/version.generated.ts
|
|
1173
|
-
var version = "3.1.
|
|
1173
|
+
var version = "3.1.1";
|
|
1174
1174
|
|
|
1175
1175
|
// src/PluvServer.ts
|
|
1176
1176
|
var PluvServer = class {
|
|
@@ -1493,10 +1493,10 @@ var PluvIO = class {
|
|
|
1493
1493
|
}
|
|
1494
1494
|
return new PluvRouter(events);
|
|
1495
1495
|
}
|
|
1496
|
-
server(config
|
|
1497
|
-
var _a;
|
|
1498
|
-
return new PluvServer(__spreadProps(__spreadValues({}, config), {
|
|
1499
|
-
authorize: (
|
|
1496
|
+
server(...config) {
|
|
1497
|
+
var _a, _b;
|
|
1498
|
+
return new PluvServer(__spreadProps(__spreadValues({}, (_a = config[0]) != null ? _a : {}), {
|
|
1499
|
+
authorize: (_b = this._authorize) != null ? _b : void 0,
|
|
1500
1500
|
context: this._context,
|
|
1501
1501
|
crdt: this._crdt,
|
|
1502
1502
|
debug: this._debug,
|
package/dist/index.mjs
CHANGED
|
@@ -1128,7 +1128,7 @@ var IORoom = class {
|
|
|
1128
1128
|
};
|
|
1129
1129
|
|
|
1130
1130
|
// src/version.generated.ts
|
|
1131
|
-
var version = "3.1.
|
|
1131
|
+
var version = "3.1.1";
|
|
1132
1132
|
|
|
1133
1133
|
// src/PluvServer.ts
|
|
1134
1134
|
var PluvServer = class {
|
|
@@ -1451,10 +1451,10 @@ var PluvIO = class {
|
|
|
1451
1451
|
}
|
|
1452
1452
|
return new PluvRouter(events);
|
|
1453
1453
|
}
|
|
1454
|
-
server(config
|
|
1455
|
-
var _a;
|
|
1456
|
-
return new PluvServer(__spreadProps(__spreadValues({}, config), {
|
|
1457
|
-
authorize: (
|
|
1454
|
+
server(...config) {
|
|
1455
|
+
var _a, _b;
|
|
1456
|
+
return new PluvServer(__spreadProps(__spreadValues({}, (_a = config[0]) != null ? _a : {}), {
|
|
1457
|
+
authorize: (_b = this._authorize) != null ? _b : void 0,
|
|
1458
1458
|
context: this._context,
|
|
1459
1459
|
crdt: this._crdt,
|
|
1460
1460
|
debug: this._debug,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/io",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
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.10.0",
|
|
22
22
|
"kleur": "^4.1.5",
|
|
23
23
|
"wonka": "^6.3.5",
|
|
24
|
-
"@pluv/crdt": "^3.1.
|
|
25
|
-
"@pluv/types": "^3.1.
|
|
24
|
+
"@pluv/crdt": "^3.1.1",
|
|
25
|
+
"@pluv/types": "^3.1.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"eslint": "^9.27.0",
|
|
29
29
|
"genversion": "^3.2.0",
|
|
30
30
|
"tsup": "^8.5.0",
|
|
31
31
|
"typescript": "^5.8.3",
|
|
32
|
-
"@pluv/tsconfig": "^3.1.
|
|
33
|
-
"eslint-config-pluv": "^3.1.
|
|
32
|
+
"@pluv/tsconfig": "^3.1.1",
|
|
33
|
+
"eslint-config-pluv": "^3.1.1"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "pnpm run version && tsup src/index.ts --format esm,cjs --dts",
|
package/src/PluvIO.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AbstractCrdtDocFactory, CrdtLibraryType, NoopCrdtDocFactory } from "@pluv/crdt";
|
|
2
2
|
import { noop } from "@pluv/crdt";
|
|
3
|
-
import type { BaseUser, IOAuthorize, InferIOAuthorizeUser } from "@pluv/types";
|
|
3
|
+
import type { BaseUser, HasRequiredProperty, IOAuthorize, InferIOAuthorizeUser } from "@pluv/types";
|
|
4
4
|
import type { AbstractPlatform, InferInitContextType } from "./AbstractPlatform";
|
|
5
5
|
import type { WebSocketRegisterConfig } from "./IORoom";
|
|
6
6
|
import { PluvProcedure } from "./PluvProcedure";
|
|
@@ -56,7 +56,7 @@ type ResolvedServerConfig<
|
|
|
56
56
|
? { getInitialStorage?: "[ERROR]: Must specify crdt to use getInitialStorage" }
|
|
57
57
|
: { getInitialStorage: GetInitialStorageFn<TContext> });
|
|
58
58
|
|
|
59
|
-
export type
|
|
59
|
+
export type BaseServerConfig<
|
|
60
60
|
TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>,
|
|
61
61
|
TAuthorize extends PluvIOAuthorize<
|
|
62
62
|
TPlatform,
|
|
@@ -78,6 +78,23 @@ export type ServerConfig<
|
|
|
78
78
|
: P]: ResolvedServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>[P];
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
+
export type ServerConfig<
|
|
82
|
+
TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>,
|
|
83
|
+
TAuthorize extends PluvIOAuthorize<
|
|
84
|
+
TPlatform,
|
|
85
|
+
any,
|
|
86
|
+
InferInitContextType<TPlatform>
|
|
87
|
+
> | null = any,
|
|
88
|
+
TContext extends Record<string, any> = {},
|
|
89
|
+
TCrdt extends CrdtLibraryType<any> = CrdtLibraryType<NoopCrdtDocFactory>,
|
|
90
|
+
TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {},
|
|
91
|
+
> =
|
|
92
|
+
HasRequiredProperty<
|
|
93
|
+
BaseServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>
|
|
94
|
+
> extends true
|
|
95
|
+
? [BaseServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>]
|
|
96
|
+
: [BaseServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>?];
|
|
97
|
+
|
|
81
98
|
export class PluvIO<
|
|
82
99
|
TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>,
|
|
83
100
|
TAuthorize extends PluvIOAuthorize<
|
|
@@ -187,24 +204,24 @@ export class PluvIO<
|
|
|
187
204
|
}
|
|
188
205
|
|
|
189
206
|
public server<TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {}>(
|
|
190
|
-
config: ServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>
|
|
191
|
-
TPlatform,
|
|
192
|
-
TAuthorize,
|
|
193
|
-
TContext,
|
|
194
|
-
TCrdt,
|
|
195
|
-
TEvents
|
|
196
|
-
>,
|
|
207
|
+
...config: ServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>
|
|
197
208
|
): PluvServer<TPlatform, TAuthorize, TContext, TCrdt, TEvents> {
|
|
198
209
|
return new PluvServer<TPlatform, TAuthorize, TContext, TCrdt, TEvents>({
|
|
199
|
-
...config
|
|
210
|
+
...((config[0] ?? {}) as PluvServerConfig<
|
|
211
|
+
TPlatform,
|
|
212
|
+
TAuthorize,
|
|
213
|
+
TContext,
|
|
214
|
+
TCrdt,
|
|
215
|
+
TEvents
|
|
216
|
+
>),
|
|
200
217
|
authorize: this._authorize ?? undefined,
|
|
201
218
|
context: this._context,
|
|
202
219
|
crdt: this._crdt,
|
|
203
220
|
debug: this._debug,
|
|
204
|
-
io: this as PluvIO<TPlatform, TAuthorize, TContext>,
|
|
221
|
+
io: this as PluvIO<TPlatform, TAuthorize, TContext, TCrdt>,
|
|
205
222
|
limits: this._limits,
|
|
206
223
|
platform: this._platform,
|
|
207
|
-
}
|
|
224
|
+
});
|
|
208
225
|
}
|
|
209
226
|
|
|
210
227
|
private _getIOAuthorize(
|
package/src/version.generated.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '3.1.
|
|
2
|
+
export const version = '3.1.1'
|