@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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @pluv/io@0.3.6 build /home/runner/work/pluv/pluv/packages/io
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
  CLI Building entry: src/index.ts
@@ -8,10 +8,10 @@
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- ESM dist/index.mjs 27.19 KB
12
- ESM ⚡️ Build success in 112ms
13
- CJS dist/index.js 29.25 KB
14
- CJS ⚡️ Build success in 113ms
11
+ CJS dist/index.js 29.32 KB
12
+ CJS ⚡️ Build success in 63ms
13
+ ESM dist/index.mjs 27.26 KB
14
+ ESM ⚡️ Build success in 79ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 2971ms
17
- DTS dist/index.d.ts 12.73 KB
16
+ DTS ⚡️ Build success in 2692ms
17
+ DTS dist/index.d.ts 12.82 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @pluv/io
2
2
 
3
+ ## 0.3.7
4
+
5
+ ### Patch Changes
6
+
7
+ - ecc4040: added ability to set debug when room is created
8
+
3
9
  ## 0.3.6
4
10
 
5
11
  ### Patch Changes
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/io",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "@pluv/io server-side websocket manager",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
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";