@remnawave/backend-contract 0.3.43 → 0.3.45

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.
Files changed (33) hide show
  1. package/build/backend/api/controllers/users.d.ts +4 -0
  2. package/build/backend/api/controllers/users.d.ts.map +1 -1
  3. package/build/backend/api/controllers/users.js +4 -0
  4. package/build/backend/api/routes.d.ts +4 -0
  5. package/build/backend/api/routes.d.ts.map +1 -1
  6. package/build/backend/api/routes.js +4 -0
  7. package/build/backend/commands/users/bulk/bulk-update-users.command.js +1 -1
  8. package/build/backend/commands/users/bulk-all/bulk-all-reset-traffic-users.command.d.ts +24 -0
  9. package/build/backend/commands/users/bulk-all/bulk-all-reset-traffic-users.command.d.ts.map +1 -0
  10. package/build/backend/commands/users/bulk-all/bulk-all-reset-traffic-users.command.js +15 -0
  11. package/build/backend/commands/users/bulk-all/bulk-all-update-users.command.d.ts +60 -0
  12. package/build/backend/commands/users/bulk-all/bulk-all-update-users.command.d.ts.map +1 -0
  13. package/build/backend/commands/users/bulk-all/bulk-all-update-users.command.js +43 -0
  14. package/build/backend/commands/users/bulk-all/index.d.ts +3 -0
  15. package/build/backend/commands/users/bulk-all/index.d.ts.map +1 -0
  16. package/build/backend/commands/users/bulk-all/index.js +18 -0
  17. package/build/backend/commands/users/index.d.ts +1 -0
  18. package/build/backend/commands/users/index.d.ts.map +1 -1
  19. package/build/backend/commands/users/index.js +1 -0
  20. package/build/backend/commands/users/update-user.command.js +1 -1
  21. package/build/backend/constants/errors/errors.d.ts +10 -0
  22. package/build/backend/constants/errors/errors.d.ts.map +1 -1
  23. package/build/backend/constants/errors/errors.js +10 -0
  24. package/build/frontend/api/controllers/users.js +4 -0
  25. package/build/frontend/api/routes.js +4 -0
  26. package/build/frontend/commands/users/bulk/bulk-update-users.command.js +1 -1
  27. package/build/frontend/commands/users/bulk-all/bulk-all-reset-traffic-users.command.js +15 -0
  28. package/build/frontend/commands/users/bulk-all/bulk-all-update-users.command.js +43 -0
  29. package/build/frontend/commands/users/bulk-all/index.js +18 -0
  30. package/build/frontend/commands/users/index.js +1 -0
  31. package/build/frontend/commands/users/update-user.command.js +1 -1
  32. package/build/frontend/constants/errors/errors.js +10 -0
  33. package/package.json +1 -1
@@ -19,6 +19,10 @@ export declare const USERS_ROUTES: {
19
19
  readonly REVOKE_SUBSCRIPTION: "bulk/revoke-subscription";
20
20
  readonly DELETE: "bulk/delete";
21
21
  readonly UPDATE_INBOUNDS: "bulk/update-inbounds";
22
+ readonly ALL: {
23
+ readonly UPDATE: "bulk/all/update";
24
+ readonly RESET_TRAFFIC: "bulk/all/reset-traffic";
25
+ };
22
26
  };
23
27
  readonly GET_BY_TELEGRAM_ID: "tg";
24
28
  readonly GET_BY_EMAIL: "email";
@@ -1 +1 @@
1
- {"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../../../api/controllers/users.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,EAAG,OAAgB,CAAC;AAEjD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;CAuBf,CAAC"}
1
+ {"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../../../api/controllers/users.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,EAAG,OAAgB,CAAC;AAEjD,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2Bf,CAAC"}
@@ -22,6 +22,10 @@ exports.USERS_ROUTES = {
22
22
  REVOKE_SUBSCRIPTION: 'bulk/revoke-subscription',
23
23
  DELETE: 'bulk/delete',
24
24
  UPDATE_INBOUNDS: 'bulk/update-inbounds',
25
+ ALL: {
26
+ UPDATE: 'bulk/all/update',
27
+ RESET_TRAFFIC: 'bulk/all/reset-traffic',
28
+ },
25
29
  },
