@pluv/io 0.3.6 → 0.3.7
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 +6 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +3 -2
- package/dist/index.mjs +3 -2
- package/package.json +1 -1
- package/src/PluvIO.ts +9 -2
- package/src/index.ts +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/io@0.3.
|
|
2
|
+
> @pluv/io@0.3.7 build /home/runner/work/pluv/pluv/packages/io
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
[34mCLI[39m Target: es6
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m29.32 KB[39m
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 63ms
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m27.26 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 79ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m12.
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 2692ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m12.82 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -238,6 +238,9 @@ type PluvIOConfig<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any
|
|
|
238
238
|
initialStorage?: (room: string) => MaybePromise<Maybe<string>>;
|
|
239
239
|
platform: TPlatform;
|
|
240
240
|
};
|
|
241
|
+
interface GetRoomOptions {
|
|
242
|
+
debug?: boolean;
|
|
243
|
+
}
|
|
241
244
|
declare class PluvIO<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, any> = BaseIOAuthorize, TContext extends JsonObject = {}, TInput extends EventRecord<string, any> = {}, TOutput extends EventRecord<string, any> = {}> implements IOLike<TAuthorize, TInput, TOutput> {
|
|
242
245
|
private _context;
|
|
243
246
|
private _initialStorage;
|
|
@@ -250,7 +253,7 @@ declare class PluvIO<TPlatform extends AbstractPlatform<any> = AbstractPlatform<
|
|
|
250
253
|
constructor(options: PluvIOConfig<TPlatform, TAuthorize, TContext, TInput, TOutput>);
|
|
251
254
|
createToken(params: JWTEncodeParams<InferIOAuthorizeUser<InferIOAuthorize<this>>>): Promise<string>;
|
|
252
255
|
event<TEvent extends string, TData extends JsonObject = {}, TResult extends EventRecord<string, any> = {}>(event: TEvent, config: EventConfig<TContext, TData, TResult>): PluvIO<TPlatform, TAuthorize, TContext, Spread<[TInput, EventRecord<TEvent, TData>]>, Spread<[TOutput, TResult]>>;
|
|
253
|
-
getRoom(room: string): IORoom<TPlatform, TAuthorize, TContext, TInput, TOutput>;
|
|
256
|
+
getRoom(room: string, options?: GetRoomOptions): IORoom<TPlatform, TAuthorize, TContext, TInput, TOutput>;
|
|
254
257
|
static merge<TIO1 extends PluvIO, TIO2 extends PluvIO>(first: TIO1, second: TIO2): PluvIO<InferIOPlatform<TIO1>, InferIOAuthorize<TIO1>, InferIOContext<TIO1>, Spread<[InferIOInput<TIO1>, InferIOInput<TIO2>]>, Spread<[InferIOOutput<TIO1>, InferIOOutput<TIO2>]>>;
|
|
255
258
|
private _logDebug;
|
|
256
259
|
}
|
|
@@ -264,4 +267,4 @@ type CreateIOParams<TPlatform extends AbstractPlatform<any> = AbstractPlatform<a
|
|
|
264
267
|
};
|
|
265
268
|
declare const createIO: <TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TContext extends JsonObject = {}, TAuthorizeUser extends BaseUser = BaseUser, TAuthorizeRequired extends boolean = false>(params: CreateIOParams<TPlatform, TContext, TAuthorizeUser, TAuthorizeRequired>) => PluvIO<TPlatform, IOAuthorize<TAuthorizeUser, TAuthorizeRequired>, TContext, BaseClientEventRecord, BaseIOEventRecord<IOAuthorize<TAuthorizeUser, TAuthorizeRequired>>>;
|
|
266
269
|
|
|
267
|
-
export { AbstractCloseEvent, AbstractErrorEvent, AbstractEvent, AbstractEventMap, AbstractListener, AbstractMessageEvent, AbstractPersistance, AbstractPlatform, AbstractPubSub, AbstractWebSocket, AbstractWebSocketConfig, AbstractWebSocketHandleErrorParams, AuthorizeModule, AuthorizeParams, ConvertWebSocketConfig, CreateIOParams, IOPubSubEventMessage, IORoom, InferIORoom, InferWebSocketType, JWT, JWTEncodeParams, PluvIO, createIO };
|
|
270
|
+
export { AbstractCloseEvent, AbstractErrorEvent, AbstractEvent, AbstractEventMap, AbstractListener, AbstractMessageEvent, AbstractPersistance, AbstractPlatform, AbstractPubSub, AbstractWebSocket, AbstractWebSocketConfig, AbstractWebSocketHandleErrorParams, AuthorizeModule, AuthorizeParams, ConvertWebSocketConfig, CreateIOParams, GetRoomOptions, IOPubSubEventMessage, IORoom, InferIORoom, InferWebSocketType, JWT, JWTEncodeParams, PluvIO, createIO };
|
package/dist/index.js
CHANGED
|
@@ -861,8 +861,9 @@ var PluvIO = class {
|
|
|
861
861
|
})
|
|
862
862
|
);
|
|
863
863
|
}
|
|
864
|
-
getRoom(room) {
|
|
864
|
+
getRoom(room, options = {}) {
|
|
865
865
|
var _a;
|
|
866
|
+
const { debug } = options;
|
|
866
867
|
if (!/^[a-z0-9]+[a-z0-9\-_]+[a-z0-9]+$/i.test(room)) {
|
|
867
868
|
throw new Error("Unsupported room name");
|
|
868
869
|
}
|
|
@@ -873,7 +874,7 @@ var PluvIO = class {
|
|
|
873
874
|
const newRoom = new IORoom(room, {
|
|
874
875
|
authorize: (_a = this._authorize) != null ? _a : void 0,
|
|
875
876
|
context: this._context,
|
|
876
|
-
debug: this._debug,
|
|
877
|
+
debug: debug != null ? debug : this._debug,
|
|
877
878
|
events: this._events,
|
|
878
879
|
initialStorage: () => {
|
|
879
880
|
var _a2;
|
package/dist/index.mjs
CHANGED
|
@@ -824,8 +824,9 @@ var PluvIO = class {
|
|
|
824
824
|
})
|
|
825
825
|
);
|
|
826
826
|
}
|
|
827
|
-
getRoom(room) {
|
|
827
|
+
getRoom(room, options = {}) {
|
|
828
828
|
var _a;
|
|
829
|
+
const { debug } = options;
|
|
829
830
|
if (!/^[a-z0-9]+[a-z0-9\-_]+[a-z0-9]+$/i.test(room)) {
|
|
830
831
|
throw new Error("Unsupported room name");
|
|
831
832
|
}
|
|
@@ -836,7 +837,7 @@ var PluvIO = class {
|
|
|
836
837
|
const newRoom = new IORoom(room, {
|
|
837
838
|
authorize: (_a = this._authorize) != null ? _a : void 0,
|
|
838
839
|
context: this._context,
|
|
839
|
-
debug: this._debug,
|
|
840
|
+
debug: debug != null ? debug : this._debug,
|
|
840
841
|
events: this._events,
|
|
841
842
|
initialStorage: () => {
|
|
842
843
|
var _a2;
|
package/package.json
CHANGED
package/src/PluvIO.ts
CHANGED
|
@@ -60,6 +60,10 @@ export type PluvIOConfig<
|
|
|
60
60
|
platform: TPlatform;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
+
export interface GetRoomOptions {
|
|
64
|
+
debug?: boolean;
|
|
65
|
+
}
|
|
66
|
+
|
|
63
67
|
export class PluvIO<
|
|
64
68
|
TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>,
|
|
65
69
|
TAuthorize extends IOAuthorize<any, any> = BaseIOAuthorize,
|
|
@@ -253,8 +257,11 @@ export class PluvIO<
|
|
|
253
257
|
}
|
|
254
258
|
|
|
255
259
|
public getRoom(
|
|
256
|
-
room: string
|
|
260
|
+
room: string,
|
|
261
|
+
options: GetRoomOptions = {}
|
|
257
262
|
): IORoom<TPlatform, TAuthorize, TContext, TInput, TOutput> {
|
|
263
|
+
const { debug } = options;
|
|
264
|
+
|
|
258
265
|
if (!/^[a-z0-9]+[a-z0-9\-_]+[a-z0-9]+$/i.test(room)) {
|
|
259
266
|
throw new Error("Unsupported room name");
|
|
260
267
|
}
|
|
@@ -273,7 +280,7 @@ export class PluvIO<
|
|
|
273
280
|
>(room, {
|
|
274
281
|
authorize: this._authorize ?? undefined,
|
|
275
282
|
context: this._context,
|
|
276
|
-
debug: this._debug,
|
|
283
|
+
debug: debug ?? this._debug,
|
|
277
284
|
events: this._events,
|
|
278
285
|
initialStorage: () => this._initialStorage?.(room),
|
|
279
286
|
onDestroy: (encodedState) => {
|
package/src/index.ts
CHANGED
|
@@ -32,4 +32,4 @@ export type {
|
|
|
32
32
|
export type { CreateIOParams } from "./createIO";
|
|
33
33
|
export { createIO } from "./createIO";
|
|
34
34
|
export type { IORoom } from "./IORoom";
|
|
35
|
-
export type { InferIORoom, PluvIO } from "./PluvIO";
|
|
35
|
+
export type { GetRoomOptions, InferIORoom, PluvIO } from "./PluvIO";
|