@remnawave/backend-contract 2.9.32 → 2.9.33
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 +25 -3
- 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 +50 -6
- 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 +47 -5
- 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 +3 -23
- package/build/backend/constants/response-rules/response-rules.contants.d.ts.map +1 -1
- package/build/backend/constants/response-rules/response-rules.contants.js +3 -22
- package/build/backend/models/response-rules/index.d.ts +0 -2
- package/build/backend/models/response-rules/index.d.ts.map +1 -1
- package/build/backend/models/response-rules/index.js +0 -2
- package/build/backend/models/response-rules/response-rule-condition.schema.d.ts +3 -40
- 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 +6 -156
- package/build/backend/models/response-rules/response-rule.schema.d.ts +44 -4
- package/build/backend/models/response-rules/response-rule.schema.d.ts.map +1 -1
- package/build/backend/models/response-rules/response-rule.schema.js +10 -26
- package/build/backend/models/response-rules/response-rules-config.schema.d.ts +25 -3
- 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 +4 -9
- 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 +22 -30
- package/build/backend/models/subscription-settings.schema.d.ts +25 -3
- package/build/backend/models/subscription-settings.schema.d.ts.map +1 -1
- package/build/frontend/constants/response-rules/response-rules.contants.js +3 -22
- package/build/frontend/models/response-rules/index.js +0 -2
- package/build/frontend/models/response-rules/response-rule-condition.schema.js +6 -156
- package/build/frontend/models/response-rules/response-rule.schema.js +10 -26
- package/build/frontend/models/response-rules/response-rules-config.schema.js +4 -9
- package/build/frontend/models/response-rules/response-rules-examples.js +22 -30
- package/package.json +1 -1
- package/build/backend/models/response-rules/response-rules-legacy.schema.d.ts +0 -157
- package/build/backend/models/response-rules/response-rules-legacy.schema.d.ts.map +0 -1
- package/build/backend/models/response-rules/response-rules-legacy.schema.js +0 -33
- package/build/backend/models/response-rules/response-rules-migration.d.ts +0 -10
- package/build/backend/models/response-rules/response-rules-migration.d.ts.map +0 -1
- package/build/backend/models/response-rules/response-rules-migration.js +0 -45
- package/build/frontend/models/response-rules/response-rules-legacy.schema.js +0 -33
- package/build/frontend/models/response-rules/response-rules-migration.js +0 -45
|
@@ -19,7 +19,9 @@ 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.
|
|
22
|
+
version: z.ZodEnum<{
|
|
23
|
+
readonly 1: "1";
|
|
24
|
+
}>;
|
|
23
25
|
settings: z.ZodOptional<z.ZodObject<{
|
|
24
26
|
disableSubscriptionAccessByPath: z.ZodOptional<z.ZodBoolean>;
|
|
25
27
|
}, z.core.$strip>>;
|
|
@@ -27,7 +29,27 @@ export declare namespace GetSubscriptionSettingsCommand {
|
|
|
27
29
|
name: z.ZodString;
|
|
28
30
|
description: z.ZodOptional<z.ZodString>;
|
|
29
31
|
enabled: z.ZodBoolean;
|
|
30
|
-
|
|
32
|
+
operator: z.ZodEnum<{
|
|
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>>;
|
|
31
53
|
responseType: z.ZodEnum<{
|
|
32
54
|
readonly BROWSER: "BROWSER";
|
|
33
55
|
readonly BLOCK: "BLOCK";
|
|
@@ -61,7 +83,7 @@ export declare namespace GetSubscriptionSettingsCommand {
|
|
|
61
83
|
}, z.core.$strip>>;
|
|
62
84
|
excludeHostsByTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
63
85
|
}, z.core.$strip>>;
|
|
64
|
-
}, z.core.$
|
|
86
|
+
}, z.core.$strip>>;
|
|
65
87
|
}, z.core.$strip>>;
|
|
66
88
|
hwidSettings: z.ZodNullable<z.ZodObject<{
|
|
67
89
|
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,7 +18,9 @@ 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.
|
|
21
|
+
version: z.ZodEnum<{
|
|
22
|
+
readonly 1: "1";
|
|
23
|
+
}>;
|
|
22
24
|
settings: z.ZodOptional<z.ZodObject<{
|
|
23
25
|
disableSubscriptionAccessByPath: z.ZodOptional<z.ZodBoolean>;
|
|
24
26
|
}, z.core.$strip>>;
|
|
@@ -26,7 +28,27 @@ export declare namespace UpdateSubscriptionSettingsCommand {
|
|
|
26
28
|
name: z.ZodString;
|
|
27
29
|
description: z.ZodOptional<z.ZodString>;
|
|
28
30
|
enabled: z.ZodBoolean;
|
|
29
|
-
|
|
31
|
+
operator: z.ZodEnum<{
|
|
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>>;
|
|
30
52
|
responseType: z.ZodEnum<{
|
|
31
53
|
readonly BROWSER: "BROWSER";
|
|
32
54
|
readonly BLOCK: "BLOCK";
|
|
@@ -60,7 +82,7 @@ export declare namespace UpdateSubscriptionSettingsCommand {
|
|
|
60
82
|
}, z.core.$strip>>;
|
|
61
83
|
excludeHostsByTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
62
84
|
}, z.core.$strip>>;
|
|
63
|
-
}, z.core.$
|
|
85
|
+
}, z.core.$strip>>;
|
|
64
86
|
}, z.core.$strip>>;
|
|
65
87
|
hwidSettings: z.ZodOptional<z.ZodObject<{
|
|
66
88
|
enabled: z.ZodBoolean;
|
|
@@ -84,7 +106,9 @@ export declare namespace UpdateSubscriptionSettingsCommand {
|
|
|
84
106
|
customResponseHeaders: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
85
107
|
randomizeHosts: z.ZodBoolean;
|
|
86
108
|
responseRules: z.ZodNullable<z.ZodObject<{
|
|
87
|
-
version: z.
|
|
109
|
+
version: z.ZodEnum<{
|
|
110
|
+
readonly 1: "1";
|
|
111
|
+
}>;
|
|
88
112
|
settings: z.ZodOptional<z.ZodObject<{
|
|
89
113
|
disableSubscriptionAccessByPath: z.ZodOptional<z.ZodBoolean>;
|
|
90
114
|
}, z.core.$strip>>;
|
|
@@ -92,7 +116,27 @@ export declare namespace UpdateSubscriptionSettingsCommand {
|
|
|
92
116
|
name: z.ZodString;
|
|
93
117
|
description: z.ZodOptional<z.ZodString>;
|
|
94
118
|
enabled: z.ZodBoolean;
|
|
95
|
-
|
|
119
|
+
operator: z.ZodEnum<{
|
|
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>>;
|
|
96
140
|
responseType: z.ZodEnum<{
|
|
97
141
|
readonly BROWSER: "BROWSER";
|
|
98
142
|
readonly BLOCK: "BLOCK";
|
|
@@ -126,7 +170,7 @@ export declare namespace UpdateSubscriptionSettingsCommand {
|
|
|
126
170
|
}, z.core.$strip>>;
|
|
127
171
|
excludeHostsByTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
128
172
|
}, z.core.$strip>>;
|
|
129
|
-
}, z.core.$
|
|
173
|
+
}, z.core.$strip>>;
|
|
130
174
|
}, z.core.$strip>>;
|
|
131
175
|
hwidSettings: z.ZodNullable<z.ZodObject<{
|
|
132
176
|
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,7 +5,9 @@ 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.
|
|
8
|
+
version: z.ZodEnum<{
|
|
9
|
+
readonly 1: "1";
|
|
10
|
+
}>;
|
|
9
11
|
settings: z.ZodOptional<z.ZodObject<{
|
|
10
12
|
disableSubscriptionAccessByPath: z.ZodOptional<z.ZodBoolean>;
|
|
11
13
|
}, z.core.$strip>>;
|
|
@@ -13,7 +15,27 @@ export declare namespace TestSrrMatcherCommand {
|
|
|
13
15
|
name: z.ZodString;
|
|
14
16
|
description: z.ZodOptional<z.ZodString>;
|
|
15
17
|
enabled: z.ZodBoolean;
|
|
16
|
-
|
|
18
|
+
operator: z.ZodEnum<{
|
|
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>>;
|
|
17
39
|
responseType: z.ZodEnum<{
|
|
18
40
|
readonly BROWSER: "BROWSER";
|
|
19
41
|
readonly BLOCK: "BLOCK";
|
|
@@ -47,7 +69,7 @@ export declare namespace TestSrrMatcherCommand {
|
|
|
47
69
|
}, z.core.$strip>>;
|
|
48
70
|
excludeHostsByTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
49
71
|
}, z.core.$strip>>;
|
|
50
|
-
}, z.core.$
|
|
72
|
+
}, z.core.$strip>>;
|
|
51
73
|
}, z.core.$strip>;
|
|
52
74
|
}, z.core.$strip>;
|
|
53
75
|
const ResponseSchema: z.ZodObject<{
|
|
@@ -70,7 +92,27 @@ export declare namespace TestSrrMatcherCommand {
|
|
|
70
92
|
name: z.ZodString;
|
|
71
93
|
description: z.ZodOptional<z.ZodString>;
|
|
72
94
|
enabled: z.ZodBoolean;
|
|
73
|
-
|
|
95
|
+
operator: z.ZodEnum<{
|
|
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>>;
|
|
74
116
|
responseType: z.ZodEnum<{
|
|
75
117
|
readonly BROWSER: "BROWSER";
|
|
76
118
|
readonly BLOCK: "BLOCK";
|
|
@@ -104,7 +146,7 @@ export declare namespace TestSrrMatcherCommand {
|
|
|
104
146
|
}, z.core.$strip>>;
|
|
105
147
|
excludeHostsByTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
106
148
|
}, z.core.$strip>>;
|
|
107
|
-
}, z.core.$
|
|
149
|
+
}, z.core.$strip>>;
|
|
108
150
|
inputHeaders: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
109
151
|
outputHeaders: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
110
152
|
}, 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,28 +1,12 @@
|
|
|
1
1
|
export declare const RESPONSE_RULES_CONFIG_VERSION: {
|
|
2
2
|
readonly 1: "1";
|
|
3
|
-
readonly 2: "2";
|
|
4
3
|
};
|
|
5
|
-
/**
|
|
6
|
-
* Version 1
|
|
7
|
-
*/
|
|
8
4
|
export declare const RESPONSE_RULES_OPERATORS: {
|
|
9
5
|
readonly AND: "AND";
|
|
10
6
|
readonly OR: "OR";
|
|
11
7
|
};
|
|
12
|
-
|
|
13
|
-
|
|
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`";
|
|
8
|
+
export declare const RESPONSE_RULE_CONDITION_TYPES: {
|
|
9
|
+
readonly HEADER: "HEADER";
|
|
26
10
|
};
|
|
27
11
|
export declare const RESPONSE_RULES_CONDITION_OPERATORS: {
|
|
28
12
|
readonly EQUALS: "EQUALS";
|
|
@@ -35,8 +19,6 @@ export declare const RESPONSE_RULES_CONDITION_OPERATORS: {
|
|
|
35
19
|
readonly NOT_ENDS_WITH: "NOT_ENDS_WITH";
|
|
36
20
|
readonly REGEX: "REGEX";
|
|
37
21
|
readonly NOT_REGEX: "NOT_REGEX";
|
|
38
|
-
readonly EXISTS: "EXISTS";
|
|
39
|
-
readonly NOT_EXISTS: "NOT_EXISTS";
|
|
40
22
|
};
|
|
41
23
|
export declare const RESPONSE_RULES_RESPONSE_TYPES: {
|
|
42
24
|
readonly BROWSER: "BROWSER";
|
|
@@ -57,7 +39,7 @@ export type TResponseRulesResponseTypeKeys = (typeof RESPONSE_RULES_RESPONSE_TYP
|
|
|
57
39
|
export type TResponseRulesConditionOperator = [
|
|
58
40
|
keyof typeof RESPONSE_RULES_CONDITION_OPERATORS
|
|
59
41
|
][number];
|
|
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"
|
|
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")[];
|
|
61
43
|
export type TResponseRulesConditionOperatorKeys = (typeof RESPONSE_RULES_CONDITION_OPERATORS)[keyof typeof RESPONSE_RULES_CONDITION_OPERATORS];
|
|
62
44
|
export declare const RESPONSE_RULES_RESPONSE_TYPES_DESCRIPTION: {
|
|
63
45
|
readonly XRAY_JSON: "Return **subscription** in XRAY-JSON format. (Using `Xray Json` template)";
|
|
@@ -83,7 +65,5 @@ export declare const RESPONSE_RULES_CONDITION_OPERATORS_DESCRIPTION: {
|
|
|
83
65
|
readonly NOT_ENDS_WITH: "Confirms the header value does not end with the specified string. `!string.endsWith()`";
|
|
84
66
|
readonly REGEX: "Evaluates if the header value matches the specified regular expression pattern. `regex.test()`";
|
|
85
67
|
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`";
|
|
88
68
|
};
|
|
89
69
|
//# 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;;CAEhC,CAAC;AAEX,eAAO,MAAM,wBAAwB;;;CAG3B,CAAC;AAEX,eAAO,MAAM,6BAA6B;;CAEhC,CAAC;AAEX,eAAO,MAAM,kCAAkC;;;;;;;;;;;CAWrC,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,uJAErD,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;;;;;;;;;;;CAqBjD,CAAC"}
|
|
@@ -1,31 +1,16 @@
|
|
|
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_RULE_CONDITION_TYPES = 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',
|
|
8
7
|
};
|
|
9
|
-
/**
|
|
10
|
-
* Version 1
|
|
11
|
-
*/
|
|
12
8
|
exports.RESPONSE_RULES_OPERATORS = {
|
|
13
9
|
AND: 'AND',
|
|
14
10
|
OR: 'OR',
|
|
15
11
|
};
|
|
16
|
-
|
|
17
|
-
|
|
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`',
|
|
12
|
+
exports.RESPONSE_RULE_CONDITION_TYPES = {
|
|
13
|
+
HEADER: 'HEADER',
|
|
29
14
|
};
|
|
30
15
|
exports.RESPONSE_RULES_CONDITION_OPERATORS = {
|
|
31
16
|
EQUALS: 'EQUALS',
|
|
@@ -38,8 +23,6 @@ exports.RESPONSE_RULES_CONDITION_OPERATORS = {
|
|
|
38
23
|
NOT_ENDS_WITH: 'NOT_ENDS_WITH',
|
|
39
24
|
REGEX: 'REGEX',
|
|
40
25
|
NOT_REGEX: 'NOT_REGEX',
|
|
41
|
-
EXISTS: 'EXISTS',
|
|
42
|
-
NOT_EXISTS: 'NOT_EXISTS',
|
|
43
26
|
};
|
|
44
27
|
exports.RESPONSE_RULES_RESPONSE_TYPES = {
|
|
45
28
|
...subscription_template_1.SUBSCRIPTION_TEMPLATE_TYPE,
|
|
@@ -75,6 +58,4 @@ exports.RESPONSE_RULES_CONDITION_OPERATORS_DESCRIPTION = {
|
|
|
75
58
|
[exports.RESPONSE_RULES_CONDITION_OPERATORS.NOT_ENDS_WITH]: 'Confirms the header value does not end with the specified string. `!string.endsWith()`',
|
|
76
59
|
[exports.RESPONSE_RULES_CONDITION_OPERATORS.REGEX]: 'Evaluates if the header value matches the specified regular expression pattern. `regex.test()`',
|
|
77
60
|
[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`',
|
|
80
61
|
};
|
|
@@ -2,6 +2,4 @@ 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';
|
|
7
5
|
//# 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"}
|
|
@@ -18,5 +18,3 @@ __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,22 +1,4 @@
|
|
|
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;
|
|
20
2
|
export declare const ResponseRuleConditionSchema: z.ZodObject<{
|
|
21
3
|
headerName: z.ZodString;
|
|
22
4
|
operator: z.ZodEnum<{
|
|
@@ -30,27 +12,8 @@ export declare const ResponseRuleConditionSchema: z.ZodObject<{
|
|
|
30
12
|
readonly NOT_ENDS_WITH: "NOT_ENDS_WITH";
|
|
31
13
|
readonly REGEX: "REGEX";
|
|
32
14
|
readonly NOT_REGEX: "NOT_REGEX";
|
|
33
|
-
readonly EXISTS: "EXISTS";
|
|
34
|
-
readonly NOT_EXISTS: "NOT_EXISTS";
|
|
35
15
|
}>;
|
|
36
|
-
value: z.
|
|
37
|
-
caseSensitive: z.
|
|
38
|
-
}, z.core.$
|
|
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
|
-
};
|
|
16
|
+
value: z.ZodString;
|
|
17
|
+
caseSensitive: z.ZodBoolean;
|
|
18
|
+
}, z.core.$strip>;
|
|
56
19
|
//# 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;AAOxB,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;iBA8ClC,CAAC"}
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.forEachResponseRuleCondition = forEachResponseRuleCondition;
|
|
5
|
-
exports.measureResponseRuleConditionTree = measureResponseRuleConditionTree;
|
|
3
|
+
exports.ResponseRuleConditionSchema = void 0;
|
|
6
4
|
const zod_1 = require("zod");
|
|
7
5
|
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
|
-
];
|
|
14
6
|
exports.ResponseRuleConditionSchema = zod_1.z
|
|
15
|
-
.
|
|
7
|
+
.object({
|
|
16
8
|
headerName: zod_1.z
|
|
17
9
|
.string()
|
|
18
10
|
.regex(/^[!#$%&'*+\-.0-9A-Z^_`a-z|~]+$/, 'Invalid header name. Only letters(a-z, A-Z), numbers(0-9), underscores(_) and hyphens(-) are allowed.')
|
|
@@ -29,27 +21,14 @@ exports.ResponseRuleConditionSchema = zod_1.z
|
|
|
29
21
|
.string()
|
|
30
22
|
.min(1, 'Value is required')
|
|
31
23
|
.max(255, 'Value must be less than 255 characters')
|
|
32
|
-
.optional()
|
|
33
24
|
.meta({
|
|
34
|
-
markdownDescription: '**Value** to check against the **headerName**.
|
|
25
|
+
markdownDescription: '**Value** to check against the **headerName**.',
|
|
35
26
|
}),
|
|
36
|
-
caseSensitive: zod_1.z.boolean().
|
|
37
|
-
|
|
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.',
|
|
27
|
+
caseSensitive: zod_1.z.boolean().meta({
|
|
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.',
|
|
39
29
|
}),
|
|
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
|
-
}
|
|
50
30
|
})
|
|
51
31
|
.meta({
|
|
52
|
-
title: 'Condition',
|
|
53
32
|
markdownDescription: 'Condition to check against the **headerName**.',
|
|
54
33
|
defaultSnippets: [
|
|
55
34
|
{
|
|
@@ -59,137 +38,8 @@ exports.ResponseRuleConditionSchema = zod_1.z
|
|
|
59
38
|
headerName: 'accept',
|
|
60
39
|
operator: 'CONTAINS',
|
|
61
40
|
value: 'text/html',
|
|
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
|
-
},
|
|
41
|
+
caseSensitive: true,
|
|
146
42
|
},
|
|
147
43
|
},
|
|
148
44
|
],
|
|
149
45
|
});
|
|
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
|
-
}
|