@veloxts/events 0.6.102 → 0.6.104
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/schemas.d.ts +12 -94
- package/dist/schemas.js +1 -1
- package/package.json +4 -4
package/dist/schemas.d.ts
CHANGED
|
@@ -10,13 +10,7 @@ import { z } from 'zod';
|
|
|
10
10
|
export declare const PresenceMemberSchema: z.ZodObject<{
|
|
11
11
|
id: z.ZodString;
|
|
12
12
|
info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
13
|
-
},
|
|
14
|
-
id: string;
|
|
15
|
-
info?: Record<string, unknown> | undefined;
|
|
16
|
-
}, {
|
|
17
|
-
id: string;
|
|
18
|
-
info?: Record<string, unknown> | undefined;
|
|
19
|
-
}>;
|
|
13
|
+
}, z.core.$strip>;
|
|
20
14
|
/**
|
|
21
15
|
* Schema for SSE subscribe endpoint.
|
|
22
16
|
* POST /events/subscribe
|
|
@@ -27,28 +21,8 @@ export declare const SseSubscribeBodySchema: z.ZodObject<{
|
|
|
27
21
|
member: z.ZodOptional<z.ZodObject<{
|
|
28
22
|
id: z.ZodString;
|
|
29
23
|
info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
info?: Record<string, unknown> | undefined;
|
|
33
|
-
}, {
|
|
34
|
-
id: string;
|
|
35
|
-
info?: Record<string, unknown> | undefined;
|
|
36
|
-
}>>;
|
|
37
|
-
}, "strip", z.ZodTypeAny, {
|
|
38
|
-
connectionId: string;
|
|
39
|
-
channel: string;
|
|
40
|
-
member?: {
|
|
41
|
-
id: string;
|
|
42
|
-
info?: Record<string, unknown> | undefined;
|
|
43
|
-
} | undefined;
|
|
44
|
-
}, {
|
|
45
|
-
connectionId: string;
|
|
46
|
-
channel: string;
|
|
47
|
-
member?: {
|
|
48
|
-
id: string;
|
|
49
|
-
info?: Record<string, unknown> | undefined;
|
|
50
|
-
} | undefined;
|
|
51
|
-
}>;
|
|
24
|
+
}, z.core.$strip>>;
|
|
25
|
+
}, z.core.$strip>;
|
|
52
26
|
export type SseSubscribeBody = z.infer<typeof SseSubscribeBodySchema>;
|
|
53
27
|
/**
|
|
54
28
|
* Schema for SSE unsubscribe endpoint.
|
|
@@ -57,13 +31,7 @@ export type SseSubscribeBody = z.infer<typeof SseSubscribeBodySchema>;
|
|
|
57
31
|
export declare const SseUnsubscribeBodySchema: z.ZodObject<{
|
|
58
32
|
connectionId: z.ZodString;
|
|
59
33
|
channel: z.ZodString;
|
|
60
|
-
},
|
|
61
|
-
connectionId: string;
|
|
62
|
-
channel: string;
|
|
63
|
-
}, {
|
|
64
|
-
connectionId: string;
|
|
65
|
-
channel: string;
|
|
66
|
-
}>;
|
|
34
|
+
}, z.core.$strip>;
|
|
67
35
|
export type SseUnsubscribeBody = z.infer<typeof SseUnsubscribeBodySchema>;
|
|
68
36
|
/**
|
|
69
37
|
* Schema for WebSocket auth endpoint.
|
|
@@ -72,19 +40,13 @@ export type SseUnsubscribeBody = z.infer<typeof SseUnsubscribeBodySchema>;
|
|
|
72
40
|
export declare const WsAuthBodySchema: z.ZodObject<{
|
|
73
41
|
socketId: z.ZodString;
|
|
74
42
|
channel: z.ZodString;
|
|
75
|
-
},
|
|
76
|
-
channel: string;
|
|
77
|
-
socketId: string;
|
|
78
|
-
}, {
|
|
79
|
-
channel: string;
|
|
80
|
-
socketId: string;
|
|
81
|
-
}>;
|
|
43
|
+
}, z.core.$strip>;
|
|
82
44
|
export type WsAuthBody = z.infer<typeof WsAuthBodySchema>;
|
|
83
45
|
/**
|
|
84
46
|
* Schema for WebSocket client messages.
|
|
85
47
|
* Uses discriminated union for type-safe message handling.
|
|
86
48
|
*/
|
|
87
|
-
export declare const ClientMessageSchema: z.ZodDiscriminatedUnion<
|
|
49
|
+
export declare const ClientMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
88
50
|
type: z.ZodLiteral<"subscribe">;
|
|
89
51
|
channel: z.ZodString;
|
|
90
52
|
auth: z.ZodOptional<z.ZodString>;
|
|
@@ -92,62 +54,18 @@ export declare const ClientMessageSchema: z.ZodDiscriminatedUnion<"type", [z.Zod
|
|
|
92
54
|
data: z.ZodOptional<z.ZodObject<{
|
|
93
55
|
id: z.ZodString;
|
|
94
56
|
info: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
95
|
-
},
|
|
96
|
-
|
|
97
|
-
info?: Record<string, unknown> | undefined;
|
|
98
|
-
}, {
|
|
99
|
-
id: string;
|
|
100
|
-
info?: Record<string, unknown> | undefined;
|
|
101
|
-
}>>;
|
|
102
|
-
}, "strip", z.ZodTypeAny, {
|
|
103
|
-
channel: string;
|
|
104
|
-
type: "subscribe";
|
|
105
|
-
data?: {
|
|
106
|
-
id: string;
|
|
107
|
-
info?: Record<string, unknown> | undefined;
|
|
108
|
-
} | undefined;
|
|
109
|
-
auth?: string | undefined;
|
|
110
|
-
channelData?: string | undefined;
|
|
111
|
-
}, {
|
|
112
|
-
channel: string;
|
|
113
|
-
type: "subscribe";
|
|
114
|
-
data?: {
|
|
115
|
-
id: string;
|
|
116
|
-
info?: Record<string, unknown> | undefined;
|
|
117
|
-
} | undefined;
|
|
118
|
-
auth?: string | undefined;
|
|
119
|
-
channelData?: string | undefined;
|
|
120
|
-
}>, z.ZodObject<{
|
|
57
|
+
}, z.core.$strip>>;
|
|
58
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
121
59
|
type: z.ZodLiteral<"unsubscribe">;
|
|
122
60
|
channel: z.ZodString;
|
|
123
|
-
},
|
|
124
|
-
channel: string;
|
|
125
|
-
type: "unsubscribe";
|
|
126
|
-
}, {
|
|
127
|
-
channel: string;
|
|
128
|
-
type: "unsubscribe";
|
|
129
|
-
}>, z.ZodObject<{
|
|
61
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
130
62
|
type: z.ZodLiteral<"ping">;
|
|
131
|
-
},
|
|
132
|
-
type: "ping";
|
|
133
|
-
}, {
|
|
134
|
-
type: "ping";
|
|
135
|
-
}>, z.ZodObject<{
|
|
63
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
136
64
|
type: z.ZodLiteral<"message">;
|
|
137
65
|
channel: z.ZodString;
|
|
138
66
|
event: z.ZodString;
|
|
139
67
|
data: z.ZodOptional<z.ZodUnknown>;
|
|
140
|
-
},
|
|
141
|
-
event: string;
|
|
142
|
-
channel: string;
|
|
143
|
-
type: "message";
|
|
144
|
-
data?: unknown;
|
|
145
|
-
}, {
|
|
146
|
-
event: string;
|
|
147
|
-
channel: string;
|
|
148
|
-
type: "message";
|
|
149
|
-
data?: unknown;
|
|
150
|
-
}>]>;
|
|
68
|
+
}, z.core.$strip>], "type">;
|
|
151
69
|
export type ValidatedClientMessage = z.infer<typeof ClientMessageSchema>;
|
|
152
70
|
/**
|
|
153
71
|
* Validation result type - discriminated union for type-safe error handling.
|
|
@@ -165,7 +83,7 @@ export type ValidationResult<T> = {
|
|
|
165
83
|
*
|
|
166
84
|
* @template TSchema - The Zod schema type
|
|
167
85
|
*/
|
|
168
|
-
export declare function validateBody<TSchema extends z.
|
|
86
|
+
export declare function validateBody<TSchema extends z.ZodType>(body: unknown, schema: TSchema): ValidationResult<z.infer<TSchema>>;
|
|
169
87
|
/**
|
|
170
88
|
* Format Zod validation errors for API response.
|
|
171
89
|
*/
|
package/dist/schemas.js
CHANGED
|
@@ -12,7 +12,7 @@ import { z } from 'zod';
|
|
|
12
12
|
*/
|
|
13
13
|
export const PresenceMemberSchema = z.object({
|
|
14
14
|
id: z.string().min(1, 'Member ID is required'),
|
|
15
|
-
info: z.record(z.unknown()).optional(),
|
|
15
|
+
info: z.record(z.string(), z.unknown()).optional(),
|
|
16
16
|
});
|
|
17
17
|
// =============================================================================
|
|
18
18
|
// SSE Endpoint Schemas
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veloxts/events",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.104",
|
|
4
4
|
"description": "Real-time event broadcasting for VeloxTS framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"fastify-plugin": "5.1.0",
|
|
30
30
|
"superjson": "2.2.6",
|
|
31
31
|
"ws": "8.19.0",
|
|
32
|
-
"zod": "3.
|
|
33
|
-
"@veloxts/core": "0.6.
|
|
32
|
+
"zod": "4.3.6",
|
|
33
|
+
"@veloxts/core": "0.6.104"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"fastify": "^5.7.4",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"ioredis": "5.9.2",
|
|
50
50
|
"typescript": "5.9.3",
|
|
51
51
|
"vitest": "4.0.18",
|
|
52
|
-
"@veloxts/testing": "0.6.
|
|
52
|
+
"@veloxts/testing": "0.6.104"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|