26
30
  GET_BY_TELEGRAM_ID: 'tg',
27
31
  GET_BY_EMAIL: 'email',
@@ -65,6 +65,10 @@ export declare const REST_API: {
65
65
  readonly REVOKE_SUBSCRIPTION: "/api/users/bulk/revoke-subscription";
66
66
  readonly DELETE: "/api/users/bulk/delete";
67
67
  readonly UPDATE_INBOUNDS: "/api/users/bulk/update-inbounds";
68
+ readonly ALL: {
69
+ readonly UPDATE: "/api/users/bulk/all/update";
70
+ readonly RESET_TRAFFIC: "/api/users/bulk/all/reset-traffic";
71
+ };
68
72
  };
69
73
  readonly GET_BY_TELEGRAM_ID: (telegramId: string) => string;
70
74
  readonly GET_BY_EMAIL: (email: string) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../api/routes.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,EAAG,MAAe,CAAC;AACpC,eAAO,MAAM,YAAY,EAAG,UAAmB,CAAC;AAChD,eAAO,MAAM,cAAc,EAAG,SAAkB,CAAC;AAEjD,eAAO,MAAM,QAAQ;;;;;;;;gCAQE,MAAM;;;;;;;;gCASN,MAAM;;;iCAIL,MAAM;iCAEN,MAAM;iCAEN,MAAM;gCAEP,MAAM;;;;;;;;;;;;;;kDAeY,MAAM;;;;;;;;;;qCAWnB,MAAM;gDAEK,MAAM;6CAET,MAAM;8DAEW,MAAM;6CAEvB,MAAM;sCAEb,MAAM;qCAEP,MAAM;qCAEN,MAAM;;;4CAIC,MAAM;;;;;;;;;kDAUA,MAAM;uCAEjB,MAAM;;;kCAIX,MAAM;0CAEE,MAAM;uCAET,MAAM;;;;;;;;gCASb,MAAM;iCAEL,MAAM;;;;;;;;;;;;;;;0CAgBG,MAAM;;;;;;;CAQ7B,CAAC"}
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../api/routes.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,IAAI,EAAG,MAAe,CAAC;AACpC,eAAO,MAAM,YAAY,EAAG,UAAmB,CAAC;AAChD,eAAO,MAAM,cAAc,EAAG,SAAkB,CAAC;AAEjD,eAAO,MAAM,QAAQ;;;;;;;;gCAQE,MAAM;;;;;;;;gCASN,MAAM;;;iCAIL,MAAM;iCAEN,MAAM;iCAEN,MAAM;gCAEP,MAAM;;;;;;;;;;;;;;kDAeY,MAAM;;;;;;;;;;qCAWnB,MAAM;gDAEK,MAAM;6CAET,MAAM;8DAEW,MAAM;6CAEvB,MAAM;sCAEb,MAAM;qCAEP,MAAM;qCAEN,MAAM;;;4CAIC,MAAM;;;;;;;;;;;;;kDAcA,MAAM;uCAEjB,MAAM;;;kCAIX,MAAM;0CAEE,MAAM;uCAET,MAAM;;;;;;;;gCASb,MAAM;iCAEL,MAAM;;;;;;;;;;;;;;;0CAgBG,MAAM;;;;;;;CAQ7B,CAAC"}
@@ -102,6 +102,10 @@ exports.REST_API = {
102
102
  REVOKE_SUBSCRIPTION: `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.BULK.REVOKE_SUBSCRIPTION}`,
103
103
  DELETE: `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.BULK.DELETE}`,
104
104
  UPDATE_INBOUNDS: `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.BULK.UPDATE_INBOUNDS}`,
105
+ ALL: {
106
+ UPDATE: `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.BULK.ALL.UPDATE}`,
107
+ RESET_TRAFFIC: `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.BULK.ALL.RESET_TRAFFIC}`,
108
+ },
105
109
  },
