@pluv/platform-pluv 2.2.2 → 2.2.3

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/platform-pluv@2.2.2 build /home/runner/work/pluv/pluv/packages/platform-pluv
2
+ > @pluv/platform-pluv@2.2.3 build /home/runner/work/pluv/pluv/packages/platform-pluv
3
3
  > tsup src/index.ts --format esm,cjs --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,11 +8,11 @@
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- CJS dist/index.js 14.25 KB
12
- CJS ⚡️ Build success in 96ms
13
- ESM dist/index.mjs 12.42 KB
14
- ESM ⚡️ Build success in 99ms
11
+ ESM dist/index.mjs 12.70 KB
12
+ ESM ⚡️ Build success in 121ms
13
+ CJS dist/index.js 14.54 KB
14
+ CJS ⚡️ Build success in 124ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 5981ms
17
- DTS dist/index.d.mts 3.65 KB
18
- DTS dist/index.d.ts 3.65 KB
16
+ DTS ⚡️ Build success in 6328ms
17
+ DTS dist/index.d.mts 3.72 KB
18
+ DTS dist/index.d.ts 3.72 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @pluv/platform-pluv
2
2
 
3
+ ## 2.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - feeae21: Added debug logging.
8
+ - @pluv/crdt@2.2.3
9
+ - @pluv/io@2.2.3
10
+ - @pluv/types@2.2.3
11
+
3
12
  ## 2.2.2
4
13
 
5
14
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -15,6 +15,7 @@ interface PluvPlatformConfig<TContext extends Record<string, any> = {}> {
15
15
  * @deprecated Internal use only. Changes to this will never be marked as breaking.
16
16
  */
17
17
  _defs?: {
18
+ debug?: boolean;
18
19
  endpoints?: PluvIOEndpoints | (() => MaybePromise<PluvIOEndpoints>);
19
20
  };
20
21
  basePath: string;
@@ -59,6 +60,7 @@ declare class PluvPlatform<TContext extends Record<string, any> = {}, TUser exte
59
60
  private readonly _app;
60
61
  private readonly _basePath;
61
62
  private readonly _context;
63
+ private readonly _debug;
62
64
  private readonly _endpoints;
63
65
  private _getInitialStorage?;
64
66
  private _listeners?;
@@ -79,6 +81,7 @@ declare class PluvPlatform<TContext extends Record<string, any> = {}, TUser exte
79
81
  setSerializedState(webSocket: AbstractWebSocket, state: WebSocketSerializedState): WebSocketSerializedState;
80
82
  validateConfig(config: any): void;
81
83
  private _webhooksRouter;
84
+ private _logDebug;
82
85
  }
83
86
 
