@remnawave/backend-contract 2.1.10 → 2.1.11

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.
@@ -3,60 +3,9 @@ export declare namespace UpdateUserCommand {
3
3
  const url: "/api/users/";
4
4
  const TSQ_url: "/api/users/";
5
5
  const endpointDetails: import("../../constants").EndpointDetails;
6
- const RequestSchema: z.ZodObject<Pick<{
6
+ const RequestSchema: z.ZodObject<{
7
7
  uuid: z.ZodString;
8
- shortUuid: z.ZodString;
9
- username: z.ZodString;
10
- status: z.ZodDefault<z.ZodNativeEnum<{
11
- readonly ACTIVE: "ACTIVE";
12
- readonly DISABLED: "DISABLED";
13
- readonly LIMITED: "LIMITED";
14
- readonly EXPIRED: "EXPIRED";
15
- }>>;
16
- usedTrafficBytes: z.ZodNumber;
17
- lifetimeUsedTrafficBytes: z.ZodNumber;
18
- trafficLimitBytes: z.ZodDefault<z.ZodNumber>;
19
- trafficLimitStrategy: z.ZodDefault<z.ZodNativeEnum<{
20
- readonly NO_RESET: "NO_RESET";
21
- readonly DAY: "DAY";
22
- readonly WEEK: "WEEK";
23
- readonly MONTH: "MONTH";
24
- }>>;
25
- subLastUserAgent: z.ZodNullable<z.ZodString>;
26
- subLastOpenedAt: z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>;
27
- expireAt: z.ZodEffects<z.ZodString, Date, string>;
28
- onlineAt: z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>;
29
- subRevokedAt: z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>;
30
- lastTrafficResetAt: z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>;
31
- trojanPassword: z.ZodString;
32
- vlessUuid: z.ZodString;
33
- ssPassword: z.ZodString;
34
- description: z.ZodNullable<z.ZodString>;
35
- tag: z.ZodNullable<z.ZodString>;
36
- telegramId: z.ZodNullable<z.ZodNumber>;
37
- email: z.ZodNullable<z.ZodString>;
38
- hwidDeviceLimit: z.ZodNullable<z.ZodNumber>;
39
- firstConnectedAt: z.ZodNullable<z.ZodEffects<z.ZodString, Date, string>>;
40
- lastTriggeredThreshold: z.ZodDefault<z.ZodNumber>;
41
- createdAt: z.ZodEffects<z.ZodString, Date, string>;
42
- updatedAt: z.ZodEffects<z.ZodString, Date, string>;
43
- activeInternalSquads: z.ZodArray<z.ZodObject<{
44
- uuid: z.ZodString;
45
- name: z.ZodString;
46
- }, "strip", z.ZodTypeAny, {
47
- uuid: string;
48
- name: string;
49
- }, {
50
- uuid: string;
51
- name: string;
52
- }>, "many">;
53
- }, "uuid"> & {
54
- status: z.ZodOptional<z.ZodDefault<z.ZodNativeEnum<{
55
- readonly ACTIVE: "ACTIVE";
56
- readonly DISABLED: "DISABLED";
57
- readonly LIMITED: "LIMITED";
58
- readonly EXPIRED: "EXPIRED";
59
- }>>>;
8
+ status: z.ZodOptional<z.ZodEnum<["ACTIVE", "DISABLED"]>>;
60
9
  trafficLimitBytes: z.ZodOptional<z.ZodNumber>;
61
10
  trafficLimitStrategy: z.ZodOptional<z.ZodEffects<z.ZodDefault<z.ZodNativeEnum<{
62
11
  readonly NO_RESET: "NO_RESET";
@@ -73,7 +22,7 @@ export declare namespace UpdateUserCommand {
73
22
  activeInternalSquads: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
74
23
  }, "strip", z.ZodTypeAny, {
75
24
  uuid: string;
76
- status?: "DISABLED" | "LIMITED" | "EXPIRED" | "ACTIVE" | undefined;
25
+ status?: "DISABLED" | "ACTIVE" | undefined;
77
26
  tag?: string | null | undefined;
78
27
  trafficLimitBytes?: number | undefined;
79
28
  description?: string | null | undefined;
@@ -85,7 +34,7 @@ export declare namespace UpdateUserCommand {
85
34
  activeInternalSquads?: string[] | undefined;
86
35
  }, {
87
36
  uuid: string;
88
- status?: "DISABLED" | "LIMITED" | "EXPIRED" | "ACTIVE" | undefined;
37
+ status?: "DISABLED" | "ACTIVE" | undefined;
89
38
  tag?: string | null | undefined;
90
39
  trafficLimitBytes?: number | undefined;
91
40
  description?: string | null | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"update-user.command.d.ts","sourceRoot":"","sources":["../../../../commands/users/update-user.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,yBAAiB,iBAAiB,CAAC;IACxB,MAAM,GAAG,eAAwB,CAAC;IAClC,MAAM,OAAO,eAAM,CAAC;IAEpB,MAAM,eAAe,2CAI3B,CAAC;IAEK,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAwDxB,CAAC;IAEH,KAAY,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;IAE7C,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEzB,CAAC;IAEH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
1
+ {"version":3,"file":"update-user.command.d.ts","sourceRoot":"","sources":["../../../../commands/users/update-user.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,yBAAiB,iBAAiB,CAAC;IACxB,MAAM,GAAG,eAAwB,CAAC;IAClC,MAAM,OAAO,eAAM,CAAC;IAEpB,MAAM,eAAe,2CAI3B,CAAC;IAEK,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+DxB,CAAC;IAEH,KAAY,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;IAE7C,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEzB,CAAC;IAEH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
@@ -10,10 +10,15 @@ var UpdateUserCommand;
10
10
  UpdateUserCommand.url = api_1.REST_API.USERS.UPDATE;
11
11
  UpdateUserCommand.TSQ_url = UpdateUserCommand.url;
12
12
  UpdateUserCommand.endpointDetails = (0, constants_1.getEndpointDetails)(api_1.USERS_ROUTES.UPDATE, 'patch', 'Update a user');
13
- UpdateUserCommand.RequestSchema = models_1.UsersSchema.pick({
14
- uuid: true,
15
- }).extend({
16
- status: models_1.UsersSchema.shape.status.optional(),
13
+ UpdateUserCommand.RequestSchema = zod_1.z.object({
14
+ uuid: zod_1.z.string().uuid(),
15
+ status: zod_1.z
16
+ .enum([constants_1.USERS_STATUS.ACTIVE, constants_1.USERS_STATUS.DISABLED], {
17
+ errorMap: () => ({
18
+ message: "You can't change status to LIMITED or EXPIRED. This statuses handled by Remnawave.",
19
+ }),
20
+ })
21
+ .optional(),
17
22
  trafficLimitBytes: zod_1.z
18
23
  .number({
19
24
  invalid_type_error: 'Traffic limit must be a number',
@@ -10,10 +10,15 @@ var UpdateUserCommand;
10
10
  UpdateUserCommand.url = api_1.REST_API.USERS.UPDATE;
11
11
  UpdateUserCommand.TSQ_url = UpdateUserCommand.url;
12
12
  UpdateUserCommand.endpointDetails = (0, constants_1.getEndpointDetails)(api_1.USERS_ROUTES.UPDATE, 'patch', 'Update a user');
13
- UpdateUserCommand.RequestSchema = models_1.UsersSchema.pick({
14
- uuid: true,
15
- }).extend({
16
- status: models_1.UsersSchema.shape.status.optional(),
13
+ UpdateUserCommand.RequestSchema = zod_1.z.object({
14
+ uuid: zod_1.z.string().uuid(),
15
+ status: zod_1.z
16
+ .enum([constants_1.USERS_STATUS.ACTIVE, constants_1.USERS_STATUS.DISABLED], {
17
+ errorMap: () => ({
18
+ message: "You can't change status to LIMITED or EXPIRED. This statuses handled by Remnawave.",
19
+ }),
20
+ })
21
+ .optional(),
17
22
  trafficLimitBytes: zod_1.z
18
23
  .number({
19
24
  invalid_type_error: 'Traffic limit must be a number',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnawave/backend-contract",
3
- "version": "2.1.10",
3
+ "version": "2.1.11",
4
4
  "public": true,
5
5
  "license": "AGPL-3.0-only",
6
6
  "description": "A contract library for Remnawave Backend. It can be used in backend and frontend.",