@remnawave/backend-contract 2.9.31 → 2.9.32
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 +3 -25
- package/build/backend/commands/subscription-settings/get-subscription-settings.command.d.ts.map +1 -1
- package/build/backend/commands/subscription-settings/update-subscription-settings.command.d.ts +6 -50
- package/build/backend/commands/subscription-settings/update-subscription-settings.command.d.ts.map +1 -1
- package/build/backend/commands/system/testers/test-srr-matcher.command.d.ts +5 -47
- package/build/backend/commands/system/testers/test-srr-matcher.command.d.ts.map +1 -1
- package/build/backend/constants/response-rules/response-rules.contants.d.ts +23 -3
- package/build/backend/constants/response-rules/response-rules.contants.d.ts.map +1 -1
- package/build/backend/constants/response-rules/response-rules.contants.js +22 -3
- package/build/backend/models/response-rules/index.d.ts +2 -0
- package/build/backend/models/response-rules/index.d.ts.map +1 -1
- package/build/backend/models/response-rules/index.js +2 -0
- package/build/backend/models/response-rules/response-rule-condition.schema.d.ts +40 -3
- 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 +156 -6
- package/build/backend/models/response-rules/response-rule.schema.d.ts +4 -44
- package/build/backend/models/response-rules/response-rule.schema.d.ts.map +1 -1
- package/build/backend/models/response-rules/response-rule.schema.js +26 -10
- package/build/backend/models/response-rules/response-rules-config.schema.d.ts +3 -25
- 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 +9 -4
- package/build/backend/models/response-rules/response-rules-examples.d.ts +2 -2
- package/build/backend/models/response-rules/response-rules-examples.d.ts.map +1 -1
- package/build/backend/models/response-rules/response-rules-examples.js +30 -22
- package/build/backend/models/response-rules/response-rules-legacy.schema.d.ts +157 -0
- package/build/backend/models/response-rules/response-rules-legacy.schema.d.ts.map +1 -0
- package/build/backend/models/response-rules/response-rules-legacy.schema.js +33 -0
- package/build/backend/models/response-rules/response-rules-migration.d.ts +10 -0
- package/build/backend/models/response-rules/response-rules-migration.d.ts.map +1 -0
- package/build/backend/models/response-rules/response-rules-migration.js +45 -0
- package/build/backend/models/subscription-settings.schema.d.ts +3 -25
- package/build/backend/models/subscription-settings.schema.d.ts.map +1 -1
- package/build/frontend/constants/response-rules/response-rules.contants.js +22 -3
- package/build/frontend/models/response-rules/index.js +2 -0
- package/build/frontend/models/response-rules/response-rule-condition.schema.js +156 -6
- package/build/frontend/models/response-rules/response-rule.schema.js +26 -10
- package/build/frontend/models/response-rules/response-rules-config.schema.js +9 -4
- package/build/frontend/models/response-rules/response-rules-examples.js +30 -22
- package/build/frontend/models/response-rules/response-rules-legacy.schema.js +33 -0
- package/build/frontend/models/response-rules/response-rules-migration.js +45 -0
- package/package.json +1 -1
|
@@ -19,9 +19,7 @@ export declare namespace GetSubscriptionSettingsCommand {
|
|
|
19
19
|
customResponseHeaders: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
20
20
|
randomizeHosts: z.ZodBoolean;
|
|
21
21
|
responseRules: z.ZodNullable<z.ZodObject<{
|
|
22
|
-
version: z.
|
|
23
|
-
readonly 1: "1";
|
|
24
|
-
}>;
|
|
22
|
+
version: z.ZodLiteral<"2">;
|
|
25
23
|
settings: z.ZodOptional<z.ZodObject<{
|
|
26
24
|
disableSubscriptionAccessByPath: z.ZodOptional<z.ZodBoolean>;
|
|
27
25
|
}, z.core.$strip>>;
|
|
@@ -29,27 +27,7 @@ export declare namespace GetSubscriptionSettingsCommand {
|
|
|
29
27
|
name: z.ZodString;
|
|
30
28
|
description: z.ZodOptional<z.ZodString>;
|
|
31
29
|
enabled: z.ZodBoolean;
|
|
32
|
-
|
|
33
|
-
readonly AND: "AND";
|
|
34
|
-
readonly OR: "OR";
|
|
35
|
-
}>;
|
|
36
|
-
conditions: z.ZodArray<z.ZodObject<{
|
|
37
|
-
headerName: z.ZodString;
|
|
38
|
-
operator: z.ZodEnum<{
|
|
39
|
-
readonly EQUALS: "EQUALS";
|
|
40
|
-
readonly NOT_EQUALS: "NOT_EQUALS";
|
|
41
|
-
readonly CONTAINS: "CONTAINS";
|
|
42
|
-
readonly NOT_CONTAINS: "NOT_CONTAINS";
|
|
43
|
-
readonly STARTS_WITH: "STARTS_WITH";
|
|
44
|
-
readonly NOT_STARTS_WITH: "NOT_STARTS_WITH";
|
|
45
|
-
readonly ENDS_WITH: "ENDS_WITH";
|
|
46
|
-
readonly NOT_ENDS_WITH: "NOT_ENDS_WITH";
|
|
47
|
-
readonly REGEX: "REGEX";
|
|
48
|
-
readonly NOT_REGEX: "NOT_REGEX";
|
|
49
|
-
}>;
|
|
50
|
-
value: z.ZodString;
|
|
51
|
-
caseSensitive: z.ZodBoolean;
|
|
52
|
-
}, z.core.$strip>>;
|
|
30
|
+
when: z.ZodOptional<z.ZodType<import("../../models").TResponseRuleConditionNode, unknown, z.core.$ZodTypeInternals<import("../../models").TResponseRuleConditionNode, unknown>>>;
|
|
53
31
|
responseType: z.ZodEnum<{
|
|
54
32
|
readonly BROWSER: "BROWSER";
|
|
55
33
|
readonly BLOCK: "BLOCK";
|
|
@@ -83,7 +61,7 @@ export declare namespace GetSubscriptionSettingsCommand {
|
|
|
83
61
|
}, z.core.$strip>>;
|
|
84
62
|
excludeHostsByTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
85
63
|
}, z.core.$strip>>;
|
|
86
|
-
}, z.core.$
|
|
64
|
+
}, z.core.$strict>>;
|
|
87
65
|
}, z.core.$strip>>;
|
|
88
66
|
hwidSettings: z.ZodNullable<z.ZodObject<{
|
|
89
67
|
enabled: z.ZodBoolean;
|
package/build/backend/commands/subscription-settings/get-subscription-settings.command.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-subscription-settings.command.d.ts","sourceRoot":"","sources":["../../../../commands/subscription-settings/get-subscription-settings.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,yBAAiB,8BAA8B,CAAC;IACrC,MAAM,GAAG,+BAAqC,CAAC;IAC/C,MAAM,OAAO,+BAAM,CAAC;IAEpB,MAAM,eAAe,2CAK3B,CAAC;IAEK,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"get-subscription-settings.command.d.ts","sourceRoot":"","sources":["../../../../commands/subscription-settings/get-subscription-settings.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,yBAAiB,8BAA8B,CAAC;IACrC,MAAM,GAAG,+BAAqC,CAAC;IAC/C,MAAM,OAAO,+BAAM,CAAC;IAEpB,MAAM,eAAe,2CAK3B,CAAC;IAEK,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAEzB,CAAC;IAEH,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
|
package/build/backend/commands/subscription-settings/update-subscription-settings.command.d.ts
CHANGED
|
@@ -18,9 +18,7 @@ export declare namespace UpdateSubscriptionSettingsCommand {
|
|
|
18
18
|
customResponseHeaders: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
19
19
|
randomizeHosts: z.ZodOptional<z.ZodBoolean>;
|
|
20
20
|
responseRules: z.ZodOptional<z.ZodObject<{
|
|
21
|
-
version: z.
|
|
22
|
-
readonly 1: "1";
|
|
23
|
-
}>;
|
|
21
|
+
version: z.ZodLiteral<"2">;
|
|
24
22
|
settings: z.ZodOptional<z.ZodObject<{
|
|
25
23
|
disableSubscriptionAccessByPath: z.ZodOptional<z.ZodBoolean>;
|
|
26
24
|
}, z.core.$strip>>;
|
|
@@ -28,27 +26,7 @@ export declare namespace UpdateSubscriptionSettingsCommand {
|
|
|
28
26
|
name: z.ZodString;
|
|
29
27
|
description: z.ZodOptional<z.ZodString>;
|
|
30
28
|
enabled: z.ZodBoolean;
|
|
31
|
-
|
|
32
|
-
readonly AND: "AND";
|
|
33
|
-
readonly OR: "OR";
|
|
34
|
-
}>;
|
|
35
|
-
conditions: z.ZodArray<z.ZodObject<{
|
|
36
|
-
headerName: z.ZodString;
|
|
37
|
-
operator: z.ZodEnum<{
|
|
38
|
-
readonly EQUALS: "EQUALS";
|
|
39
|
-
readonly NOT_EQUALS: "NOT_EQUALS";
|
|
40
|
-
readonly CONTAINS: "CONTAINS";
|
|
41
|
-
readonly NOT_CONTAINS: "NOT_CONTAINS";
|
|
42
|
-
readonly STARTS_WITH: "STARTS_WITH";
|
|
43
|
-
readonly NOT_STARTS_WITH: "NOT_STARTS_WITH";
|
|
44
|
-
readonly ENDS_WITH: "ENDS_WITH";
|
|
45
|
-
readonly NOT_ENDS_WITH: "NOT_ENDS_WITH";
|
|
46
|
-
readonly REGEX: "REGEX";
|
|
47
|
-
readonly NOT_REGEX: "NOT_REGEX";
|
|
48
|
-
}>;
|
|
49
|
-
value: z.ZodString;
|
|
50
|
-
caseSensitive: z.ZodBoolean;
|
|
51
|
-
}, z.core.$strip>>;
|
|
29
|
+
when: z.ZodOptional<z.ZodType<import("../../models").TResponseRuleConditionNode, unknown, z.core.$ZodTypeInternals<import("../../models").TResponseRuleConditionNode, unknown>>>;
|
|
52
30
|
responseType: z.ZodEnum<{
|
|
53
31
|
readonly BROWSER: "BROWSER";
|
|
54
32
|
readonly BLOCK: "BLOCK";
|
|
@@ -82,7 +60,7 @@ export declare namespace UpdateSubscriptionSettingsCommand {
|
|
|
82
60
|
}, z.core.$strip>>;
|
|
83
61
|
excludeHostsByTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
84
62
|
}, z.core.$strip>>;
|
|
85
|
-
}, z.core.$
|
|
63
|
+
}, z.core.$strict>>;
|
|
86
64
|
}, z.core.$strip>>;
|
|
87
65
|
hwidSettings: z.ZodOptional<z.ZodObject<{
|
|
88
66
|
enabled: z.ZodBoolean;
|
|
@@ -106,9 +84,7 @@ export declare namespace UpdateSubscriptionSettingsCommand {
|
|
|
106
84
|
customResponseHeaders: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
107
85
|
randomizeHosts: z.ZodBoolean;
|
|
108
86
|
responseRules: z.ZodNullable<z.ZodObject<{
|
|
109
|
-
version: z.
|
|
110
|
-
readonly 1: "1";
|
|
111
|
-
}>;
|
|
87
|
+
version: z.ZodLiteral<"2">;
|
|
112
88
|
settings: z.ZodOptional<z.ZodObject<{
|
|
113
89
|
disableSubscriptionAccessByPath: z.ZodOptional<z.ZodBoolean>;
|
|
114
90
|
}, z.core.$strip>>;
|
|
@@ -116,27 +92,7 @@ export declare namespace UpdateSubscriptionSettingsCommand {
|
|
|
116
92
|
name: z.ZodString;
|
|
117
93
|
description: z.ZodOptional<z.ZodString>;
|
|
118
94
|
enabled: z.ZodBoolean;
|
|
119
|
-
|
|
120
|
-
readonly AND: "AND";
|
|
121
|
-
readonly OR: "OR";
|
|
122
|
-
}>;
|
|
123
|
-
conditions: z.ZodArray<z.ZodObject<{
|
|
124
|
-
headerName: z.ZodString;
|
|
125
|
-
operator: z.ZodEnum<{
|
|
126
|
-
readonly EQUALS: "EQUALS";
|
|
127
|
-
readonly NOT_EQUALS: "NOT_EQUALS";
|
|
128
|
-
readonly CONTAINS: "CONTAINS";
|
|
129
|
-
readonly NOT_CONTAINS: "NOT_CONTAINS";
|
|
130
|
-
readonly STARTS_WITH: "STARTS_WITH";
|
|
131
|
-
readonly NOT_STARTS_WITH: "NOT_STARTS_WITH";
|
|
132
|
-
readonly ENDS_WITH: "ENDS_WITH";
|
|
133
|
-
readonly NOT_ENDS_WITH: "NOT_ENDS_WITH";
|
|
134
|
-
readonly REGEX: "REGEX";
|
|
135
|
-
readonly NOT_REGEX: "NOT_REGEX";
|
|
136
|
-
}>;
|
|
137
|
-
value: z.ZodString;
|
|
138
|
-
caseSensitive: z.ZodBoolean;
|
|
139
|
-
}, z.core.$strip>>;
|
|
95
|
+
when: z.ZodOptional<z.ZodType<import("../../models").TResponseRuleConditionNode, unknown, z.core.$ZodTypeInternals<import("../../models").TResponseRuleConditionNode, unknown>>>;
|
|
140
96
|
responseType: z.ZodEnum<{
|
|
141
97
|
readonly BROWSER: "BROWSER";
|
|
142
98
|
readonly BLOCK: "BLOCK";
|
|
@@ -170,7 +126,7 @@ export declare namespace UpdateSubscriptionSettingsCommand {
|
|
|
170
126
|
}, z.core.$strip>>;
|
|
171
127
|
excludeHostsByTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
172
128
|
}, z.core.$strip>>;
|
|
173
|
-
}, z.core.$
|
|
129
|
+
}, z.core.$strict>>;
|
|
174
130
|
}, z.core.$strip>>;
|
|
175
131
|
hwidSettings: z.ZodNullable<z.ZodObject<{
|
|
176
132
|
enabled: z.ZodBoolean;
|
package/build/backend/commands/subscription-settings/update-subscription-settings.command.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-subscription-settings.command.d.ts","sourceRoot":"","sources":["../../../../commands/subscription-settings/update-subscription-settings.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,yBAAiB,iCAAiC,CAAC;IACxC,MAAM,GAAG,+BAAwC,CAAC;IAClD,MAAM,OAAO,+BAAM,CAAC;IAEpB,MAAM,eAAe,2CAK3B,CAAC;IAEK,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"update-subscription-settings.command.d.ts","sourceRoot":"","sources":["../../../../commands/subscription-settings/update-subscription-settings.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,yBAAiB,iCAAiC,CAAC;IACxC,MAAM,GAAG,+BAAwC,CAAC;IAClD,MAAM,OAAO,+BAAM,CAAC;IAEpB,MAAM,eAAe,2CAK3B,CAAC;IAEK,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAmB5B,CAAC;IAEI,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAEzB,CAAC;IAEH,KAAY,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;IAC5D,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
|
|
@@ -5,9 +5,7 @@ export declare namespace TestSrrMatcherCommand {
|
|
|
5
5
|
const endpointDetails: import("../../../constants").EndpointDetails;
|
|
6
6
|
const RequestBodySchema: z.ZodObject<{
|
|
7
7
|
responseRules: z.ZodObject<{
|
|
8
|
-
version: z.
|
|
9
|
-
readonly 1: "1";
|
|
10
|
-
}>;
|
|
8
|
+
version: z.ZodLiteral<"2">;
|
|
11
9
|
settings: z.ZodOptional<z.ZodObject<{
|
|
12
10
|
disableSubscriptionAccessByPath: z.ZodOptional<z.ZodBoolean>;
|
|
13
11
|
}, z.core.$strip>>;
|
|
@@ -15,27 +13,7 @@ export declare namespace TestSrrMatcherCommand {
|
|
|
15
13
|
name: z.ZodString;
|
|
16
14
|
description: z.ZodOptional<z.ZodString>;
|
|
17
15
|
enabled: z.ZodBoolean;
|
|
18
|
-
|
|
19
|
-
readonly AND: "AND";
|
|
20
|
-
readonly OR: "OR";
|
|
21
|
-
}>;
|
|
22
|
-
conditions: z.ZodArray<z.ZodObject<{
|
|
23
|
-
headerName: z.ZodString;
|
|
24
|
-
operator: z.ZodEnum<{
|
|
25
|
-
readonly EQUALS: "EQUALS";
|
|
26
|
-
readonly NOT_EQUALS: "NOT_EQUALS";
|
|
27
|
-
readonly CONTAINS: "CONTAINS";
|
|
28
|
-
readonly NOT_CONTAINS: "NOT_CONTAINS";
|
|
29
|
-
readonly STARTS_WITH: "STARTS_WITH";
|
|
30
|
-
readonly NOT_STARTS_WITH: "NOT_STARTS_WITH";
|
|
31
|
-
readonly ENDS_WITH: "ENDS_WITH";
|
|
32
|
-
readonly NOT_ENDS_WITH: "NOT_ENDS_WITH";
|
|
33
|
-
readonly REGEX: "REGEX";
|
|
34
|
-
readonly NOT_REGEX: "NOT_REGEX";
|
|
35
|
-
}>;
|
|
36
|
-
value: z.ZodString;
|
|
37
|
-
caseSensitive: z.ZodBoolean;
|
|
38
|
-
}, z.core.$strip>>;
|
|
16
|
+
when: z.ZodOptional<z.ZodType<import("../../../models").TResponseRuleConditionNode, unknown, z.core.$ZodTypeInternals<import("../../../models").TResponseRuleConditionNode, unknown>>>;
|
|
39
17
|
responseType: z.ZodEnum<{
|
|
40
18
|
readonly BROWSER: "BROWSER";
|
|
41
19
|
readonly BLOCK: "BLOCK";
|
|
@@ -69,7 +47,7 @@ export declare namespace TestSrrMatcherCommand {
|
|
|
69
47
|
}, z.core.$strip>>;
|
|
70
48
|
excludeHostsByTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
71
49
|
}, z.core.$strip>>;
|
|
72
|
-
}, z.core.$
|
|
50
|
+
}, z.core.$strict>>;
|
|
73
51
|
}, z.core.$strip>;
|
|
74
52
|
}, z.core.$strip>;
|
|
75
53
|
const ResponseSchema: z.ZodObject<{
|
|
@@ -92,27 +70,7 @@ export declare namespace TestSrrMatcherCommand {
|
|
|
92
70
|
name: z.ZodString;
|
|
93
71
|
description: z.ZodOptional<z.ZodString>;
|
|
94
72
|
enabled: z.ZodBoolean;
|
|
95
|
-
|
|
96
|
-
readonly AND: "AND";
|
|
97
|
-
readonly OR: "OR";
|
|
98
|
-
}>;
|
|
99
|
-
conditions: z.ZodArray<z.ZodObject<{
|
|
100
|
-
headerName: z.ZodString;
|
|
101
|
-
operator: z.ZodEnum<{
|
|
102
|
-
readonly EQUALS: "EQUALS";
|
|
103
|
-
readonly NOT_EQUALS: "NOT_EQUALS";
|
|
104
|
-
readonly CONTAINS: "CONTAINS";
|
|
105
|
-
readonly NOT_CONTAINS: "NOT_CONTAINS";
|
|
106
|
-
readonly STARTS_WITH: "STARTS_WITH";
|
|
107
|
-
readonly NOT_STARTS_WITH: "NOT_STARTS_WITH";
|
|
108
|
-
readonly ENDS_WITH: "ENDS_WITH";
|
|
109
|
-
readonly NOT_ENDS_WITH: "NOT_ENDS_WITH";
|
|
110
|
-
readonly REGEX: "REGEX";
|
|
111
|
-
readonly NOT_REGEX: "NOT_REGEX";
|
|
112
|
-
}>;
|
|
113
|
-
value: z.ZodString;
|
|
114
|
-
caseSensitive: z.ZodBoolean;
|
|
115
|
-
}, z.core.$strip>>;
|
|
73
|
+
when: z.ZodOptional<z.ZodType<import("../../../models").TResponseRuleConditionNode, unknown, z.core.$ZodTypeInternals<import("../../../models").TResponseRuleConditionNode, unknown>>>;
|
|
116
74
|
responseType: z.ZodEnum<{
|
|
117
75
|
readonly BROWSER: "BROWSER";
|
|
118
76
|
readonly BLOCK: "BLOCK";
|
|
@@ -146,7 +104,7 @@ export declare namespace TestSrrMatcherCommand {
|
|
|
146
104
|
}, z.core.$strip>>;
|
|
147
105
|
excludeHostsByTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
148
106
|
}, z.core.$strip>>;
|
|
149
|
-
}, z.core.$
|
|
107
|
+
}, z.core.$strict>>;
|
|
150
108
|
inputHeaders: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
151
109
|
outputHeaders: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
152
110
|
}, z.core.$strip>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-srr-matcher.command.d.ts","sourceRoot":"","sources":["../../../../../commands/system/testers/test-srr-matcher.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,yBAAiB,qBAAqB,CAAC;IAC5B,MAAM,GAAG,mCAAsC,CAAC;IAChD,MAAM,OAAO,mCAAM,CAAC;IAEpB,MAAM,eAAe,8CAK3B,CAAC;IACK,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"test-srr-matcher.command.d.ts","sourceRoot":"","sources":["../../../../../commands/system/testers/test-srr-matcher.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,yBAAiB,qBAAqB,CAAC;IAC5B,MAAM,GAAG,mCAAsC,CAAC;IAChD,MAAM,OAAO,mCAAM,CAAC;IAEpB,MAAM,eAAe,8CAK3B,CAAC;IACK,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAE5B,CAAC;IAEI,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAQzB,CAAC;IAEH,KAAY,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;IAC5D,KAAY,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;CACzD"}
|
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
export declare const RESPONSE_RULES_CONFIG_VERSION: {
|
|
2
2
|
readonly 1: "1";
|
|
3
|
+
readonly 2: "2";
|
|
3
4
|
};
|
|
5
|
+
/**
|
|
6
|
+
* Version 1
|
|
7
|
+
*/
|
|
4
8
|
export declare const RESPONSE_RULES_OPERATORS: {
|
|
5
9
|
readonly AND: "AND";
|
|
6
10
|
readonly OR: "OR";
|
|
7
11
|
};
|
|
8
|
-
|
|
9
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Version 2
|
|
14
|
+
*/
|
|
15
|
+
export declare const RESPONSE_RULES_GROUP_OPERATORS: {
|
|
16
|
+
readonly AND: "AND";
|
|
17
|
+
readonly OR: "OR";
|
|
18
|
+
readonly NOT: "NOT";
|
|
19
|
+
};
|
|
20
|
+
export type TResponseRulesGroupOperator = keyof typeof RESPONSE_RULES_GROUP_OPERATORS;
|
|
21
|
+
export declare const RESPONSE_RULES_GROUP_OPERATORS_VALUES: ("AND" | "OR" | "NOT")[];
|
|
22
|
+
export declare const RESPONSE_RULES_GROUP_OPERATORS_DESCRIPTION: {
|
|
23
|
+
readonly AND: "Matches only if **all** nested conditions match. `conditions.every()`";
|
|
24
|
+
readonly OR: "Matches if **at least one** nested condition matches. `conditions.some()`";
|
|
25
|
+
readonly NOT: "Inverts the result of the nested **condition**. `!condition`";
|
|
10
26
|
};
|
|
11
27
|
export declare const RESPONSE_RULES_CONDITION_OPERATORS: {
|
|
12
28
|
readonly EQUALS: "EQUALS";
|
|
@@ -19,6 +35,8 @@ export declare const RESPONSE_RULES_CONDITION_OPERATORS: {
|
|
|
19
35
|
readonly NOT_ENDS_WITH: "NOT_ENDS_WITH";
|
|
20
36
|
readonly REGEX: "REGEX";
|
|
21
37
|
readonly NOT_REGEX: "NOT_REGEX";
|
|
38
|
+
readonly EXISTS: "EXISTS";
|
|
39
|
+
readonly NOT_EXISTS: "NOT_EXISTS";
|
|
22
40
|
};
|
|
23
41
|
export declare const RESPONSE_RULES_RESPONSE_TYPES: {
|
|
24
42
|
readonly BROWSER: "BROWSER";
|
|
@@ -39,7 +57,7 @@ export type TResponseRulesResponseTypeKeys = (typeof RESPONSE_RULES_RESPONSE_TYP
|
|
|
39
57
|
export type TResponseRulesConditionOperator = [
|
|
40
58
|
keyof typeof RESPONSE_RULES_CONDITION_OPERATORS
|
|
41
59
|
][number];
|
|
42
|
-
export declare const RESPONSE_RULES_CONDITION_OPERATORS_VALUES: ("EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX")[];
|
|
60
|
+
export declare const RESPONSE_RULES_CONDITION_OPERATORS_VALUES: ("EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX" | "EXISTS" | "NOT_EXISTS")[];
|
|
43
61
|
export type TResponseRulesConditionOperatorKeys = (typeof RESPONSE_RULES_CONDITION_OPERATORS)[keyof typeof RESPONSE_RULES_CONDITION_OPERATORS];
|
|
44
62
|
export declare const RESPONSE_RULES_RESPONSE_TYPES_DESCRIPTION: {
|
|
45
63
|
readonly XRAY_JSON: "Return **subscription** in XRAY-JSON format. (Using `Xray Json` template)";
|
|
@@ -65,5 +83,7 @@ export declare const RESPONSE_RULES_CONDITION_OPERATORS_DESCRIPTION: {
|
|
|
65
83
|
readonly NOT_ENDS_WITH: "Confirms the header value does not end with the specified string. `!string.endsWith()`";
|
|
66
84
|
readonly REGEX: "Evaluates if the header value matches the specified regular expression pattern. `regex.test()`";
|
|
67
85
|
readonly NOT_REGEX: "Evaluates if the header value does not match the specified regular expression pattern. `!regex.test()`";
|
|
86
|
+
readonly EXISTS: "Checks that the header is present in the request, regardless of its value. `value` is not required. `string !== undefined`";
|
|
87
|
+
readonly NOT_EXISTS: "Checks that the header is not present in the request. `value` is not required. `string === undefined`";
|
|
68
88
|
};
|
|
69
89
|
//# sourceMappingURL=response-rules.contants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-rules.contants.d.ts","sourceRoot":"","sources":["../../../../constants/response-rules/response-rules.contants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,6BAA6B
|
|
1
|
+
{"version":3,"file":"response-rules.contants.d.ts","sourceRoot":"","sources":["../../../../constants/response-rules/response-rules.contants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,6BAA6B;;;CAGhC,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;CAG3B,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,8BAA8B;;;;CAIjC,CAAC;AAEX,MAAM,MAAM,2BAA2B,GAAG,MAAM,OAAO,8BAA8B,CAAC;AACtF,eAAO,MAAM,qCAAqC,0BAAgD,CAAC;AAEnG,eAAO,MAAM,0CAA0C;;;;CAO7C,CAAC;AAEX,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;CAarC,CAAC;AAEX,eAAO,MAAM,6BAA6B;;;;;;;;;;;;CAOhC,CAAC;AAEX,MAAM,MAAM,0BAA0B,GAAG,CAAC,MAAM,OAAO,6BAA6B,CAAC,CAAC,MAAM,CAAC,CAAC;AAC9F,eAAO,MAAM,oCAAoC,0JAA+C,CAAC;AACjG,MAAM,MAAM,8BAA8B,GACtC,CAAC,OAAO,6BAA6B,CAAC,CAAC,MAAM,OAAO,6BAA6B,CAAC,CAAC;AAEvF,MAAM,MAAM,+BAA+B,GAAG;IAC1C,MAAM,OAAO,kCAAkC;CAClD,CAAC,MAAM,CAAC,CAAC;AACV,eAAO,MAAM,yCAAyC,iLAErD,CAAC;AACF,MAAM,MAAM,mCAAmC,GAC3C,CAAC,OAAO,kCAAkC,CAAC,CAAC,MAAM,OAAO,kCAAkC,CAAC,CAAC;AAEjG,eAAO,MAAM,yCAAyC;;;;;;;;;;;;CAqB5C,CAAC;AAEX,eAAO,MAAM,8CAA8C;;;;;;;;;;;;;CAyBjD,CAAC"}
|
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RESPONSE_RULES_CONDITION_OPERATORS_DESCRIPTION = exports.RESPONSE_RULES_RESPONSE_TYPES_DESCRIPTION = exports.RESPONSE_RULES_CONDITION_OPERATORS_VALUES = exports.RESPONSE_RULES_RESPONSE_TYPES_VALUES = exports.RESPONSE_RULES_RESPONSE_TYPES = exports.RESPONSE_RULES_CONDITION_OPERATORS = exports.
|
|
3
|
+
exports.RESPONSE_RULES_CONDITION_OPERATORS_DESCRIPTION = exports.RESPONSE_RULES_RESPONSE_TYPES_DESCRIPTION = exports.RESPONSE_RULES_CONDITION_OPERATORS_VALUES = exports.RESPONSE_RULES_RESPONSE_TYPES_VALUES = exports.RESPONSE_RULES_RESPONSE_TYPES = exports.RESPONSE_RULES_CONDITION_OPERATORS = exports.RESPONSE_RULES_GROUP_OPERATORS_DESCRIPTION = exports.RESPONSE_RULES_GROUP_OPERATORS_VALUES = exports.RESPONSE_RULES_GROUP_OPERATORS = exports.RESPONSE_RULES_OPERATORS = exports.RESPONSE_RULES_CONFIG_VERSION = void 0;
|
|
4
4
|
const subscription_template_1 = require("../subscription-template");
|
|
5
5
|
exports.RESPONSE_RULES_CONFIG_VERSION = {
|
|
6
6
|
1: '1',
|
|
7
|
+
2: '2',
|
|
7
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* Version 1
|
|
11
|
+
*/
|
|
8
12
|
exports.RESPONSE_RULES_OPERATORS = {
|
|
9
13
|
AND: 'AND',
|
|
10
14
|
OR: 'OR',
|
|
11
15
|
};
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Version 2
|
|
18
|
+
*/
|
|
19
|
+
exports.RESPONSE_RULES_GROUP_OPERATORS = {
|
|
20
|
+
AND: 'AND',
|
|
21
|
+
OR: 'OR',
|
|
22
|
+
NOT: 'NOT',
|
|
23
|
+
};
|
|
24
|
+
exports.RESPONSE_RULES_GROUP_OPERATORS_VALUES = Object.values(exports.RESPONSE_RULES_GROUP_OPERATORS);
|
|
25
|
+
exports.RESPONSE_RULES_GROUP_OPERATORS_DESCRIPTION = {
|
|
26
|
+
[exports.RESPONSE_RULES_GROUP_OPERATORS.AND]: 'Matches only if **all** nested conditions match. `conditions.every()`',
|
|
27
|
+
[exports.RESPONSE_RULES_GROUP_OPERATORS.OR]: 'Matches if **at least one** nested condition matches. `conditions.some()`',
|
|
28
|
+
[exports.RESPONSE_RULES_GROUP_OPERATORS.NOT]: 'Inverts the result of the nested **condition**. `!condition`',
|
|
14
29
|
};
|
|
15
30
|
exports.RESPONSE_RULES_CONDITION_OPERATORS = {
|
|
16
31
|
EQUALS: 'EQUALS',
|
|
@@ -23,6 +38,8 @@ exports.RESPONSE_RULES_CONDITION_OPERATORS = {
|
|
|
23
38
|
NOT_ENDS_WITH: 'NOT_ENDS_WITH',
|
|
24
39
|
REGEX: 'REGEX',
|
|
25
40
|
NOT_REGEX: 'NOT_REGEX',
|
|
41
|
+
EXISTS: 'EXISTS',
|
|
42
|
+
NOT_EXISTS: 'NOT_EXISTS',
|
|
26
43
|
};
|
|
27
44
|
exports.RESPONSE_RULES_RESPONSE_TYPES = {
|
|
28
45
|
...subscription_template_1.SUBSCRIPTION_TEMPLATE_TYPE,
|
|
@@ -58,4 +75,6 @@ exports.RESPONSE_RULES_CONDITION_OPERATORS_DESCRIPTION = {
|
|
|
58
75
|
[exports.RESPONSE_RULES_CONDITION_OPERATORS.NOT_ENDS_WITH]: 'Confirms the header value does not end with the specified string. `!string.endsWith()`',
|
|
59
76
|
[exports.RESPONSE_RULES_CONDITION_OPERATORS.REGEX]: 'Evaluates if the header value matches the specified regular expression pattern. `regex.test()`',
|
|
60
77
|
[exports.RESPONSE_RULES_CONDITION_OPERATORS.NOT_REGEX]: 'Evaluates if the header value does not match the specified regular expression pattern. `!regex.test()`',
|
|
78
|
+
[exports.RESPONSE_RULES_CONDITION_OPERATORS.EXISTS]: 'Checks that the header is present in the request, regardless of its value. `value` is not required. `string !== undefined`',
|
|
79
|
+
[exports.RESPONSE_RULES_CONDITION_OPERATORS.NOT_EXISTS]: 'Checks that the header is not present in the request. `value` is not required. `string === undefined`',
|
|
61
80
|
};
|
|
@@ -2,4 +2,6 @@ export * from './response-rule-condition.schema';
|
|
|
2
2
|
export * from './response-rule-modifications.schema';
|
|
3
3
|
export * from './response-rule.schema';
|
|
4
4
|
export * from './response-rules-config.schema';
|
|
5
|
+
export * from './response-rules-legacy.schema';
|
|
6
|
+
export * from './response-rules-migration';
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../models/response-rules/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../models/response-rules/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC"}
|
|
@@ -18,3 +18,5 @@ __exportStar(require("./response-rule-condition.schema"), exports);
|
|
|
18
18
|
__exportStar(require("./response-rule-modifications.schema"), exports);
|
|
19
19
|
__exportStar(require("./response-rule.schema"), exports);
|
|
20
20
|
__exportStar(require("./response-rules-config.schema"), exports);
|
|
21
|
+
__exportStar(require("./response-rules-legacy.schema"), exports);
|
|
22
|
+
__exportStar(require("./response-rules-migration"), exports);
|
|
@@ -1,4 +1,22 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { RESPONSE_RULES_GROUP_OPERATORS, TResponseRulesConditionOperatorKeys } from '../../constants';
|
|
3
|
+
export declare const RESPONSE_RULES_MAX_CONDITION_DEPTH = 10;
|
|
4
|
+
export declare const RESPONSE_RULES_MAX_CONDITION_NODES = 100;
|
|
5
|
+
export interface IResponseRuleCondition {
|
|
6
|
+
caseSensitive?: boolean;
|
|
7
|
+
headerName: string;
|
|
8
|
+
operator: TResponseRulesConditionOperatorKeys;
|
|
9
|
+
value?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface IResponseRuleConditionGroup {
|
|
12
|
+
conditions: TResponseRuleConditionNode[];
|
|
13
|
+
operator: typeof RESPONSE_RULES_GROUP_OPERATORS.AND | typeof RESPONSE_RULES_GROUP_OPERATORS.OR;
|
|
14
|
+
}
|
|
15
|
+
export interface IResponseRuleConditionNot {
|
|
16
|
+
condition: TResponseRuleConditionNode;
|
|
17
|
+
operator: typeof RESPONSE_RULES_GROUP_OPERATORS.NOT;
|
|
18
|
+
}
|
|
19
|
+
export type TResponseRuleConditionNode = IResponseRuleCondition | IResponseRuleConditionGroup | IResponseRuleConditionNot;
|
|
2
20
|
export declare const ResponseRuleConditionSchema: z.ZodObject<{
|
|
3
21
|
headerName: z.ZodString;
|
|
4
22
|
operator: z.ZodEnum<{
|
|
@@ -12,8 +30,27 @@ export declare const ResponseRuleConditionSchema: z.ZodObject<{
|
|
|
12
30
|
readonly NOT_ENDS_WITH: "NOT_ENDS_WITH";
|
|
13
31
|
readonly REGEX: "REGEX";
|
|
14
32
|
readonly NOT_REGEX: "NOT_REGEX";
|
|
33
|
+
readonly EXISTS: "EXISTS";
|
|
34
|
+
readonly NOT_EXISTS: "NOT_EXISTS";
|
|
15
35
|
}>;
|
|
16
|
-
value: z.ZodString
|
|
17
|
-
caseSensitive: z.ZodBoolean
|
|
18
|
-
}, z.core.$
|
|
36
|
+
value: z.ZodOptional<z.ZodString>;
|
|
37
|
+
caseSensitive: z.ZodOptional<z.ZodBoolean>;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
export declare const ResponseRuleConditionGroupSchema: z.ZodObject<{
|
|
40
|
+
operator: z.ZodEnum<{
|
|
41
|
+
AND: "AND";
|
|
42
|
+
OR: "OR";
|
|
43
|
+
}>;
|
|
44
|
+
conditions: z.ZodArray<z.ZodType<TResponseRuleConditionNode, unknown, z.core.$ZodTypeInternals<TResponseRuleConditionNode, unknown>>>;
|
|
45
|
+
}, z.core.$strict>;
|
|
46
|
+
export declare const ResponseRuleConditionNotSchema: z.ZodObject<{
|
|
47
|
+
operator: z.ZodLiteral<"NOT">;
|
|
48
|
+
condition: z.ZodType<TResponseRuleConditionNode, unknown, z.core.$ZodTypeInternals<TResponseRuleConditionNode, unknown>>;
|
|
49
|
+
}, z.core.$strict>;
|
|
50
|
+
export declare const ResponseRuleConditionNodeSchema: z.ZodType<TResponseRuleConditionNode>;
|
|
51
|
+
export declare function forEachResponseRuleCondition(node: TResponseRuleConditionNode, callback: (condition: IResponseRuleCondition) => void): void;
|
|
52
|
+
export declare function measureResponseRuleConditionTree(node: TResponseRuleConditionNode): {
|
|
53
|
+
depth: number;
|
|
54
|
+
nodes: number;
|
|
55
|
+
};
|
|
19
56
|
//# sourceMappingURL=response-rule-condition.schema.d.ts.map
|
|
@@ -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;
|
|
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;AAExB,OAAO,EAGH,8BAA8B,EAE9B,mCAAmC,EACtC,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,kCAAkC,KAAK,CAAC;AACrD,eAAO,MAAM,kCAAkC,MAAM,CAAC;AAEtD,MAAM,WAAW,sBAAsB;IACnC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,mCAAmC,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,2BAA2B;IACxC,UAAU,EAAE,0BAA0B,EAAE,CAAC;IACzC,QAAQ,EACF,OAAO,8BAA8B,CAAC,GAAG,GACzC,OAAO,8BAA8B,CAAC,EAAE,CAAC;CAClD;AAED,MAAM,WAAW,yBAAyB;IACtC,SAAS,EAAE,0BAA0B,CAAC;IACtC,QAAQ,EAAE,OAAO,8BAA8B,CAAC,GAAG,CAAC;CACvD;AAED,MAAM,MAAM,0BAA0B,GAChC,sBAAsB,GACtB,2BAA2B,GAC3B,yBAAyB,CAAC;AAOhC,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;kBAsElC,CAAC;AAEP,eAAO,MAAM,gCAAgC;;;;;;kBAgDvC,CAAC;AAEP,eAAO,MAAM,8BAA8B;;;kBA+BrC,CAAC;AAEP,eAAO,MAAM,+BAA+B,EAAE,CAAC,CAAC,OAAO,CAAC,0BAA0B,CAY5E,CAAC;AAEP,wBAAgB,4BAA4B,CACxC,IAAI,EAAE,0BAA0B,EAChC,QAAQ,EAAE,CAAC,SAAS,EAAE,sBAAsB,KAAK,IAAI,GACtD,IAAI,CAcN;AAED,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,0BAA0B,GAAG;IAChF,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB,CAoBA"}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ResponseRuleConditionSchema = void 0;
|
|
3
|
+
exports.ResponseRuleConditionNodeSchema = exports.ResponseRuleConditionNotSchema = exports.ResponseRuleConditionGroupSchema = exports.ResponseRuleConditionSchema = exports.RESPONSE_RULES_MAX_CONDITION_NODES = exports.RESPONSE_RULES_MAX_CONDITION_DEPTH = void 0;
|
|
4
|
+
exports.forEachResponseRuleCondition = forEachResponseRuleCondition;
|
|
5
|
+
exports.measureResponseRuleConditionTree = measureResponseRuleConditionTree;
|
|
4
6
|
const zod_1 = require("zod");
|
|
5
7
|
const constants_1 = require("../../constants");
|
|
8
|
+
exports.RESPONSE_RULES_MAX_CONDITION_DEPTH = 10;
|
|
9
|
+
exports.RESPONSE_RULES_MAX_CONDITION_NODES = 100;
|
|
10
|
+
const OPERATORS_WITHOUT_VALUE = [
|
|
11
|
+
constants_1.RESPONSE_RULES_CONDITION_OPERATORS.EXISTS,
|
|
12
|
+
constants_1.RESPONSE_RULES_CONDITION_OPERATORS.NOT_EXISTS,
|
|
13
|
+
];
|
|
6
14
|
exports.ResponseRuleConditionSchema = zod_1.z
|
|
7
|
-
.
|
|
15
|
+
.strictObject({
|
|
8
16
|
headerName: zod_1.z
|
|
9
17
|
.string()
|
|
10
18
|
.regex(/^[!#$%&'*+\-.0-9A-Z^_`a-z|~]+$/, 'Invalid header name. Only letters(a-z, A-Z), numbers(0-9), underscores(_) and hyphens(-) are allowed.')
|
|
@@ -21,14 +29,27 @@ exports.ResponseRuleConditionSchema = zod_1.z
|
|
|
21
29
|
.string()
|
|
22
30
|
.min(1, 'Value is required')
|
|
23
31
|
.max(255, 'Value must be less than 255 characters')
|
|
32
|
+
.optional()
|
|
24
33
|
.meta({
|
|
25
|
-
markdownDescription: '**Value** to check against the **headerName**.',
|
|
34
|
+
markdownDescription: '**Value** to check against the **headerName**. Required for all operators except `EXISTS` and `NOT_EXISTS`.',
|
|
26
35
|
}),
|
|
27
|
-
caseSensitive: zod_1.z.boolean().meta({
|
|
28
|
-
|
|
36
|
+
caseSensitive: zod_1.z.boolean().optional().meta({
|
|
37
|
+
default: false,
|
|
38
|
+
markdownDescription: 'Whether the value is **case sensitive**. Optional, defaults to `false`. \n\n - `true`: the value will be compared as is. \n\n - `false`: the value will be lowercased **before** comparison.',
|
|
29
39
|
}),
|
|
40
|
+
})
|
|
41
|
+
.superRefine((condition, ctx) => {
|
|
42
|
+
if (condition.value === undefined &&
|
|
43
|
+
!OPERATORS_WITHOUT_VALUE.includes(condition.operator)) {
|
|
44
|
+
ctx.addIssue({
|
|
45
|
+
code: 'custom',
|
|
46
|
+
path: ['value'],
|
|
47
|
+
message: `Value is required for operator "${condition.operator}".`,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
30
50
|
})
|
|
31
51
|
.meta({
|
|
52
|
+
title: 'Condition',
|
|
32
53
|
markdownDescription: 'Condition to check against the **headerName**.',
|
|
33
54
|
defaultSnippets: [
|
|
34
55
|
{
|
|
@@ -38,8 +59,137 @@ exports.ResponseRuleConditionSchema = zod_1.z
|
|
|
38
59
|
headerName: 'accept',
|
|
39
60
|
operator: 'CONTAINS',
|
|
40
61
|
value: 'text/html',
|
|
41
|
-
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
label: 'Examples: Check if header exists',
|
|
66
|
+
markdownDescription: 'Condition to check if **headerName** is present in the request',
|
|
67
|
+
body: {
|
|
68
|
+
headerName: 'x-hwid',
|
|
69
|
+
operator: 'EXISTS',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
});
|
|
74
|
+
exports.ResponseRuleConditionGroupSchema = zod_1.z
|
|
75
|
+
.strictObject({
|
|
76
|
+
operator: zod_1.z
|
|
77
|
+
.enum([constants_1.RESPONSE_RULES_GROUP_OPERATORS.AND, constants_1.RESPONSE_RULES_GROUP_OPERATORS.OR])
|
|
78
|
+
.meta({
|
|
79
|
+
markdownDescription: 'Logical operator to use for combining nested **conditions**.',
|
|
80
|
+
markdownEnumDescriptions: [
|
|
81
|
+
constants_1.RESPONSE_RULES_GROUP_OPERATORS_DESCRIPTION.AND,
|
|
82
|
+
constants_1.RESPONSE_RULES_GROUP_OPERATORS_DESCRIPTION.OR,
|
|
83
|
+
],
|
|
84
|
+
}),
|
|
85
|
+
get conditions() {
|
|
86
|
+
return zod_1.z
|
|
87
|
+
.array(exports.ResponseRuleConditionNodeSchema)
|
|
88
|
+
.min(1, 'Group must contain at least one condition')
|
|
89
|
+
.meta({
|
|
90
|
+
title: 'Conditions',
|
|
91
|
+
markdownDescription: 'Array of nested conditions. Each item is either a **condition** or another **group** (`AND`/`OR`/`NOT`), so groups can be nested to express complex logic.',
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
})
|
|
95
|
+
.meta({
|
|
96
|
+
title: 'Condition Group',
|
|
97
|
+
markdownDescription: 'Group of nested conditions combined with a logical **operator** (`AND`/`OR`). Groups can be nested inside each other.',
|
|
98
|
+
defaultSnippets: [
|
|
99
|
+
{
|
|
100
|
+
label: 'Examples: OR group',
|
|
101
|
+
markdownDescription: 'Group that matches if **at least one** nested condition matches',
|
|
102
|
+
body: {
|
|
103
|
+
operator: 'OR',
|
|
104
|
+
conditions: [
|
|
105
|
+
{
|
|
106
|
+
headerName: 'user-agent',
|
|
107
|
+
operator: 'CONTAINS',
|
|
108
|
+
value: 'Hiddify',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
headerName: 'user-agent',
|
|
112
|
+
operator: 'CONTAINS',
|
|
113
|
+
value: 'FoxRay',
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
});
|
|
120
|
+
exports.ResponseRuleConditionNotSchema = zod_1.z
|
|
121
|
+
.strictObject({
|
|
122
|
+
operator: zod_1.z.literal(constants_1.RESPONSE_RULES_GROUP_OPERATORS.NOT).meta({
|
|
123
|
+
markdownDescription: constants_1.RESPONSE_RULES_GROUP_OPERATORS_DESCRIPTION.NOT,
|
|
124
|
+
}),
|
|
125
|
+
get condition() {
|
|
126
|
+
return exports.ResponseRuleConditionNodeSchema.meta({
|
|
127
|
+
title: 'Condition',
|
|
128
|
+
markdownDescription: 'Nested condition to invert. Can be a **condition** or a **group**.',
|
|
129
|
+
});
|
|
130
|
+
},
|
|
131
|
+
})
|
|
132
|
+
.meta({
|
|
133
|
+
title: 'NOT Group',
|
|
134
|
+
markdownDescription: 'Inverts the result of the nested **condition**. The nested condition can be a single condition or a whole group.',
|
|
135
|
+
defaultSnippets: [
|
|
136
|
+
{
|
|
137
|
+
label: 'Examples: NOT group',
|
|
138
|
+
markdownDescription: 'Matches if the nested condition does **not** match',
|
|
139
|
+
body: {
|
|
140
|
+
operator: 'NOT',
|
|
141
|
+
condition: {
|
|
142
|
+
headerName: 'user-agent',
|
|
143
|
+
operator: 'CONTAINS',
|
|
144
|
+
value: 'Happ',
|
|
145
|
+
},
|
|
42
146
|
},
|
|
43
147
|
},
|
|
44
148
|
],
|
|
45
149
|
});
|
|
150
|
+
exports.ResponseRuleConditionNodeSchema = zod_1.z
|
|
151
|
+
.lazy(() => zod_1.z.discriminatedUnion('operator', [
|
|
152
|
+
exports.ResponseRuleConditionSchema,
|
|
153
|
+
exports.ResponseRuleConditionGroupSchema,
|
|
154
|
+
exports.ResponseRuleConditionNotSchema,
|
|
155
|
+
]))
|
|
156
|
+
.meta({
|
|
157
|
+
title: 'Condition Node',
|
|
158
|
+
markdownDescription: 'Either a single **condition** (header check) or a **group** (`AND`/`OR`/`NOT`) with nested conditions. Groups can be nested to express complex logic, e.g. `A AND (B OR C)`.',
|
|
159
|
+
});
|
|
160
|
+
function forEachResponseRuleCondition(node, callback) {
|
|
161
|
+
switch (node.operator) {
|
|
162
|
+
case constants_1.RESPONSE_RULES_GROUP_OPERATORS.AND:
|
|
163
|
+
case constants_1.RESPONSE_RULES_GROUP_OPERATORS.OR:
|
|
164
|
+
for (const child of node.conditions) {
|
|
165
|
+
forEachResponseRuleCondition(child, callback);
|
|
166
|
+
}
|
|
167
|
+
return;
|
|
168
|
+
case constants_1.RESPONSE_RULES_GROUP_OPERATORS.NOT:
|
|
169
|
+
forEachResponseRuleCondition(node.condition, callback);
|
|
170
|
+
return;
|
|
171
|
+
default:
|
|
172
|
+
callback(node);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function measureResponseRuleConditionTree(node) {
|
|
176
|
+
switch (node.operator) {
|
|
177
|
+
case constants_1.RESPONSE_RULES_GROUP_OPERATORS.AND:
|
|
178
|
+
case constants_1.RESPONSE_RULES_GROUP_OPERATORS.OR: {
|
|
179
|
+
let depth = 0;
|
|
180
|
+
let nodes = 1;
|
|
181
|
+
for (const child of node.conditions) {
|
|
182
|
+
const childMetrics = measureResponseRuleConditionTree(child);
|
|
183
|
+
depth = Math.max(depth, childMetrics.depth);
|
|
184
|
+
nodes += childMetrics.nodes;
|
|
185
|
+
}
|
|
186
|
+
return { depth: depth + 1, nodes };
|
|
187
|
+
}
|
|
188
|
+
case constants_1.RESPONSE_RULES_GROUP_OPERATORS.NOT: {
|
|
189
|
+
const childMetrics = measureResponseRuleConditionTree(node.condition);
|
|
190
|
+
return { depth: childMetrics.depth + 1, nodes: childMetrics.nodes + 1 };
|
|
191
|
+
}
|
|
192
|
+
default:
|
|
193
|
+
return { depth: 1, nodes: 1 };
|
|
194
|
+
}
|
|
195
|
+
}
|