@pluv/io 0.28.0 → 0.30.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,9 +1,9 @@
1
1
 
2
- > @pluv/io@0.28.0 build /home/runner/work/pluv/pluv/packages/io
2
+ > @pluv/io@0.30.0 build /home/runner/work/pluv/pluv/packages/io
3
3
  > pnpm run version && tsup src/index.ts --format esm,cjs --dts
4
4
 
5
5
 
6
- > @pluv/io@0.28.0 version /home/runner/work/pluv/pluv/packages/io
6
+ > @pluv/io@0.30.0 version /home/runner/work/pluv/pluv/packages/io
7
7
  > genversion ./src/version.generated.ts --esm
8
8
 
9
9
  CLI Building entry: src/index.ts
@@ -12,11 +12,11 @@
12
12
  CLI Target: es6
13
13
  ESM Build start
14
14
  CJS Build start
15
- ESM dist/index.mjs 39.84 KB
16
- ESM ⚡️ Build success in 129ms
17
15
  CJS dist/index.js 41.98 KB
18
- CJS ⚡️ Build success in 130ms
16
+ CJS ⚡️ Build success in 126ms
17
+ ESM dist/index.mjs 39.84 KB
18
+ ESM ⚡️ Build success in 137ms
19
19
  DTS Build start
20
- DTS ⚡️ Build success in 2275ms
21
- DTS dist/index.d.mts 25.32 KB
22
- DTS dist/index.d.ts 25.32 KB
20
+ DTS ⚡️ Build success in 2298ms
21
+ DTS dist/index.d.mts 25.37 KB
22
+ DTS dist/index.d.ts 25.37 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @pluv/io
2
2
 
3
+ ## 0.30.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 7246a9e: Added `CrdtLibraryType` so that `@pluv/crdt-yjs` and `@pluv/crdt-loro` export a new property `kind` containing an identifier for the crdt.
8
+ - @pluv/crdt@0.30.0
9
+ - @pluv/types@0.30.0
10
+
11
+ ## 0.29.0
12
+
13
+ ### Patch Changes
14
+
15
+ - @pluv/crdt@0.29.0
16
+ - @pluv/types@0.29.0
17
+
3
18
  ## 0.28.0
4
19
 
5
20
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { JsonObject, MaybePromise, IOAuthorize, IOEventMessage, EventRecord, InputZodLike, ProcedureLike, BaseIOAuthorize, IORouterLike, InferIOAuthorizeUser, Id, InferEventMessage, InferEventsOutput, Maybe, IOLike, InferIOOutput, BaseUser, InferIOInput, InferIOAuthorize } from '@pluv/types';
1
+ import { JsonObject, MaybePromise, IOAuthorize, IOEventMessage, EventRecord, InputZodLike, ProcedureLike, BaseIOAuthorize, IORouterLike, InferIOAuthorizeUser, Id, Maybe, InferEventMessage, InferEventsOutput, IOLike, InferIOOutput, BaseUser, InferIOInput, InferIOAuthorize } from '@pluv/types';
2
2
  export { BaseUser, EventMessage, EventRecord, IOEventMessage } from '@pluv/types';
3
- import { AbstractCrdtDoc, AbstractCrdtDocFactory } from '@pluv/crdt';
3
+ import { AbstractCrdtDocFactory, AbstractCrdtDoc } from '@pluv/crdt';
4
4
 
5
5
  declare abstract class AbstractPersistence {
6
6
  abstract addUser(room: string, connectionId: string, user: JsonObject | null): Promise<void>;
@@ -122,6 +122,10 @@ declare global {
122
122
  log: (...data: any[]) => void;
123
123
  };
124
124
  }
125
+ interface CrdtLibraryType {
126
+ doc: (value: any) => AbstractCrdtDocFactory<any>;
127
+ kind: "loro" | "yjs";
128
+ }
125
129
  type EventResolver<TPlatform extends AbstractPlatform = AbstractPlatform, TAuthorize extends IOAuthorize<any, any, InferRoomContextType<TPlatform>> = BaseIOAuthorize, TContext extends Record<string, any> = {}, TInput extends JsonObject = {}, TOutput extends EventRecord<string, any> = {}> = (data: TInput, context: EventResolverContext<TPlatform, TAuthorize, TContext>) => MaybePromise<TOutput | void>;
