@pluv/io 1.0.2 → 2.0.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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +16 -0
- package/README.md +2 -2
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +5 -5
- package/src/IORoom.ts +4 -3
- package/src/types.ts +3 -2
- package/src/version.generated.ts +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/io@
|
|
2
|
+
> @pluv/io@2.0.1 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@
|
|
6
|
+
> @pluv/io@2.0.1 version /home/runner/work/pluv/pluv/packages/io
|
|
7
7
|
> genversion ./src/version.generated.ts --esm
|
|
8
8
|
|
|
9
9
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
[34mESM[39m Build start
|
|
14
14
|
[34mCJS[39m Build start
|
|
15
15
|
[32mESM[39m [1mdist/index.mjs [22m[32m51.32 KB[39m
|
|
16
|
-
[32mESM[39m ⚡️ Build success in
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 116ms
|
|
17
17
|
[32mCJS[39m [1mdist/index.js [22m[32m53.49 KB[39m
|
|
18
|
-
[32mCJS[39m ⚡️ Build success in
|
|
18
|
+
[32mCJS[39m ⚡️ Build success in 130ms
|
|
19
19
|
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in
|
|
21
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m32.
|
|
22
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m32.
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 3973ms
|
|
21
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m32.19 KB[39m
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m32.19 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @pluv/io
|
|
2
2
|
|
|
3
|
+
## 2.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @pluv/crdt@2.0.1
|
|
8
|
+
- @pluv/types@2.0.1
|
|
9
|
+
|
|
10
|
+
## 2.0.0
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 047a1d8: Moved several internal types to `@pluv/types`.
|
|
15
|
+
- Updated dependencies [047a1d8]
|
|
16
|
+
- @pluv/types@2.0.0
|
|
17
|
+
- @pluv/crdt@2.0.0
|
|
18
|
+
|
|
3
19
|
## 1.0.2
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -58,8 +58,8 @@ Create your frontend client with your backend types
|
|
|
58
58
|
const types = infer((i) => ({ io: i<typeof ioServer> }));
|
|
59
59
|
const io = createClient({
|
|
60
60
|
types,
|
|
61
|
-
initialStorage: yjs.doc(() => ({
|
|
62
|
-
messages:
|
|
61
|
+
initialStorage: yjs.doc((t) => ({
|
|
62
|
+
messages: t.array<string>("messages"),
|
|
63
63
|
})),
|
|
64
64
|
presence: z.object({
|
|
65
65
|
selectionId: z.string().nullable()
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { JsonObject, IOAuthorize, InferIOAuthorizeUser, MaybePromise, IOEventMessage, EventRecord, ProcedureLike, InputZodLike, IORouterLike, BaseUser, UndefinedProps, Id, InferEventMessage, InferEventsOutput, Maybe, IOLike, InferIOOutput, InferIOInput, InferIOAuthorize } from '@pluv/types';
|
|
1
|
+
import { JsonObject, IOAuthorize, InferIOAuthorizeUser, MaybePromise, IOEventMessage, EventRecord, ProcedureLike, InputZodLike, IORouterLike, BaseUser, UndefinedProps, CrdtDocLike, Id, InferEventMessage, InferEventsOutput, Maybe, IOLike, InferIOOutput, InferIOInput, InferIOAuthorize } from '@pluv/types';
|
|
2
2
|
export { BaseUser, EventMessage, EventRecord, IOEventMessage } from '@pluv/types';
|
|
3
|
-
import { AbstractCrdtDocFactory
|
|
3
|
+
import { AbstractCrdtDocFactory } from '@pluv/crdt';
|
|
4
4
|
|
|
5
5
|
declare abstract class AbstractPersistence {
|
|
6
6
|
abstract addUser(room: string, connectionId: string, user: JsonObject | null): Promise<void>;
|
|
@@ -129,7 +129,7 @@ type EventResolverKind = "broadcast" | "self" | "sync";
|
|
|
129
129
|
type EventResolver<TKind extends EventResolverKind = EventResolverKind, TPlatform extends AbstractPlatform = AbstractPlatform, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null = null, TContext extends Record<string, any> = {}, TInput extends JsonObject = {}, TOutput extends EventRecord<string, any> = {}> = (data: TInput, context: EventResolverContext<TKind, TPlatform, TAuthorize, TContext>) => MaybePromise<TOutput | void>;
|
|
130
130
|
interface EventResolverContext<TKind extends EventResolverKind = EventResolverKind, TPlatform extends AbstractPlatform = AbstractPlatform, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null = null, TContext extends Record<string, any> = {}> {
|
|
131
131
|
context: TContext;
|
|
132
|
-
doc:
|
|
132
|
+
doc: CrdtDocLike<any>;
|
|
133
133
|
garbageCollect: () => Promise<void>;
|
|
134
134
|
presence: JsonObject | null;
|
|
135
135
|
room: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { JsonObject, IOAuthorize, InferIOAuthorizeUser, MaybePromise, IOEventMessage, EventRecord, ProcedureLike, InputZodLike, IORouterLike, BaseUser, UndefinedProps, Id, InferEventMessage, InferEventsOutput, Maybe, IOLike, InferIOOutput, InferIOInput, InferIOAuthorize } from '@pluv/types';
|
|
1
|
+
import { JsonObject, IOAuthorize, InferIOAuthorizeUser, MaybePromise, IOEventMessage, EventRecord, ProcedureLike, InputZodLike, IORouterLike, BaseUser, UndefinedProps, CrdtDocLike, Id, InferEventMessage, InferEventsOutput, Maybe, IOLike, InferIOOutput, InferIOInput, InferIOAuthorize } from '@pluv/types';
|
|
2
2
|
export { BaseUser, EventMessage, EventRecord, IOEventMessage } from '@pluv/types';
|
|
3
|
-
import { AbstractCrdtDocFactory
|
|
3
|
+
import { AbstractCrdtDocFactory } from '@pluv/crdt';
|
|
4
4
|
|
|
5
5
|
declare abstract class AbstractPersistence {
|
|
6
6
|
abstract addUser(room: string, connectionId: string, user: JsonObject | null): Promise<void>;
|
|
@@ -129,7 +129,7 @@ type EventResolverKind = "broadcast" | "self" | "sync";
|
|
|
129
129
|
type EventResolver<TKind extends EventResolverKind = EventResolverKind, TPlatform extends AbstractPlatform = AbstractPlatform, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null = null, TContext extends Record<string, any> = {}, TInput extends JsonObject = {}, TOutput extends EventRecord<string, any> = {}> = (data: TInput, context: EventResolverContext<TKind, TPlatform, TAuthorize, TContext>) => MaybePromise<TOutput | void>;
|
|
130
130
|
interface EventResolverContext<TKind extends EventResolverKind = EventResolverKind, TPlatform extends AbstractPlatform = AbstractPlatform, TAuthorize extends IOAuthorize<any, InferInitContextType<TPlatform>> | null = null, TContext extends Record<string, any> = {}> {
|
|
131
131
|
context: TContext;
|
|
132
|
-
doc:
|
|
132
|
+
doc: CrdtDocLike<any>;
|
|
133
133
|
garbageCollect: () => Promise<void>;
|
|
134
134
|
presence: JsonObject | null;
|
|
135
135
|
room: string;
|
package/dist/index.js
CHANGED
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/io",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
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.10.0",
|
|
22
22
|
"kleur": "^4.1.5",
|
|
23
23
|
"wonka": "^6.3.5",
|
|
24
|
-
"@pluv/crdt": "^
|
|
25
|
-
"@pluv/types": "^
|
|
24
|
+
"@pluv/crdt": "^2.0.1",
|
|
25
|
+
"@pluv/types": "^2.0.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"eslint": "^9.25.1",
|
|
29
29
|
"genversion": "^3.2.0",
|
|
30
30
|
"tsup": "^8.4.0",
|
|
31
31
|
"typescript": "^5.8.3",
|
|
32
|
-
"@pluv/tsconfig": "^
|
|
33
|
-
"eslint-config-pluv": "^
|
|
32
|
+
"@pluv/tsconfig": "^2.0.1",
|
|
33
|
+
"eslint-config-pluv": "^2.0.1"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "pnpm run version && tsup src/index.ts --format esm,cjs --dts",
|
package/src/IORoom.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AbstractCrdtDocFactory } from "@pluv/crdt";
|
|
2
2
|
import { noop } from "@pluv/crdt";
|
|
3
3
|
import type {
|
|
4
4
|
BaseIOEventRecord,
|
|
5
5
|
BaseUser,
|
|
6
|
+
CrdtDocLike,
|
|
6
7
|
EventMessage,
|
|
7
8
|
IOEventMessage,
|
|
8
9
|
IOLike,
|
|
@@ -123,7 +124,7 @@ export class IORoom<
|
|
|
123
124
|
{
|
|
124
125
|
public readonly id: string;
|
|
125
126
|
|
|
126
|
-
private _doc: Promise<
|
|
127
|
+
private _doc: Promise<CrdtDocLike<any>>;
|
|
127
128
|
private _lastGarbageCollectMs: number = -1 * (GARBAGE_COLLECT_INTERVAL_MS + 1);
|
|
128
129
|
private _uninitialize: Promise<() => Promise<void>> | null = null;
|
|
129
130
|
|
|
@@ -625,7 +626,7 @@ export class IORoom<
|
|
|
625
626
|
}
|
|
626
627
|
}
|
|
627
628
|
|
|
628
|
-
private async _getInitialDoc(): Promise<
|
|
629
|
+
private async _getInitialDoc(): Promise<CrdtDocLike<any>> {
|
|
629
630
|
const doc = this._docFactory.getEmpty();
|
|
630
631
|
const encodedState = await this._platform.persistence.getStorageState(this.id);
|
|
631
632
|
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AbstractCrdtDocFactory } from "@pluv/crdt";
|
|
2
2
|
import type {
|
|
3
3
|
BaseUser,
|
|
4
|
+
CrdtDocLike,
|
|
4
5
|
EventRecord,
|
|
5
6
|
IOAuthorize,
|
|
6
7
|
Id,
|
|
@@ -53,7 +54,7 @@ export interface EventResolverContext<
|
|
|
53
54
|
TContext extends Record<string, any> = {},
|
|
54
55
|
> {
|
|
55
56
|
context: TContext;
|
|
56
|
-
doc:
|
|
57
|
+
doc: CrdtDocLike<any>;
|
|
57
58
|
garbageCollect: () => Promise<void>;
|
|
58
59
|
presence: JsonObject | null;
|
|
59
60
|
room: string;
|
package/src/version.generated.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '
|
|
2
|
+
export const version = '2.0.1'
|