@pluv/client 3.2.0 → 3.2.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.
- package/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +17 -3
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +19 -7
- package/dist/index.mjs +19 -7
- package/package.json +11 -7
- package/src/MockedRoom.ts +2 -2
- package/src/PluvRoom.ts +2 -3
- package/src/infer.ts +4 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/client@3.2.
|
|
2
|
+
> @pluv/client@3.2.2 build /home/runner/work/pluv/pluv/packages/client
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
[34mCLI[39m Target: es6
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m65.76 KB[39m
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 119ms
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m64.03 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 132ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m19.
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m19.
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 4648ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m19.23 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m19.23 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @pluv/client
|
|
2
2
|
|
|
3
|
+
## 3.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8665dbe: Updated types of `createClient` so that the types inferred from `createClient` are flattened and no-longer depend on `@pluv/server`.
|
|
8
|
+
- Updated dependencies [8665dbe]
|
|
9
|
+
- @pluv/types@3.2.2
|
|
10
|
+
- @pluv/crdt@3.2.2
|
|
11
|
+
|
|
12
|
+
## 3.2.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 1e0c886: Updated crdt internal private properties to use native [private elements](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_elements).
|
|
17
|
+
- @pluv/crdt@3.2.1
|
|
18
|
+
- @pluv/types@3.2.1
|
|
19
|
+
|
|
3
20
|
## 3.2.0
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -1382,7 +1399,6 @@
|
|
|
1382
1399
|
### Minor Changes
|
|
1383
1400
|
|
|
1384
1401
|
- 99b5ca9: ## Breaking Changes
|
|
1385
|
-
|
|
1386
1402
|
- `@pluv/io` has been updated to introduce `PluvProcedure`, `PluvRouter` and `PluvServer`. This change is intended to improve the ergonomics of declaring events and simplifying inferences of event types.
|
|
1387
1403
|
|
|
1388
1404
|
### Before:
|
|
@@ -1584,7 +1600,6 @@
|
|
|
1584
1600
|
### Minor Changes
|
|
1585
1601
|
|
|
1586
1602
|
- 4280220: ## Breaking Changes
|
|
1587
|
-
|
|
1588
1603
|
- Storage types are now kept on the root of the document.
|
|
1589
1604
|
- Previously, `@pluv/crdt-yjs` kept all shared-types on a hidden Yjs Map called `storage` on the root of the Yjs Doc. Now all shared-types are kept on the root of the Yjs Doc instead. This behavior should be more in-line with how shared-types are documented to be used from Yjs.
|
|
1590
1605
|
- `@pluv/client` and `@pluv/react` no-longer re-export `@pluv/crdt-yjs`. This package will now need to be installed separately.
|
|
@@ -2088,7 +2103,6 @@
|
|
|
2088
2103
|
### Patch Changes
|
|
2089
2104
|
|
|
2090
2105
|
- f4317ba: \* Renamed type `unstable_YObjectValue` to `YObjectValue`;
|
|
2091
|
-
|
|
2092
2106
|
- Renamed type `unstable_YObject` to `YObject`.
|
|
2093
2107
|
- Re-exported `xmlElement`, `xmlFragment` and `xmlText` from `@pluv/client`.
|
|
2094
2108
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractCrdtDocFactory, InferDocLike, NoopCrdtDocFactory, InferStorage, InferDoc, InferCrdtJson } from '@pluv/crdt';
|
|
2
2
|
export { CrdtType, InferCrdtJson } from '@pluv/crdt';
|
|
3
|
-
import { IOLike, JsonObject, EventRecord, CrdtDocLike, UserInfo, MaybePromise, Id, ProcedureLike, InputZodLike, IORouterLike, InferIOAuthorizeUser,
|
|
3
|
+
import { IOLike, InferIOAuthorize, InferIOCrdt, InferIOEvents, JsonObject, EventRecord, CrdtDocLike, UserInfo, MaybePromise, Id, ProcedureLike, InputZodLike, IORouterLike, InferIOAuthorizeUser, BaseUser, RoomLike, InferIOOutput, InferIOInput, RoomEventListenerMap, BroadcastProxy, WebSocketConnection, SubscribeProxy, UpdateMyPresenceAction, InferIOCrdtKind, MergeEvents } from '@pluv/types';
|
|
4
4
|
export { BaseUser, ConnectionState, EventMessage, EventNotifierSubscriptionCallback, EventRecord, IOEventMessage, MergeEvents, RoomLike, UserInfo, WebSocketConnection, WebSocketState } from '@pluv/types';
|
|
5
5
|
|
|
6
6
|
declare abstract class AbstractStorageStore {
|
|
@@ -19,7 +19,7 @@ declare const identity: <T extends unknown>(x: T) => T;
|
|
|
19
19
|
type InferCallback<TIO extends IOLike<any, any, any>> = (i: typeof identity) => {
|
|
20
20
|
io: (io: TIO) => TIO;
|
|
21
21
|
};
|
|
22
|
-
declare const infer: <TIO extends IOLike<any, any, any>>(callback: InferCallback<TIO>) => InferCallback<TIO
|
|
22
|
+
declare const infer: <TIO extends IOLike<any, any, any>>(callback: InferCallback<TIO>) => InferCallback<IOLike<InferIOAuthorize<TIO>, InferIOCrdt<TIO>, InferIOEvents<TIO>>>;
|
|
23
23
|
|
|
24
24
|
type EventResolver<TIO extends IOLike, TInput extends JsonObject, TOutput extends EventRecord<string, any>, TPresence extends Record<string, any>, TDocLike extends CrdtDocLike<any, any>> = (data: TInput, context: EventResolverContext<TIO, TPresence, TDocLike>) => MaybePromise<TOutput | void>;
|
|
25
25
|
interface EventResolverContext<TIO extends IOLike, TPresence extends Record<string, any>, TDocLike extends CrdtDocLike<any, any>> {
|
|
@@ -142,6 +142,7 @@ type RoomConfig<TIO extends IOLike, TMetadata extends JsonObject, TPresence exte
|
|
|
142
142
|
router?: PluvRouter<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
|
|
143
143
|
} & RoomEndpoints<TIO, TMetadata> & Pick<CrdtManagerOptions<TCrdt>, "initialStorage"> & UsersManagerConfig<TPresence>>;
|
|
144
144
|
declare class PluvRoom<TIO extends IOLike<any, any, any>, TMetadata extends JsonObject = {}, TPresence extends Record<string, any> = {}, TCrdt extends AbstractCrdtDocFactory<any, any> = NoopCrdtDocFactory, TEvents extends PluvRouterEventConfig<TIO, TPresence, InferStorage<TCrdt>> = {}> implements RoomLike<TIO, InferDoc<TCrdt>, TPresence, InferStorage<TCrdt>> {
|
|
145
|
+
#private;
|
|
145
146
|
readonly _endpoints: RoomEndpoints<TIO, TMetadata>;
|
|
146
147
|
readonly id: string;
|
|
147
148
|
readonly metadata?: InputZodLike<TMetadata>;
|
|
@@ -236,7 +237,6 @@ declare class PluvRoom<TIO extends IOLike<any, any, any>, TMetadata extends Json
|
|
|
236
237
|
private _reconnect;
|
|
237
238
|
private _sendMessage;
|
|
238
239
|
private _setMetadata;
|
|
239
|
-
private _storage;
|
|
240
240
|
private _updateState;
|
|
241
241
|
}
|
|
242
242
|
|
|
@@ -301,6 +301,7 @@ type MockedRoomConfig<TIO extends IOLike, TPresence extends Record<string, any>,
|
|
|
301
301
|
router?: PluvRouter<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
|
|
302
302
|
} & Pick<CrdtManagerOptions<TCrdt>, "initialStorage"> & Omit<UsersManagerConfig<TPresence>, "limits">;
|
|
303
303
|
declare class MockedRoom<TIO extends IOLike, TPresence extends Record<string, any>, TCrdt extends AbstractCrdtDocFactory<any, any>, TEvents extends PluvRouterEventConfig<TIO, TPresence, InferStorage<TCrdt>>> implements RoomLike<TIO, InferDoc<TCrdt>, TPresence, InferStorage<TCrdt>> {
|
|
304
|
+
#private;
|
|
304
305
|
readonly id: string;
|
|
305
306
|
private readonly _crdtManager;
|
|
306
307
|
private readonly _crdtNotifier;
|
|
@@ -338,7 +339,6 @@ declare class MockedRoom<TIO extends IOLike, TPresence extends Record<string, an
|
|
|
338
339
|
private _observeCrdt;
|
|
339
340
|
private _other;
|
|
340
341
|
private _simulateEvent;
|
|
341
|
-
private _storage;
|
|
342
342
|
}
|
|
343
343
|
|
|
344
344
|
interface RegisterParams<TMetadata extends JsonObject> {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractCrdtDocFactory, InferDocLike, NoopCrdtDocFactory, InferStorage, InferDoc, InferCrdtJson } from '@pluv/crdt';
|
|
2
2
|
export { CrdtType, InferCrdtJson } from '@pluv/crdt';
|
|
3
|
-
import { IOLike, JsonObject, EventRecord, CrdtDocLike, UserInfo, MaybePromise, Id, ProcedureLike, InputZodLike, IORouterLike, InferIOAuthorizeUser,
|
|
3
|
+
import { IOLike, InferIOAuthorize, InferIOCrdt, InferIOEvents, JsonObject, EventRecord, CrdtDocLike, UserInfo, MaybePromise, Id, ProcedureLike, InputZodLike, IORouterLike, InferIOAuthorizeUser, BaseUser, RoomLike, InferIOOutput, InferIOInput, RoomEventListenerMap, BroadcastProxy, WebSocketConnection, SubscribeProxy, UpdateMyPresenceAction, InferIOCrdtKind, MergeEvents } from '@pluv/types';
|
|
4
4
|
export { BaseUser, ConnectionState, EventMessage, EventNotifierSubscriptionCallback, EventRecord, IOEventMessage, MergeEvents, RoomLike, UserInfo, WebSocketConnection, WebSocketState } from '@pluv/types';
|
|
5
5
|
|
|
6
6
|
declare abstract class AbstractStorageStore {
|
|
@@ -19,7 +19,7 @@ declare const identity: <T extends unknown>(x: T) => T;
|
|
|
19
19
|
type InferCallback<TIO extends IOLike<any, any, any>> = (i: typeof identity) => {
|
|
20
20
|
io: (io: TIO) => TIO;
|
|
21
21
|
};
|
|
22
|
-
declare const infer: <TIO extends IOLike<any, any, any>>(callback: InferCallback<TIO>) => InferCallback<TIO
|
|
22
|
+
declare const infer: <TIO extends IOLike<any, any, any>>(callback: InferCallback<TIO>) => InferCallback<IOLike<InferIOAuthorize<TIO>, InferIOCrdt<TIO>, InferIOEvents<TIO>>>;
|
|
23
23
|
|
|
24
24
|
type EventResolver<TIO extends IOLike, TInput extends JsonObject, TOutput extends EventRecord<string, any>, TPresence extends Record<string, any>, TDocLike extends CrdtDocLike<any, any>> = (data: TInput, context: EventResolverContext<TIO, TPresence, TDocLike>) => MaybePromise<TOutput | void>;
|
|
25
25
|
interface EventResolverContext<TIO extends IOLike, TPresence extends Record<string, any>, TDocLike extends CrdtDocLike<any, any>> {
|
|
@@ -142,6 +142,7 @@ type RoomConfig<TIO extends IOLike, TMetadata extends JsonObject, TPresence exte
|
|
|
142
142
|
router?: PluvRouter<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
|
|
143
143
|
} & RoomEndpoints<TIO, TMetadata> & Pick<CrdtManagerOptions<TCrdt>, "initialStorage"> & UsersManagerConfig<TPresence>>;
|
|
144
144
|
declare class PluvRoom<TIO extends IOLike<any, any, any>, TMetadata extends JsonObject = {}, TPresence extends Record<string, any> = {}, TCrdt extends AbstractCrdtDocFactory<any, any> = NoopCrdtDocFactory, TEvents extends PluvRouterEventConfig<TIO, TPresence, InferStorage<TCrdt>> = {}> implements RoomLike<TIO, InferDoc<TCrdt>, TPresence, InferStorage<TCrdt>> {
|
|
145
|
+
#private;
|
|
145
146
|
readonly _endpoints: RoomEndpoints<TIO, TMetadata>;
|
|
146
147
|
readonly id: string;
|
|
147
148
|
readonly metadata?: InputZodLike<TMetadata>;
|
|
@@ -236,7 +237,6 @@ declare class PluvRoom<TIO extends IOLike<any, any, any>, TMetadata extends Json
|
|
|
236
237
|
private _reconnect;
|
|
237
238
|
private _sendMessage;
|
|
238
239
|
private _setMetadata;
|
|
239
|
-
private _storage;
|
|
240
240
|
private _updateState;
|
|
241
241
|
}
|
|
242
242
|
|
|
@@ -301,6 +301,7 @@ type MockedRoomConfig<TIO extends IOLike, TPresence extends Record<string, any>,
|
|
|
301
301
|
router?: PluvRouter<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
|
|
302
302
|
} & Pick<CrdtManagerOptions<TCrdt>, "initialStorage"> & Omit<UsersManagerConfig<TPresence>, "limits">;
|
|
303
303
|
declare class MockedRoom<TIO extends IOLike, TPresence extends Record<string, any>, TCrdt extends AbstractCrdtDocFactory<any, any>, TEvents extends PluvRouterEventConfig<TIO, TPresence, InferStorage<TCrdt>>> implements RoomLike<TIO, InferDoc<TCrdt>, TPresence, InferStorage<TCrdt>> {
|
|
304
|
+
#private;
|
|
304
305
|
readonly id: string;
|
|
305
306
|
private readonly _crdtManager;
|
|
306
307
|
private readonly _crdtNotifier;
|
|
@@ -338,7 +339,6 @@ declare class MockedRoom<TIO extends IOLike, TPresence extends Record<string, an
|
|
|
338
339
|
private _observeCrdt;
|
|
339
340
|
private _other;
|
|
340
341
|
private _simulateEvent;
|
|
341
|
-
private _storage;
|
|
342
342
|
}
|
|
343
343
|
|
|
344
344
|
interface RegisterParams<TMetadata extends JsonObject> {
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,9 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
7
7
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
9
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __typeError = (msg) => {
|
|
11
|
+
throw TypeError(msg);
|
|
12
|
+
};
|
|
10
13
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
14
|
var __spreadValues = (a, b) => {
|
|
12
15
|
for (var prop in b || (b = {}))
|
|
@@ -33,6 +36,9 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
33
36
|
return to;
|
|
34
37
|
};
|
|
35
38
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
39
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
40
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
41
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
36
42
|
var __async = (__this, __arguments, generator) => {
|
|
37
43
|
return new Promise((resolve, reject) => {
|
|
38
44
|
var fulfilled = (value) => {
|
|
@@ -589,6 +595,7 @@ var ORIGIN_STORAGE_UPDATED = "$storageUpdated";
|
|
|
589
595
|
var DEFAULT_PLUV_CLIENT_ADDON = (input) => ({
|
|
590
596
|
storage: new StorageStore(input.room.id)
|
|
591
597
|
});
|
|
598
|
+
var __storage;
|
|
592
599
|
var PluvRoom = class {
|
|
593
600
|
constructor(room, options) {
|
|
594
601
|
this._crdtNotifier = new CrdtNotifier();
|
|
@@ -723,7 +730,7 @@ var PluvRoom = class {
|
|
|
723
730
|
}
|
|
724
731
|
if (prop === "event") return this._event;
|
|
725
732
|
if (prop === "other") return this._other;
|
|
726
|
-
if (prop === "storage") return this
|
|
733
|
+
if (prop === "storage") return __privateGet(this, __storage);
|
|
727
734
|
}
|
|
728
735
|
}
|
|
729
736
|
);
|
|
@@ -781,7 +788,7 @@ var PluvRoom = class {
|
|
|
781
788
|
if (!clientId) return () => void 0;
|
|
782
789
|
return this._usersNotifier.subscribeOther(clientId, callback);
|
|
783
790
|
};
|
|
784
|
-
this
|
|
791
|
+
__privateAdd(this, __storage, new Proxy(
|
|
785
792
|
(key, callback) => this._crdtNotifier.subscribe(key, callback),
|
|
786
793
|
{
|
|
787
794
|
get: (fn, prop) => {
|
|
@@ -795,7 +802,7 @@ var PluvRoom = class {
|
|
|
795
802
|
};
|
|
796
803
|
}
|
|
797
804
|
}
|
|
798
|
-
);
|
|
805
|
+
));
|
|
799
806
|
const {
|
|
800
807
|
addons = [],
|
|
801
808
|
authEndpoint,
|
|
@@ -1562,6 +1569,7 @@ var PluvRoom = class {
|
|
|
1562
1569
|
return newState;
|
|
1563
1570
|
}
|
|
1564
1571
|
};
|
|
1572
|
+
__storage = new WeakMap();
|
|
1565
1573
|
|
|
1566
1574
|
// src/PluvClient.ts
|
|
1567
1575
|
var PluvClient = class {
|
|
@@ -1663,10 +1671,13 @@ var createClient = (options) => {
|
|
|
1663
1671
|
};
|
|
1664
1672
|
|
|
1665
1673
|
// src/infer.ts
|
|
1666
|
-
var infer = (callback) =>
|
|
1674
|
+
var infer = (callback) => {
|
|
1675
|
+
return callback;
|
|
1676
|
+
};
|
|
1667
1677
|
|
|
1668
1678
|
// src/MockedRoom.ts
|
|
1669
1679
|
var import_types2 = require("@pluv/types");
|
|
1680
|
+
var __storage2;
|
|
1670
1681
|
var MockedRoom = class {
|
|
1671
1682
|
constructor(room, options) {
|
|
1672
1683
|
this._crdtNotifier = new CrdtNotifier();
|
|
@@ -1788,7 +1799,7 @@ var MockedRoom = class {
|
|
|
1788
1799
|
}
|
|
1789
1800
|
if (prop === "event") return this._event;
|
|
1790
1801
|
if (prop === "other") return this._other;
|
|
1791
|
-
if (prop === "storage") return this
|
|
1802
|
+
if (prop === "storage") return __privateGet(this, __storage2);
|
|
1792
1803
|
}
|
|
1793
1804
|
}
|
|
1794
1805
|
);
|
|
@@ -1827,7 +1838,7 @@ var MockedRoom = class {
|
|
|
1827
1838
|
if (!clientId) return () => void 0;
|
|
1828
1839
|
return this._usersNotifier.subscribeOther(clientId, callback);
|
|
1829
1840
|
};
|
|
1830
|
-
this
|
|
1841
|
+
__privateAdd(this, __storage2, new Proxy(
|
|
1831
1842
|
(key, callback) => this._crdtNotifier.subscribe(key, callback),
|
|
1832
1843
|
{
|
|
1833
1844
|
get: (fn, prop) => {
|
|
@@ -1841,7 +1852,7 @@ var MockedRoom = class {
|
|
|
1841
1852
|
};
|
|
1842
1853
|
}
|
|
1843
1854
|
}
|
|
1844
|
-
);
|
|
1855
|
+
));
|
|
1845
1856
|
const { events, initialPresence, initialStorage, limits, presence, router } = options;
|
|
1846
1857
|
this.id = room;
|
|
1847
1858
|
this._events = events;
|
|
@@ -1910,6 +1921,7 @@ var MockedRoom = class {
|
|
|
1910
1921
|
});
|
|
1911
1922
|
}
|
|
1912
1923
|
};
|
|
1924
|
+
__storage2 = new WeakMap();
|
|
1913
1925
|
|
|
1914
1926
|
// src/register.ts
|
|
1915
1927
|
var register = (params) => {
|
package/dist/index.mjs
CHANGED
|
@@ -4,6 +4,9 @@ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
|
4
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __typeError = (msg) => {
|
|
8
|
+
throw TypeError(msg);
|
|
9
|
+
};
|
|
7
10
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
11
|
var __spreadValues = (a, b) => {
|
|
9
12
|
for (var prop in b || (b = {}))
|
|
@@ -17,6 +20,9 @@ var __spreadValues = (a, b) => {
|
|
|
17
20
|
return a;
|
|
18
21
|
};
|
|
19
22
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
24
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
25
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
20
26
|
var __async = (__this, __arguments, generator) => {
|
|
21
27
|
return new Promise((resolve, reject) => {
|
|
22
28
|
var fulfilled = (value) => {
|
|
@@ -561,6 +567,7 @@ var ORIGIN_STORAGE_UPDATED = "$storageUpdated";
|
|
|
561
567
|
var DEFAULT_PLUV_CLIENT_ADDON = (input) => ({
|
|
562
568
|
storage: new StorageStore(input.room.id)
|
|
563
569
|
});
|
|
570
|
+
var __storage;
|
|
564
571
|
var PluvRoom = class {
|
|
565
572
|
constructor(room, options) {
|
|
566
573
|
this._crdtNotifier = new CrdtNotifier();
|
|
@@ -695,7 +702,7 @@ var PluvRoom = class {
|
|
|
695
702
|
}
|
|
696
703
|
if (prop === "event") return this._event;
|
|
697
704
|
if (prop === "other") return this._other;
|
|
698
|
-
if (prop === "storage") return this
|
|
705
|
+
if (prop === "storage") return __privateGet(this, __storage);
|
|
699
706
|
}
|
|
700
707
|
}
|
|
701
708
|
);
|
|
@@ -753,7 +760,7 @@ var PluvRoom = class {
|
|
|
753
760
|
if (!clientId) return () => void 0;
|
|
754
761
|
return this._usersNotifier.subscribeOther(clientId, callback);
|
|
755
762
|
};
|
|
756
|
-
this
|
|
763
|
+
__privateAdd(this, __storage, new Proxy(
|
|
757
764
|
(key, callback) => this._crdtNotifier.subscribe(key, callback),
|
|
758
765
|
{
|
|
759
766
|
get: (fn, prop) => {
|
|
@@ -767,7 +774,7 @@ var PluvRoom = class {
|
|
|
767
774
|
};
|
|
768
775
|
}
|
|
769
776
|
}
|
|
770
|
-
);
|
|
777
|
+
));
|
|
771
778
|
const {
|
|
772
779
|
addons = [],
|
|
773
780
|
authEndpoint,
|
|
@@ -1534,6 +1541,7 @@ var PluvRoom = class {
|
|
|
1534
1541
|
return newState;
|
|
1535
1542
|
}
|
|
1536
1543
|
};
|
|
1544
|
+
__storage = new WeakMap();
|
|
1537
1545
|
|
|
1538
1546
|
// src/PluvClient.ts
|
|
1539
1547
|
var PluvClient = class {
|
|
@@ -1635,10 +1643,13 @@ var createClient = (options) => {
|
|
|
1635
1643
|
};
|
|
1636
1644
|
|
|
1637
1645
|
// src/infer.ts
|
|
1638
|
-
var infer = (callback) =>
|
|
1646
|
+
var infer = (callback) => {
|
|
1647
|
+
return callback;
|
|
1648
|
+
};
|
|
1639
1649
|
|
|
1640
1650
|
// src/MockedRoom.ts
|
|
1641
1651
|
import { ConnectionState as ConnectionState2, StorageState as StorageState2 } from "@pluv/types";
|
|
1652
|
+
var __storage2;
|
|
1642
1653
|
var MockedRoom = class {
|
|
1643
1654
|
constructor(room, options) {
|
|
1644
1655
|
this._crdtNotifier = new CrdtNotifier();
|
|
@@ -1760,7 +1771,7 @@ var MockedRoom = class {
|
|
|
1760
1771
|
}
|
|
1761
1772
|
if (prop === "event") return this._event;
|
|
1762
1773
|
if (prop === "other") return this._other;
|
|
1763
|
-
if (prop === "storage") return this
|
|
1774
|
+
if (prop === "storage") return __privateGet(this, __storage2);
|
|
1764
1775
|
}
|
|
1765
1776
|
}
|
|
1766
1777
|
);
|
|
@@ -1799,7 +1810,7 @@ var MockedRoom = class {
|
|
|
1799
1810
|
if (!clientId) return () => void 0;
|
|
1800
1811
|
return this._usersNotifier.subscribeOther(clientId, callback);
|
|
1801
1812
|
};
|
|
1802
|
-
this
|
|
1813
|
+
__privateAdd(this, __storage2, new Proxy(
|
|
1803
1814
|
(key, callback) => this._crdtNotifier.subscribe(key, callback),
|
|
1804
1815
|
{
|
|
1805
1816
|
get: (fn, prop) => {
|
|
@@ -1813,7 +1824,7 @@ var MockedRoom = class {
|
|
|
1813
1824
|
};
|
|
1814
1825
|
}
|
|
1815
1826
|
}
|
|
1816
|
-
);
|
|
1827
|
+
));
|
|
1817
1828
|
const { events, initialPresence, initialStorage, limits, presence, router } = options;
|
|
1818
1829
|
this.id = room;
|
|
1819
1830
|
this._events = events;
|
|
@@ -1882,6 +1893,7 @@ var MockedRoom = class {
|
|
|
1882
1893
|
});
|
|
1883
1894
|
}
|
|
1884
1895
|
};
|
|
1896
|
+
__storage2 = new WeakMap();
|
|
1885
1897
|
|
|
1886
1898
|
// src/register.ts
|
|
1887
1899
|
var register = (params) => {
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/client",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"description": "@pluv/io frontend client",
|
|
5
|
-
"author":
|
|
5
|
+
"author": {
|
|
6
|
+
"email": "david@pluv.io",
|
|
7
|
+
"name": "i3dly",
|
|
8
|
+
"url": "https://github.com/i3dly"
|
|
9
|
+
},
|
|
6
10
|
"license": "MIT",
|
|
7
11
|
"homepage": "https://github.com/pluv-io/pluv",
|
|
8
12
|
"repository": {
|
|
@@ -18,15 +22,15 @@
|
|
|
18
22
|
},
|
|
19
23
|
"dependencies": {
|
|
20
24
|
"wonka": "^6.3.5",
|
|
21
|
-
"@pluv/crdt": "^3.2.
|
|
22
|
-
"@pluv/types": "^3.2.
|
|
25
|
+
"@pluv/crdt": "^3.2.2",
|
|
26
|
+
"@pluv/types": "^3.2.2"
|
|
23
27
|
},
|
|
24
28
|
"devDependencies": {
|
|
25
|
-
"eslint": "^9.
|
|
29
|
+
"eslint": "^9.31.0",
|
|
26
30
|
"tsup": "^8.5.0",
|
|
27
31
|
"typescript": "^5.8.3",
|
|
28
|
-
"@pluv/tsconfig": "^3.2.
|
|
29
|
-
"eslint-config-pluv": "^3.2.
|
|
32
|
+
"@pluv/tsconfig": "^3.2.2",
|
|
33
|
+
"eslint-config-pluv": "^3.2.2"
|
|
30
34
|
},
|
|
31
35
|
"scripts": {
|
|
32
36
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|
package/src/MockedRoom.ts
CHANGED
|
@@ -309,7 +309,7 @@ export class MockedRoom<
|
|
|
309
309
|
|
|
310
310
|
if (prop === "event") return this._event;
|
|
311
311
|
if (prop === "other") return this._other;
|
|
312
|
-
if (prop === "storage") return this
|
|
312
|
+
if (prop === "storage") return this.#_storage;
|
|
313
313
|
},
|
|
314
314
|
},
|
|
315
315
|
) as SubscribeProxy<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
|
|
@@ -434,7 +434,7 @@ export class MockedRoom<
|
|
|
434
434
|
});
|
|
435
435
|
}
|
|
436
436
|
|
|
437
|
-
|
|
437
|
+
#_storage = new Proxy(
|
|
438
438
|
<TKey extends keyof InferStorage<TCrdt>>(
|
|
439
439
|
key: TKey,
|
|
440
440
|
callback: StorageSubscriptionCallback<InferStorage<TCrdt>, TKey>,
|
package/src/PluvRoom.ts
CHANGED
|
@@ -78,7 +78,6 @@ const ORIGIN_INITIALIZED = "$initialized";
|
|
|
78
78
|
const ORIGIN_STORAGE_UPDATED = "$storageUpdated";
|
|
79
79
|
|
|
80
80
|
declare global {
|
|
81
|
-
// eslint-disable-next-line no-var
|
|
82
81
|
var process: {
|
|
83
82
|
env: {
|
|
84
83
|
[key: string]: string | undefined;
|
|
@@ -586,7 +585,7 @@ export class PluvRoom<
|
|
|
586
585
|
|
|
587
586
|
if (prop === "event") return this._event;
|
|
588
587
|
if (prop === "other") return this._other;
|
|
589
|
-
if (prop === "storage") return this
|
|
588
|
+
if (prop === "storage") return this.#_storage;
|
|
590
589
|
},
|
|
591
590
|
},
|
|
592
591
|
) as SubscribeProxy<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
|
|
@@ -1561,7 +1560,7 @@ export class PluvRoom<
|
|
|
1561
1560
|
return parsed;
|
|
1562
1561
|
}
|
|
1563
1562
|
|
|
1564
|
-
|
|
1563
|
+
#_storage = new Proxy(
|
|
1565
1564
|
<TKey extends keyof InferStorage<TCrdt>>(
|
|
1566
1565
|
key: TKey,
|
|
1567
1566
|
callback: StorageSubscriptionCallback<InferStorage<TCrdt>, TKey>,
|
package/src/infer.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IOLike } from "@pluv/types";
|
|
1
|
+
import type { InferIOAuthorize, InferIOCrdt, InferIOEvents, IOLike } from "@pluv/types";
|
|
2
2
|
import type { identity } from "./utils";
|
|
3
3
|
|
|
4
4
|
export type InferCallback<TIO extends IOLike<any, any, any>> = (i: typeof identity) => {
|
|
@@ -7,4 +7,6 @@ export type InferCallback<TIO extends IOLike<any, any, any>> = (i: typeof identi
|
|
|
7
7
|
|
|
8
8
|
export const infer = <TIO extends IOLike<any, any, any>>(
|
|
9
9
|
callback: InferCallback<TIO>,
|
|
10
|
-
): InferCallback<TIO
|
|
10
|
+
): InferCallback<IOLike<InferIOAuthorize<TIO>, InferIOCrdt<TIO>, InferIOEvents<TIO>>> => {
|
|
11
|
+
return callback as any;
|
|
12
|
+
};
|