@remnawave/backend-contract 2.1.78 → 2.1.80

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.
@@ -0,0 +1,24 @@
1
+ import z from 'zod';
2
+ export declare const ResponseRuleModificationsSchema: z.ZodOptional<z.ZodObject<{
3
+ headers: z.ZodArray<z.ZodObject<{
4
+ key: z.ZodString;
5
+ value: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ value: string;
8
+ key: string;
9
+ }, {
10
+ value: string;
11
+ key: string;
12
+ }>, "many">;
13
+ }, "strip", z.ZodTypeAny, {
14
+ headers: {
15
+ value: string;
16
+ key: string;
17
+ }[];
18
+ }, {
19
+ headers: {
20
+ value: string;
21
+ key: string;
22
+ }[];
23
+ }>>;
24
+ //# sourceMappingURL=response-rule-modifications.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response-rule-modifications.schema.d.ts","sourceRoot":"","sources":["../../../../models/response-rules/response-rule-modifications.schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AA0BpB,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;GAyCvC,CAAC"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ResponseRuleModificationsSchema = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
8
+ const exampleJson = JSON.stringify({
9
+ headers: [
10
+ {
11
+ key: 'X-Custom-Header',
12
+ value: 'Custom Value',
13
+ },
14
+ ],
15
+ }, null, 2);
16
+ const exampleHeaderJson = JSON.stringify([
17
+ {
18
+ key: 'X-Custom-Header',
19
+ value: 'Custom Value',
20
+ },
21
+ ], null, 2);
22
+ exports.ResponseRuleModificationsSchema = zod_1.default
23
+ .object({
24
+ headers: zod_1.default
25
+ .array(zod_1.default.object({
26
+ key: zod_1.default
27
+ .string()
28
+ .regex(/^[!#$%&'*+\-.0-9A-Z^_`a-z|~]+$/, 'Invalid header name. Only letters(a-z, A-Z), numbers(0-9), underscores(_) and hyphens(-) are allowed.')
29
+ .describe(JSON.stringify({
30
+ title: 'Key',
31
+ markdownDescription: 'Key of the response header. Must comply with RFC 7230.',
32
+ })),
33
+ value: zod_1.default
34
+ .string()
35
+ .min(1, 'Value is required')
36
+ .describe(JSON.stringify({
37
+ title: 'Value',
38
+ markdownDescription: 'Value of the response header. ',
39
+ })),
40
+ }))
41
+ .describe(JSON.stringify({
42
+ markdownDescription: `Array of headers to be added when the rule is matched.\n\nExample:\n\`\`\`json\n${exampleHeaderJson}\n\`\`\``,
43
+ })),
44
+ })
45
+ .optional()
46
+ .describe(JSON.stringify({
47
+ markdownDescription: `Response modifications to be applied when the rule is matched.\n\nExample:\n\`\`\`json\n${exampleJson}\n\`\`\``,
48
+ }));
@@ -1 +1 @@
1
- {"version":3,"file":"response-rule.schema.d.ts","sourceRoot":"","sources":["../../../../models/response-rules/response-rule.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoCxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiH1B,CAAC"}
1
+ {"version":3,"file":"response-rule.schema.d.ts","sourceRoot":"","sources":["../../../../models/response-rules/response-rule.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqCxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6E1B,CAAC"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ResponseRuleSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const constants_1 = require("../../constants");
6
+ const response_rule_modifications_schema_1 = require("./response-rule-modifications.schema");
6
7
  const response_rule_condition_schema_1 = require("./response-rule-condition.schema");
7
8
  const RuleExampleJson = JSON.stringify({
8
9
  name: 'Block Legacy Clients',
@@ -57,30 +58,7 @@ exports.ResponseRuleSchema = zod_1.z
57
58
  .map(([key, description]) => `- **${key}**: ${description}\n`)
58
59
  .join('\n')}`,
59
60
  })),
60
- responseModifications: zod_1.z
61
- .object({
62
- headers: zod_1.z
63
- .array(zod_1.z.object({
64
- key: zod_1.z
65
- .string()
66
- .regex(/^[!#$%&'*+\-.0-9A-Z^_`a-z|~]+$/, 'Invalid header name. Only letters(a-z, A-Z), numbers(0-9), underscores(_) and hyphens(-) are allowed.')
67
- .describe(JSON.stringify({
68
- title: 'Key',
69
- markdownDescription: 'Key of the response header. Must comply with RFC 7230.',
70
- })),
71
- value: zod_1.z
72
- .string()
73
- .min(1, 'Value is required')
74
- .describe(JSON.stringify({
75
- title: 'Value',
76
- markdownDescription: 'Value of the response header. ',
77
- })),
78
- }))
79
- .describe(JSON.stringify({
80
- markdownDescription: 'Response headers to be added when the rule is matched.',
81
- })),
82
- })
83
- .optional(),
61
+ responseModifications: response_rule_modifications_schema_1.ResponseRuleModificationsSchema,
84
62
  })
