@pluv/client 2.1.0 → 2.2.1

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/src/types.ts CHANGED
@@ -1,6 +1,4 @@
1
- import type { CrdtType } from "@pluv/crdt";
2
1
  import type {
3
- ConnectionState,
4
2
  CrdtDocLike,
5
3
  EventRecord,
6
4
  Id,
@@ -19,22 +17,22 @@ export interface AuthorizationState<TIO extends IOLike> {
19
17
  }
20
18
 
21
19
  export type EventResolver<
22
- TIO extends IOLike = IOLike,
23
- TInput extends JsonObject = {},
24
- TOutput extends EventRecord<string, any> = {},
25
- TPresence extends JsonObject = {},
26
- TStorage extends Record<string, CrdtType<any, any>> = {},
20
+ TIO extends IOLike,
21
+ TInput extends JsonObject,
22
+ TOutput extends EventRecord<string, any>,
23
+ TPresence extends Record<string, any>,
24
+ TDocLike extends CrdtDocLike<any, any>,
27
25
  > = (
28
26
  data: TInput,
29
- context: EventResolverContext<TIO, TPresence, TStorage>,
27
+ context: EventResolverContext<TIO, TPresence, TDocLike>,
30
28
  ) => MaybePromise<TOutput | void>;
31
29
 
32
30
  export interface EventResolverContext<
33
- TIO extends IOLike = IOLike,
34
- TPresence extends JsonObject = {},
35
- TStorage extends Record<string, CrdtType<any, any>> = {},
31
+ TIO extends IOLike,
32
+ TPresence extends Record<string, any>,
33
+ TDocLike extends CrdtDocLike<any, any>,
36
34
  > {
37
- doc: CrdtDocLike<TStorage>;
35
+ doc: TDocLike;
38
36
  others: readonly UserInfo<TIO, TPresence>[];
39
37
  room: string;
40
38
  user: UserInfo<TIO, TPresence>;
@@ -76,25 +74,6 @@ export type PublicKey<TMetadata extends JsonObject> =
76
74
  | string
77
75
  | ((params: PublicKeyParams<TMetadata>) => string);
78
76
 
79
- export interface WebSocketConnection {
80
- /**
81
- * @description How many times a connection attempt was made. This will increment upon each
82
- * unsuccessful attempt, and will reset upon a successful connection.
83
- * @date April 13, 2025
84
- */
85
- attempts: number;
86
- /**
87
- * @description How many times the user has connected to the room. This can be more than 1 in
88
- * the case of reconnects. This is tracked because on the very first connection (i.e. when
89
- * count is 0) we don't want to send the storage state as an update to the room and overwrite
90
- * the upstream state.
91
- * @date April 13, 2025
92
- */
93
- count: number;
94
- id: string | null;
95
- state: ConnectionState;
96
- }
97
-
98
77
  export type WithMetadata<TMetadata extends JsonObject = {}> = keyof TMetadata extends never
99
78
  ? { metadata?: undefined }
100
79
  : { metadata: TMetadata };