84
87
  type PlatformPluvCreateIOParams<TContext extends Record<string, any> = {}, TUser extends BaseUser$1 = BaseUser$1> = Id<PluvPlatformConfig & Omit<CreateIOParams<PluvPlatform, TContext, TUser>, "authorize" | "context" | "limits" | "platform"> & {
package/dist/index.d.ts CHANGED
@@ -15,6 +15,7 @@ interface PluvPlatformConfig<TContext extends Record<string, any> = {}> {
15
15
  * @deprecated Internal use only. Changes to this will never be marked as breaking.
16
16
  */
17
17
  _defs?: {
18
+ debug?: boolean;
18
19
  endpoints?: PluvIOEndpoints | (() => MaybePromise<PluvIOEndpoints>);
19
20
  };
20
21
  basePath: string;
@@ -59,6 +60,7 @@ declare class PluvPlatform<TContext extends Record<string, any> = {}, TUser exte
59
60
  private readonly _app;
60
61
  private readonly _basePath;
61
62
  private readonly _context;
63
+ private readonly _debug;
62
64
  private readonly _endpoints;
63
65
  private _getInitialStorage?;
64
66
  private _listeners?;
@@ -79,6 +81,7 @@ declare class PluvPlatform<TContext extends Record<string, any> = {}, TUser exte
79
81
  setSerializedState(webSocket: AbstractWebSocket, state: WebSocketSerializedState): WebSocketSerializedState;
80
82
  validateConfig(config: any): void;
81
83
  private _webhooksRouter;
84
+ private _logDebug;
82
85
  }
83
86
 
84
87
  type PlatformPluvCreateIOParams<TContext extends Record<string, any> = {}, TUser extends BaseUser$1 = BaseUser$1> = Id<PluvPlatformConfig & Omit<CreateIOParams<PluvPlatform, TContext, TUser>, "authorize" | "context" | "limits" | "platform"> & {
package/dist/index.js CHANGED
@@ -217,7 +217,7 @@ var verifyWebhook = (params) => __async(null, null, function* () {
217
217
  // src/PluvPlatform.ts
218
218
  var PluvPlatform = class extends import_io.AbstractPlatform {
219
219
  constructor(params) {
220
- var _a;
220
+ var _a, _b;
221
221
  super();
222
222
  this._config = {
223
223
  authorize: {
@@ -244,6 +244,7 @@ var PluvPlatform = class extends import_io.AbstractPlatform {
244
244
  typeof this._publicKey === "string" ? this._publicKey : this._publicKey(),
245
245
  typeof this._secretKey === "string" ? this._secretKey : this._secretKey()
246
246
  ]);
247
+ this._logDebug({ endpoints, publicKey, secretKey });
247
248
  const res = yield fetch(endpoints.createToken, {
248
249
  headers: { "content-type": "application/json" },
249
250
  method: "post",
@@ -254,7 +255,10 @@ var PluvPlatform = class extends import_io.AbstractPlatform {
254
255
  secretKey,
255
256
  user: parsed
256
257
  })
257
- }).catch(() => null);
258
+ }).catch((error) => {
259
+ this._logDebug(error);
260
+ return null;
261
+ });
258
262
  if (!res || !res.ok || res.status !== 200) {
259
263
  throw new Error("Authorization failed");
260
264
  }
@@ -337,10 +341,11 @@ var PluvPlatform = class extends import_io.AbstractPlatform {
337
341
  return createErrorResponse(c, { message }, status);
338
342
  }
339
343
  }));
340
- const { _defs, context, basePath, publicKey, secretKey, webhookSecret } = params;
344
+ const { _defs, basePath, context, publicKey, secretKey, webhookSecret } = params;
341
345
  this._basePath = basePath;
342
346
  this._context = typeof context === "function" ? context(this._roomContext) : context;
343
- this._endpoints = (_a = _defs == null ? void 0 : _defs.endpoints) != null ? _a : {
347
+ this._debug = (_a = _defs == null ? void 0 : _defs.debug) != null ? _a : false;
348
+ this._endpoints = (_b = _defs == null ? void 0 : _defs.endpoints) != null ? _b : {
344
349
  createToken: "https://rooms.pluv.io/api/room/token"
345
350
  };
346
351
  this._publicKey = publicKey;
@@ -402,6 +407,10 @@ var PluvPlatform = class extends import_io.AbstractPlatform {
402
407
  }
403
408
  };
404
409
  }
410
+ _logDebug(...args) {
411
+ if (!this._debug) return;
412
+ console.log(...args);
413
+ }
405
414
  };
406
415
 
407
416
  // src/platformPluv.ts
package/dist/index.mjs CHANGED
@@ -187,7 +187,7 @@ var verifyWebhook = (params) => __async(null, null, function* () {
187
187
  // src/PluvPlatform.ts
188
188
  var PluvPlatform = class extends AbstractPlatform {
189
189
  constructor(params) {
190
- var _a;
190
+ var _a, _b;
191
191
  super();
192
192
  this._config = {
193
193
  authorize: {
@@ -214,6 +214,7 @@ var PluvPlatform = class extends AbstractPlatform {
214
214
  typeof this._publicKey === "string" ? this._publicKey : this._publicKey(),
215
215
  typeof this._secretKey === "string" ? this._secretKey : this._secretKey()
216
216
  ]);
217
+ this._logDebug({ endpoints, publicKey, secretKey });
217
218
  const res = yield fetch(endpoints.createToken, {
218
219
  headers: { "content-type": "application/json" },
219
220
  method: "post",
@@ -224,7 +225,10 @@ var PluvPlatform = class extends AbstractPlatform {
224
225
  secretKey,
225
226
  user: parsed
226
227
  })
227
- }).catch(() => null);
228
+ }).catch((error) => {
229
+ this._logDebug(error);
230
+ return null;
231
+ });
228
232
  if (!res || !res.ok || res.status !== 200) {
229
233
  throw new Error("Authorization failed");
230
234
  }
@@ -307,10 +311,11 @@ var PluvPlatform = class extends AbstractPlatform {
307
311
  return createErrorResponse(c, { message }, status);
308
312
  }
309
313
  }));
310
- const { _defs, context, basePath, publicKey, secretKey, webhookSecret } = params;
314
+ const { _defs, basePath, context, publicKey, secretKey, webhookSecret } = params;
311
315
  this._basePath = basePath;
312
316
  this._context = typeof context === "function" ? context(this._roomContext) : context;
