@pluv/client 0.34.1 → 0.35.0

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.34.1 build /home/runner/work/pluv/pluv/packages/client
2
+ > @pluv/client@0.35.0 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
- ESM dist/index.mjs 47.16 KB
12
- ESM ⚡️ Build success in 116ms
13
- CJS dist/index.js 48.46 KB
14
- CJS ⚡️ Build success in 116ms
11
+ ESM dist/index.mjs 47.18 KB
12
+ ESM ⚡️ Build success in 90ms
13
+ CJS dist/index.js 48.48 KB
14
+ CJS ⚡️ Build success in 91ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 3604ms
17
- DTS dist/index.d.mts 22.72 KB
18
- DTS dist/index.d.ts 22.72 KB
16
+ DTS ⚡️ Build success in 3640ms
17
+ DTS dist/index.d.mts 22.61 KB
18
+ DTS dist/index.d.ts 22.61 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @pluv/client
2
2
 
3
+ ## 0.35.0
4
+
5
+ ### Patch Changes
6
+
7
+ - @pluv/crdt@0.35.0
8
+ - @pluv/types@0.35.0
9
+
3
10
  ## 0.34.1
4
11
 
5
12
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { CrdtType, AbstractCrdtDoc, InferCrdtJson, AbstractCrdtDocFactory } from '@pluv/crdt';
2
2
  export { CrdtType, InferCrdtJson } from '@pluv/crdt';
3
- import * as _pluv_types from '@pluv/types';
4
- import { IOLike, InferIOOutput, Id, IOEventMessage, JsonObject, InferIOAuthorizeUser, InferIOAuthorize, EventRecord, MaybePromise, InputZodLike, ProcedureLike, IORouterLike, InferIOInput, InferIOAuthorizeRequired } from '@pluv/types';
3
+ import { IOLike, InferIOOutput, Id, IOEventMessage, JsonObject, InferIOAuthorizeUser, InferIOAuthorize, EventRecord, MaybePromise, InputZodLike, ProcedureLike, IORouterLike, InferIOInput } from '@pluv/types';
5
4
  export { BaseUser, EventMessage, EventRecord, IOEventMessage } from '@pluv/types';
6
5
  import { Subject } from 'wonka';
7
6
 
@@ -164,10 +163,10 @@ type FetchOptions = {
164
163
  };
165
164
  type RoomEndpoints<TIO extends IOLike, TMetadata extends JsonObject> = {
166
165
  wsEndpoint?: WsEndpoint<TMetadata>;
167
- } & (InferIOAuthorizeRequired<InferIOAuthorize<TIO>> extends true ? {
168
- authEndpoint: AuthEndpoint<TMetadata>;
169
- } : {
166
+ } & (InferIOAuthorize<TIO> extends null ? {
170
167
  authEndpoint?: undefined;
168
+ } : {
169
+ authEndpoint: AuthEndpoint<TMetadata>;
171
170
  });
172
171
  type PluvRoomAddon<TIO extends IOLike = IOLike, TMetadata extends JsonObject = {}, TPresence extends JsonObject = {}, TStorage extends Record<string, CrdtType<any, any>> = {}> = (input: PluvRoomAddonInput<TIO, TMetadata, TPresence, TStorage>) => Partial<PluvRoomAddonResult>;
173
172
  interface PluvRoomAddonInput<TIO extends IOLike = IOLike, TMetadata extends JsonObject = {}, TPresence extends JsonObject = {}, TStorage extends Record<string, CrdtType<any, any>> = {}> {
@@ -191,7 +190,7 @@ type RoomConfig<TIO extends IOLike, TMetadata extends JsonObject = {}, TPresence
191
190
  } : {
192
191
  metadata: TMetadata;
193
192
  })>;