85
63
  .describe(JSON.stringify({
86
64
  title: 'Response Rule',
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ResponseRuleModificationsSchema = void 0;
7
+ const zod_1 = __importDefault(require("zod"));
8
+ const exampleJson = JSON.stringify({
9
+ headers: [
10
+ {
11
+ key: 'X-Custom-Header',
12
+ value: 'Custom Value',
13
+ },
14
+ ],
15
+ }, null, 2);
16
+ const exampleHeaderJson = JSON.stringify([
17
+ {
18
+ key: 'X-Custom-Header',
19
+ value: 'Custom Value',
20
+ },
21
+ ], null, 2);
22
+ exports.ResponseRuleModificationsSchema = zod_1.default
23
+ .object({
24
+ headers: zod_1.default
25
+ .array(zod_1.default.object({
26
+ key: zod_1.default
27
+ .string()
28
+ .regex(/^[!#$%&'*+\-.0-9A-Z^_`a-z|~]+$/, 'Invalid header name. Only letters(a-z, A-Z), numbers(0-9), underscores(_) and hyphens(-) are allowed.')
29
+ .describe(JSON.stringify({
30
+ title: 'Key',
31
+ markdownDescription: 'Key of the response header. Must comply with RFC 7230.',
32
+ })),
33
+ value: zod_1.default
34
+ .string()
35
+ .min(1, 'Value is required')
36
+ .describe(JSON.stringify({
37
+ title: 'Value',
38
+ markdownDescription: 'Value of the response header. ',
39
+ })),
40
+ }))
41
+ .describe(JSON.stringify({
42
+ markdownDescription: `Array of headers to be added when the rule is matched.\n\nExample:\n\`\`\`json\n${exampleHeaderJson}\n\`\`\``,
43
+ })),
44
+ })
45
+ .optional()
46
+ .describe(JSON.stringify({
47
+ markdownDescription: `Response modifications to be applied when the rule is matched.\n\nExample:\n\`\`\`json\n${exampleJson}\n\`\`\``,
48
+ }));
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ResponseRuleSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const constants_1 = require("../../constants");
6
+ const response_rule_modifications_schema_1 = require("./response-rule-modifications.schema");
6
7
  const response_rule_condition_schema_1 = require("./response-rule-condition.schema");
7
8
  const RuleExampleJson = JSON.stringify({
8
9
  name: 'Block Legacy Clients',
@@ -57,30 +58,7 @@ exports.ResponseRuleSchema = zod_1.z
57
58
  .map(([key, description]) => `- **${key}**: ${description}\n`)
58
59
  .join('\n')}`,
59
60
  })),
60
- responseModifications: zod_1.z
61
- .object({
62
- headers: zod_1.z
63
- .array(zod_1.z.object({
64
- key: zod_1.z
65
- .string()
66
- .regex(/^[!#$%&'*+\-.0-9A-Z^_`a-z|~]+$/, 'Invalid header name. Only letters(a-z, A-Z), numbers(0-9), underscores(_) and hyphens(-) are allowed.')
67
- .describe(JSON.stringify({
68
- title: 'Key',
69
- markdownDescription: 'Key of the response header. Must comply with RFC 7230.',
70
- })),
71
- value: zod_1.z
72
- .string()
73
- .min(1, 'Value is required')
74
- .describe(JSON.stringify({
75
- title: 'Value',
76
- markdownDescription: 'Value of the response header. ',
77
- })),
78
- }))
79
- .describe(JSON.stringify({
80
- markdownDescription: 'Response headers to be added when the rule is matched.',
81
- })),
82
- })
83
- .optional(),
61
+ responseModifications: response_rule_modifications_schema_1.ResponseRuleModificationsSchema,
84
62
  })
85
63
  .describe(JSON.stringify({
86
64
  title: 'Response Rule',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnawave/backend-contract",
3
- "version": "2.1.78",
3
+ "version": "2.1.80",
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.",