@remnawave/backend-contract 2.9.5 → 2.9.6
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.
- package/build/backend/commands/subscription-settings/get-subscription-settings.command.d.ts +1 -1
- package/build/backend/commands/subscription-settings/update-subscription-settings.command.d.ts +2 -2
- package/build/backend/commands/system/testers/test-srr-matcher.command.d.ts +2 -2
- package/build/backend/models/response-rules/response-rule-condition.schema.d.ts.map +1 -1
- package/build/backend/models/response-rules/response-rule-condition.schema.js +12 -11
- package/build/backend/models/response-rules/response-rule-modifications.schema.d.ts +1 -1
- package/build/backend/models/response-rules/response-rule-modifications.schema.d.ts.map +1 -1
- package/build/backend/models/response-rules/response-rule-modifications.schema.js +38 -43
- package/build/backend/models/response-rules/response-rule-settings.schema.d.ts.map +1 -1
- package/build/backend/models/response-rules/response-rule-settings.schema.js +6 -7
- package/build/backend/models/response-rules/response-rule.schema.d.ts +2 -2
- package/build/backend/models/response-rules/response-rule.schema.d.ts.map +1 -1
- package/build/backend/models/response-rules/response-rule.schema.js +20 -16
- package/build/backend/models/response-rules/response-rules-config.schema.d.ts +1 -1
- package/build/backend/models/response-rules/response-rules-config.schema.d.ts.map +1 -1
- package/build/backend/models/response-rules/response-rules-config.schema.js +2 -2
- package/build/backend/models/response-rules/response-rules-examples.d.ts +3 -3
- package/build/backend/models/response-rules/response-rules-examples.d.ts.map +1 -1
- package/build/backend/models/subscription-settings/hwid-settings.schema.d.ts.map +1 -1
- package/build/backend/models/subscription-settings/hwid-settings.schema.js +1 -1
- package/build/backend/models/subscription-settings.schema.d.ts +1 -1
- package/build/frontend/models/response-rules/response-rule-condition.schema.js +12 -11
- package/build/frontend/models/response-rules/response-rule-modifications.schema.js +38 -43
- package/build/frontend/models/response-rules/response-rule-settings.schema.js +6 -7
- package/build/frontend/models/response-rules/response-rule.schema.js +20 -16
- package/build/frontend/models/response-rules/response-rules-config.schema.js +2 -2
- package/build/frontend/models/subscription-settings/hwid-settings.schema.js +1 -1
- package/package.json +1 -1
|
@@ -74,7 +74,7 @@ export declare namespace GetSubscriptionSettingsCommand {
|
|
|
74
74
|
key: z.ZodString;
|
|
75
75
|
value: z.ZodString;
|
|
76
76
|
}, z.core.$strip>>>;
|
|
77
|
-
applyHeadersToEnd: z.ZodOptional<z.
|
|
77
|
+
applyHeadersToEnd: z.ZodOptional<z.ZodBoolean>;
|
|
78
78
|
subscriptionTemplate: z.ZodOptional<z.ZodString>;
|
|
79
79
|
ignoreHostXrayJsonTemplate: z.ZodOptional<z.ZodBoolean>;
|
|
80
80
|
ignoreServeJsonAtBaseSubscription: z.ZodOptional<z.ZodBoolean>;
|
package/build/backend/commands/subscription-settings/update-subscription-settings.command.d.ts
CHANGED
|
@@ -73,7 +73,7 @@ export declare namespace UpdateSubscriptionSettingsCommand {
|
|
|
73
73
|
key: z.ZodString;
|
|
74
74
|
value: z.ZodString;
|
|
75
75
|
}, z.core.$strip>>>;
|
|
76
|
-
applyHeadersToEnd: z.ZodOptional<z.
|
|
76
|
+
applyHeadersToEnd: z.ZodOptional<z.ZodBoolean>;
|
|
77
77
|
subscriptionTemplate: z.ZodOptional<z.ZodString>;
|
|
78
78
|
ignoreHostXrayJsonTemplate: z.ZodOptional<z.ZodBoolean>;
|
|
79
79
|
ignoreServeJsonAtBaseSubscription: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -167,7 +167,7 @@ export declare namespace UpdateSubscriptionSettingsCommand {
|
|
|
167
167
|
key: z.ZodString;
|
|
168
168
|
value: z.ZodString;
|
|
169
169
|
}, z.core.$strip>>>;
|
|
170
|
-
applyHeadersToEnd: z.ZodOptional<z.
|
|
170
|
+
applyHeadersToEnd: z.ZodOptional<z.ZodBoolean>;
|
|
171
171
|
subscriptionTemplate: z.ZodOptional<z.ZodString>;
|
|
172
172
|
ignoreHostXrayJsonTemplate: z.ZodOptional<z.ZodBoolean>;
|
|
173
173
|
ignoreServeJsonAtBaseSubscription: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -54,7 +54,7 @@ export declare namespace TestSrrMatcherCommand {
|
|
|
54
54
|
key: z.ZodString;
|
|
55
55
|
value: z.ZodString;
|
|
56
56
|
}, z.core.$strip>>>;
|
|
57
|
-
applyHeadersToEnd: z.ZodOptional<z.
|
|
57
|
+
applyHeadersToEnd: z.ZodOptional<z.ZodBoolean>;
|
|
58
58
|
subscriptionTemplate: z.ZodOptional<z.ZodString>;
|
|
59
59
|
ignoreHostXrayJsonTemplate: z.ZodOptional<z.ZodBoolean>;
|
|
60
60
|
ignoreServeJsonAtBaseSubscription: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -131,7 +131,7 @@ export declare namespace TestSrrMatcherCommand {
|
|
|
131
131
|
key: z.ZodString;
|
|
132
132
|
value: z.ZodString;
|
|
133
133
|
}, z.core.$strip>>>;
|
|
134
|
-
applyHeadersToEnd: z.ZodOptional<z.
|
|
134
|
+
applyHeadersToEnd: z.ZodOptional<z.ZodBoolean>;
|
|
135
135
|
subscriptionTemplate: z.ZodOptional<z.ZodString>;
|
|
136
136
|
ignoreHostXrayJsonTemplate: z.ZodOptional<z.ZodBoolean>;
|
|
137
137
|
ignoreServeJsonAtBaseSubscription: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-rule-condition.schema.d.ts","sourceRoot":"","sources":["../../../../models/response-rules/response-rule-condition.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"response-rule-condition.schema.d.ts","sourceRoot":"","sources":["../../../../models/response-rules/response-rule-condition.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;iBA8ClC,CAAC"}
|
|
@@ -8,26 +8,27 @@ exports.ResponseRuleConditionSchema = zod_1.z
|
|
|
8
8
|
headerName: zod_1.z
|
|
9
9
|
.string()
|
|
10
10
|
.regex(/^[!#$%&'*+\-.0-9A-Z^_`a-z|~]+$/, 'Invalid header name. Only letters(a-z, A-Z), numbers(0-9), underscores(_) and hyphens(-) are allowed.')
|
|
11
|
-
.
|
|
11
|
+
.meta({
|
|
12
|
+
title: 'Header Name',
|
|
12
13
|
markdownDescription: '**Name** of the HTTP header to check. Must comply with RFC 7230.',
|
|
13
|
-
})
|
|
14
|
-
operator: zod_1.z.enum(constants_1.RESPONSE_RULES_CONDITION_OPERATORS).
|
|
14
|
+
}),
|
|
15
|
+
operator: zod_1.z.enum(constants_1.RESPONSE_RULES_CONDITION_OPERATORS).meta({
|
|
15
16
|
errorMessage: 'Invalid operator. Please select a valid operator.',
|
|
16
17
|
markdownDescription: 'Operator to use for comparing the `headerName` with `value`.',
|
|
17
18
|
markdownEnumDescriptions: Object.entries(constants_1.RESPONSE_RULES_CONDITION_OPERATORS_DESCRIPTION).map(([_key, description]) => description),
|
|
18
|
-
})
|
|
19
|
+
}),
|
|
19
20
|
value: zod_1.z
|
|
20
21
|
.string()
|
|
21
22
|
.min(1, 'Value is required')
|
|
22
23
|
.max(255, 'Value must be less than 255 characters')
|
|
23
|
-
.
|
|
24
|
-
markdownDescription:
|
|
25
|
-
})
|
|
26
|
-
caseSensitive: zod_1.z.boolean().
|
|
24
|
+
.meta({
|
|
25
|
+
markdownDescription: '**Value** to check against the **headerName**.',
|
|
26
|
+
}),
|
|
27
|
+
caseSensitive: zod_1.z.boolean().meta({
|
|
27
28
|
markdownDescription: 'Whether the value is **case sensitive**. \n\n - `true`: the value will be compared as is. \n\n - `false`: the value will be lowercased **before** comparison.',
|
|
28
|
-
})
|
|
29
|
+
}),
|
|
29
30
|
})
|
|
30
|
-
.
|
|
31
|
+
.meta({
|
|
31
32
|
markdownDescription: 'Condition to check against the **headerName**.',
|
|
32
33
|
defaultSnippets: [
|
|
33
34
|
{
|
|
@@ -41,4 +42,4 @@ exports.ResponseRuleConditionSchema = zod_1.z
|
|
|
41
42
|
},
|
|
42
43
|
},
|
|
43
44
|
],
|
|
44
|
-
})
|
|
45
|
+
});
|
|
@@ -11,7 +11,7 @@ export declare const ResponseRuleModificationsSchema: z.ZodOptional<z.ZodObject<
|
|
|
11
11
|
key: z.ZodString;
|
|
12
12
|
value: z.ZodString;
|
|
13
13
|
}, z.core.$strip>>>;
|
|
14
|
-
applyHeadersToEnd: z.ZodOptional<z.
|
|
14
|
+
applyHeadersToEnd: z.ZodOptional<z.ZodBoolean>;
|
|
15
15
|
subscriptionTemplate: z.ZodOptional<z.ZodString>;
|
|
16
16
|
ignoreHostXrayJsonTemplate: z.ZodOptional<z.ZodBoolean>;
|
|
17
17
|
ignoreServeJsonAtBaseSubscription: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1 +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;AAEpB,eAAO,MAAM,4BAA4B;;;;;;iBAGvC,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;
|
|
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;AAEpB,eAAO,MAAM,4BAA4B;;;;;;iBAGvC,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;kBA+HtC,CAAC"}
|
|
@@ -17,20 +17,20 @@ exports.ResponseRuleModificationsSchema = zod_1.default
|
|
|
17
17
|
key: zod_1.default
|
|
18
18
|
.string()
|
|
19
19
|
.regex(/^[!#$%&'*+\-.0-9A-Z^_`a-z|~]+$/, 'Invalid header name. Only letters(a-z, A-Z), numbers(0-9), underscores(_) and hyphens(-) are allowed.')
|
|
20
|
-
.
|
|
20
|
+
.meta({
|
|
21
|
+
title: 'Header Key',
|
|
21
22
|
markdownDescription: 'Key of the response header. Must comply with RFC 7230.',
|
|
22
|
-
})
|
|
23
|
-
value: zod_1.default
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
markdownDescription: 'Value of the response header. ',
|
|
28
|
-
})),
|
|
23
|
+
}),
|
|
24
|
+
value: zod_1.default.string().min(1).meta({
|
|
25
|
+
title: 'Header Value',
|
|
26
|
+
markdownDescription: 'Value of the response header.',
|
|
27
|
+
}),
|
|
29
28
|
})
|
|
30
|
-
.
|
|
29
|
+
.meta({
|
|
30
|
+
title: 'Headers',
|
|
31
31
|
markdownDescription: '**Key** and **value** of the response header will be added to the response.',
|
|
32
|
-
}))
|
|
33
|
-
.
|
|
32
|
+
}))
|
|
33
|
+
.meta({
|
|
34
34
|
defaultSnippets: [
|
|
35
35
|
{
|
|
36
36
|
label: 'Examples: Add custom header',
|
|
@@ -44,38 +44,32 @@ exports.ResponseRuleModificationsSchema = zod_1.default
|
|
|
44
44
|
},
|
|
45
45
|
],
|
|
46
46
|
markdownDescription: 'Array of headers to be added when the rule is matched.',
|
|
47
|
-
})
|
|
47
|
+
})
|
|
48
48
|
.optional(),
|
|
49
|
-
applyHeadersToEnd: zod_1.default
|
|
50
|
-
|
|
51
|
-
.optional()
|
|
52
|
-
.describe(JSON.stringify({
|
|
49
|
+
applyHeadersToEnd: zod_1.default.boolean().optional().meta({
|
|
50
|
+
title: 'Apply Headers to End',
|
|
53
51
|
markdownDescription: 'By default, headers are added when forming the response. In some cases, headers set in SRR may be overridden by headers from other parts of the system. If you set this flag to **true**, headers from SRR will be added at the very end, just before the response is sent. In this case, SRR headers may override headers from other sections.',
|
|
54
|
-
})
|
|
55
|
-
.optional(),
|
|
52
|
+
}),
|
|
56
53
|
subscriptionTemplate: zod_1.default
|
|
57
54
|
.string()
|
|
58
55
|
.min(1, 'Subscription template name is required')
|
|
59
56
|
.optional()
|
|
60
|
-
.
|
|
57
|
+
.meta({
|
|
58
|
+
title: 'Subscription Template',
|
|
61
59
|
markdownDescription: 'Override the subscription template with the given name. If not provided, the default subscription template will be used. If the template name is not found, the default subscription template for this type will be used. **This modification have higher priority than settings from External Squads.**',
|
|
62
|
-
})
|
|
63
|
-
ignoreHostXrayJsonTemplate: zod_1.default
|
|
64
|
-
|
|
65
|
-
.optional()
|
|
66
|
-
.describe(JSON.stringify({
|
|
60
|
+
}),
|
|
61
|
+
ignoreHostXrayJsonTemplate: zod_1.default.boolean().optional().meta({
|
|
62
|
+
title: 'Ignore Host Xray Json Template',
|
|
67
63
|
markdownDescription: "Each Host may have its own Xray Json Template. If you set this flag to **true**, the Xray Json Template defined by the SRR will be used. **The Host's Xray Json Template will be ignored.**",
|
|
68
|
-
})
|
|
69
|
-
ignoreServeJsonAtBaseSubscription: zod_1.default
|
|
70
|
-
|
|
71
|
-
.optional()
|
|
72
|
-
.describe(JSON.stringify({
|
|
64
|
+
}),
|
|
65
|
+
ignoreServeJsonAtBaseSubscription: zod_1.default.boolean().optional().meta({
|
|
66
|
+
title: 'Ignore Serve Json at Base Subscription',
|
|
73
67
|
markdownDescription: 'If you set this flag to **true**, the **Serve JSON at Base Subscription** setting will be ignored (set to **false**).',
|
|
74
|
-
})
|
|
68
|
+
}),
|
|
75
69
|
additionalExtendedClientsRegex: zod_1.default
|
|
76
70
|
.array(zod_1.default.string().min(1))
|
|
77
71
|
.optional()
|
|
78
|
-
.
|
|
72
|
+
.meta({
|
|
79
73
|
markdownDescription: 'Additional regex patterns to match extended clients. Matched clients will receive `serverDescription` in the subscription response.\n\n' +
|
|
80
74
|
'**Default Mihomo extended clients:**\n' +
|
|
81
75
|
'- `^FlClash ?X/`\n' +
|
|
@@ -86,16 +80,15 @@ exports.ResponseRuleModificationsSchema = zod_1.default
|
|
|
86
80
|
'- `^Happ/`\n' +
|
|
87
81
|
'- `^INCY/`\n\n' +
|
|
88
82
|
'**Example:** `["^MyClient/", "^CustomApp\\\\/v2"]`',
|
|
89
|
-
})
|
|
90
|
-
disableHwidCheck: zod_1.default
|
|
91
|
-
|
|
92
|
-
.optional()
|
|
93
|
-
.describe(JSON.stringify({
|
|
83
|
+
}),
|
|
84
|
+
disableHwidCheck: zod_1.default.boolean().optional().meta({
|
|
85
|
+
title: 'Disable HWID Check',
|
|
94
86
|
markdownDescription: 'If you set this flag to **true**, the HWID check will be disabled. **This modification have higher priority than settings from Subscription Settings.**',
|
|
95
|
-
})
|
|
96
|
-
encryption: exports.ResponseRuleEncryptionSchema.optional().
|
|
87
|
+
}),
|
|
88
|
+
encryption: exports.ResponseRuleEncryptionSchema.optional().meta({
|
|
89
|
+
title: 'Encryption',
|
|
97
90
|
markdownDescription: 'Encrypt response body with given parameters. Generate keypairs with Rescue CLI: `docker exec -it remnawave cli`, select "Generate keypairs".',
|
|
98
|
-
})
|
|
91
|
+
}),
|
|
99
92
|
excludeHostsByTags: zod_1.default
|
|
100
93
|
.array(zod_1.default
|
|
101
94
|
.string()
|
|
@@ -103,12 +96,14 @@ exports.ResponseRuleModificationsSchema = zod_1.default
|
|
|
103
96
|
.max(36, 'Each tag must be less than 36 characters'))
|
|
104
97
|
.min(1)
|
|
105
98
|
.optional()
|
|
106
|
-
.
|
|
99
|
+
.meta({
|
|
100
|
+
title: 'Exclude Hosts by Tags',
|
|
107
101
|
markdownDescription: 'Excludes hosts from the subscription output if at least one tag in the host matches the given tags.',
|
|
108
|
-
})
|
|
102
|
+
}),
|
|
109
103
|
})
|
|
110
104
|
.optional()
|
|
111
|
-
.
|
|
105
|
+
.meta({
|
|
106
|
+
title: 'Response Modifications',
|
|
112
107
|
examples: [
|
|
113
108
|
{
|
|
114
109
|
headers: [
|
|
@@ -120,4 +115,4 @@ exports.ResponseRuleModificationsSchema = zod_1.default
|
|
|
120
115
|
},
|
|
121
116
|
],
|
|
122
117
|
markdownDescription: 'Response modifications to be applied when the rule is matched. Optional.',
|
|
123
|
-
})
|
|
118
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-rule-settings.schema.d.ts","sourceRoot":"","sources":["../../../../models/response-rules/response-rule-settings.schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,0BAA0B;;
|
|
1
|
+
{"version":3,"file":"response-rule-settings.schema.d.ts","sourceRoot":"","sources":["../../../../models/response-rules/response-rule-settings.schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,0BAA0B;;kBAYjC,CAAC"}
|
|
@@ -7,14 +7,13 @@ exports.ResponseRuleSettingsSchema = void 0;
|
|
|
7
7
|
const zod_1 = __importDefault(require("zod"));
|
|
8
8
|
exports.ResponseRuleSettingsSchema = zod_1.default
|
|
9
9
|
.object({
|
|
10
|
-
disableSubscriptionAccessByPath: zod_1.default
|
|
11
|
-
|
|
12
|
-
.optional()
|
|
13
|
-
.describe(JSON.stringify({
|
|
10
|
+
disableSubscriptionAccessByPath: zod_1.default.boolean().optional().meta({
|
|
11
|
+
title: 'Disable Subscription Access by Path',
|
|
14
12
|
markdownDescription: "Usually, a user's subscription may also be available via additional paths such as **/json**, **/stash**, or **/mihomo**. If this flag is set to **true**, access via these additional paths will be disabled.",
|
|
15
|
-
})
|
|
13
|
+
}),
|
|
16
14
|
})
|
|
17
15
|
.optional()
|
|
18
|
-
.
|
|
16
|
+
.meta({
|
|
17
|
+
title: 'Response Rule Settings',
|
|
19
18
|
markdownDescription: 'Settings for the **response rules** config. Optional.',
|
|
20
|
-
})
|
|
19
|
+
});
|
|
@@ -42,7 +42,7 @@ export declare const ResponseRuleSchemaBase: z.ZodObject<{
|
|
|
42
42
|
key: z.ZodString;
|
|
43
43
|
value: z.ZodString;
|
|
44
44
|
}, z.core.$strip>>>;
|
|
45
|
-
applyHeadersToEnd: z.ZodOptional<z.
|
|
45
|
+
applyHeadersToEnd: z.ZodOptional<z.ZodBoolean>;
|
|
46
46
|
subscriptionTemplate: z.ZodOptional<z.ZodString>;
|
|
47
47
|
ignoreHostXrayJsonTemplate: z.ZodOptional<z.ZodBoolean>;
|
|
48
48
|
ignoreServeJsonAtBaseSubscription: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -101,7 +101,7 @@ export declare const ResponseRuleSchema: z.ZodObject<{
|
|
|
101
101
|
key: z.ZodString;
|
|
102
102
|
value: z.ZodString;
|
|
103
103
|
}, z.core.$strip>>>;
|
|
104
|
-
applyHeadersToEnd: z.ZodOptional<z.
|
|
104
|
+
applyHeadersToEnd: z.ZodOptional<z.ZodBoolean>;
|
|
105
105
|
subscriptionTemplate: z.ZodOptional<z.ZodString>;
|
|
106
106
|
ignoreHostXrayJsonTemplate: z.ZodOptional<z.ZodBoolean>;
|
|
107
107
|
ignoreServeJsonAtBaseSubscription: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -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;AAexB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
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;AAexB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuCjC,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmB7B,CAAC"}
|
|
@@ -11,34 +11,40 @@ exports.ResponseRuleSchemaBase = zod_1.z.object({
|
|
|
11
11
|
.string()
|
|
12
12
|
.min(1, 'Name is required')
|
|
13
13
|
.max(50, 'Name must be less than 50 characters')
|
|
14
|
-
.
|
|
14
|
+
.meta({
|
|
15
|
+
title: 'Name',
|
|
15
16
|
markdownDescription: 'Name of the response rule.',
|
|
16
|
-
})
|
|
17
|
+
}),
|
|
17
18
|
description: zod_1.z
|
|
18
19
|
.string()
|
|
19
20
|
.min(1, 'Description is required')
|
|
20
21
|
.max(250, 'Description must be less than 250 characters')
|
|
21
22
|
.optional()
|
|
22
|
-
.
|
|
23
|
+
.meta({
|
|
24
|
+
title: 'Description',
|
|
23
25
|
markdownDescription: 'Description of the response rule. Optional.',
|
|
24
|
-
})
|
|
25
|
-
enabled: zod_1.z.boolean().
|
|
26
|
+
}),
|
|
27
|
+
enabled: zod_1.z.boolean().meta({
|
|
28
|
+
title: 'Enabled',
|
|
26
29
|
markdownDescription: 'Control whether the response rule is enabled or disabled. \n\n - `true` the rule will be applied. \n\n - `false` the rule will be always ignored.',
|
|
27
|
-
})
|
|
28
|
-
operator: zod_1.z.enum(constants_1.RESPONSE_RULES_OPERATORS).
|
|
30
|
+
}),
|
|
31
|
+
operator: zod_1.z.enum(constants_1.RESPONSE_RULES_OPERATORS).meta({
|
|
29
32
|
markdownDescription: 'Operator to use for combining conditions in the rule.',
|
|
30
|
-
})
|
|
31
|
-
conditions: zod_1.z.array(response_rule_condition_schema_1.ResponseRuleConditionSchema).
|
|
33
|
+
}),
|
|
34
|
+
conditions: zod_1.z.array(response_rule_condition_schema_1.ResponseRuleConditionSchema).meta({
|
|
35
|
+
title: 'Conditions',
|
|
32
36
|
markdownDescription: 'Array of conditions to check against the request headers. Conditions are applied with **operator**. If conditions are empty, the rule will be matched.',
|
|
33
|
-
})
|
|
34
|
-
responseType: zod_1.z.enum(constants_1.RESPONSE_RULES_RESPONSE_TYPES).
|
|
37
|
+
}),
|
|
38
|
+
responseType: zod_1.z.enum(constants_1.RESPONSE_RULES_RESPONSE_TYPES).meta({
|
|
35
39
|
errorMessage: 'Invalid response type. Please select a valid response type.',
|
|
36
40
|
markdownDescription: `Type of the response. Determines the type of **response** to be returned when the rule is matched.`,
|
|
37
41
|
markdownEnumDescriptions: Object.entries(constants_1.RESPONSE_RULES_RESPONSE_TYPES_DESCRIPTION).map(([_key, description]) => description),
|
|
38
|
-
})
|
|
42
|
+
}),
|
|
39
43
|
responseModifications: response_rule_modifications_schema_1.ResponseRuleModificationsSchema,
|
|
40
44
|
});
|
|
41
|
-
exports.ResponseRuleSchema = exports.ResponseRuleSchemaBase.
|
|
45
|
+
exports.ResponseRuleSchema = exports.ResponseRuleSchemaBase.meta({
|
|
46
|
+
title: 'Response Rule',
|
|
47
|
+
markdownDescription: (0, response_rules_examples_1.generateResponseRuleDescription)(exports.ResponseRuleSchemaBase),
|
|
42
48
|
defaultSnippets: [
|
|
43
49
|
{
|
|
44
50
|
label: 'Examples: Blank rule',
|
|
@@ -55,6 +61,4 @@ exports.ResponseRuleSchema = exports.ResponseRuleSchemaBase.describe(JSON.string
|
|
|
55
61
|
},
|
|
56
62
|
},
|
|
57
63
|
],
|
|
58
|
-
|
|
59
|
-
markdownDescription: (0, response_rules_examples_1.generateResponseRuleDescription)(exports.ResponseRuleSchemaBase),
|
|
60
|
-
}));
|
|
64
|
+
});
|
|
@@ -49,7 +49,7 @@ export declare const ResponseRulesConfigSchema: z.ZodObject<{
|
|
|
49
49
|
key: z.ZodString;
|
|
50
50
|
value: z.ZodString;
|
|
51
51
|
}, z.core.$strip>>>;
|
|
52
|
-
applyHeadersToEnd: z.ZodOptional<z.
|
|
52
|
+
applyHeadersToEnd: z.ZodOptional<z.ZodBoolean>;
|
|
53
53
|
subscriptionTemplate: z.ZodOptional<z.ZodString>;
|
|
54
54
|
ignoreHostXrayJsonTemplate: z.ZodOptional<z.ZodBoolean>;
|
|
55
55
|
ignoreServeJsonAtBaseSubscription: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-rules-config.schema.d.ts","sourceRoot":"","sources":["../../../../models/response-rules/response-rules-config.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"response-rules-config.schema.d.ts","sourceRoot":"","sources":["../../../../models/response-rules/response-rules-config.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAYpC,CAAC"}
|
|
@@ -12,9 +12,9 @@ exports.ResponseRulesConfigSchema = zod_1.z.object({
|
|
|
12
12
|
markdownDescription: 'Version of the **response rules** config. Currently supported version is **1**.',
|
|
13
13
|
}),
|
|
14
14
|
settings: response_rule_settings_schema_1.ResponseRuleSettingsSchema,
|
|
15
|
-
rules: zod_1.z.array(response_rule_schema_1.ResponseRuleSchema).
|
|
15
|
+
rules: zod_1.z.array(response_rule_schema_1.ResponseRuleSchema).meta({
|
|
16
16
|
title: 'Response Rules',
|
|
17
17
|
markdownDescription: `Array of **response rules**. Rules are evaluated in order and the first rule that matches is applied. If no rule matches, request will be blocked by default.\n\n**Example:**\n\`\`\`json\n${JSON.stringify([response_rules_examples_1.EXAMPLES_SRR_BLANK_RULE], null, 2)}\n\`\`\``,
|
|
18
18
|
defaultSnippets: [],
|
|
19
|
-
})
|
|
19
|
+
}),
|
|
20
20
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import z from 'zod';
|
|
2
|
-
import {
|
|
3
|
-
export declare const EXAMPLES_SRR_BLANK_RULE: z.infer<typeof
|
|
4
|
-
export declare const EXAMPLES_SRR_BLOCK_LEGACY_CLIENTS_RULE: z.infer<typeof
|
|
2
|
+
import type { ResponseRuleSchemaBase } from './response-rule.schema';
|
|
3
|
+
export declare const EXAMPLES_SRR_BLANK_RULE: z.infer<typeof ResponseRuleSchemaBase>;
|
|
4
|
+
export declare const EXAMPLES_SRR_BLOCK_LEGACY_CLIENTS_RULE: z.infer<typeof ResponseRuleSchemaBase>;
|
|
5
5
|
export declare function generateResponseRuleDescription(schema: typeof ResponseRuleSchemaBase): string;
|
|
6
6
|
//# sourceMappingURL=response-rules-examples.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-rules-examples.d.ts","sourceRoot":"","sources":["../../../../models/response-rules/response-rules-examples.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAOpB,OAAO,
|
|
1
|
+
{"version":3,"file":"response-rules-examples.d.ts","sourceRoot":"","sources":["../../../../models/response-rules/response-rules-examples.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAOpB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAErE,eAAO,MAAM,uBAAuB,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAU1E,CAAC;AAEF,eAAO,MAAM,sCAAsC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAoBzF,CAAC;AAEF,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,OAAO,sBAAsB,UAcpF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hwid-settings.schema.d.ts","sourceRoot":"","sources":["../../../../models/subscription-settings/hwid-settings.schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,kBAAkB;;;;
|
|
1
|
+
{"version":3,"file":"hwid-settings.schema.d.ts","sourceRoot":"","sources":["../../../../models/subscription-settings/hwid-settings.schema.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,eAAO,MAAM,kBAAkB;;;;iBAI7B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -8,5 +8,5 @@ const zod_1 = __importDefault(require("zod"));
|
|
|
8
8
|
exports.HwidSettingsSchema = zod_1.default.object({
|
|
9
9
|
enabled: zod_1.default.boolean(),
|
|
10
10
|
fallbackDeviceLimit: zod_1.default.number(),
|
|
11
|
-
maxDevicesAnnounce: zod_1.default.nullable(zod_1.default.string().max(200
|
|
11
|
+
maxDevicesAnnounce: zod_1.default.nullable(zod_1.default.string().max(200)),
|
|
12
12
|
});
|
|
@@ -69,7 +69,7 @@ export declare const SubscriptionSettingsSchema: z.ZodObject<{
|
|
|
69
69
|
key: z.ZodString;
|
|
70
70
|
value: z.ZodString;
|
|
71
71
|
}, z.core.$strip>>>;
|
|
72
|
-
applyHeadersToEnd: z.ZodOptional<z.
|
|
72
|
+
applyHeadersToEnd: z.ZodOptional<z.ZodBoolean>;
|
|
73
73
|
subscriptionTemplate: z.ZodOptional<z.ZodString>;
|
|
74
74
|
ignoreHostXrayJsonTemplate: z.ZodOptional<z.ZodBoolean>;
|
|
75
75
|
ignoreServeJsonAtBaseSubscription: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -8,26 +8,27 @@ exports.ResponseRuleConditionSchema = zod_1.z
|
|
|
8
8
|
headerName: zod_1.z
|
|
9
9
|
.string()
|
|
10
10
|
.regex(/^[!#$%&'*+\-.0-9A-Z^_`a-z|~]+$/, 'Invalid header name. Only letters(a-z, A-Z), numbers(0-9), underscores(_) and hyphens(-) are allowed.')
|
|
11
|
-
.
|
|
11
|
+
.meta({
|
|
12
|
+
title: 'Header Name',
|
|
12
13
|
markdownDescription: '**Name** of the HTTP header to check. Must comply with RFC 7230.',
|
|
13
|
-
})
|
|
14
|
-
operator: zod_1.z.enum(constants_1.RESPONSE_RULES_CONDITION_OPERATORS).
|
|
14
|
+
}),
|
|
15
|
+
operator: zod_1.z.enum(constants_1.RESPONSE_RULES_CONDITION_OPERATORS).meta({
|
|
15
16
|
errorMessage: 'Invalid operator. Please select a valid operator.',
|
|
16
17
|
markdownDescription: 'Operator to use for comparing the `headerName` with `value`.',
|
|
17
18
|
markdownEnumDescriptions: Object.entries(constants_1.RESPONSE_RULES_CONDITION_OPERATORS_DESCRIPTION).map(([_key, description]) => description),
|
|
18
|
-
})
|
|
19
|
+
}),
|
|
19
20
|
value: zod_1.z
|
|
20
21
|
.string()
|
|
21
22
|
.min(1, 'Value is required')
|
|
22
23
|
.max(255, 'Value must be less than 255 characters')
|
|
23
|
-
.
|
|
24
|
-
markdownDescription:
|
|
25
|
-
})
|
|
26
|
-
caseSensitive: zod_1.z.boolean().
|
|
24
|
+
.meta({
|
|
25
|
+
markdownDescription: '**Value** to check against the **headerName**.',
|
|
26
|
+
}),
|
|
27
|
+
caseSensitive: zod_1.z.boolean().meta({
|
|
27
28
|
markdownDescription: 'Whether the value is **case sensitive**. \n\n - `true`: the value will be compared as is. \n\n - `false`: the value will be lowercased **before** comparison.',
|
|
28
|
-
})
|
|
29
|
+
}),
|
|
29
30
|
})
|
|
30
|
-
.
|
|
31
|
+
.meta({
|
|
31
32
|
markdownDescription: 'Condition to check against the **headerName**.',
|
|
32
33
|
defaultSnippets: [
|
|
33
34
|
{
|
|
@@ -41,4 +42,4 @@ exports.ResponseRuleConditionSchema = zod_1.z
|
|
|
41
42
|
},
|
|
42
43
|
},
|
|
43
44
|
],
|
|
44
|
-
})
|
|
45
|
+
});
|
|
@@ -17,20 +17,20 @@ exports.ResponseRuleModificationsSchema = zod_1.default
|
|
|
17
17
|
key: zod_1.default
|
|
18
18
|
.string()
|
|
19
19
|
.regex(/^[!#$%&'*+\-.0-9A-Z^_`a-z|~]+$/, 'Invalid header name. Only letters(a-z, A-Z), numbers(0-9), underscores(_) and hyphens(-) are allowed.')
|
|
20
|
-
.
|
|
20
|
+
.meta({
|
|
21
|
+
title: 'Header Key',
|
|
21
22
|
markdownDescription: 'Key of the response header. Must comply with RFC 7230.',
|
|
22
|
-
})
|
|
23
|
-
value: zod_1.default
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
markdownDescription: 'Value of the response header. ',
|
|
28
|
-
})),
|
|
23
|
+
}),
|
|
24
|
+
value: zod_1.default.string().min(1).meta({
|
|
25
|
+
title: 'Header Value',
|
|
26
|
+
markdownDescription: 'Value of the response header.',
|
|
27
|
+
}),
|
|
29
28
|
})
|
|
30
|
-
.
|
|
29
|
+
.meta({
|
|
30
|
+
title: 'Headers',
|
|
31
31
|
markdownDescription: '**Key** and **value** of the response header will be added to the response.',
|
|
32
|
-
}))
|
|
33
|
-
.
|
|
32
|
+
}))
|
|
33
|
+
.meta({
|
|
34
34
|
defaultSnippets: [
|
|
35
35
|
{
|
|
36
36
|
label: 'Examples: Add custom header',
|
|
@@ -44,38 +44,32 @@ exports.ResponseRuleModificationsSchema = zod_1.default
|
|
|
44
44
|
},
|
|
45
45
|
],
|
|
46
46
|
markdownDescription: 'Array of headers to be added when the rule is matched.',
|
|
47
|
-
})
|
|
47
|
+
})
|
|
48
48
|
.optional(),
|
|
49
|
-
applyHeadersToEnd: zod_1.default
|
|
50
|
-
|
|
51
|
-
.optional()
|
|
52
|
-
.describe(JSON.stringify({
|
|
49
|
+
applyHeadersToEnd: zod_1.default.boolean().optional().meta({
|
|
50
|
+
title: 'Apply Headers to End',
|
|
53
51
|
markdownDescription: 'By default, headers are added when forming the response. In some cases, headers set in SRR may be overridden by headers from other parts of the system. If you set this flag to **true**, headers from SRR will be added at the very end, just before the response is sent. In this case, SRR headers may override headers from other sections.',
|
|
54
|
-
})
|
|
55
|
-
.optional(),
|
|
52
|
+
}),
|
|
56
53
|
subscriptionTemplate: zod_1.default
|
|
57
54
|
.string()
|
|
58
55
|
.min(1, 'Subscription template name is required')
|
|
59
56
|
.optional()
|
|
60
|
-
.
|
|
57
|
+
.meta({
|
|
58
|
+
title: 'Subscription Template',
|
|
61
59
|
markdownDescription: 'Override the subscription template with the given name. If not provided, the default subscription template will be used. If the template name is not found, the default subscription template for this type will be used. **This modification have higher priority than settings from External Squads.**',
|
|
62
|
-
})
|
|
63
|
-
ignoreHostXrayJsonTemplate: zod_1.default
|
|
64
|
-
|
|
65
|
-
.optional()
|
|
66
|
-
.describe(JSON.stringify({
|
|
60
|
+
}),
|
|
61
|
+
ignoreHostXrayJsonTemplate: zod_1.default.boolean().optional().meta({
|
|
62
|
+
title: 'Ignore Host Xray Json Template',
|
|
67
63
|
markdownDescription: "Each Host may have its own Xray Json Template. If you set this flag to **true**, the Xray Json Template defined by the SRR will be used. **The Host's Xray Json Template will be ignored.**",
|
|
68
|
-
})
|
|
69
|
-
ignoreServeJsonAtBaseSubscription: zod_1.default
|
|
70
|
-
|
|
71
|
-
.optional()
|
|
72
|
-
.describe(JSON.stringify({
|
|
64
|
+
}),
|
|
65
|
+
ignoreServeJsonAtBaseSubscription: zod_1.default.boolean().optional().meta({
|
|
66
|
+
title: 'Ignore Serve Json at Base Subscription',
|
|
73
67
|
markdownDescription: 'If you set this flag to **true**, the **Serve JSON at Base Subscription** setting will be ignored (set to **false**).',
|
|
74
|
-
})
|
|
68
|
+
}),
|
|
75
69
|
additionalExtendedClientsRegex: zod_1.default
|
|
76
70
|
.array(zod_1.default.string().min(1))
|
|
77
71
|
.optional()
|
|
78
|
-
.
|
|
72
|
+
.meta({
|
|
79
73
|
markdownDescription: 'Additional regex patterns to match extended clients. Matched clients will receive `serverDescription` in the subscription response.\n\n' +
|
|
80
74
|
'**Default Mihomo extended clients:**\n' +
|
|
81
75
|
'- `^FlClash ?X/`\n' +
|
|
@@ -86,16 +80,15 @@ exports.ResponseRuleModificationsSchema = zod_1.default
|
|
|
86
80
|
'- `^Happ/`\n' +
|
|
87
81
|
'- `^INCY/`\n\n' +
|
|
88
82
|
'**Example:** `["^MyClient/", "^CustomApp\\\\/v2"]`',
|
|
89
|
-
})
|
|
90
|
-
disableHwidCheck: zod_1.default
|
|
91
|
-
|
|
92
|
-
.optional()
|
|
93
|
-
.describe(JSON.stringify({
|
|
83
|
+
}),
|
|
84
|
+
disableHwidCheck: zod_1.default.boolean().optional().meta({
|
|
85
|
+
title: 'Disable HWID Check',
|
|
94
86
|
markdownDescription: 'If you set this flag to **true**, the HWID check will be disabled. **This modification have higher priority than settings from Subscription Settings.**',
|
|
95
|
-
})
|
|
96
|
-
encryption: exports.ResponseRuleEncryptionSchema.optional().
|
|
87
|
+
}),
|
|
88
|
+
encryption: exports.ResponseRuleEncryptionSchema.optional().meta({
|
|
89
|
+
title: 'Encryption',
|
|
97
90
|
markdownDescription: 'Encrypt response body with given parameters. Generate keypairs with Rescue CLI: `docker exec -it remnawave cli`, select "Generate keypairs".',
|
|
98
|
-
})
|
|
91
|
+
}),
|
|
99
92
|
excludeHostsByTags: zod_1.default
|
|
100
93
|
.array(zod_1.default
|
|
101
94
|
.string()
|
|
@@ -103,12 +96,14 @@ exports.ResponseRuleModificationsSchema = zod_1.default
|
|
|
103
96
|
.max(36, 'Each tag must be less than 36 characters'))
|
|
104
97
|
.min(1)
|
|
105
98
|
.optional()
|
|
106
|
-
.
|
|
99
|
+
.meta({
|
|
100
|
+
title: 'Exclude Hosts by Tags',
|
|
107
101
|
markdownDescription: 'Excludes hosts from the subscription output if at least one tag in the host matches the given tags.',
|
|
108
|
-
})
|
|
102
|
+
}),
|
|
109
103
|
})
|
|
110
104
|
.optional()
|
|
111
|
-
.
|
|
105
|
+
.meta({
|
|
106
|
+
title: 'Response Modifications',
|
|
112
107
|
examples: [
|
|
113
108
|
{
|
|
114
109
|
headers: [
|
|
@@ -120,4 +115,4 @@ exports.ResponseRuleModificationsSchema = zod_1.default
|
|
|
120
115
|
},
|
|
121
116
|
],
|
|
122
117
|
markdownDescription: 'Response modifications to be applied when the rule is matched. Optional.',
|
|
123
|
-
})
|
|
118
|
+
});
|
|
@@ -7,14 +7,13 @@ exports.ResponseRuleSettingsSchema = void 0;
|
|
|
7
7
|
const zod_1 = __importDefault(require("zod"));
|
|
8
8
|
exports.ResponseRuleSettingsSchema = zod_1.default
|
|
9
9
|
.object({
|
|
10
|
-
disableSubscriptionAccessByPath: zod_1.default
|
|
11
|
-
|
|
12
|
-
.optional()
|
|
13
|
-
.describe(JSON.stringify({
|
|
10
|
+
disableSubscriptionAccessByPath: zod_1.default.boolean().optional().meta({
|
|
11
|
+
title: 'Disable Subscription Access by Path',
|
|
14
12
|
markdownDescription: "Usually, a user's subscription may also be available via additional paths such as **/json**, **/stash**, or **/mihomo**. If this flag is set to **true**, access via these additional paths will be disabled.",
|
|
15
|
-
})
|
|
13
|
+
}),
|
|
16
14
|
})
|
|
17
15
|
.optional()
|
|
18
|
-
.
|
|
16
|
+
.meta({
|
|
17
|
+
title: 'Response Rule Settings',
|
|
19
18
|
markdownDescription: 'Settings for the **response rules** config. Optional.',
|
|
20
|
-
})
|
|
19
|
+
});
|
|
@@ -11,34 +11,40 @@ exports.ResponseRuleSchemaBase = zod_1.z.object({
|
|
|
11
11
|
.string()
|
|
12
12
|
.min(1, 'Name is required')
|
|
13
13
|
.max(50, 'Name must be less than 50 characters')
|
|
14
|
-
.
|
|
14
|
+
.meta({
|
|
15
|
+
title: 'Name',
|
|
15
16
|
markdownDescription: 'Name of the response rule.',
|
|
16
|
-
})
|
|
17
|
+
}),
|
|
17
18
|
description: zod_1.z
|
|
18
19
|
.string()
|
|
19
20
|
.min(1, 'Description is required')
|
|
20
21
|
.max(250, 'Description must be less than 250 characters')
|
|
21
22
|
.optional()
|
|
22
|
-
.
|
|
23
|
+
.meta({
|
|
24
|
+
title: 'Description',
|
|
23
25
|
markdownDescription: 'Description of the response rule. Optional.',
|
|
24
|
-
})
|
|
25
|
-
enabled: zod_1.z.boolean().
|
|
26
|
+
}),
|
|
27
|
+
enabled: zod_1.z.boolean().meta({
|
|
28
|
+
title: 'Enabled',
|
|
26
29
|
markdownDescription: 'Control whether the response rule is enabled or disabled. \n\n - `true` the rule will be applied. \n\n - `false` the rule will be always ignored.',
|
|
27
|
-
})
|
|
28
|
-
operator: zod_1.z.enum(constants_1.RESPONSE_RULES_OPERATORS).
|
|
30
|
+
}),
|
|
31
|
+
operator: zod_1.z.enum(constants_1.RESPONSE_RULES_OPERATORS).meta({
|
|
29
32
|
markdownDescription: 'Operator to use for combining conditions in the rule.',
|
|
30
|
-
})
|
|
31
|
-
conditions: zod_1.z.array(response_rule_condition_schema_1.ResponseRuleConditionSchema).
|
|
33
|
+
}),
|
|
34
|
+
conditions: zod_1.z.array(response_rule_condition_schema_1.ResponseRuleConditionSchema).meta({
|
|
35
|
+
title: 'Conditions',
|
|
32
36
|
markdownDescription: 'Array of conditions to check against the request headers. Conditions are applied with **operator**. If conditions are empty, the rule will be matched.',
|
|
33
|
-
})
|
|
34
|
-
responseType: zod_1.z.enum(constants_1.RESPONSE_RULES_RESPONSE_TYPES).
|
|
37
|
+
}),
|
|
38
|
+
responseType: zod_1.z.enum(constants_1.RESPONSE_RULES_RESPONSE_TYPES).meta({
|
|
35
39
|
errorMessage: 'Invalid response type. Please select a valid response type.',
|
|
36
40
|
markdownDescription: `Type of the response. Determines the type of **response** to be returned when the rule is matched.`,
|
|
37
41
|
markdownEnumDescriptions: Object.entries(constants_1.RESPONSE_RULES_RESPONSE_TYPES_DESCRIPTION).map(([_key, description]) => description),
|
|
38
|
-
})
|
|
42
|
+
}),
|
|
39
43
|
responseModifications: response_rule_modifications_schema_1.ResponseRuleModificationsSchema,
|
|
40
44
|
});
|
|
41
|
-
exports.ResponseRuleSchema = exports.ResponseRuleSchemaBase.
|
|
45
|
+
exports.ResponseRuleSchema = exports.ResponseRuleSchemaBase.meta({
|
|
46
|
+
title: 'Response Rule',
|
|
47
|
+
markdownDescription: (0, response_rules_examples_1.generateResponseRuleDescription)(exports.ResponseRuleSchemaBase),
|
|
42
48
|
defaultSnippets: [
|
|
43
49
|
{
|
|
44
50
|
label: 'Examples: Blank rule',
|
|
@@ -51,6 +57,4 @@ exports.ResponseRuleSchema = exports.ResponseRuleSchemaBase.describe(JSON.string
|
|
|
51
57
|
body: Object.assign({}, response_rules_examples_1.EXAMPLES_SRR_BLOCK_LEGACY_CLIENTS_RULE),
|
|
52
58
|
},
|
|
53
59
|
],
|
|
54
|
-
|
|
55
|
-
markdownDescription: (0, response_rules_examples_1.generateResponseRuleDescription)(exports.ResponseRuleSchemaBase),
|
|
56
|
-
}));
|
|
60
|
+
});
|
|
@@ -12,9 +12,9 @@ exports.ResponseRulesConfigSchema = zod_1.z.object({
|
|
|
12
12
|
markdownDescription: 'Version of the **response rules** config. Currently supported version is **1**.',
|
|
13
13
|
}),
|
|
14
14
|
settings: response_rule_settings_schema_1.ResponseRuleSettingsSchema,
|
|
15
|
-
rules: zod_1.z.array(response_rule_schema_1.ResponseRuleSchema).
|
|
15
|
+
rules: zod_1.z.array(response_rule_schema_1.ResponseRuleSchema).meta({
|
|
16
16
|
title: 'Response Rules',
|
|
17
17
|
markdownDescription: `Array of **response rules**. Rules are evaluated in order and the first rule that matches is applied. If no rule matches, request will be blocked by default.\n\n**Example:**\n\`\`\`json\n${JSON.stringify([response_rules_examples_1.EXAMPLES_SRR_BLANK_RULE], null, 2)}\n\`\`\``,
|
|
18
18
|
defaultSnippets: [],
|
|
19
|
-
})
|
|
19
|
+
}),
|
|
20
20
|
});
|
|
@@ -8,5 +8,5 @@ const zod_1 = __importDefault(require("zod"));
|
|
|
8
8
|
exports.HwidSettingsSchema = zod_1.default.object({
|
|
9
9
|
enabled: zod_1.default.boolean(),
|
|
10
10
|
fallbackDeviceLimit: zod_1.default.number(),
|
|
11
|
-
maxDevicesAnnounce: zod_1.default.nullable(zod_1.default.string().max(200
|
|
11
|
+
maxDevicesAnnounce: zod_1.default.nullable(zod_1.default.string().max(200)),
|
|
12
12
|
});
|
package/package.json
CHANGED