@pluv/io 0.41.2 → 0.41.4
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 +15 -0
- package/dist/index.js +15 -2
- package/dist/index.mjs +15 -2
- package/package.json +5 -5
- package/src/PluvServer.ts +3 -1
- package/src/utils/index.ts +1 -0
- package/src/utils/pickBy.ts +13 -0
- package/src/version.generated.ts +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/io@0.41.
|
|
2
|
+
> @pluv/io@0.41.4 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.41.
|
|
6
|
+
> @pluv/io@0.41.4 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
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
[34mCLI[39m Target: es6
|
|
13
13
|
[34mESM[39m Build start
|
|
14
14
|
[34mCJS[39m Build start
|
|
15
|
-
[32mCJS[39m [1mdist/index.js [22m[32m51.
|
|
16
|
-
[32mCJS[39m ⚡️ Build success in
|
|
17
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m49.
|
|
18
|
-
[32mESM[39m ⚡️ Build success in
|
|
15
|
+
[32mCJS[39m [1mdist/index.js [22m[32m51.61 KB[39m
|
|
16
|
+
[32mCJS[39m ⚡️ Build success in 127ms
|
|
17
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m49.44 KB[39m
|
|
18
|
+
[32mESM[39m ⚡️ Build success in 127ms
|
|
19
19
|
[34mDTS[39m Build start
|
|
20
|
-
[32mDTS[39m ⚡️ Build success in
|
|
20
|
+
[32mDTS[39m ⚡️ Build success in 2958ms
|
|
21
21
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m31.42 KB[39m
|
|
22
22
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m31.42 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @pluv/io
|
|
2
2
|
|
|
3
|
+
## 0.41.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @pluv/crdt@0.41.4
|
|
8
|
+
- @pluv/types@0.41.4
|
|
9
|
+
|
|
10
|
+
## 0.41.3
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 49051c0: Fix presence keys becoming lost, causing presence objects to be partial and failing schema validation.
|
|
15
|
+
- @pluv/crdt@0.41.3
|
|
16
|
+
- @pluv/types@0.41.3
|
|
17
|
+
|
|
3
18
|
## 0.41.2
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1104,8 +1104,20 @@ var IORoom = class {
|
|
|
1104
1104
|
}
|
|
1105
1105
|
};
|
|
1106
1106
|
|
|
1107
|
+
// src/utils/pickBy.ts
|
|
1108
|
+
var pickBy = (obj, by) => {
|
|
1109
|
+
const result = {};
|
|
1110
|
+
const keys = Object.keys(obj);
|
|
1111
|
+
for (let i = 0; i < keys.length; ++i) {
|
|
1112
|
+
const key = keys[i];
|
|
1113
|
+
const value = obj[key];
|
|
1114
|
+
if (by(value)) result[key] = value;
|
|
1115
|
+
}
|
|
1116
|
+
return result;
|
|
1117
|
+
};
|
|
1118
|
+
|
|
1107
1119
|
// src/version.generated.ts
|
|
1108
|
-
var version = "0.41.
|
|
1120
|
+
var version = "0.41.4";
|
|
1109
1121
|
|
|
1110
1122
|
// src/PluvServer.ts
|
|
1111
1123
|
var PluvServer = class {
|
|
@@ -1184,7 +1196,8 @@ var PluvServer = class {
|
|
|
1184
1196
|
const presence = data == null ? void 0 : data.presence;
|
|
1185
1197
|
const { session } = context;
|
|
1186
1198
|
if (!session) return {};
|
|
1187
|
-
const
|
|
1199
|
+
const cleanedPatch = pickBy(presence != null ? presence : {}, (value) => typeof value !== "undefined");
|
|
1200
|
+
const updated = Object.assign(/* @__PURE__ */ Object.create(null), session.presence, cleanedPatch);
|
|
1188
1201
|
const bytes = new TextEncoder().encode(JSON.stringify(updated)).length;
|
|
1189
1202
|
if (bytes > MAX_PRESENCE_SIZE_BYTES) {
|
|
1190
1203
|
throw new Error(
|
package/dist/index.mjs
CHANGED
|
@@ -1062,8 +1062,20 @@ var IORoom = class {
|
|
|
1062
1062
|
}
|
|
1063
1063
|
};
|
|
1064
1064
|
|
|
1065
|
+
// src/utils/pickBy.ts
|
|
1066
|
+
var pickBy = (obj, by) => {
|
|
1067
|
+
const result = {};
|
|
1068
|
+
const keys = Object.keys(obj);
|
|
1069
|
+
for (let i = 0; i < keys.length; ++i) {
|
|
1070
|
+
const key = keys[i];
|
|
1071
|
+
const value = obj[key];
|
|
1072
|
+
if (by(value)) result[key] = value;
|
|
1073
|
+
}
|
|
1074
|
+
return result;
|
|
1075
|
+
};
|
|
1076
|
+
|
|
1065
1077
|
// src/version.generated.ts
|
|
1066
|
-
var version = "0.41.
|
|
1078
|
+
var version = "0.41.4";
|
|
1067
1079
|
|
|
1068
1080
|
// src/PluvServer.ts
|
|
1069
1081
|
var PluvServer = class {
|
|
@@ -1142,7 +1154,8 @@ var PluvServer = class {
|
|
|
1142
1154
|
const presence = data == null ? void 0 : data.presence;
|
|
1143
1155
|
const { session } = context;
|
|
1144
1156
|
if (!session) return {};
|
|
1145
|
-
const
|
|
1157
|
+
const cleanedPatch = pickBy(presence != null ? presence : {}, (value) => typeof value !== "undefined");
|
|
1158
|
+
const updated = Object.assign(/* @__PURE__ */ Object.create(null), session.presence, cleanedPatch);
|
|
1146
1159
|
const bytes = new TextEncoder().encode(JSON.stringify(updated)).length;
|
|
1147
1160
|
if (bytes > MAX_PRESENCE_SIZE_BYTES) {
|
|
1148
1161
|
throw new Error(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/io",
|
|
3
|
-
"version": "0.41.
|
|
3
|
+
"version": "0.41.4",
|
|
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/
|
|
25
|
-
"@pluv/
|
|
24
|
+
"@pluv/crdt": "^0.41.4",
|
|
25
|
+
"@pluv/types": "^0.41.4"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"eslint": "^9.25.0",
|
|
29
29
|
"genversion": "^3.2.0",
|
|
30
30
|
"tsup": "^8.4.0",
|
|
31
31
|
"typescript": "^5.8.3",
|
|
32
|
-
"@pluv/tsconfig": "^0.41.
|
|
33
|
-
"eslint-config-pluv": "^0.41.
|
|
32
|
+
"@pluv/tsconfig": "^0.41.4",
|
|
33
|
+
"eslint-config-pluv": "^0.41.4"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "pnpm run version && tsup src/index.ts --format esm,cjs --dts",
|
package/src/PluvServer.ts
CHANGED
|
@@ -19,6 +19,7 @@ import type {
|
|
|
19
19
|
PluvIOListeners,
|
|
20
20
|
ResolvedPluvIOAuthorize,
|
|
21
21
|
} from "./types";
|
|
22
|
+
import { pickBy } from "./utils";
|
|
22
23
|
import { __PLUV_VERSION } from "./version";
|
|
23
24
|
|
|
24
25
|
export type InferIORoom<TServer extends PluvServer<any, any, any, any>> =
|
|
@@ -170,7 +171,8 @@ export class PluvServer<
|
|
|
170
171
|
|
|
171
172
|
if (!session) return {};
|
|
172
173
|
|
|
173
|
-
const
|
|
174
|
+
const cleanedPatch = pickBy(presence ?? {}, (value) => typeof value !== "undefined");
|
|
175
|
+
const updated = Object.assign(Object.create(null), session.presence, cleanedPatch);
|
|
174
176
|
const bytes = new TextEncoder().encode(JSON.stringify(updated)).length;
|
|
175
177
|
|
|
176
178
|
if (bytes > MAX_PRESENCE_SIZE_BYTES) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { pickBy } from "./pickBy";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const pickBy = <T extends Record<string, any>>(obj: T, by: (value: T[keyof T]) => boolean): Partial<T> => {
|
|
2
|
+
const result: Partial<T> = {};
|
|
3
|
+
const keys: (keyof T)[] = Object.keys(obj);
|
|
4
|
+
|
|
5
|
+
for (let i = 0; i < keys.length; ++i) {
|
|
6
|
+
const key = keys[i];
|
|
7
|
+
const value = obj[key];
|
|
8
|
+
|
|
9
|
+
if (by(value)) result[key] = value;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
return result;
|
|
13
|
+
};
|
package/src/version.generated.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '0.41.
|
|
2
|
+
export const version = '0.41.4'
|