@pluv/client 0.38.1 → 0.38.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/client@0.38.1 build /home/runner/work/pluv/pluv/packages/client
2
+ > @pluv/client@0.38.3 build /home/runner/work/pluv/pluv/packages/client
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 48.91 KB
12
- CJS ⚡️ Build success in 115ms
13
- ESM dist/index.mjs 47.59 KB
14
- ESM ⚡️ Build success in 129ms
11
+ CJS dist/index.js 49.48 KB
12
+ CJS ⚡️ Build success in 118ms
13
+ ESM dist/index.mjs 48.17 KB
14
+ ESM ⚡️ Build success in 119ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 3357ms
17
- DTS dist/index.d.mts 23.13 KB
18
- DTS dist/index.d.ts 23.13 KB
16
+ DTS ⚡️ Build success in 3259ms
17
+ DTS dist/index.d.mts 23.16 KB
18
+ DTS dist/index.d.ts 23.16 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @pluv/client
2
2
 
3
+ ## 0.38.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 8346273: Disallow the `# @pluv/client character in router event names.
8
+ - @pluv/crdt@0.38.3
9
+ - @pluv/types@0.38.3
10
+
11
+ ## 0.38.2
12
+
13
+ ### Patch Changes
14
+
15
+ - de35f0b: Require `PluvRouter` event names to be formatted as valid JavaScript variable names.
16
+ - @pluv/crdt@0.38.2
17
+ - @pluv/types@0.38.2
18
+
3
19
  ## 0.38.1
4
20
 
5
21
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -86,6 +86,7 @@ declare class PluvRouter<TIO extends IOLike = IOLike, TPresence extends JsonObje
86
86
  };
87
87
  constructor(events: TEvents);
88
88
  static merge<TRouters extends PluvRouter<any, any, any, any>[]>(...routers: TRouters): MergedRouter<TRouters>;
89
+ private _isValidEventName;
89
90
  }
90
91
 
91
92
  interface StateNotifierSubjects<TIO extends IOLike, TPresence extends JsonObject> {
package/dist/index.d.ts CHANGED
@@ -86,6 +86,7 @@ declare class PluvRouter<TIO extends IOLike = IOLike, TPresence extends JsonObje
86
86
  };
87
87
  constructor(events: TEvents);
88
88
  static merge<TRouters extends PluvRouter<any, any, any, any>[]>(...routers: TRouters): MergedRouter<TRouters>;
89
+ private _isValidEventName;
89
90
  }
90
91
 
