@remnawave/backend-contract 0.0.17 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
@@ -18,3 +18,4 @@ __exportStar(require("./create.command"), exports);
|
|
18
18
|
__exportStar(require("./delete.command"), exports);
|
19
19
|
__exportStar(require("./get-all.command"), exports);
|
20
20
|
__exportStar(require("./reorder.command"), exports);
|
21
|
+
__exportStar(require("./update.command"), exports);
|
@@ -0,0 +1,51 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.UpdateHostCommand = void 0;
|
4
|
+
const zod_1 = require("zod");
|
5
|
+
const api_1 = require("../../api");
|
6
|
+
const alpn_1 = require("../../constants/hosts/alpn");
|
7
|
+
const fingerprints_1 = require("../../constants/hosts/fingerprints");
|
8
|
+
const models_1 = require("../../models");
|
9
|
+
var UpdateHostCommand;
|
10
|
+
(function (UpdateHostCommand) {
|
11
|
+
UpdateHostCommand.url = api_1.REST_API.HOSTS.UPDATE;
|
12
|
+
UpdateHostCommand.RequestSchema = models_1.HostsSchema.pick({
|
13
|
+
uuid: true,
|
14
|
+
}).extend({
|
15
|
+
inboundUuid: zod_1.z
|
16
|
+
.string({
|
17
|
+
invalid_type_error: 'Inbound UUID must be a string',
|
18
|
+
})
|
19
|
+
.uuid('Inbound UUID must be a valid UUID')
|
20
|
+
.optional(),
|
21
|
+
remark: zod_1.z
|
22
|
+
.string({
|
23
|
+
invalid_type_error: 'Remark must be a string',
|
24
|
+
})
|
25
|
+
.max(40, {
|
26
|
+
message: 'Remark must be less than 40 characters',
|
27
|
+
})
|
28
|
+
.optional(),
|
29
|
+
address: zod_1.z
|
30
|
+
.string({
|
31
|
+
invalid_type_error: 'Address must be a string',
|
32
|
+
})
|
33
|
+
.optional(),
|
34
|
+
port: zod_1.z
|
35
|
+
.number({
|
36
|
+
invalid_type_error: 'Port must be an integer',
|
37
|
+
})
|
38
|
+
.int()
|
39
|
+
.optional(),
|
40
|
+
path: zod_1.z.optional(zod_1.z.string()),
|
41
|
+
sni: zod_1.z.optional(zod_1.z.string()),
|
42
|
+
host: zod_1.z.optional(zod_1.z.string()),
|
43
|
+
alpn: zod_1.z.optional(zod_1.z.nativeEnum(alpn_1.ALPN)),
|
44
|
+
fingerprint: zod_1.z.optional(zod_1.z.nativeEnum(fingerprints_1.FINGERPRINTS)),
|
45
|
+
allowInsecure: zod_1.z.optional(zod_1.z.boolean()),
|
46
|
+
isDisabled: zod_1.z.optional(zod_1.z.boolean()),
|
47
|
+
});
|
48
|
+
UpdateHostCommand.ResponseSchema = zod_1.z.object({
|
49
|
+
response: models_1.HostsSchema,
|
50
|
+
});
|
51
|
+
})(UpdateHostCommand || (exports.UpdateHostCommand = UpdateHostCommand = {}));
|
package/commands/hosts/index.ts
CHANGED
@@ -0,0 +1,53 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
import { REST_API } from '../../api';
|
3
|
+
import { ALPN } from '../../constants/hosts/alpn';
|
4
|
+
import { FINGERPRINTS } from '../../constants/hosts/fingerprints';
|
5
|
+
import { HostsSchema } from '../../models';
|
6
|
+
|
7
|
+
export namespace UpdateHostCommand {
|
8
|
+
export const url = REST_API.HOSTS.UPDATE;
|
9
|
+
|
10
|
+
export const RequestSchema = HostsSchema.pick({
|
11
|
+
uuid: true,
|
12
|
+
}).extend({
|
13
|
+
inboundUuid: z
|
14
|
+
.string({
|
15
|
+
invalid_type_error: 'Inbound UUID must be a string',
|
16
|
+
})
|
17
|
+
.uuid('Inbound UUID must be a valid UUID')
|
18
|
+
.optional(),
|
19
|
+
remark: z
|
20
|
+
.string({
|
21
|
+
invalid_type_error: 'Remark must be a string',
|
22
|
+
})
|
23
|
+
.max(40, {
|
24
|
+
message: 'Remark must be less than 40 characters',
|
25
|
+
})
|
26
|
+
.optional(),
|
27
|
+
address: z
|
28
|
+
.string({
|
29
|
+
invalid_type_error: 'Address must be a string',
|
30
|
+
})
|
31
|
+
.optional(),
|
32
|
+
port: z
|
33
|
+
.number({
|
34
|
+
invalid_type_error: 'Port must be an integer',
|
35
|
+
})
|
36
|
+
.int()
|
37
|
+
.optional(),
|
38
|
+
path: z.optional(z.string()),
|
39
|
+
sni: z.optional(z.string()),
|
40
|
+
host: z.optional(z.string()),
|
41
|
+
alpn: z.optional(z.nativeEnum(ALPN)),
|
42
|
+
fingerprint: z.optional(z.nativeEnum(FINGERPRINTS)),
|
43
|
+
allowInsecure: z.optional(z.boolean()),
|
44
|
+
isDisabled: z.optional(z.boolean()),
|
45
|
+
});
|
46
|
+
export type Request = z.infer<typeof RequestSchema>;
|
47
|
+
|
48
|
+
export const ResponseSchema = z.object({
|
49
|
+
response: HostsSchema,
|
50
|
+
});
|
51
|
+
|
52
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
53
|
+
}
|