@remnawave/backend-contract 2.9.25 → 2.9.26

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.
@@ -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;;;;CAIxB,CAAC"}
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"}
@@ -42,4 +42,5 @@ exports.EXPORT_TO_STREAM_KEYS = {
42
42
  PREFIX: 'ioraw:',
43
43
  USER_USAGE: 'export:user_usage',
44
44
  SUBSCRIPTION_REQUESTS: 'export:subscription_requests',
45
+ NODE_CONNECTIONS: 'export:node_connections',
45
46
  };
@@ -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
+ nodeUuid: z.ZodUUID;
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;AAKpB,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"}
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;;;;;;;;;;;iBAuBlD,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,40 @@ 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
+ nodeUuid: zod_1.default.uuid().describe('UUID of the node the snapshot belongs to.'),
79
+ ts: zod_1.default.iso
80
+ .datetime()
81
+ .transform((str) => new Date(str))
82
+ .describe('Time the snapshot was exported (ISO 8601, UTC).'),
83
+ users: zod_1.default
84
+ .string()
85
+ .transform((raw, ctx) => {
86
+ try {
87
+ return JSON.parse(raw);
88
+ }
89
+ catch {
90
+ ctx.addIssue({ code: 'custom', message: 'users must be a valid JSON array' });
91
+ return zod_1.default.NEVER;
92
+ }
93
+ })
94
+ .pipe(zod_1.default.array(exports.NodeConnectionUserSchema))
95
+ .describe('JSON array of users connected to the node with their IPs.'),
96
+ })
97
+ .meta({
98
+ 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.`,
99
+ });
@@ -42,4 +42,5 @@ exports.EXPORT_TO_STREAM_KEYS = {
42
42
  PREFIX: 'ioraw:',
43
43
  USER_USAGE: 'export:user_usage',
44
44
  SUBSCRIPTION_REQUESTS: 'export:subscription_requests',
45
+ NODE_CONNECTIONS: 'export:node_connections',
45
46
  };
@@ -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,40 @@ 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
+ nodeUuid: zod_1.default.uuid().describe('UUID of the node the snapshot belongs to.'),
79
+ ts: zod_1.default.iso
80
+ .datetime()
81
+ .transform((str) => new Date(str))
82
+ .describe('Time the snapshot was exported (ISO 8601, UTC).'),
83
+ users: zod_1.default
84
+ .string()
85
+ .transform((raw, ctx) => {
86
+ try {
87
+ return JSON.parse(raw);
88
+ }
89
+ catch {
90
+ ctx.addIssue({ code: 'custom', message: 'users must be a valid JSON array' });
91
+ return zod_1.default.NEVER;
92
+ }
93
+ })
94
+ .pipe(zod_1.default.array(exports.NodeConnectionUserSchema))
95
+ .describe('JSON array of users connected to the node with their IPs.'),
96
+ })
97
+ .meta({
98
+ 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.`,
99
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnawave/backend-contract",
3
- "version": "2.9.25",
3
+ "version": "2.9.26",
4
4
  "description": "A contract library for Remnawave Backend. It can be used in backend and frontend.",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/remnawave",