313
- this._endpoints = (_a = _defs == null ? void 0 : _defs.endpoints) != null ? _a : {
317
+ this._debug = (_a = _defs == null ? void 0 : _defs.debug) != null ? _a : false;
318
+ this._endpoints = (_b = _defs == null ? void 0 : _defs.endpoints) != null ? _b : {
314
319
  createToken: "https://rooms.pluv.io/api/room/token"
315
320
  };
316
321
  this._publicKey = publicKey;
@@ -372,6 +377,10 @@ var PluvPlatform = class extends AbstractPlatform {
372
377
  }
373
378
  };
374
379
  }
380
+ _logDebug(...args) {
381
+ if (!this._debug) return;
382
+ console.log(...args);
383
+ }
375
384
  };
376
385
 
377
386
  // src/platformPluv.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/platform-pluv",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "@pluv/io adapter for pluv.io",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -17,20 +17,20 @@
17
17
  "access": "public"
18
18
  },
19
19
  "dependencies": {
20
- "@types/node": "^22.15.18",
20
+ "@types/node": "^22.15.21",
21
21
  "fast-json-stable-stringify": "^2.1.0",
22
22
  "hono": "^4.7.10",
23
- "zod": "^3.24.4",
24
- "@pluv/crdt": "^2.2.2",
25
- "@pluv/io": "^2.2.2",
26
- "@pluv/types": "^2.2.2"
23
+ "zod": "^3.25.17",
24
+ "@pluv/crdt": "^2.2.3",
25
+ "@pluv/io": "^2.2.3",
26
+ "@pluv/types": "^2.2.3"
27
27
  },
28
28
  "devDependencies": {
29
29
  "eslint": "^9.27.0",
30
30
  "tsup": "^8.5.0",
31
31
  "typescript": "^5.8.3",
32
- "@pluv/tsconfig": "^2.2.2",
33
- "eslint-config-pluv": "^2.2.2"
32
+ "@pluv/tsconfig": "^2.2.3",
33
+ "eslint-config-pluv": "^2.2.3"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsup src/index.ts --format esm,cjs --dts",
@@ -29,6 +29,7 @@ export interface PluvPlatformConfig<TContext extends Record<string, any> = {}> {
29
29
  * @deprecated Internal use only. Changes to this will never be marked as breaking.
30
30
  */
31
31
  _defs?: {
32
+ debug?: boolean;
32
33
  endpoints?: PluvIOEndpoints | (() => MaybePromise<PluvIOEndpoints>);
33
34
  };
34
35
  basePath: string;
@@ -83,6 +84,7 @@ export class PluvPlatform<
83
84
  private readonly _app: Hono;
84
85
  private readonly _basePath: string;
85
86
  private readonly _context: any;
87
+ private readonly _debug: boolean;
86
88
  private readonly _endpoints: PluvIOEndpoints | (() => MaybePromise<PluvIOEndpoints>);
87
89
  private _getInitialStorage?: GetInitialStorageFn<{}>;
88
90
  private _listeners?: PluvIOListeners;
@@ -99,6 +101,8 @@ export class PluvPlatform<
99
101
  typeof this._secretKey === "string" ? this._secretKey : this._secretKey(),
100
102
  ]);
101
103
 
104
+ this._logDebug({ endpoints, publicKey, secretKey });
105
+
102
106
  const res = await fetch(endpoints.createToken, {
103
107
  headers: { "content-type": "application/json" },
104
108
  method: "post",
@@ -109,7 +113,11 @@ export class PluvPlatform<
109
113
  secretKey,
110
114
  user: parsed,
111
115
  }),
112
- }).catch(() => null);
116
+ }).catch((error) => {
117
+ this._logDebug(error);
118
+
119
+ return null;
120
+ });
113
121
 
114
122
  if (!res || !res.ok || res.status !== 200) {
115
123
  throw new Error("Authorization failed");
@@ -125,10 +133,11 @@ export class PluvPlatform<
125
133
  constructor(params: PluvPlatformConfig) {
126
134
  super();
127
135
 
128
- const { _defs, context, basePath, publicKey, secretKey, webhookSecret } = params;
136
+ const { _defs, basePath, context, publicKey, secretKey, webhookSecret } = params;
129
137
 
130
138
  this._basePath = basePath;
131
139
  this._context = typeof context === "function" ? context(this._roomContext) : context;
140
+ this._debug = _defs?.debug ?? false;
132
141
  this._endpoints = _defs?.endpoints ?? {
133
142
  createToken: "https://rooms.pluv.io/api/room/token",
134
143
  };
@@ -296,4 +305,10 @@ export class PluvPlatform<
296
305
  return createErrorResponse(c, { message }, status);
297
306
  }
298
307
  });
308
+
309
+ private _logDebug(...args: any[]): void {
310
+ if (!this._debug) return;
311
+
312
+ console.log(...args);
313
+ }
299
314
  }