@lolyjs/core 0.2.0-alpha.24 → 0.2.0-alpha.25
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/dist/cli.cjs +0 -15
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +0 -15
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +0 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +1 -6
- package/dist/index.d.ts +1 -6
- package/dist/index.js +0 -15
- package/dist/index.js.map +1 -1
- package/dist/react/sockets.cjs +0 -8
- package/dist/react/sockets.cjs.map +1 -1
- package/dist/react/sockets.js +0 -8
- package/dist/react/sockets.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import http from 'http';
|
|
2
2
|
export { a as ApiContext, A as ApiMiddleware, G as GenerateStaticParams, L as LoaderResult, M as MetadataLoader, R as RouteMiddleware, S as ServerContext, b as ServerLoader, W as WssActions } from './index.types-DMOO-uvF.mjs';
|
|
3
|
-
import {
|
|
3
|
+
import { Socket } from 'socket.io';
|
|
4
4
|
export { c as bootstrapClient } from './bootstrap-BfGTMUkj.mjs';
|
|
5
5
|
import { ZodSchema, z } from 'zod';
|
|
6
6
|
import * as express_rate_limit from 'express-rate-limit';
|
|
@@ -153,7 +153,6 @@ interface RateLimitCfg {
|
|
|
153
153
|
type GuardFn<TUser = any> = (ctx: {
|
|
154
154
|
user: TUser | null;
|
|
155
155
|
req: AuthContext["req"];
|
|
156
|
-
socket: Socket;
|
|
157
156
|
namespace: string;
|
|
158
157
|
}) => boolean | Promise<boolean>;
|
|
159
158
|
/**
|
|
@@ -279,10 +278,6 @@ interface WssActions {
|
|
|
279
278
|
* Extended WssContext with full RFC support.
|
|
280
279
|
*/
|
|
281
280
|
interface WssContext<TData = any, TUser = any> {
|
|
282
|
-
/** Socket.IO server instance */
|
|
283
|
-
io: Server;
|
|
284
|
-
/** Socket.IO socket instance */
|
|
285
|
-
socket: Socket;
|
|
286
281
|
/** Request metadata */
|
|
287
282
|
req: {
|
|
288
283
|
headers: Record<string, string | string[] | undefined>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import http from 'http';
|
|
2
2
|
export { a as ApiContext, A as ApiMiddleware, G as GenerateStaticParams, L as LoaderResult, M as MetadataLoader, R as RouteMiddleware, S as ServerContext, b as ServerLoader, W as WssActions } from './index.types-DMOO-uvF.js';
|
|
3
|
-
import {
|
|
3
|
+
import { Socket } from 'socket.io';
|
|
4
4
|
export { c as bootstrapClient } from './bootstrap-BfGTMUkj.js';
|
|
5
5
|
import { ZodSchema, z } from 'zod';
|
|
6
6
|
import * as express_rate_limit from 'express-rate-limit';
|
|
@@ -153,7 +153,6 @@ interface RateLimitCfg {
|
|
|
153
153
|
type GuardFn<TUser = any> = (ctx: {
|
|
154
154
|
user: TUser | null;
|
|
155
155
|
req: AuthContext["req"];
|
|
156
|
-
socket: Socket;
|
|
157
156
|
namespace: string;
|
|
158
157
|
}) => boolean | Promise<boolean>;
|
|
159
158
|
/**
|
|
@@ -279,10 +278,6 @@ interface WssActions {
|
|
|
279
278
|
* Extended WssContext with full RFC support.
|
|
280
279
|
*/
|
|
281
280
|
interface WssContext<TData = any, TUser = any> {
|
|
282
|
-
/** Socket.IO server instance */
|
|
283
|
-
io: Server;
|
|
284
|
-
/** Socket.IO socket instance */
|
|
285
|
-
socket: Socket;
|
|
286
281
|
/** Request metadata */
|
|
287
282
|
req: {
|
|
288
283
|
headers: Record<string, string | string[] | undefined>;
|
package/dist/index.js
CHANGED
|
@@ -16629,7 +16629,6 @@ async function executeGuard(guardFn, ctx) {
|
|
|
16629
16629
|
const guardCtx = {
|
|
16630
16630
|
user: ctx.user,
|
|
16631
16631
|
req: ctx.req,
|
|
16632
|
-
socket: ctx.socket,
|
|
16633
16632
|
namespace: ctx.pathname
|
|
16634
16633
|
};
|
|
16635
16634
|
const result = await guardFn(guardCtx);
|
|
@@ -16736,9 +16735,6 @@ var generateActions = (socket, namespace, presence) => {
|
|
|
16736
16735
|
return {
|
|
16737
16736
|
emit: async (event, payload) => {
|
|
16738
16737
|
if (!presence) {
|
|
16739
|
-
console.warn(
|
|
16740
|
-
"[loly:realtime] toUser() requires presence manager. Make sure realtime is properly configured."
|
|
16741
|
-
);
|
|
16742
16738
|
return;
|
|
16743
16739
|
}
|
|
16744
16740
|
const socketIds = await presence.getSocketsForUser(userId);
|
|
@@ -16841,19 +16837,12 @@ async function setupWssEvents(options) {
|
|
|
16841
16837
|
const subClient = pubClient.duplicate();
|
|
16842
16838
|
io.adapter(createAdapter(pubClient, subClient));
|
|
16843
16839
|
} catch (error) {
|
|
16844
|
-
console.error(
|
|
16845
|
-
"[loly:realtime] Failed to setup Redis adapter:",
|
|
16846
|
-
error instanceof Error ? error.message : String(error)
|
|
16847
|
-
);
|
|
16848
16840
|
throw error;
|
|
16849
16841
|
}
|
|
16850
16842
|
}
|
|
16851
16843
|
for (const wssRoute of wssRoutes) {
|
|
16852
16844
|
const normalized = wssRoute.normalized;
|
|
16853
16845
|
if (!normalized) {
|
|
16854
|
-
console.warn(
|
|
16855
|
-
`[loly:realtime] Skipping route ${wssRoute.pattern}: No normalized route definition`
|
|
16856
|
-
);
|
|
16857
16846
|
continue;
|
|
16858
16847
|
}
|
|
16859
16848
|
let namespacePath = normalized.namespace || wssRoute.pattern.replace(/^\/wss/, "");
|
|
@@ -16864,9 +16853,7 @@ async function setupWssEvents(options) {
|
|
|
16864
16853
|
namespacePath = "/";
|
|
16865
16854
|
}
|
|
16866
16855
|
const namespace = io.of(namespacePath);
|
|
16867
|
-
console.log(`[loly:realtime] Registered namespace: ${namespacePath} (from pattern: ${wssRoute.pattern})`);
|
|
16868
16856
|
namespace.on("connection", async (socket) => {
|
|
16869
|
-
console.log(`[loly:realtime] Client connected to namespace ${namespacePath}, socket: ${socket.id}`);
|
|
16870
16857
|
const requestId = generateRequestId();
|
|
16871
16858
|
socket.requestId = requestId;
|
|
16872
16859
|
const log = createWssLogger(namespacePath, socket);
|
|
@@ -16878,8 +16865,6 @@ async function setupWssEvents(options) {
|
|
|
16878
16865
|
await presence.addSocketForUser(String(user.id), socket.id);
|
|
16879
16866
|
}
|
|
16880
16867
|
const baseCtx = {
|
|
16881
|
-
socket,
|
|
16882
|
-
io: namespace.server,
|
|
16883
16868
|
req: {
|
|
16884
16869
|
headers: socket.handshake.headers,
|
|
16885
16870
|
ip: socket.handshake.address,
|