@remnawave/backend-contract 2.9.25 → 2.9.27
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/build/backend/constants/cache-keys/cache-keys.constants.d.ts +1 -0
- package/build/backend/constants/cache-keys/cache-keys.constants.d.ts.map +1 -1
- package/build/backend/constants/cache-keys/cache-keys.constants.js +1 -0
- package/build/backend/models/export-stream/export-stream.schema.d.ts +22 -0
- package/build/backend/models/export-stream/export-stream.schema.d.ts.map +1 -1
- package/build/backend/models/export-stream/export-stream.schema.js +42 -1
- package/build/frontend/constants/cache-keys/cache-keys.constants.js +1 -0
- package/build/frontend/models/export-stream/export-stream.schema.js +42 -1
- package/package.json +1 -1
|
@@ -40,5 +40,6 @@ export declare const EXPORT_TO_STREAM_KEYS: {
|
|
|
40
40
|
readonly PREFIX: "ioraw:";
|
|
41
41
|
readonly USER_USAGE: "export:user_usage";
|
|
42
42
|
readonly SUBSCRIPTION_REQUESTS: "export:subscription_requests";
|
|
43
|
+
readonly NODE_CONNECTIONS: "export:node_connections";
|
|
43
44
|
};
|
|
44
45
|
//# sourceMappingURL=cache-keys.constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache-keys.constants.d.ts","sourceRoot":"","sources":["../../../../constants/cache-keys/cache-keys.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,eAAO,MAAM,UAAU;;6CAEa,MAAM;2CACR,MAAM,QAAQ,yBAAyB;kDAEhC,MAAM;oDACJ,MAAM;;sCAEpB,MAAM;uCACL,MAAM;uCACN,MAAM;mCACV,MAAM;sCACH,MAAM;iCACX,MAAM;wCACC,MAAM;kDACI,MAAM,QAAQ,yBAAyB;CAEtE,CAAC;AAEX,eAAO,MAAM,cAAc;;;;;;;;;;CAUjB,CAAC;AAEX,eAAO,MAAM,mBAAmB;;uCAEF,MAAM;;;;CAK1B,CAAC;AAEX,eAAO,MAAM,uBAAuB;;CAE1B,CAAC;AAEX,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"cache-keys.constants.d.ts","sourceRoot":"","sources":["../../../../constants/cache-keys/cache-keys.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,eAAO,MAAM,UAAU;;6CAEa,MAAM;2CACR,MAAM,QAAQ,yBAAyB;kDAEhC,MAAM;oDACJ,MAAM;;sCAEpB,MAAM;uCACL,MAAM;uCACN,MAAM;mCACV,MAAM;sCACH,MAAM;iCACX,MAAM;wCACC,MAAM;kDACI,MAAM,QAAQ,yBAAyB;CAEtE,CAAC;AAEX,eAAO,MAAM,cAAc;;;;;;;;;;CAUjB,CAAC;AAEX,eAAO,MAAM,mBAAmB;;uCAEF,MAAM;;;;CAK1B,CAAC;AAEX,eAAO,MAAM,uBAAuB;;CAE1B,CAAC;AAEX,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC"}
|
|
@@ -27,4 +27,26 @@ export declare const RemnawaveSubscriptionRequestStreamMessageSchema: z.ZodObjec
|
|
|
27
27
|
userAgent: z.ZodOptional<z.ZodString>;
|
|
28
28
|
}, z.core.$strip>;
|
|
29
29
|
export type TRemnawaveSubscriptionRequestStreamMessage = z.infer<typeof RemnawaveSubscriptionRequestStreamMessageSchema>;
|
|
30
|
+
export declare const NODE_CONNECTIONS_STREAM_MESSAGE_VERSION = "1";
|
|
31
|
+
export declare const NodeConnectionUserSchema: z.ZodObject<{
|
|
32
|
+
userId: z.ZodString;
|
|
33
|
+
ips: z.ZodArray<z.ZodObject<{
|
|
34
|
+
ip: z.ZodString;
|
|
35
|
+
lastSeen: z.ZodCoercedDate<unknown>;
|
|
36
|
+
}, z.core.$strip>>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
export declare const RemnawaveNodeConnectionsStreamMessageSchema: z.ZodObject<{
|
|
39
|
+
v: z.ZodLiteral<"1">;
|
|
40
|
+
nodeId: z.ZodString;
|
|
41
|
+
ts: z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>;
|
|
42
|
+
users: z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<any, string>>, z.ZodArray<z.ZodObject<{
|
|
43
|
+
userId: z.ZodString;
|
|
44
|
+
ips: z.ZodArray<z.ZodObject<{
|
|
45
|
+
ip: z.ZodString;
|
|
46
|
+
lastSeen: z.ZodCoercedDate<unknown>;
|
|
47
|
+
}, z.core.$strip>>;
|
|
48
|
+
}, z.core.$strip>>>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export type TNodeConnectionUser = z.infer<typeof NodeConnectionUserSchema>;
|
|
51
|
+
export type TRemnawaveNodeConnectionsStreamMessage = z.infer<typeof RemnawaveNodeConnectionsStreamMessageSchema>;
|
|
30
52
|
//# sourceMappingURL=export-stream.schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export-stream.schema.d.ts","sourceRoot":"","sources":["../../../../models/export-stream/export-stream.schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"export-stream.schema.d.ts","sourceRoot":"","sources":["../../../../models/export-stream/export-stream.schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAMpB,eAAO,MAAM,iCAAiC,MAAM,CAAC;AAErD,eAAO,MAAM,2BAA2B;;;iBAMtC,CAAC;AAEH,eAAO,MAAM,qCAAqC;;;;;;;;;;;iBAyB5C,CAAC;AAEP,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AACjF,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,qCAAqC,CAC/C,CAAC;AAEF,eAAO,MAAM,2CAA2C,MAAM,CAAC;AAE/D,eAAO,MAAM,+CAA+C;;;;;;iBAkBtD,CAAC;AAEP,MAAM,MAAM,0CAA0C,GAAG,CAAC,CAAC,KAAK,CAC5D,OAAO,+CAA+C,CACzD,CAAC;AAEF,eAAO,MAAM,uCAAuC,MAAM,CAAC;AAE3D,eAAO,MAAM,wBAAwB;;;;;;iBAYnC,CAAC;AAEH,eAAO,MAAM,2CAA2C;;;;;;;;;;;iBA0BlD,CAAC;AAEP,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC3E,MAAM,MAAM,sCAAsC,GAAG,CAAC,CAAC,KAAK,CACxD,OAAO,2CAA2C,CACrD,CAAC"}
|
|
@@ -3,10 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.RemnawaveSubscriptionRequestStreamMessageSchema = exports.SUBSCRIPTION_REQUEST_STREAM_MESSAGE_VERSION = exports.RemnawaveUserUsageStreamMessageSchema = exports.UserUsageStreamRecordSchema = exports.USER_USAGE_STREAM_MESSAGE_VERSION = void 0;
|
|
6
|
+
exports.RemnawaveNodeConnectionsStreamMessageSchema = exports.NodeConnectionUserSchema = exports.NODE_CONNECTIONS_STREAM_MESSAGE_VERSION = exports.RemnawaveSubscriptionRequestStreamMessageSchema = exports.SUBSCRIPTION_REQUEST_STREAM_MESSAGE_VERSION = exports.RemnawaveUserUsageStreamMessageSchema = exports.UserUsageStreamRecordSchema = exports.USER_USAGE_STREAM_MESSAGE_VERSION = void 0;
|
|
7
7
|
const zod_1 = __importDefault(require("zod"));
|
|
8
8
|
const USER_USAGE_STREAM_KEY = 'ioraw:export:user_usage';
|
|
9
9
|
const SUBSCRIPTION_REQUESTS_STREAM_KEY = 'ioraw:export:subscription_requests';
|
|
10
|
+
const NODE_CONNECTIONS_STREAM_KEY = 'ioraw:export:node_connections';
|
|
10
11
|
exports.USER_USAGE_STREAM_MESSAGE_VERSION = '1';
|
|
11
12
|
exports.UserUsageStreamRecordSchema = zod_1.default.object({
|
|
12
13
|
userId: zod_1.default.string().regex(/^\d+$/).describe('User ID (bigint as string).'),
|
|
@@ -59,3 +60,43 @@ exports.RemnawaveSubscriptionRequestStreamMessageSchema = zod_1.default
|
|
|
59
60
|
.meta({
|
|
60
61
|
description: `A single message of the "${SUBSCRIPTION_REQUESTS_STREAM_KEY}" Redis Stream (EXPORT_TO_STREAM_ENABLED).`,
|
|
61
62
|
});
|
|
63
|
+
exports.NODE_CONNECTIONS_STREAM_MESSAGE_VERSION = '1';
|
|
64
|
+
exports.NodeConnectionUserSchema = zod_1.default.object({
|
|
65
|
+
userId: zod_1.default.string().regex(/^\d+$/).describe('User ID (bigint as string).'),
|
|
66
|
+
ips: zod_1.default
|
|
67
|
+
.array(zod_1.default.object({
|
|
68
|
+
ip: zod_1.default.string().describe('Client IP address.'),
|
|
69
|
+
lastSeen: zod_1.default.coerce
|
|
70
|
+
.date()
|
|
71
|
+
.describe('Last time this IP was seen on the node (ISO 8601, UTC).'),
|
|
72
|
+
}))
|
|
73
|
+
.describe('IP addresses the user is connected from.'),
|
|
74
|
+
});
|
|
75
|
+
exports.RemnawaveNodeConnectionsStreamMessageSchema = zod_1.default
|
|
76
|
+
.object({
|
|
77
|
+
v: zod_1.default.literal(exports.NODE_CONNECTIONS_STREAM_MESSAGE_VERSION).describe('Message schema version.'),
|
|
78
|
+
nodeId: zod_1.default
|
|
79
|
+
.string()
|
|
80
|
+
.regex(/^\d+$/)
|
|
81
|
+
.describe('Node ID the snapshot belongs to (bigint as string).'),
|
|
82
|
+
ts: zod_1.default.iso
|
|
83
|
+
.datetime()
|
|
84
|
+
.transform((str) => new Date(str))
|
|
85
|
+
.describe('Time the snapshot was exported (ISO 8601, UTC).'),
|
|
86
|
+
users: zod_1.default
|
|
87
|
+
.string()
|
|
88
|
+
.transform((raw, ctx) => {
|
|
89
|
+
try {
|
|
90
|
+
return JSON.parse(raw);
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
ctx.addIssue({ code: 'custom', message: 'users must be a valid JSON array' });
|
|
94
|
+
return zod_1.default.NEVER;
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
.pipe(zod_1.default.array(exports.NodeConnectionUserSchema))
|
|
98
|
+
.describe('JSON array of users connected to the node with their IPs.'),
|
|
99
|
+
})
|
|
100
|
+
.meta({
|
|
101
|
+
description: `A single message of the "${NODE_CONNECTIONS_STREAM_KEY}" Redis Stream (EXPORT_TO_STREAM_ENABLED). Snapshot of connections on one node; retention is time-based.`,
|
|
102
|
+
});
|
|
@@ -3,10 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.RemnawaveSubscriptionRequestStreamMessageSchema = exports.SUBSCRIPTION_REQUEST_STREAM_MESSAGE_VERSION = exports.RemnawaveUserUsageStreamMessageSchema = exports.UserUsageStreamRecordSchema = exports.USER_USAGE_STREAM_MESSAGE_VERSION = void 0;
|
|
6
|
+
exports.RemnawaveNodeConnectionsStreamMessageSchema = exports.NodeConnectionUserSchema = exports.NODE_CONNECTIONS_STREAM_MESSAGE_VERSION = exports.RemnawaveSubscriptionRequestStreamMessageSchema = exports.SUBSCRIPTION_REQUEST_STREAM_MESSAGE_VERSION = exports.RemnawaveUserUsageStreamMessageSchema = exports.UserUsageStreamRecordSchema = exports.USER_USAGE_STREAM_MESSAGE_VERSION = void 0;
|
|
7
7
|
const zod_1 = __importDefault(require("zod"));
|
|
8
8
|
const USER_USAGE_STREAM_KEY = 'ioraw:export:user_usage';
|
|
9
9
|
const SUBSCRIPTION_REQUESTS_STREAM_KEY = 'ioraw:export:subscription_requests';
|
|
10
|
+
const NODE_CONNECTIONS_STREAM_KEY = 'ioraw:export:node_connections';
|
|
10
11
|
exports.USER_USAGE_STREAM_MESSAGE_VERSION = '1';
|
|
11
12
|
exports.UserUsageStreamRecordSchema = zod_1.default.object({
|
|
12
13
|
userId: zod_1.default.string().regex(/^\d+$/).describe('User ID (bigint as string).'),
|
|
@@ -59,3 +60,43 @@ exports.RemnawaveSubscriptionRequestStreamMessageSchema = zod_1.default
|
|
|
59
60
|
.meta({
|
|
60
61
|
description: `A single message of the "${SUBSCRIPTION_REQUESTS_STREAM_KEY}" Redis Stream (EXPORT_TO_STREAM_ENABLED).`,
|
|
61
62
|
});
|
|
63
|
+
exports.NODE_CONNECTIONS_STREAM_MESSAGE_VERSION = '1';
|
|
64
|
+
exports.NodeConnectionUserSchema = zod_1.default.object({
|
|
65
|
+
userId: zod_1.default.string().regex(/^\d+$/).describe('User ID (bigint as string).'),
|
|
66
|
+
ips: zod_1.default
|
|
67
|
+
.array(zod_1.default.object({
|
|
68
|
+
ip: zod_1.default.string().describe('Client IP address.'),
|
|
69
|
+
lastSeen: zod_1.default.coerce
|
|
70
|
+
.date()
|
|
71
|
+
.describe('Last time this IP was seen on the node (ISO 8601, UTC).'),
|
|
72
|
+
}))
|
|
73
|
+
.describe('IP addresses the user is connected from.'),
|
|
74
|
+
});
|
|
75
|
+
exports.RemnawaveNodeConnectionsStreamMessageSchema = zod_1.default
|
|
76
|
+
.object({
|
|
77
|
+
v: zod_1.default.literal(exports.NODE_CONNECTIONS_STREAM_MESSAGE_VERSION).describe('Message schema version.'),
|
|
78
|
+
nodeId: zod_1.default
|
|
79
|
+
.string()
|
|
80
|
+
.regex(/^\d+$/)
|
|
81
|
+
.describe('Node ID the snapshot belongs to (bigint as string).'),
|
|
82
|
+
ts: zod_1.default.iso
|
|
83
|
+
.datetime()
|
|
84
|
+
.transform((str) => new Date(str))
|
|
85
|
+
.describe('Time the snapshot was exported (ISO 8601, UTC).'),
|
|
86
|
+
users: zod_1.default
|
|
87
|
+
.string()
|
|
88
|
+
.transform((raw, ctx) => {
|
|
89
|
+
try {
|
|
90
|
+
return JSON.parse(raw);
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
ctx.addIssue({ code: 'custom', message: 'users must be a valid JSON array' });
|
|
94
|
+
return zod_1.default.NEVER;
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
.pipe(zod_1.default.array(exports.NodeConnectionUserSchema))
|
|
98
|
+
.describe('JSON array of users connected to the node with their IPs.'),
|
|
99
|
+
})
|
|
100
|
+
.meta({
|
|
101
|
+
description: `A single message of the "${NODE_CONNECTIONS_STREAM_KEY}" Redis Stream (EXPORT_TO_STREAM_ENABLED). Snapshot of connections on one node; retention is time-based.`,
|
|
102
|
+
});
|
package/package.json
CHANGED