106
110
  GET_BY_TELEGRAM_ID: (telegramId) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET_BY_TELEGRAM_ID}/${telegramId}`,
107
111
  GET_BY_EMAIL: (email) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET_BY_EMAIL}/${email}`,
@@ -27,7 +27,7 @@ var BulkUpdateUsersCommand;
27
27
  .describe('Traffic limit reset strategy')),
28
28
  expireAt: zod_1.z.optional(zod_1.z
29
29
  .string()
30
- .datetime({ message: 'Invalid date format' })
30
+ .datetime({ local: true, offset: true, message: 'Invalid date format' })
31
31
  .transform((str) => new Date(str))
32
32
  .refine((date) => date > new Date(), {
33
33
  message: 'Expiration date cannot be in the past',
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ export declare namespace BulkAllResetTrafficUsersCommand {
3
+ const url: "/api/users/bulk/all/reset-traffic";
4
+ const TSQ_url: "/api/users/bulk/all/reset-traffic";
5
+ const ResponseSchema: z.ZodObject<{
6
+ response: z.ZodObject<{
7
+ eventSent: z.ZodBoolean;
8
+ }, "strip", z.ZodTypeAny, {
9
+ eventSent: boolean;
10
+ }, {
11
+ eventSent: boolean;
12
+ }>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ response: {
15
+ eventSent: boolean;
16
+ };
17
+ }, {
18
+ response: {
19
+ eventSent: boolean;
20
+ };
21
+ }>;
22
+ type Response = z.infer<typeof ResponseSchema>;
23
+ }
24
+ //# sourceMappingURL=bulk-all-reset-traffic-users.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bulk-all-reset-traffic-users.command.d.ts","sourceRoot":"","sources":["../../../../../commands/users/bulk-all/bulk-all-reset-traffic-users.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,yBAAiB,+BAA+B,CAAC;IACtC,MAAM,GAAG,qCAAwC,CAAC;IAClD,MAAM,OAAO,qCAAM,CAAC;IAEpB,MAAM,cAAc;;;;;;;;;;;;;;;;MAIzB,CAAC;IAEH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BulkAllResetTrafficUsersCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const api_1 = require("../../../api");
6
+ var BulkAllResetTrafficUsersCommand;
7
+ (function (BulkAllResetTrafficUsersCommand) {
8
+ BulkAllResetTrafficUsersCommand.url = api_1.REST_API.USERS.BULK.ALL.RESET_TRAFFIC;
9
+ BulkAllResetTrafficUsersCommand.TSQ_url = BulkAllResetTrafficUsersCommand.url;
10
+ BulkAllResetTrafficUsersCommand.ResponseSchema = zod_1.z.object({
11
+ response: zod_1.z.object({
12
+ eventSent: zod_1.z.boolean(),
13
+ }),
14
+ });
15
+ })(BulkAllResetTrafficUsersCommand || (exports.BulkAllResetTrafficUsersCommand = BulkAllResetTrafficUsersCommand = {}));
@@ -0,0 +1,60 @@
1
+ import { z } from 'zod';
2
+ export declare namespace BulkAllUpdateUsersCommand {
3
+ const url: "/api/users/bulk/all/update";
4
+ const TSQ_url: "/api/users/bulk/all/update";
5
+ const RequestSchema: z.ZodObject<{
6
+ status: z.ZodOptional<z.ZodDefault<z.ZodNativeEnum<{
7
+ readonly ACTIVE: "ACTIVE";
8
+ readonly DISABLED: "DISABLED";
9
+ readonly LIMITED: "LIMITED";
10
+ readonly EXPIRED: "EXPIRED";
11
+ }>>>;
12
+ trafficLimitBytes: z.ZodOptional<z.ZodNumber>;
13
+ trafficLimitStrategy: z.ZodOptional<z.ZodNativeEnum<{
14
+ readonly NO_RESET: "NO_RESET";
15
+ readonly DAY: "DAY";
16
+ readonly WEEK: "WEEK";
17
+ readonly MONTH: "MONTH";
18
+ }>>;
19
+ expireAt: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodString, Date, string>, Date, string>>;
20
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
21
+ telegramId: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
22
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
23
+ }, "strip", z.ZodTypeAny, {
24
+ status?: "DISABLED" | "LIMITED" | "EXPIRED" | "ACTIVE" | undefined;
25
+ email?: string | null | undefined;
26
+ trafficLimitBytes?: number | undefined;
27
+ description?: string | null | undefined;
28
+ trafficLimitStrategy?: "MONTH" | "NO_RESET" | "DAY" | "WEEK" | undefined;
29
+ expireAt?: Date | undefined;
30
+ telegramId?: number | null | undefined;
31
+ }, {
32
+ status?: "DISABLED" | "LIMITED" | "EXPIRED" | "ACTIVE" | undefined;
33
+ email?: string | null | undefined;
34
+ trafficLimitBytes?: number | undefined;
35
+ description?: string | null | undefined;
36
+ trafficLimitStrategy?: "MONTH" | "NO_RESET" | "DAY" | "WEEK" | undefined;
37
+ expireAt?: string | undefined;
38
+ telegramId?: number | null | undefined;
39
+ }>;
40
+ type Request = z.infer<typeof RequestSchema>;
41
+ const ResponseSchema: z.ZodObject<{
42
+ response: z.ZodObject<{
43
+ eventSent: z.ZodBoolean;
44
+ }, "strip", z.ZodTypeAny, {
45
+ eventSent: boolean;
46
+ }, {
47
+ eventSent: boolean;
48
+ }>;
49
+ }, "strip", z.ZodTypeAny, {
50
+ response: {
51
+ eventSent: boolean;
52
+ };
53
+ }, {
54
+ response: {
55
+ eventSent: boolean;
56
+ };
57
+ }>;
58
+ type Response = z.infer<typeof ResponseSchema>;
59
+ }
60
+ //# sourceMappingURL=bulk-all-update-users.command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bulk-all-update-users.command.d.ts","sourceRoot":"","sources":["../../../../../commands/users/bulk-all/bulk-all-update-users.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,yBAAiB,yBAAyB,CAAC;IAChC,MAAM,GAAG,8BAAiC,CAAC;IAC3C,MAAM,OAAO,8BAAM,CAAC;IAEpB,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA+BxB,CAAC;IAEH,KAAY,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;IAE7C,MAAM,cAAc;;;;;;;;;;;;;;;;MAIzB,CAAC;IAEH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BulkAllUpdateUsersCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const constants_1 = require("../../../constants");
6
+ const models_1 = require("../../../models");
7
+ const api_1 = require("../../../api");
8
+ var BulkAllUpdateUsersCommand;
9
+ (function (BulkAllUpdateUsersCommand) {
10
+ BulkAllUpdateUsersCommand.url = api_1.REST_API.USERS.BULK.ALL.UPDATE;
11
+ BulkAllUpdateUsersCommand.TSQ_url = BulkAllUpdateUsersCommand.url;
12
+ BulkAllUpdateUsersCommand.RequestSchema = zod_1.z.object({
13
+ status: models_1.UsersSchema.shape.status.optional(),
14
+ trafficLimitBytes: zod_1.z.optional(zod_1.z
15
+ .number({
16
+ invalid_type_error: 'Traffic limit must be a number',
17
+ })
18
+ .int('Traffic limit must be an integer')
19
+ .min(0, 'Traffic limit must be greater than 0')
20
+ .describe('Traffic limit in bytes. 0 - unlimited')),
21
+ trafficLimitStrategy: zod_1.z.optional(zod_1.z
22
+ .nativeEnum(constants_1.RESET_PERIODS, {
23
+ description: 'Available reset periods',
24
+ })
25
+ .describe('Traffic limit reset strategy')),
26
+ expireAt: zod_1.z.optional(zod_1.z
27
+ .string()
28
+ .datetime({ local: true, offset: true, message: 'Invalid date format' })
29
+ .transform((str) => new Date(str))
30
+ .refine((date) => date > new Date(), {
31
+ message: 'Expiration date cannot be in the past',
32
+ })
33
+ .describe('Expiration date: 2025-01-17T15:38:45.065Z')),
34
+ description: zod_1.z.optional(zod_1.z.string().nullable()),
35
+ telegramId: zod_1.z.optional(zod_1.z.number().nullable()),
36
+ email: zod_1.z.optional(zod_1.z.string().email('Invalid email format').nullable()),
37
+ });
38
+ BulkAllUpdateUsersCommand.ResponseSchema = zod_1.z.object({
39
+ response: zod_1.z.object({
40
+ eventSent: zod_1.z.boolean(),
41
+ }),
42
+ });
43
+ })(BulkAllUpdateUsersCommand || (exports.BulkAllUpdateUsersCommand = BulkAllUpdateUsersCommand = {}));
@@ -0,0 +1,3 @@
1
+ export * from './bulk-all-reset-traffic-users.command';
2
+ export * from './bulk-all-update-users.command';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../commands/users/bulk-all/index.ts"],"names":[],"mappings":"AAAA,cAAc,wCAAwC,CAAC;AACvD,cAAc,iCAAiC,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./bulk-all-reset-traffic-users.command"), exports);
18
+ __exportStar(require("./bulk-all-update-users.command"), exports);
@@ -1,4 +1,5 @@
1
1
  export * from './bulk';
2
+ export * from './bulk-all';
2
3
  export * from './create-user.command';
3
4
  export * from './delete-user.command';
4
5
  export * from './disable-user.command';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../commands/users/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../commands/users/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,yCAAyC,CAAC;AACxD,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oCAAoC,CAAC;AACnD,cAAc,uBAAuB,CAAC"}
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./bulk"), exports);
18
+ __exportStar(require("./bulk-all"), exports);
18
19
  __exportStar(require("./create-user.command"), exports);
19
20
  __exportStar(require("./delete-user.command"), exports);
20
21
  __exportStar(require("./disable-user.command"), exports);
@@ -42,7 +42,7 @@ var UpdateUserCommand;
42
42
  .optional(),
43
43
  expireAt: zod_1.z
44
44
  .string()
45
- .datetime({ message: 'Invalid date format' })
45
+ .datetime({ local: true, offset: true, message: 'Invalid date format' })
46
46
  .transform((str) => new Date(str))
47
47
  .refine((date) => date > new Date(), {
48
48
  message: 'Expiration date cannot be in the past',
@@ -464,5 +464,15 @@ export declare const ERRORS: {
464
464
  readonly message: "Bulk add inbounds to users error";
465
465
  readonly httpCode: 500;
466
466
  };
467
+ readonly BULK_UPDATE_ALL_USERS_ERROR: {
468
+ readonly code: "A087";
469
+ readonly message: "Bulk update all users error";
470
+ readonly httpCode: 500;
471
+ };
472
+ readonly INVALID_USER_STATUS_ERROR: {
473
+ readonly code: "A089";
474
+ readonly message: "LIMITED and EXPIRED statuses are not allowed to be set manually.";
475
+ readonly httpCode: 400;
476
+ };
467
477
  };
468
478
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../constants/errors/errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAwJY,MAAM;;;;;;;;;;wCAUN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCA4IN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqI3B,CAAC"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../constants/errors/errors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAwJY,MAAM;;;;;;;;;;wCAUN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCA4IN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+I3B,CAAC"}
@@ -435,4 +435,14 @@ exports.ERRORS = {
435
435
  message: 'Bulk add inbounds to users error',
436
436
  httpCode: 500,
437
437
  },
438
+ BULK_UPDATE_ALL_USERS_ERROR: {
439
+ code: 'A087',
440
+ message: 'Bulk update all users error',
441
+ httpCode: 500,
442
+ },
443
+ INVALID_USER_STATUS_ERROR: {
444
+ code: 'A089',
445
+ message: 'LIMITED and EXPIRED statuses are not allowed to be set manually.',
446
+ httpCode: 400,
447
+ },
438
448
  };
@@ -22,6 +22,10 @@ exports.USERS_ROUTES = {
22
22
  REVOKE_SUBSCRIPTION: 'bulk/revoke-subscription',
23
23
  DELETE: 'bulk/delete',
24
24
  UPDATE_INBOUNDS: 'bulk/update-inbounds',
25
+ ALL: {
26
+ UPDATE: 'bulk/all/update',
27
+ RESET_TRAFFIC: 'bulk/all/reset-traffic',
28
+ },
25
29
  },
26
30
  GET_BY_TELEGRAM_ID: 'tg',
27
31
  GET_BY_EMAIL: 'email',
@@ -102,6 +102,10 @@ exports.REST_API = {
102
102
  REVOKE_SUBSCRIPTION: `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.BULK.REVOKE_SUBSCRIPTION}`,
103
103
  DELETE: `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.BULK.DELETE}`,
104
104
  UPDATE_INBOUNDS: `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.BULK.UPDATE_INBOUNDS}`,
105
+ ALL: {
106
+ UPDATE: `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.BULK.ALL.UPDATE}`,
107
+ RESET_TRAFFIC: `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.BULK.ALL.RESET_TRAFFIC}`,
108
+ },
105
109
  },
106
110
  GET_BY_TELEGRAM_ID: (telegramId) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET_BY_TELEGRAM_ID}/${telegramId}`,
107
111
  GET_BY_EMAIL: (email) => `${exports.ROOT}/${CONTROLLERS.USERS_CONTROLLER}/${CONTROLLERS.USERS_ROUTES.GET_BY_EMAIL}/${email}`,
@@ -27,7 +27,7 @@ var BulkUpdateUsersCommand;
27
27
  .describe('Traffic limit reset strategy')),
28
28
  expireAt: zod_1.z.optional(zod_1.z
29
29
  .string()
30
- .datetime({ message: 'Invalid date format' })
30
+ .datetime({ local: true, offset: true, message: 'Invalid date format' })
31
31
  .transform((str) => new Date(str))
32
32
  .refine((date) => date > new Date(), {
33
33
  message: 'Expiration date cannot be in the past',
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BulkAllResetTrafficUsersCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const api_1 = require("../../../api");
6
+ var BulkAllResetTrafficUsersCommand;
7
+ (function (BulkAllResetTrafficUsersCommand) {
8
+ BulkAllResetTrafficUsersCommand.url = api_1.REST_API.USERS.BULK.ALL.RESET_TRAFFIC;
9
+ BulkAllResetTrafficUsersCommand.TSQ_url = BulkAllResetTrafficUsersCommand.url;
10
+ BulkAllResetTrafficUsersCommand.ResponseSchema = zod_1.z.object({
11
+ response: zod_1.z.object({
12
+ eventSent: zod_1.z.boolean(),
13
+ }),
14
+ });
15
+ })(BulkAllResetTrafficUsersCommand || (exports.BulkAllResetTrafficUsersCommand = BulkAllResetTrafficUsersCommand = {}));
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BulkAllUpdateUsersCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const constants_1 = require("../../../constants");
6
+ const models_1 = require("../../../models");
7
+ const api_1 = require("../../../api");
8
+ var BulkAllUpdateUsersCommand;
9
+ (function (BulkAllUpdateUsersCommand) {
10
+ BulkAllUpdateUsersCommand.url = api_1.REST_API.USERS.BULK.ALL.UPDATE;
11
+ BulkAllUpdateUsersCommand.TSQ_url = BulkAllUpdateUsersCommand.url;
12
+ BulkAllUpdateUsersCommand.RequestSchema = zod_1.z.object({
13
+ status: models_1.UsersSchema.shape.status.optional(),
14
+ trafficLimitBytes: zod_1.z.optional(zod_1.z
15
+ .number({
16
+ invalid_type_error: 'Traffic limit must be a number',
17
+ })
18
+ .int('Traffic limit must be an integer')
19
+ .min(0, 'Traffic limit must be greater than 0')
20
+ .describe('Traffic limit in bytes. 0 - unlimited')),
21
+ trafficLimitStrategy: zod_1.z.optional(zod_1.z
22
+ .nativeEnum(constants_1.RESET_PERIODS, {
23
+ description: 'Available reset periods',
24
+ })
25
+ .describe('Traffic limit reset strategy')),
26
+ expireAt: zod_1.z.optional(zod_1.z
27
+ .string()
28
+ .datetime({ local: true, offset: true, message: 'Invalid date format' })
29
+ .transform((str) => new Date(str))
30
+ .refine((date) => date > new Date(), {
31
+ message: 'Expiration date cannot be in the past',
32
+ })
33
+ .describe('Expiration date: 2025-01-17T15:38:45.065Z')),
34
+ description: zod_1.z.optional(zod_1.z.string().nullable()),
35
+ telegramId: zod_1.z.optional(zod_1.z.number().nullable()),
36
+ email: zod_1.z.optional(zod_1.z.string().email('Invalid email format').nullable()),
37
+ });
38
+ BulkAllUpdateUsersCommand.ResponseSchema = zod_1.z.object({
39
+ response: zod_1.z.object({
40
+ eventSent: zod_1.z.boolean(),
41
+ }),
42
+ });
43
+ })(BulkAllUpdateUsersCommand || (exports.BulkAllUpdateUsersCommand = BulkAllUpdateUsersCommand = {}));
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./bulk-all-reset-traffic-users.command"), exports);
18
+ __exportStar(require("./bulk-all-update-users.command"), exports);
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./bulk"), exports);
18
+ __exportStar(require("./bulk-all"), exports);
18
19
  __exportStar(require("./create-user.command"), exports);
19
20
  __exportStar(require("./delete-user.command"), exports);
20
21
  __exportStar(require("./disable-user.command"), exports);
@@ -42,7 +42,7 @@ var UpdateUserCommand;
42
42
  .optional(),
43
43
  expireAt: zod_1.z
44
44
  .string()
45
- .datetime({ message: 'Invalid date format' })
45
+ .datetime({ local: true, offset: true, message: 'Invalid date format' })
46
46
  .transform((str) => new Date(str))
47
47
  .refine((date) => date > new Date(), {
48
48
  message: 'Expiration date cannot be in the past',
@@ -435,4 +435,14 @@ exports.ERRORS = {
435
435
  message: 'Bulk add inbounds to users error',
436
436
  httpCode: 500,
437
437
  },
438
+ BULK_UPDATE_ALL_USERS_ERROR: {
439
+ code: 'A087',
440
+ message: 'Bulk update all users error',
441
+ httpCode: 500,
442
+ },
443
+ INVALID_USER_STATUS_ERROR: {
444
+ code: 'A089',
445
+ message: 'LIMITED and EXPIRED statuses are not allowed to be set manually.',
446
+ httpCode: 400,
447
+ },
438
448
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnawave/backend-contract",
3
- "version": "0.3.43",
3
+ "version": "0.3.45",
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.",