126
130
  interface EventResolverContext<TPlatform extends AbstractPlatform = AbstractPlatform, TAuthorize extends IOAuthorize<any, any, InferRoomContextType<TPlatform>> = BaseIOAuthorize, TContext extends Record<string, any> = {}> {
127
131
  context: TContext;
@@ -374,9 +378,7 @@ declare class PluvServer<TPlatform extends AbstractPlatform<any> = AbstractPlatf
374
378
  type PluvIOConfig<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, any, InferPlatformContextType<TPlatform>>, TContext extends JsonObject> = {
375
379
  authorize?: TAuthorize;
376
380
  context?: TContext;
377
- crdt?: {
378
- doc: (value: any) => AbstractCrdtDocFactory<any>;
379
- };
381
+ crdt?: CrdtLibraryType;
380
382
  debug?: boolean;
381
383
  platform: TPlatform;
382
384
  };
@@ -402,12 +404,10 @@ declare class PluvIO<TPlatform extends AbstractPlatform<any> = AbstractPlatform<
402
404
  type CreateIOParams<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TContext extends JsonObject = {}, TAuthorizeUser extends BaseUser = BaseUser, TAuthorizeRequired extends boolean = false> = {
403
405
  authorize?: IOAuthorize<TAuthorizeUser, TAuthorizeRequired, InferPlatformContextType<TPlatform>>;
404
406
  context?: TContext;
405
- crdt?: {
406
- doc: (value: any) => AbstractCrdtDocFactory<any>;
407
- };
407
+ crdt?: CrdtLibraryType;
408
408
  debug?: boolean;
409
409
  platform: TPlatform;
410
410
  };
411
411
  declare const createIO: <TPlatform extends AbstractPlatform<any> = AbstractPlatform<any, {}, {}>, TContext extends JsonObject = {}, TAuthorizeUser extends BaseUser = BaseUser, TAuthorizeRequired extends boolean = false>(params: CreateIOParams<TPlatform, TContext, TAuthorizeUser, TAuthorizeRequired>) => PluvIO<TPlatform, IOAuthorize<TAuthorizeUser, TAuthorizeRequired, InferPlatformContextType<TPlatform>>, TContext>;
412
412
 
413
- export { type AbstractCloseEvent, type AbstractErrorEvent, type AbstractEvent, type AbstractEventMap, type AbstractListener, type AbstractMessageEvent, AbstractPersistence, AbstractPlatform, type AbstractPlatformConfig, AbstractPubSub, AbstractWebSocket, type AbstractWebSocketConfig, type AbstractWebSocketHandleErrorParams, type AuthorizeModule, type AuthorizeParams, type ConvertWebSocketConfig, type CreateIOParams, type CreateRoomOptions, type IOPubSubEventMessage, IORoom, type IORoomListenerEvent, type IORoomMessageEvent, type InferIORoom, type InferPlatformContextType, type InferPlatformWebSocketType, type InferRoomContextType, type JWT, type JWTEncodeParams, type MergedRouter, PluvIO, type PluvIOConfig, type PluvIOListeners, PluvProcedure, type PluvProcedureConfig, PluvRouter, type PluvRouterEventConfig, PluvServer, type PluvServerConfig, type ServerConfig, type WebSocketRegistrationMode, type WebSocketSerializedState, type WebSocketSession, createIO };
413
+ export { type AbstractCloseEvent, type AbstractErrorEvent, type AbstractEvent, type AbstractEventMap, type AbstractListener, type AbstractMessageEvent, AbstractPersistence, AbstractPlatform, type AbstractPlatformConfig, AbstractPubSub, AbstractWebSocket, type AbstractWebSocketConfig, type AbstractWebSocketHandleErrorParams, type AuthorizeModule, type AuthorizeParams, type ConvertWebSocketConfig, type CrdtLibraryType, type CreateIOParams, type CreateRoomOptions, type GetInitialStorageFn, type IOPubSubEventMessage, IORoom, type IORoomListenerEvent, type IORoomMessageEvent, type InferIORoom, type InferPlatformContextType, type InferPlatformWebSocketType, type InferRoomContextType, type JWT, type JWTEncodeParams, type MergedRouter, PluvIO, type PluvIOConfig, type PluvIOListeners, PluvProcedure, type PluvProcedureConfig, PluvRouter, type PluvRouterEventConfig, PluvServer, type PluvServerConfig, type ServerConfig, type WebSocketRegistrationMode, type WebSocketSerializedState, type WebSocketSession, createIO };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { JsonObject, MaybePromise, IOAuthorize, IOEventMessage, EventRecord, InputZodLike, ProcedureLike, BaseIOAuthorize, IORouterLike, InferIOAuthorizeUser, Id, InferEventMessage, InferEventsOutput, Maybe, IOLike, InferIOOutput, BaseUser, InferIOInput, InferIOAuthorize } from '@pluv/types';
1
+ import { JsonObject, MaybePromise, IOAuthorize, IOEventMessage, EventRecord, InputZodLike, ProcedureLike, BaseIOAuthorize, IORouterLike, InferIOAuthorizeUser, Id, Maybe, InferEventMessage, InferEventsOutput, IOLike, InferIOOutput, BaseUser, InferIOInput, InferIOAuthorize } from '@pluv/types';
2
2
  export { BaseUser, EventMessage, EventRecord, IOEventMessage } from '@pluv/types';
3
- import { AbstractCrdtDoc, AbstractCrdtDocFactory } from '@pluv/crdt';
3
+ import { AbstractCrdtDocFactory, AbstractCrdtDoc } from '@pluv/crdt';
4
4
 
5
5
  declare abstract class AbstractPersistence {
6
6
  abstract addUser(room: string, connectionId: string, user: JsonObject | null): Promise<void>;
@@ -122,6 +122,10 @@ declare global {
122
122
  log: (...data: any[]) => void;
123
123
  };
124
124
  }
125
+ interface CrdtLibraryType {
126
+ doc: (value: any) => AbstractCrdtDocFactory<any>;
127
+ kind: "loro" | "yjs";
128
+ }
125
129
  type EventResolver<TPlatform extends AbstractPlatform = AbstractPlatform, TAuthorize extends IOAuthorize<any, any, InferRoomContextType<TPlatform>> = BaseIOAuthorize, TContext extends Record<string, any> = {}, TInput extends JsonObject = {}, TOutput extends EventRecord<string, any> = {}> = (data: TInput, context: EventResolverContext<TPlatform, TAuthorize, TContext>) => MaybePromise<TOutput | void>;
126
130
  interface EventResolverContext<TPlatform extends AbstractPlatform = AbstractPlatform, TAuthorize extends IOAuthorize<any, any, InferRoomContextType<TPlatform>> = BaseIOAuthorize, TContext extends Record<string, any> = {}> {
127
131
  context: TContext;
@@ -374,9 +378,7 @@ declare class PluvServer<TPlatform extends AbstractPlatform<any> = AbstractPlatf
374
378
  type PluvIOConfig<TPlatform extends AbstractPlatform<any>, TAuthorize extends IOAuthorize<any, any, InferPlatformContextType<TPlatform>>, TContext extends JsonObject> = {
375
379
  authorize?: TAuthorize;
376
380
  context?: TContext;
377
- crdt?: {
378
- doc: (value: any) => AbstractCrdtDocFactory<any>;
379
- };
381
+ crdt?: CrdtLibraryType;
380
382
  debug?: boolean;
381
383
  platform: TPlatform;
382
384
  };
@@ -402,12 +404,10 @@ declare class PluvIO<TPlatform extends AbstractPlatform<any> = AbstractPlatform<
402
404
  type CreateIOParams<TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>, TContext extends JsonObject = {}, TAuthorizeUser extends BaseUser = BaseUser, TAuthorizeRequired extends boolean = false> = {
403
405
  authorize?: IOAuthorize<TAuthorizeUser, TAuthorizeRequired, InferPlatformContextType<TPlatform>>;
404
406
  context?: TContext;
405
- crdt?: {
406
- doc: (value: any) => AbstractCrdtDocFactory<any>;
407
- };
407
+ crdt?: CrdtLibraryType;
408
408
  debug?: boolean;
409
409
  platform: TPlatform;
410
410
  };
411
411
  declare const createIO: <TPlatform extends AbstractPlatform<any> = AbstractPlatform<any, {}, {}>, TContext extends JsonObject = {}, TAuthorizeUser extends BaseUser = BaseUser, TAuthorizeRequired extends boolean = false>(params: CreateIOParams<TPlatform, TContext, TAuthorizeUser, TAuthorizeRequired>) => PluvIO<TPlatform, IOAuthorize<TAuthorizeUser, TAuthorizeRequired, InferPlatformContextType<TPlatform>>, TContext>;
412
412
 
413
- export { type AbstractCloseEvent, type AbstractErrorEvent, type AbstractEvent, type AbstractEventMap, type AbstractListener, type AbstractMessageEvent, AbstractPersistence, AbstractPlatform, type AbstractPlatformConfig, AbstractPubSub, AbstractWebSocket, type AbstractWebSocketConfig, type AbstractWebSocketHandleErrorParams, type AuthorizeModule, type AuthorizeParams, type ConvertWebSocketConfig, type CreateIOParams, type CreateRoomOptions, type IOPubSubEventMessage, IORoom, type IORoomListenerEvent, type IORoomMessageEvent, type InferIORoom, type InferPlatformContextType, type InferPlatformWebSocketType, type InferRoomContextType, type JWT, type JWTEncodeParams, type MergedRouter, PluvIO, type PluvIOConfig, type PluvIOListeners, PluvProcedure, type PluvProcedureConfig, PluvRouter, type PluvRouterEventConfig, PluvServer, type PluvServerConfig, type ServerConfig, type WebSocketRegistrationMode, type WebSocketSerializedState, type WebSocketSession, createIO };
413
+ export { type AbstractCloseEvent, type AbstractErrorEvent, type AbstractEvent, type AbstractEventMap, type AbstractListener, type AbstractMessageEvent, AbstractPersistence, AbstractPlatform, type AbstractPlatformConfig, AbstractPubSub, AbstractWebSocket, type AbstractWebSocketConfig, type AbstractWebSocketHandleErrorParams, type AuthorizeModule, type AuthorizeParams, type ConvertWebSocketConfig, type CrdtLibraryType, type CreateIOParams, type CreateRoomOptions, type GetInitialStorageFn, type IOPubSubEventMessage, IORoom, type IORoomListenerEvent, type IORoomMessageEvent, type InferIORoom, type InferPlatformContextType, type InferPlatformWebSocketType, type InferRoomContextType, type JWT, type JWTEncodeParams, type MergedRouter, PluvIO, type PluvIOConfig, type PluvIOListeners, PluvProcedure, type PluvProcedureConfig, PluvRouter, type PluvRouterEventConfig, PluvServer, type PluvServerConfig, type ServerConfig, type WebSocketRegistrationMode, type WebSocketSerializedState, type WebSocketSession, createIO };
package/dist/index.js CHANGED
@@ -930,7 +930,7 @@ var IORoom = class {
930
930
  };
931
931
 
932
932
  // src/version.generated.ts
933
- var version = "0.28.0";
933
+ var version = "0.30.0";
934
934
 
935
935
  // src/PluvServer.ts
936
936
  var PluvServer = class {
package/dist/index.mjs CHANGED
@@ -889,7 +889,7 @@ var IORoom = class {
889
889
  };
890
890
 
891
891
  // src/version.generated.ts
892
- var version = "0.28.0";
892
+ var version = "0.30.0";
893
893
 
894
894
  // src/PluvServer.ts
895
895
  var PluvServer = class {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/io",
3
- "version": "0.28.0",
3
+ "version": "0.30.0",
4
4
  "description": "@pluv/io server-side websocket manager",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -21,16 +21,16 @@
21
21
  "jose": "^5.9.2",
22
22
  "kleur": "^4.1.5",
23
23
  "wonka": "^6.3.4",
24
- "@pluv/crdt": "^0.28.0",
25
- "@pluv/types": "^0.28.0"
24
+ "@pluv/crdt": "^0.30.0",
25
+ "@pluv/types": "^0.30.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "eslint": "^8.57.0",
29
29
  "genversion": "^3.2.0",
30
30
  "tsup": "^8.3.0",
31
31
  "typescript": "^5.6.2",
32
- "@pluv/tsconfig": "^0.28.0",
33
- "eslint-config-pluv": "^0.28.0"
32
+ "@pluv/tsconfig": "^0.30.0",
33
+ "eslint-config-pluv": "^0.30.0"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "pnpm run version && tsup src/index.ts --format esm,cjs --dts",
package/src/PluvIO.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  import type { AbstractCrdtDocFactory } from "@pluv/crdt";
2
2
  import { noop } from "@pluv/crdt";
3
3
  import type { BaseIOAuthorize, IOAuthorize, InferIOAuthorizeUser, JsonObject } from "@pluv/types";
4
- import type { AbstractPlatform, InferPlatformContextType, WebSocketRegistrationMode } from "./AbstractPlatform";
4
+ import type { AbstractPlatform, InferPlatformContextType } from "./AbstractPlatform";
5
5
  import { PluvProcedure } from "./PluvProcedure";
6
6
  import type { MergedRouter, PluvRouterEventConfig } from "./PluvRouter";
7
7
  import { PluvRouter } from "./PluvRouter";
8
8
  import { PluvServer } from "./PluvServer";
9
9
  import type { JWTEncodeParams } from "./authorize";
10
10
  import { authorize } from "./authorize";
11
- import type { GetInitialStorageFn, PluvIOListeners } from "./types";
11
+ import type { CrdtLibraryType, GetInitialStorageFn, PluvIOListeners } from "./types";
12
12
  import { __PLUV_VERSION } from "./version";
13
13
 
14
14
  export type PluvIOConfig<
@@ -18,7 +18,7 @@ export type PluvIOConfig<
18
18
  > = {
19
19
  authorize?: TAuthorize;
20
20
  context?: TContext;
21
- crdt?: { doc: (value: any) => AbstractCrdtDocFactory<any> };
21
+ crdt?: CrdtLibraryType;
22
22
  debug?: boolean;
23
23
  platform: TPlatform;
24
24
  };
package/src/PluvServer.ts CHANGED
@@ -11,12 +11,7 @@ import type {
11
11
  Maybe,
12
12
  } from "@pluv/types";
13
13
  import colors from "kleur";
14
- import type {
15
- AbstractPlatform,
16
- InferPlatformContextType,
17
- InferRoomContextType,
18
- WebSocketRegistrationMode,
19
- } from "./AbstractPlatform";
14
+ import type { AbstractPlatform, InferPlatformContextType, InferRoomContextType } from "./AbstractPlatform";
20
15
  import type { IORoomListeners } from "./IORoom";
21
16
  import { IORoom } from "./IORoom";
22
17
  import { PluvProcedure } from "./PluvProcedure";
package/src/createIO.ts CHANGED
@@ -1,8 +1,7 @@
1
- import type { AbstractCrdtDocFactory } from "@pluv/crdt";
2
1
  import type { BaseUser, IOAuthorize, JsonObject } from "@pluv/types";
3
2
  import type { AbstractPlatform, InferPlatformContextType } from "./AbstractPlatform";
4
3
  import { PluvIO } from "./PluvIO";
5
- import type { GetInitialStorageFn } from "./types";
4
+ import { CrdtLibraryType } from "./types";
6
5
 
7
6
  export type CreateIOParams<
8
7
  TPlatform extends AbstractPlatform<any> = AbstractPlatform<any>,
@@ -12,7 +11,7 @@ export type CreateIOParams<
12
11
  > = {
13
12
  authorize?: IOAuthorize<TAuthorizeUser, TAuthorizeRequired, InferPlatformContextType<TPlatform>>;
14
13
  context?: TContext;
15
- crdt?: { doc: (value: any) => AbstractCrdtDocFactory<any> };
14
+ crdt?: CrdtLibraryType;
16
15
  debug?: boolean;
17
16
  platform: TPlatform;
18
17
  };
package/src/index.ts CHANGED
@@ -35,6 +35,8 @@ export type { MergedRouter, PluvRouterEventConfig } from "./PluvRouter";
35
35
  export { PluvServer } from "./PluvServer";
36
36
  export type { CreateRoomOptions, InferIORoom, PluvServerConfig } from "./PluvServer";
37
37
  export type {
38
+ CrdtLibraryType,
39
+ GetInitialStorageFn,
38
40
  IORoomListenerEvent,
39
41
  IORoomMessageEvent,
40
42
  PluvIOListeners,
package/src/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { AbstractCrdtDoc } from "@pluv/crdt";
1
+ import type { AbstractCrdtDoc, AbstractCrdtDocFactory } from "@pluv/crdt";
2
2
  import type {
3
3
  BaseIOAuthorize,
4
4
  EventRecord,
@@ -26,6 +26,11 @@ declare global {
26
26
  };
27
27
  }
28
28
 
29
+ export interface CrdtLibraryType {
30
+ doc: (value: any) => AbstractCrdtDocFactory<any>;
31
+ kind: "loro" | "yjs";
32
+ }
33
+
29
34
  export type EventResolver<
30
35
  TPlatform extends AbstractPlatform = AbstractPlatform,
31
36
  TAuthorize extends IOAuthorize<any, any, InferRoomContextType<TPlatform>> = BaseIOAuthorize,
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '0.28.0'
2
+ export const version = '0.30.0'