@pluv/client 0.35.0 → 0.35.2

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.35.0 build /home/runner/work/pluv/pluv/packages/client
2
+ > @pluv/client@0.35.2 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.18 KB
12
- ESM ⚡️ Build success in 90ms
13
11
  CJS dist/index.js 48.48 KB
14
- CJS ⚡️ Build success in 91ms
12
+ CJS ⚡️ Build success in 142ms
13
+ ESM dist/index.mjs 47.18 KB
14
+ ESM ⚡️ Build success in 145ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 3640ms
17
- DTS dist/index.d.mts 22.61 KB
18
- DTS dist/index.d.ts 22.61 KB
16
+ DTS ⚡️ Build success in 3509ms
17
+ DTS dist/index.d.mts 22.65 KB
18
+ DTS dist/index.d.ts 22.65 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @pluv/client
2
2
 
3
+ ## 0.35.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [81cb692]
8
+ - @pluv/types@0.35.2
9
+ - @pluv/crdt@0.35.2
10
+
11
+ ## 0.35.1
12
+
13
+ ### Patch Changes
14
+
15
+ - @pluv/crdt@0.35.1
16
+ - @pluv/types@0.35.1
17
+
3
18
  ## 0.35.0
4
19
 
5
20
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { CrdtType, AbstractCrdtDoc, InferCrdtJson, AbstractCrdtDocFactory } from '@pluv/crdt';
2
2
  export { CrdtType, InferCrdtJson } from '@pluv/crdt';
3
- import { IOLike, InferIOOutput, Id, IOEventMessage, JsonObject, InferIOAuthorizeUser, InferIOAuthorize, EventRecord, MaybePromise, InputZodLike, ProcedureLike, IORouterLike, InferIOInput } from '@pluv/types';
3
+ import { IOLike, InferIOOutput, Id, IOEventMessage, JsonObject, InferIOAuthorizeUser, InferIOAuthorize, EventRecord, MaybePromise, InputZodLike, ProcedureLike, IORouterLike, InferIOInput, BaseUser } from '@pluv/types';
4
4
  export { BaseUser, EventMessage, EventRecord, IOEventMessage } from '@pluv/types';
5
5
  import { Subject } from 'wonka';
6
6
 
@@ -163,10 +163,10 @@ type FetchOptions = {
163
163
  };