91
92
  interface StateNotifierSubjects<TIO extends IOLike, TPresence extends JsonObject> {
package/dist/index.js CHANGED
@@ -249,6 +249,12 @@ var OtherNotifier = class {
249
249
  var PluvRouter = class _PluvRouter {
250
250
  constructor(events) {
251
251
  this._defs = { events: {} };
252
+ const invalidName = Object.keys(events).find((name) => !this._isValidEventName(name));
253
+ if (typeof invalidName === "string") {
254
+ throw new Error(
255
+ `Invalid event name. Event names must be formatted as valid JavaScript variable names: "${invalidName}"`
256
+ );
257
+ }
252
258
  this._defs = { events };
253
259
  }
254
260
  static merge(...routers) {
@@ -258,6 +264,9 @@ var PluvRouter = class _PluvRouter {
258
264
  }
259
265
  return new _PluvRouter(events);
260
266
  }
267
+ _isValidEventName(name) {
268
+ return /^[a-z_$][a-z0-9_$]*$/gi.test(name);
269
+ }
261
270
  };
262
271
 
263
272
  // src/StateNotifier.ts
@@ -1256,6 +1265,10 @@ var PluvClient = class {
1256
1265
  return new PluvProcedure();
1257
1266
  }
1258
1267
  router(events) {
1268
+ const invalidName = Object.keys(events).find((name) => name.includes("$"));
1269
+ if (typeof invalidName === "string") {
1270
+ throw new Error(`Invalid event name. Event names must not contain $: "${invalidName}"`);
1271
+ }
1259
1272
  return new PluvRouter(events);
1260
1273
  }
1261
1274
  _logDebug(...data) {
package/dist/index.mjs CHANGED
@@ -218,6 +218,12 @@ var OtherNotifier = class {
218
218
  var PluvRouter = class _PluvRouter {
219
219
  constructor(events) {
220
220
  this._defs = { events: {} };
221
+ const invalidName = Object.keys(events).find((name) => !this._isValidEventName(name));
222
+ if (typeof invalidName === "string") {
223
+ throw new Error(
224
+ `Invalid event name. Event names must be formatted as valid JavaScript variable names: "${invalidName}"`
225
+ );
226
+ }
221
227
  this._defs = { events };
222
228
  }
223
229
  static merge(...routers) {
@@ -227,6 +233,9 @@ var PluvRouter = class _PluvRouter {
227
233
  }
228
234
  return new _PluvRouter(events);
229
235
  }
236
+ _isValidEventName(name) {
237
+ return /^[a-z_$][a-z0-9_$]*$/gi.test(name);
238
+ }
230
239
  };
231
240
 
232
241
  // src/StateNotifier.ts
@@ -1225,6 +1234,10 @@ var PluvClient = class {
1225
1234
  return new PluvProcedure();
1226
1235
  }
1227
1236
  router(events) {
1237
+ const invalidName = Object.keys(events).find((name) => name.includes("$"));
1238
+ if (typeof invalidName === "string") {
1239
+ throw new Error(`Invalid event name. Event names must not contain $: "${invalidName}"`);
1240
+ }
1228
1241
  return new PluvRouter(events);
1229
1242
  }
1230
1243
  _logDebug(...data) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/client",
3
- "version": "0.38.1",
3
+ "version": "0.38.3",
4
4
  "description": "@pluv/io frontend client",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -18,15 +18,15 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "wonka": "^6.3.5",
21
- "@pluv/crdt": "^0.38.1",
22
- "@pluv/types": "^0.38.1"
21
+ "@pluv/crdt": "^0.38.3",
22
+ "@pluv/types": "^0.38.3"
23
23
  },
24
24
  "devDependencies": {
25
25
  "eslint": "^8.57.1",
26
26
  "tsup": "^8.4.0",
27
27
  "typescript": "^5.8.2",
28
- "@pluv/tsconfig": "^0.38.1",
29
- "eslint-config-pluv": "^0.38.1"
28
+ "@pluv/tsconfig": "^0.38.3",
29
+ "eslint-config-pluv": "^0.38.3"
30
30
  },
31
31
  "scripts": {
32
32
  "build": "tsup src/index.ts --format esm,cjs --dts",
package/src/PluvClient.ts CHANGED
@@ -147,6 +147,12 @@ export class PluvClient<
147
147
  public router<TEvents extends PluvRouterEventConfig<TIO, TPresence, TStorage> = {}>(
148
148
  events: TEvents,
149
149
  ): PluvRouter<TIO, TPresence, TStorage, TEvents> {
150
+ const invalidName = Object.keys(events).find((name) => name.includes("$"));
151
+
152
+ if (typeof invalidName === "string") {
153
+ throw new Error(`Invalid event name. Event names must not contain $: "${invalidName}"`);
154
+ }
155
+
150
156
  return new PluvRouter<TIO, TPresence, TStorage, TEvents>(events);
151
157
  }
152
158
 
package/src/PluvRouter.ts CHANGED
@@ -53,6 +53,14 @@ export class PluvRouter<
53
53
  readonly _defs: { events: TEvents } = { events: {} as TEvents };
54
54
 
55
55
  constructor(events: TEvents) {
56
+ const invalidName = Object.keys(events).find((name) => !this._isValidEventName(name));
57
+
58
+ if (typeof invalidName === "string") {
59
+ throw new Error(
60
+ `Invalid event name. Event names must be formatted as valid JavaScript variable names: "${invalidName}"`,
61
+ );
62
+ }
63
+
56
64
  this._defs = { events };
57
65
  }
58
66
 
@@ -67,4 +75,8 @@ export class PluvRouter<
67
75
 
68
76
  return new PluvRouter<any, any, any, any>(events) as MergedRouter<TRouters>;
69
77
  }
78
+
79
+ private _isValidEventName(name: string): boolean {
80
+ return /^[a-z_$][a-z0-9_$]*$/gi.test(name);
81
+ }
70
82
  }