194
- declare class PluvRoom<TIO extends IOLike, TMetadata extends JsonObject = {}, TPresence extends JsonObject = {}, TStorage extends Record<string, CrdtType<any, any>> = {}, TEvents extends PluvRouterEventConfig<TIO, TPresence, TStorage> = {}> extends AbstractRoom<TIO, TPresence, TStorage> {
193
+ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObject = {}, TPresence extends JsonObject = {}, TStorage extends Record<string, CrdtType<any, any>> = {}, TEvents extends PluvRouterEventConfig<TIO, TPresence, TStorage> = {}> extends AbstractRoom<TIO, TPresence, TStorage> {
195
194
  readonly _endpoints: RoomEndpoints<TIO, TMetadata>;
196
195
  private readonly _crdtManager;
197
196
  private readonly _crdtNotifier;
@@ -335,7 +334,7 @@ declare class PluvClient<TIO extends IOLike = IOLike, TPresence extends JsonObje
335
334
  private _logDebug;
336
335
  }
337
336
 
338
- declare const createClient: <TIO extends IOLike = IOLike<_pluv_types.IOAuthorize<any, any, any>, {}>, TPresence extends JsonObject = {}, TStorage extends Record<string, CrdtType<any, any>> = {}, TMetadata extends JsonObject = {}>(options: PluvClientOptions<TIO, TPresence, TStorage, TMetadata>) => PluvClient<TIO, TPresence, TStorage, TMetadata>;
337
+ declare const createClient: <TIO extends IOLike = IOLike<null, {}>, TPresence extends JsonObject = {}, TStorage extends Record<string, CrdtType<any, any>> = {}, TMetadata extends JsonObject = {}>(options: PluvClientOptions<TIO, TPresence, TStorage, TMetadata>) => PluvClient<TIO, TPresence, TStorage, TMetadata>;
339
338
 
340
339
  type MockedRoomEvents<TIO extends IOLike> = Partial<{
341
340
  [P in keyof InferIOInput<TIO>]: (data: Id<InferIOInput<TIO>[P]>) => Partial<InferIOOutput<TIO>>;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { CrdtType, AbstractCrdtDoc, InferCrdtJson, AbstractCrdtDocFactory } from '@pluv/crdt';
2
2
  export { CrdtType, InferCrdtJson } from '@pluv/crdt';
3
- import * as _pluv_types from '@pluv/types';
4
- import { IOLike, InferIOOutput, Id, IOEventMessage, JsonObject, InferIOAuthorizeUser, InferIOAuthorize, EventRecord, MaybePromise, InputZodLike, ProcedureLike, IORouterLike, InferIOInput, InferIOAuthorizeRequired } from '@pluv/types';
3
+ import { IOLike, InferIOOutput, Id, IOEventMessage, JsonObject, InferIOAuthorizeUser, InferIOAuthorize, EventRecord, MaybePromise, InputZodLike, ProcedureLike, IORouterLike, InferIOInput } from '@pluv/types';
5
4
  export { BaseUser, EventMessage, EventRecord, IOEventMessage } from '@pluv/types';
6
5
  import { Subject } from 'wonka';
7
6
 
@@ -164,10 +163,10 @@ type FetchOptions = {
164
163
  };
165
164
  type RoomEndpoints<TIO extends IOLike, TMetadata extends JsonObject> = {
166
165
  wsEndpoint?: WsEndpoint<TMetadata>;
167
- } & (InferIOAuthorizeRequired<InferIOAuthorize<TIO>> extends true ? {
168
- authEndpoint: AuthEndpoint<TMetadata>;
169
- } : {
166
+ } & (InferIOAuthorize<TIO> extends null ? {
170
167
  authEndpoint?: undefined;
168
+ } : {
169
+ authEndpoint: AuthEndpoint<TMetadata>;
171
170
  });
172
171
  type PluvRoomAddon<TIO extends IOLike = IOLike, TMetadata extends JsonObject = {}, TPresence extends JsonObject = {}, TStorage extends Record<string, CrdtType<any, any>> = {}> = (input: PluvRoomAddonInput<TIO, TMetadata, TPresence, TStorage>) => Partial<PluvRoomAddonResult>;
173
172
  interface PluvRoomAddonInput<TIO extends IOLike = IOLike, TMetadata extends JsonObject = {}, TPresence extends JsonObject = {}, TStorage extends Record<string, CrdtType<any, any>> = {}> {
@@ -191,7 +190,7 @@ type RoomConfig<TIO extends IOLike, TMetadata extends JsonObject = {}, TPresence
191
190
  } : {
192
191
  metadata: TMetadata;
193
192
  })>;
194
- declare class PluvRoom<TIO extends IOLike, TMetadata extends JsonObject = {}, TPresence extends JsonObject = {}, TStorage extends Record<string, CrdtType<any, any>> = {}, TEvents extends PluvRouterEventConfig<TIO, TPresence, TStorage> = {}> extends AbstractRoom<TIO, TPresence, TStorage> {
193
+ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObject = {}, TPresence extends JsonObject = {}, TStorage extends Record<string, CrdtType<any, any>> = {}, TEvents extends PluvRouterEventConfig<TIO, TPresence, TStorage> = {}> extends AbstractRoom<TIO, TPresence, TStorage> {
195
194
  readonly _endpoints: RoomEndpoints<TIO, TMetadata>;
196
195
  private readonly _crdtManager;
197
196
  private readonly _crdtNotifier;
@@ -335,7 +334,7 @@ declare class PluvClient<TIO extends IOLike = IOLike, TPresence extends JsonObje
335
334
  private _logDebug;
336
335
  }
337
336
 
338
- declare const createClient: <TIO extends IOLike = IOLike<_pluv_types.IOAuthorize<any, any, any>, {}>, TPresence extends JsonObject = {}, TStorage extends Record<string, CrdtType<any, any>> = {}, TMetadata extends JsonObject = {}>(options: PluvClientOptions<TIO, TPresence, TStorage, TMetadata>) => PluvClient<TIO, TPresence, TStorage, TMetadata>;
337
+ declare const createClient: <TIO extends IOLike = IOLike<null, {}>, TPresence extends JsonObject = {}, TStorage extends Record<string, CrdtType<any, any>> = {}, TMetadata extends JsonObject = {}>(options: PluvClientOptions<TIO, TPresence, TStorage, TMetadata>) => PluvClient<TIO, TPresence, TStorage, TMetadata>;
339
338
 
340
339
  type MockedRoomEvents<TIO extends IOLike> = Partial<{
341
340
  [P in keyof InferIOInput<TIO>]: (data: Id<InferIOInput<TIO>[P]>) => Partial<InferIOOutput<TIO>>;
package/dist/index.js CHANGED
@@ -890,7 +890,7 @@ var PluvRoom = class extends AbstractRoom {
890
890
  this._updateState((oldState) => {
891
891
  oldState.connection.count += 1;
892
892
  oldState.connection.id = connectionId;
893
- oldState.authorization.user = user;
893
+ oldState.authorization.user = user != null ? user : null;
894
894
  return oldState;
895
895
  });
896
896
  this._usersManager.setMyself(connectionId, user);
package/dist/index.mjs CHANGED
@@ -860,7 +860,7 @@ var PluvRoom = class extends AbstractRoom {
860
860
  this._updateState((oldState) => {
861
861
  oldState.connection.count += 1;
862
862
  oldState.connection.id = connectionId;
863
- oldState.authorization.user = user;
863
+ oldState.authorization.user = user != null ? user : null;
864
864
  return oldState;
865
865
  });
866
866
  this._usersManager.setMyself(connectionId, user);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/client",
3
- "version": "0.34.1",
3
+ "version": "0.35.0",
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.4",
21
- "@pluv/crdt": "^0.34.1",
22
- "@pluv/types": "^0.34.1"
21
+ "@pluv/crdt": "^0.35.0",
22
+ "@pluv/types": "^0.35.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "eslint": "^8.57.1",
26
26
  "tsup": "^8.3.5",
27
27
  "typescript": "^5.7.2",
28
- "@pluv/tsconfig": "^0.34.1",
29
- "eslint-config-pluv": "^0.34.1"
28
+ "@pluv/tsconfig": "^0.35.0",
29
+ "eslint-config-pluv": "^0.35.0"
30
30
  },
31
31
  "scripts": {
32
32
  "build": "tsup src/index.ts --format esm,cjs --dts",
package/src/PluvRoom.ts CHANGED
@@ -6,7 +6,6 @@ import type {
6
6
  IOLike,
7
7
  Id,
8
8
  InferIOAuthorize,
9
- InferIOAuthorizeRequired,
10
9
  InferIOAuthorizeUser,
11
10
  InferIOInput,
12
11
  InferIOOutput,
@@ -103,9 +102,7 @@ type FetchOptions = { url: string; options?: RequestInit };
103
102
 
104
103
  export type RoomEndpoints<TIO extends IOLike, TMetadata extends JsonObject> = {
105
104
  wsEndpoint?: WsEndpoint<TMetadata>;
106
- } & (InferIOAuthorizeRequired<InferIOAuthorize<TIO>> extends true
107
- ? { authEndpoint: AuthEndpoint<TMetadata> }
108
- : { authEndpoint?: undefined });
105
+ } & (InferIOAuthorize<TIO> extends null ? { authEndpoint?: undefined } : { authEndpoint: AuthEndpoint<TMetadata> });
109
106
 
110
107
  interface InternalListeners {
111
108
  onAuthorizationFail: (error: Error) => void;
@@ -156,7 +153,7 @@ export type RoomConfig<
156
153
  >;
157
154
 
158
155
  export class PluvRoom<
159
- TIO extends IOLike,
156
+ TIO extends IOLike<any, any>,
160
157
  TMetadata extends JsonObject = {},
161
158
  TPresence extends JsonObject = {},
162
159
  TStorage extends Record<string, CrdtType<any, any>> = {},
@@ -823,7 +820,7 @@ export class PluvRoom<
823
820
  this._updateState((oldState) => {
824
821
  oldState.connection.count += 1;
825
822
  oldState.connection.id = connectionId;
826
- oldState.authorization.user = user;
823
+ oldState.authorization.user = user ?? null;
827
824
 
828
825
  return oldState;
829
826
  });