164
164
  type RoomEndpoints<TIO extends IOLike, TMetadata extends JsonObject> = {
165
165
  wsEndpoint?: WsEndpoint<TMetadata>;
166
- } & (InferIOAuthorize<TIO> extends null ? {
167
- authEndpoint?: undefined;
168
- } : {
166
+ } & (InferIOAuthorizeUser<InferIOAuthorize<TIO>> extends BaseUser ? {
169
167
  authEndpoint: AuthEndpoint<TMetadata>;
168
+ } : {
169
+ authEndpoint?: undefined;
170
170
  });
171
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>;
172
172
  interface PluvRoomAddonInput<TIO extends IOLike = IOLike, TMetadata extends JsonObject = {}, TPresence extends JsonObject = {}, TStorage extends Record<string, CrdtType<any, any>> = {}> {
@@ -289,10 +289,10 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
289
289
 
290
290
  declare const identity: <T extends unknown>(x: T) => T;
291
291
 
292
- type InferCallback<TIO extends IOLike> = (i: typeof identity) => {
292
+ type InferCallback<TIO extends IOLike<any, any>> = (i: typeof identity) => {
293
293
  io: (io: TIO) => TIO;
294
294
  };
295
- type PluvClientOptions<TIO extends IOLike, TPresence extends JsonObject, TStorage extends Record<string, CrdtType<any, any>>, TMetadata extends JsonObject> = RoomEndpoints<TIO, TMetadata> & {
295
+ type PluvClientOptions<TIO extends IOLike<any, any>, TPresence extends JsonObject, TStorage extends Record<string, CrdtType<any, any>>, TMetadata extends JsonObject> = RoomEndpoints<TIO, TMetadata> & {
296
296
  debug?: boolean;
297
297
  infer: InferCallback<TIO>;
298
298
  initialStorage?: AbstractCrdtDocFactory<TStorage>;
@@ -334,7 +334,7 @@ declare class PluvClient<TIO extends IOLike = IOLike, TPresence extends JsonObje
334
334
  private _logDebug;
335
335
  }
336
336
 
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>;
337
+ declare const createClient: <TIO extends IOLike<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>;
338
338
 
339
339
  type MockedRoomEvents<TIO extends IOLike> = Partial<{
340
340
  [P in keyof InferIOInput<TIO>]: (data: Id<InferIOInput<TIO>[P]>) => Partial<InferIOOutput<TIO>>;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { CrdtType, AbstractCrdtDoc, InferCrdtJson, AbstractCrdtDocFactory } from '@pluv/crdt';
2
2
  export { CrdtType, InferCrdtJson } from '@pluv/crdt';
3
- import { IOLike, InferIOOutput, Id, IOEventMessage, JsonObject, InferIOAuthorizeUser, InferIOAuthorize, EventRecord, MaybePromise, InputZodLike, ProcedureLike, IORouterLike, InferIOInput } from '@pluv/types';
3
+ import { IOLike, InferIOOutput, Id, IOEventMessage, JsonObject, InferIOAuthorizeUser, InferIOAuthorize, EventRecord, MaybePromise, InputZodLike, ProcedureLike, IORouterLike, InferIOInput, BaseUser } from '@pluv/types';
4
4
  export { BaseUser, EventMessage, EventRecord, IOEventMessage } from '@pluv/types';
5
5
  import { Subject } from 'wonka';
6
6
 
@@ -163,10 +163,10 @@ type FetchOptions = {
163
163
  };
164
164
  type RoomEndpoints<TIO extends IOLike, TMetadata extends JsonObject> = {
165
165
  wsEndpoint?: WsEndpoint<TMetadata>;
166
- } & (InferIOAuthorize<TIO> extends null ? {
167
- authEndpoint?: undefined;
168
- } : {
166
+ } & (InferIOAuthorizeUser<InferIOAuthorize<TIO>> extends BaseUser ? {
169
167
  authEndpoint: AuthEndpoint<TMetadata>;
168
+ } : {
169
+ authEndpoint?: undefined;
170
170
  });
171
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>;
172
172
  interface PluvRoomAddonInput<TIO extends IOLike = IOLike, TMetadata extends JsonObject = {}, TPresence extends JsonObject = {}, TStorage extends Record<string, CrdtType<any, any>> = {}> {
@@ -289,10 +289,10 @@ declare class PluvRoom<TIO extends IOLike<any, any>, TMetadata extends JsonObjec
289
289
 
290
290
  declare const identity: <T extends unknown>(x: T) => T;
291
291
 
292
- type InferCallback<TIO extends IOLike> = (i: typeof identity) => {
292
+ type InferCallback<TIO extends IOLike<any, any>> = (i: typeof identity) => {
293
293
  io: (io: TIO) => TIO;
294
294
  };
295
- type PluvClientOptions<TIO extends IOLike, TPresence extends JsonObject, TStorage extends Record<string, CrdtType<any, any>>, TMetadata extends JsonObject> = RoomEndpoints<TIO, TMetadata> & {
295
+ type PluvClientOptions<TIO extends IOLike<any, any>, TPresence extends JsonObject, TStorage extends Record<string, CrdtType<any, any>>, TMetadata extends JsonObject> = RoomEndpoints<TIO, TMetadata> & {
296
296
  debug?: boolean;
297
297
  infer: InferCallback<TIO>;
298
298
  initialStorage?: AbstractCrdtDocFactory<TStorage>;
@@ -334,7 +334,7 @@ declare class PluvClient<TIO extends IOLike = IOLike, TPresence extends JsonObje
334
334
  private _logDebug;
335
335
  }
336
336
 
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>;
337
+ declare const createClient: <TIO extends IOLike<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>;
338
338
 
339
339
  type MockedRoomEvents<TIO extends IOLike> = Partial<{
340
340
  [P in keyof InferIOInput<TIO>]: (data: Id<InferIOInput<TIO>[P]>) => Partial<InferIOOutput<TIO>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/client",
3
- "version": "0.35.0",
3
+ "version": "0.35.2",
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.35.0",
22
- "@pluv/types": "^0.35.0"
21
+ "@pluv/crdt": "^0.35.2",
22
+ "@pluv/types": "^0.35.2"
23
23
  },
24
24
  "devDependencies": {
25
25
  "eslint": "^8.57.1",
26
26
  "tsup": "^8.3.5",
27
- "typescript": "^5.7.2",
28
- "@pluv/tsconfig": "^0.35.0",
29
- "eslint-config-pluv": "^0.35.0"
27
+ "typescript": "^5.7.3",
28
+ "@pluv/tsconfig": "^0.35.2",
29
+ "eslint-config-pluv": "^0.35.2"
30
30
  },
31
31
  "scripts": {
32
32
  "build": "tsup src/index.ts --format esm,cjs --dts",
package/src/PluvClient.ts CHANGED
@@ -7,12 +7,12 @@ import type { PluvRouterEventConfig } from "./PluvRouter";
7
7
  import { PluvRouter } from "./PluvRouter";
8
8
  import type { identity } from "./utils";
9
9
 
10
- export type InferCallback<TIO extends IOLike> = (i: typeof identity) => {
10
+ export type InferCallback<TIO extends IOLike<any, any>> = (i: typeof identity) => {
11
11
  io: (io: TIO) => TIO;
12
12
  };
13
13
 
14
14
  export type PluvClientOptions<
15
- TIO extends IOLike,
15
+ TIO extends IOLike<any, any>,
16
16
  TPresence extends JsonObject,
17
17
  TStorage extends Record<string, CrdtType<any, any>>,
18
18
  TMetadata extends JsonObject,
package/src/PluvRoom.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { AbstractCrdtDoc, CrdtType, InferCrdtJson } from "@pluv/crdt";
2
2
  import type {
3
3
  BaseIOEventRecord,
4
+ BaseUser,
4
5
  EventMessage,
5
6
  IOEventMessage,
6
7
  IOLike,
@@ -102,7 +103,9 @@ type FetchOptions = { url: string; options?: RequestInit };
102
103
 
103
104
  export type RoomEndpoints<TIO extends IOLike, TMetadata extends JsonObject> = {
104
105
  wsEndpoint?: WsEndpoint<TMetadata>;
105
- } & (InferIOAuthorize<TIO> extends null ? { authEndpoint?: undefined } : { authEndpoint: AuthEndpoint<TMetadata> });
106
+ } & (InferIOAuthorizeUser<InferIOAuthorize<TIO>> extends BaseUser
107
+ ? { authEndpoint: AuthEndpoint<TMetadata> }
108
+ : { authEndpoint?: undefined });
106
109
 
107
110
  interface InternalListeners {
108
111
  onAuthorizationFail: (error: Error) => void;
@@ -4,7 +4,7 @@ import type { PluvClientOptions } from "./PluvClient";
4
4
  import { PluvClient } from "./PluvClient";
5
5
 
6
6
  export const createClient = <
7
- TIO extends IOLike = IOLike,
7
+ TIO extends IOLike<any, any>,
8
8
  TPresence extends JsonObject = {},
9
9
  TStorage extends Record<string, CrdtType<any, any>> = {},
10
10
  TMetadata extends JsonObject = {},