@remnawave/backend-contract 2.1.76 → 2.1.77

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.
Files changed (44) hide show
  1. package/build/backend/commands/subscription/get-subscription-by-short-uuid-by-client-type.command.d.ts +2 -3
  2. package/build/backend/commands/subscription/get-subscription-by-short-uuid-by-client-type.command.d.ts.map +1 -1
  3. package/build/backend/commands/subscription-settings/get-subscription-settings.command.d.ts +242 -0
  4. package/build/backend/commands/subscription-settings/get-subscription-settings.command.d.ts.map +1 -1
  5. package/build/backend/commands/subscription-settings/update-subscription-settings.command.d.ts +440 -0
  6. package/build/backend/commands/subscription-settings/update-subscription-settings.command.d.ts.map +1 -1
  7. package/build/backend/commands/subscription-settings/update-subscription-settings.command.js +2 -1
  8. package/build/backend/commands/subscription-template/get-template.command.d.ts +14 -14
  9. package/build/backend/commands/subscription-template/update-template.command.d.ts +14 -14
  10. package/build/backend/commands/subscriptions/get-by/get-raw-subscription-by-short-uuid.command.d.ts +4 -4
  11. package/build/backend/constants/response-rules/response-rules.contants.d.ts +26 -19
  12. package/build/backend/constants/response-rules/response-rules.contants.d.ts.map +1 -1
  13. package/build/backend/constants/response-rules/response-rules.contants.js +17 -16
  14. package/build/backend/constants/subscription-template/template-type/request-template-type.constant.d.ts +1 -2
  15. package/build/backend/constants/subscription-template/template-type/request-template-type.constant.d.ts.map +1 -1
  16. package/build/backend/constants/subscription-template/template-type/request-template-type.constant.js +0 -1
  17. package/build/backend/constants/subscription-template/template-type/template-type.constant.d.ts +5 -5
  18. package/build/backend/constants/subscription-template/template-type/template-type.constant.d.ts.map +1 -1
  19. package/build/backend/constants/subscription-template/template-type/template-type.constant.js +4 -4
  20. package/build/backend/models/response-rules/index.d.ts +1 -0
  21. package/build/backend/models/response-rules/index.d.ts.map +1 -1
  22. package/build/backend/models/response-rules/index.js +1 -0
  23. package/build/backend/models/response-rules/response-rule-condition.schema.d.ts +29 -0
  24. package/build/backend/models/response-rules/response-rule-condition.schema.d.ts.map +1 -0
  25. package/build/backend/models/response-rules/response-rule-condition.schema.js +29 -0
  26. package/build/backend/models/response-rules/response-rule.schema.d.ts +52 -14
  27. package/build/backend/models/response-rules/response-rule.schema.d.ts.map +1 -1
  28. package/build/backend/models/response-rules/response-rule.schema.js +28 -21
  29. package/build/backend/models/response-rules/response-rules-config.schema.d.ts +72 -20
  30. package/build/backend/models/response-rules/response-rules-config.schema.d.ts.map +1 -1
  31. package/build/backend/models/response-rules/response-rules-config.schema.js +3 -0
  32. package/build/backend/models/subscription-settings.schema.d.ts +198 -0
  33. package/build/backend/models/subscription-settings.schema.d.ts.map +1 -1
  34. package/build/backend/models/subscription-settings.schema.js +2 -0
  35. package/build/frontend/commands/subscription-settings/update-subscription-settings.command.js +2 -1
  36. package/build/frontend/constants/response-rules/response-rules.contants.js +17 -15
  37. package/build/frontend/constants/subscription-template/template-type/request-template-type.constant.js +0 -1
  38. package/build/frontend/constants/subscription-template/template-type/template-type.constant.js +4 -4
  39. package/build/frontend/models/response-rules/index.js +1 -0
  40. package/build/frontend/models/response-rules/response-rule-condition.schema.js +29 -0
  41. package/build/frontend/models/response-rules/response-rule.schema.js +28 -21
  42. package/build/frontend/models/response-rules/response-rules-config.schema.js +3 -0
  43. package/build/frontend/models/subscription-settings.schema.js +2 -0
  44. package/package.json +1 -1
@@ -5,21 +5,21 @@ export declare namespace UpdateSubscriptionTemplateCommand {
5
5
  const endpointDetails: import("../../constants").EndpointDetails;
6
6
  const RequestSchema: z.ZodObject<{
7
7
  templateType: z.ZodNativeEnum<{
8
- readonly STASH: "STASH";
9
- readonly SINGBOX: "SINGBOX";
10
- readonly SINGBOX_LEGACY: "SINGBOX_LEGACY";
11
- readonly MIHOMO: "MIHOMO";
12
8
  readonly XRAY_JSON: "XRAY_JSON";
9
+ readonly XRAY_BASE64: "XRAY_BASE64";
10
+ readonly MIHOMO: "MIHOMO";
11
+ readonly STASH: "STASH";
13
12
  readonly CLASH: "CLASH";
13
+ readonly SINGBOX: "SINGBOX";
14
14
  }>;
15
15
  templateJson: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
16
16
  encodedTemplateYaml: z.ZodOptional<z.ZodString>;
17
17
  }, "strip", z.ZodTypeAny, {
18
- templateType: "STASH" | "SINGBOX" | "SINGBOX_LEGACY" | "MIHOMO" | "XRAY_JSON" | "CLASH";
18
+ templateType: "STASH" | "SINGBOX" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "XRAY_BASE64";
19
19
  templateJson?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
20
20
  encodedTemplateYaml?: string | undefined;
21
21
  }, {
22
- templateType: "STASH" | "SINGBOX" | "SINGBOX_LEGACY" | "MIHOMO" | "XRAY_JSON" | "CLASH";
22
+ templateType: "STASH" | "SINGBOX" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "XRAY_BASE64";
23
23
  templateJson?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
24
24
  encodedTemplateYaml?: string | undefined;
25
25
  }>;
@@ -28,37 +28,37 @@ export declare namespace UpdateSubscriptionTemplateCommand {
28
28
  response: z.ZodObject<{
29
29
  uuid: z.ZodString;
30
30
  templateType: z.ZodNativeEnum<{
31
- readonly STASH: "STASH";
32
- readonly SINGBOX: "SINGBOX";
33
- readonly SINGBOX_LEGACY: "SINGBOX_LEGACY";
34
- readonly MIHOMO: "MIHOMO";
35
31
  readonly XRAY_JSON: "XRAY_JSON";
32
+ readonly XRAY_BASE64: "XRAY_BASE64";
33
+ readonly MIHOMO: "MIHOMO";
34
+ readonly STASH: "STASH";
36
35
  readonly CLASH: "CLASH";
36
+ readonly SINGBOX: "SINGBOX";
37
37
  }>;
38
38
  templateJson: z.ZodNullable<z.ZodUnknown>;
39
39
  encodedTemplateYaml: z.ZodNullable<z.ZodString>;
40
40
  }, "strip", z.ZodTypeAny, {
41
41
  uuid: string;
42
- templateType: "STASH" | "SINGBOX" | "SINGBOX_LEGACY" | "MIHOMO" | "XRAY_JSON" | "CLASH";
42
+ templateType: "STASH" | "SINGBOX" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "XRAY_BASE64";
43
43
  encodedTemplateYaml: string | null;
44
44
  templateJson?: unknown;
45
45
  }, {
46
46
  uuid: string;
47
- templateType: "STASH" | "SINGBOX" | "SINGBOX_LEGACY" | "MIHOMO" | "XRAY_JSON" | "CLASH";
47
+ templateType: "STASH" | "SINGBOX" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "XRAY_BASE64";
48
48
  encodedTemplateYaml: string | null;
49
49
  templateJson?: unknown;
50
50
  }>;
51
51
  }, "strip", z.ZodTypeAny, {
52
52
  response: {
53
53
  uuid: string;
54
- templateType: "STASH" | "SINGBOX" | "SINGBOX_LEGACY" | "MIHOMO" | "XRAY_JSON" | "CLASH";
54
+ templateType: "STASH" | "SINGBOX" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "XRAY_BASE64";
55
55
  encodedTemplateYaml: string | null;
56
56
  templateJson?: unknown;
57
57
  };
58
58
  }, {
59
59
  response: {
60
60
  uuid: string;
61
- templateType: "STASH" | "SINGBOX" | "SINGBOX_LEGACY" | "MIHOMO" | "XRAY_JSON" | "CLASH";
61
+ templateType: "STASH" | "SINGBOX" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "XRAY_BASE64";
62
62
  encodedTemplateYaml: string | null;
63
63
  templateJson?: unknown;
64
64
  };
@@ -402,6 +402,7 @@ export declare namespace GetRawSubscriptionByShortUuidCommand {
402
402
  } | undefined;
403
403
  }>, "many">;
404
404
  }, "strip", z.ZodTypeAny, {
405
+ headers: Record<string, string | undefined>;
405
406
  user: {
406
407
  status: "DISABLED" | "LIMITED" | "EXPIRED" | "ACTIVE";
407
408
  uuid: string;
@@ -450,7 +451,6 @@ export declare namespace GetRawSubscriptionByShortUuidCommand {
450
451
  lifetimeTrafficUsed: string;
451
452
  isHwidLimited: boolean;
452
453
  };
453
- headers: Record<string, string | undefined>;
454
454
  rawHosts: {
455
455
  password: {
456
456
  trojanPassword: string;
@@ -506,6 +506,7 @@ export declare namespace GetRawSubscriptionByShortUuidCommand {
506
506
  } | undefined;
507
507
  }[];
508
508
  }, {
509
+ headers: Record<string, string | undefined>;
509
510
  user: {
510
511
  uuid: string;
511
512
  createdAt: string;
@@ -554,7 +555,6 @@ export declare namespace GetRawSubscriptionByShortUuidCommand {
554
555
  lifetimeTrafficUsed: string;
555
556
  isHwidLimited: boolean;
556
557
  };
557
- headers: Record<string, string | undefined>;
558
558
  rawHosts: {
559
559
  password: {
560
560
  trojanPassword: string;
@@ -612,6 +612,7 @@ export declare namespace GetRawSubscriptionByShortUuidCommand {
612
612
  }>;
613
613
  }, "strip", z.ZodTypeAny, {
614
614
  response: {
615
+ headers: Record<string, string | undefined>;
615
616
  user: {
616
617
  status: "DISABLED" | "LIMITED" | "EXPIRED" | "ACTIVE";
617
618
  uuid: string;
@@ -660,7 +661,6 @@ export declare namespace GetRawSubscriptionByShortUuidCommand {
660
661
  lifetimeTrafficUsed: string;
661
662
  isHwidLimited: boolean;
662
663
  };
663
- headers: Record<string, string | undefined>;
664
664
  rawHosts: {
665
665
  password: {
666
666
  trojanPassword: string;
@@ -718,6 +718,7 @@ export declare namespace GetRawSubscriptionByShortUuidCommand {
718
718
  };
719
719
  }, {
720
720
  response: {
721
+ headers: Record<string, string | undefined>;
721
722
  user: {
722
723
  uuid: string;
723
724
  createdAt: string;
@@ -766,7 +767,6 @@ export declare namespace GetRawSubscriptionByShortUuidCommand {
766
767
  lifetimeTrafficUsed: string;
767
768
  isHwidLimited: boolean;
768
769
  };
769
- headers: Record<string, string | undefined>;
770
770
  rawHosts: {
771
771
  password: {
772
772
  trojanPassword: string;
@@ -20,32 +20,27 @@ export declare const RESPONSE_RULES_CONDITION_OPERATORS: {
20
20
  readonly REGEX: "REGEX";
21
21
  readonly NOT_REGEX: "NOT_REGEX";
22
22
  };
23
- export declare const RESPONSE_RULES_CONDITION_OPERATORS_DESCRIPTION: {
24
- readonly EQUALS: "Equals operator checks if the header value exactly matches the specified string, case sensitive. Underlying implementation uses strict string comparison – ===.";
25
- readonly NOT_EQUALS: "Not equals operator checks if the header value does not match the specified string, case sensitive. Underlying implementation uses strict string comparison – !==.";
26
- readonly CONTAINS: "Contains operator checks if the header value contains the specified string, case sensitive. Underlying implementation uses string.includes().";
27
- readonly NOT_CONTAINS: "Not contains operator checks if the header value does not contain the specified string, case sensitive. Underlying implementation uses string.includes().";
28
- readonly STARTS_WITH: "Starts with operator checks if the header value starts with the specified string, case sensitive. Underlying implementation uses string.startsWith().";
29
- readonly NOT_STARTS_WITH: "Not starts with operator checks if the header value does not start with the specified string, case sensitive. Underlying implementation uses string.startsWith().";
30
- readonly ENDS_WITH: "Ends with operator checks if the header value ends with the specified string, case sensitive. Underlying implementation uses string.endsWith().";
31
- readonly NOT_ENDS_WITH: "Not ends with operator checks if the header value does not end with the specified string, case sensitive. Underlying implementation uses string.endsWith().";
32
- readonly REGEX: "Regex operator checks if the header value matches the specified regex. Underlying implementation uses regex.test().";
33
- readonly NOT_REGEX: "Inverse regex operator checks if the header value does not match the specified regex. Underlying implementation uses regex.test().";
34
- };
35
23
  export declare const RESPONSE_RULES_RESPONSE_TYPES: {
24
+ readonly BROWSER: "BROWSER";
36
25
  readonly BLOCK: "BLOCK";
37
- readonly XRAY_BASE64: "XRAY_BASE64";
38
26
  readonly STATUS_CODE_404: "STATUS_CODE_404";
39
- readonly STATUS_CODE_403: "STATUS_CODE_403";
40
27
  readonly STATUS_CODE_451: "STATUS_CODE_451";
41
28
  readonly SOCKET_DROP: "SOCKET_DROP";
42
- readonly STASH: "STASH";
43
- readonly SINGBOX: "SINGBOX";
44
- readonly SINGBOX_LEGACY: "SINGBOX_LEGACY";
45
- readonly MIHOMO: "MIHOMO";
46
29
  readonly XRAY_JSON: "XRAY_JSON";
30
+ readonly XRAY_BASE64: "XRAY_BASE64";
31
+ readonly MIHOMO: "MIHOMO";
32
+ readonly STASH: "STASH";
47
33
  readonly CLASH: "CLASH";
34
+ readonly SINGBOX: "SINGBOX";
48
35
  };
36
+ export type TResponseRulesResponseType = [keyof typeof RESPONSE_RULES_RESPONSE_TYPES][number];
37
+ export declare const RESPONSE_RULES_RESPONSE_TYPES_VALUES: ("STASH" | "SINGBOX" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "XRAY_BASE64" | "BROWSER" | "BLOCK" | "STATUS_CODE_404" | "STATUS_CODE_451" | "SOCKET_DROP")[];
38
+ export type TResponseRulesResponseTypeKeys = (typeof RESPONSE_RULES_RESPONSE_TYPES)[keyof typeof RESPONSE_RULES_RESPONSE_TYPES];
39
+ export type TResponseRulesConditionOperator = [
40
+ keyof typeof RESPONSE_RULES_CONDITION_OPERATORS
41
+ ][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")[];
43
+ export type TResponseRulesConditionOperatorKeys = (typeof RESPONSE_RULES_CONDITION_OPERATORS)[keyof typeof RESPONSE_RULES_CONDITION_OPERATORS];
49
44
  export declare const RESPONSE_RULES_RESPONSE_TYPES_DESCRIPTION: {
50
45
  readonly BLOCK: "Block response type blocks the request and returns a 403 status code.";
51
46
  readonly XRAY_BASE64: "Previously used as fallback response type. It return subscription as base64 encoded string. Compatible with most client application with Xray core.";
@@ -55,8 +50,20 @@ export declare const RESPONSE_RULES_RESPONSE_TYPES_DESCRIPTION: {
55
50
  readonly CLASH: "Useful for client application that use Legacy Clash core. It return subscription as Clash YAML format.";
56
51
  readonly STASH: "Format which is used by Stash client application.";
57
52
  readonly SINGBOX: "Format which is used by Singbox client application.";
58
- readonly SINGBOX_LEGACY: "Format which is used by Singbox client application (legacy version).";
59
53
  readonly MIHOMO: "Return subscription as Mihomo Core YAML format.";
60
54
  readonly XRAY_JSON: "Return subscription as Xray JSON format.";
55
+ readonly BROWSER: "Return subscription as browser format.";
56
+ };
57
+ export declare const RESPONSE_RULES_CONDITION_OPERATORS_DESCRIPTION: {
58
+ readonly EQUALS: "Equals operator checks if the header value exactly matches the specified string, case sensitive. Underlying implementation uses strict string comparison – ===.";
59
+ readonly NOT_EQUALS: "Not equals operator checks if the header value does not match the specified string, case sensitive. Underlying implementation uses strict string comparison – !==.";
60
+ readonly CONTAINS: "Contains operator checks if the header value contains the specified string, case sensitive. Underlying implementation uses string.includes().";
61
+ readonly NOT_CONTAINS: "Not contains operator checks if the header value does not contain the specified string, case sensitive. Underlying implementation uses string.includes().";
62
+ readonly STARTS_WITH: "Starts with operator checks if the header value starts with the specified string, case sensitive. Underlying implementation uses string.startsWith().";
63
+ readonly NOT_STARTS_WITH: "Not starts with operator checks if the header value does not start with the specified string, case sensitive. Underlying implementation uses string.startsWith().";
64
+ readonly ENDS_WITH: "Ends with operator checks if the header value ends with the specified string, case sensitive. Underlying implementation uses string.endsWith().";
65
+ readonly NOT_ENDS_WITH: "Not ends with operator checks if the header value does not end with the specified string, case sensitive. Underlying implementation uses string.endsWith().";
66
+ readonly REGEX: "Regex operator checks if the header value matches the specified regex. Underlying implementation uses regex.test().";
67
+ readonly NOT_REGEX: "Inverse regex operator checks if the header value does not match the specified regex. Underlying implementation uses regex.test().";
61
68
  };
62
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;;CAEhC,CAAC;AAEX,eAAO,MAAM,wBAAwB;;;CAG3B,CAAC;AAEX,eAAO,MAAM,6BAA6B;;CAEhC,CAAC;AAEX,eAAO,MAAM,kCAAkC;;;;;;;;;;;CAWrC,CAAC;AAEX,eAAO,MAAM,8CAA8C;;;;;;;;;;;CAqBjD,CAAC;AAEX,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;CAQhC,CAAC;AAEX,eAAO,MAAM,yCAAyC;;;;;;;;;;;;CAmB5C,CAAC"}
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;;;;;;;;;;;;CAkB5C,CAAC;AAEX,eAAO,MAAM,8CAA8C;;;;;;;;;;;CAqBjD,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RESPONSE_RULES_RESPONSE_TYPES_DESCRIPTION = exports.RESPONSE_RULES_RESPONSE_TYPES = exports.RESPONSE_RULES_CONDITION_OPERATORS_DESCRIPTION = exports.RESPONSE_RULES_CONDITION_OPERATORS = exports.RESPONSE_RULE_CONDITION_TYPES = exports.RESPONSE_RULES_OPERATORS = exports.RESPONSE_RULES_CONFIG_VERSION = void 0;
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',
@@ -24,27 +24,16 @@ exports.RESPONSE_RULES_CONDITION_OPERATORS = {
24
24
  REGEX: 'REGEX',
25
25
  NOT_REGEX: 'NOT_REGEX',
26
26
  };
27
- exports.RESPONSE_RULES_CONDITION_OPERATORS_DESCRIPTION = {
28
- [exports.RESPONSE_RULES_CONDITION_OPERATORS.EQUALS]: 'Equals operator checks if the header value exactly matches the specified string, case sensitive. Underlying implementation uses strict string comparison – ===.',
29
- [exports.RESPONSE_RULES_CONDITION_OPERATORS.NOT_EQUALS]: 'Not equals operator checks if the header value does not match the specified string, case sensitive. Underlying implementation uses strict string comparison – !==.',
30
- [exports.RESPONSE_RULES_CONDITION_OPERATORS.CONTAINS]: 'Contains operator checks if the header value contains the specified string, case sensitive. Underlying implementation uses string.includes().',
31
- [exports.RESPONSE_RULES_CONDITION_OPERATORS.NOT_CONTAINS]: 'Not contains operator checks if the header value does not contain the specified string, case sensitive. Underlying implementation uses string.includes().',
32
- [exports.RESPONSE_RULES_CONDITION_OPERATORS.STARTS_WITH]: 'Starts with operator checks if the header value starts with the specified string, case sensitive. Underlying implementation uses string.startsWith().',
33
- [exports.RESPONSE_RULES_CONDITION_OPERATORS.NOT_STARTS_WITH]: 'Not starts with operator checks if the header value does not start with the specified string, case sensitive. Underlying implementation uses string.startsWith().',
34
- [exports.RESPONSE_RULES_CONDITION_OPERATORS.ENDS_WITH]: 'Ends with operator checks if the header value ends with the specified string, case sensitive. Underlying implementation uses string.endsWith().',
35
- [exports.RESPONSE_RULES_CONDITION_OPERATORS.NOT_ENDS_WITH]: 'Not ends with operator checks if the header value does not end with the specified string, case sensitive. Underlying implementation uses string.endsWith().',
36
- [exports.RESPONSE_RULES_CONDITION_OPERATORS.REGEX]: 'Regex operator checks if the header value matches the specified regex. Underlying implementation uses regex.test().',
37
- [exports.RESPONSE_RULES_CONDITION_OPERATORS.NOT_REGEX]: 'Inverse regex operator checks if the header value does not match the specified regex. Underlying implementation uses regex.test().',
38
- };
39
27
  exports.RESPONSE_RULES_RESPONSE_TYPES = {
40
28
  ...subscription_template_1.SUBSCRIPTION_TEMPLATE_TYPE,
29
+ BROWSER: 'BROWSER',
41
30
  BLOCK: 'BLOCK',
42
- XRAY_BASE64: 'XRAY_BASE64',
43
31
  STATUS_CODE_404: 'STATUS_CODE_404',
44
- STATUS_CODE_403: 'STATUS_CODE_403',
45
32
  STATUS_CODE_451: 'STATUS_CODE_451',
46
33
  SOCKET_DROP: 'SOCKET_DROP',
47
34
  };
35
+ exports.RESPONSE_RULES_RESPONSE_TYPES_VALUES = Object.values(exports.RESPONSE_RULES_RESPONSE_TYPES);
36
+ exports.RESPONSE_RULES_CONDITION_OPERATORS_VALUES = Object.values(exports.RESPONSE_RULES_CONDITION_OPERATORS);
48
37
  exports.RESPONSE_RULES_RESPONSE_TYPES_DESCRIPTION = {
49
38
  [exports.RESPONSE_RULES_RESPONSE_TYPES.BLOCK]: 'Block response type blocks the request and returns a 403 status code.',
50
39
  [exports.RESPONSE_RULES_RESPONSE_TYPES.XRAY_BASE64]: 'Previously used as fallback response type. It return subscription as base64 encoded string. Compatible with most client application with Xray core.',
@@ -54,7 +43,19 @@ exports.RESPONSE_RULES_RESPONSE_TYPES_DESCRIPTION = {
54
43
  [exports.RESPONSE_RULES_RESPONSE_TYPES.CLASH]: 'Useful for client application that use Legacy Clash core. It return subscription as Clash YAML format.',
55
44
  [exports.RESPONSE_RULES_RESPONSE_TYPES.STASH]: 'Format which is used by Stash client application.',
56
45
  [exports.RESPONSE_RULES_RESPONSE_TYPES.SINGBOX]: 'Format which is used by Singbox client application.',
57
- [exports.RESPONSE_RULES_RESPONSE_TYPES.SINGBOX_LEGACY]: 'Format which is used by Singbox client application (legacy version).',
58
46
  [exports.RESPONSE_RULES_RESPONSE_TYPES.MIHOMO]: 'Return subscription as Mihomo Core YAML format.',
59
47
  [exports.RESPONSE_RULES_RESPONSE_TYPES.XRAY_JSON]: 'Return subscription as Xray JSON format.',
48
+ [exports.RESPONSE_RULES_RESPONSE_TYPES.BROWSER]: 'Return subscription as browser format.',
49
+ };
50
+ exports.RESPONSE_RULES_CONDITION_OPERATORS_DESCRIPTION = {
51
+ [exports.RESPONSE_RULES_CONDITION_OPERATORS.EQUALS]: 'Equals operator checks if the header value exactly matches the specified string, case sensitive. Underlying implementation uses strict string comparison – ===.',
52
+ [exports.RESPONSE_RULES_CONDITION_OPERATORS.NOT_EQUALS]: 'Not equals operator checks if the header value does not match the specified string, case sensitive. Underlying implementation uses strict string comparison – !==.',
53
+ [exports.RESPONSE_RULES_CONDITION_OPERATORS.CONTAINS]: 'Contains operator checks if the header value contains the specified string, case sensitive. Underlying implementation uses string.includes().',
54
+ [exports.RESPONSE_RULES_CONDITION_OPERATORS.NOT_CONTAINS]: 'Not contains operator checks if the header value does not contain the specified string, case sensitive. Underlying implementation uses string.includes().',
55
+ [exports.RESPONSE_RULES_CONDITION_OPERATORS.STARTS_WITH]: 'Starts with operator checks if the header value starts with the specified string, case sensitive. Underlying implementation uses string.startsWith().',
56
+ [exports.RESPONSE_RULES_CONDITION_OPERATORS.NOT_STARTS_WITH]: 'Not starts with operator checks if the header value does not start with the specified string, case sensitive. Underlying implementation uses string.startsWith().',
57
+ [exports.RESPONSE_RULES_CONDITION_OPERATORS.ENDS_WITH]: 'Ends with operator checks if the header value ends with the specified string, case sensitive. Underlying implementation uses string.endsWith().',
58
+ [exports.RESPONSE_RULES_CONDITION_OPERATORS.NOT_ENDS_WITH]: 'Not ends with operator checks if the header value does not end with the specified string, case sensitive. Underlying implementation uses string.endsWith().',
59
+ [exports.RESPONSE_RULES_CONDITION_OPERATORS.REGEX]: 'Regex operator checks if the header value matches the specified regex. Underlying implementation uses regex.test().',
60
+ [exports.RESPONSE_RULES_CONDITION_OPERATORS.NOT_REGEX]: 'Inverse regex operator checks if the header value does not match the specified regex. Underlying implementation uses regex.test().',
60
61
  };
@@ -1,13 +1,12 @@
1
1
  export declare const REQUEST_TEMPLATE_TYPE: {
2
2
  readonly STASH: "stash";
3
3
  readonly SINGBOX: "singbox";
4
- readonly SINGBOX_LEGACY: "singbox-legacy";
5
4
  readonly MIHOMO: "mihomo";
6
5
  readonly XRAY_JSON: "json";
7
6
  readonly V2RAY_JSON: "v2ray-json";
8
7
  readonly CLASH: "clash";
9
8
  };
10
9
  export type TRequestTemplateType = [keyof typeof REQUEST_TEMPLATE_TYPE][number];
11
- export declare const REQUEST_TEMPLATE_TYPE_VALUES: ("stash" | "singbox" | "singbox-legacy" | "mihomo" | "json" | "v2ray-json" | "clash")[];
10
+ export declare const REQUEST_TEMPLATE_TYPE_VALUES: ("stash" | "singbox" | "mihomo" | "json" | "v2ray-json" | "clash")[];
12
11
  export type TRequestTemplateTypeKeys = (typeof REQUEST_TEMPLATE_TYPE)[keyof typeof REQUEST_TEMPLATE_TYPE];
13
12
  //# sourceMappingURL=request-template-type.constant.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"request-template-type.constant.d.ts","sourceRoot":"","sources":["../../../../../constants/subscription-template/template-type/request-template-type.constant.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB;;;;;;;;CAQxB,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAChF,eAAO,MAAM,4BAA4B,yFAAuC,CAAC;AACjF,MAAM,MAAM,wBAAwB,GAChC,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC"}
1
+ {"version":3,"file":"request-template-type.constant.d.ts","sourceRoot":"","sources":["../../../../../constants/subscription-template/template-type/request-template-type.constant.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB;;;;;;;CAOxB,CAAC;AAEX,MAAM,MAAM,oBAAoB,GAAG,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAChF,eAAO,MAAM,4BAA4B,sEAAuC,CAAC;AACjF,MAAM,MAAM,wBAAwB,GAChC,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC"}
@@ -4,7 +4,6 @@ exports.REQUEST_TEMPLATE_TYPE_VALUES = exports.REQUEST_TEMPLATE_TYPE = void 0;
4
4
  exports.REQUEST_TEMPLATE_TYPE = {
5
5
  STASH: 'stash',
6
6
  SINGBOX: 'singbox',
7
- SINGBOX_LEGACY: 'singbox-legacy',
8
7
  MIHOMO: 'mihomo',
9
8
  XRAY_JSON: 'json',
10
9
  V2RAY_JSON: 'v2ray-json',
@@ -1,11 +1,11 @@
1
1
  export declare const SUBSCRIPTION_TEMPLATE_TYPE: {
2
- readonly STASH: "STASH";
3
- readonly SINGBOX: "SINGBOX";
4
- readonly SINGBOX_LEGACY: "SINGBOX_LEGACY";
5
- readonly MIHOMO: "MIHOMO";
6
2
  readonly XRAY_JSON: "XRAY_JSON";
3
+ readonly XRAY_BASE64: "XRAY_BASE64";
4
+ readonly MIHOMO: "MIHOMO";
5
+ readonly STASH: "STASH";
7
6
  readonly CLASH: "CLASH";
7
+ readonly SINGBOX: "SINGBOX";
8
8
  };
9
9
  export type TSubscriptionTemplateType = [keyof typeof SUBSCRIPTION_TEMPLATE_TYPE][number];
10
- export declare const SUBSCRIPTION_TEMPLATE_TYPE_VALUES: ("STASH" | "SINGBOX" | "SINGBOX_LEGACY" | "MIHOMO" | "XRAY_JSON" | "CLASH")[];
10
+ export declare const SUBSCRIPTION_TEMPLATE_TYPE_VALUES: ("STASH" | "SINGBOX" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "XRAY_BASE64")[];
11
11
  //# sourceMappingURL=template-type.constant.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"template-type.constant.d.ts","sourceRoot":"","sources":["../../../../../constants/subscription-template/template-type/template-type.constant.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B;;;;;;;CAO7B,CAAC;AAEX,MAAM,MAAM,yBAAyB,GAAG,CAAC,MAAM,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAC1F,eAAO,MAAM,iCAAiC,+EAA4C,CAAC"}
1
+ {"version":3,"file":"template-type.constant.d.ts","sourceRoot":"","sources":["../../../../../constants/subscription-template/template-type/template-type.constant.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B;;;;;;;CAS7B,CAAC;AAEX,MAAM,MAAM,yBAAyB,GAAG,CAAC,MAAM,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAC1F,eAAO,MAAM,iCAAiC,4EAA4C,CAAC"}
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SUBSCRIPTION_TEMPLATE_TYPE_VALUES = exports.SUBSCRIPTION_TEMPLATE_TYPE = void 0;
4
4
  exports.SUBSCRIPTION_TEMPLATE_TYPE = {
5
- STASH: 'STASH',
6
- SINGBOX: 'SINGBOX',
7
- SINGBOX_LEGACY: 'SINGBOX_LEGACY',
8
- MIHOMO: 'MIHOMO',
9
5
  XRAY_JSON: 'XRAY_JSON',
6
+ XRAY_BASE64: 'XRAY_BASE64',
7
+ MIHOMO: 'MIHOMO',
8
+ STASH: 'STASH',
10
9
  CLASH: 'CLASH',
10
+ SINGBOX: 'SINGBOX',
11
11
  };
12
12
  exports.SUBSCRIPTION_TEMPLATE_TYPE_VALUES = Object.values(exports.SUBSCRIPTION_TEMPLATE_TYPE);
@@ -1,3 +1,4 @@
1
+ export * from './response-rule-condition.schema';
1
2
  export * from './response-rule.schema';
2
3
  export * from './response-rules-config.schema';
3
4
  //# 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,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,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC"}
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./response-rule-condition.schema"), exports);
17
18
  __exportStar(require("./response-rule.schema"), exports);
18
19
  __exportStar(require("./response-rules-config.schema"), exports);
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ export declare const ResponseRuleConditionSchema: z.ZodObject<{
3
+ headerName: z.ZodString;
4
+ operator: z.ZodNativeEnum<{
5
+ readonly EQUALS: "EQUALS";
6
+ readonly NOT_EQUALS: "NOT_EQUALS";
7
+ readonly CONTAINS: "CONTAINS";
8
+ readonly NOT_CONTAINS: "NOT_CONTAINS";
9
+ readonly STARTS_WITH: "STARTS_WITH";
10
+ readonly NOT_STARTS_WITH: "NOT_STARTS_WITH";
11
+ readonly ENDS_WITH: "ENDS_WITH";
12
+ readonly NOT_ENDS_WITH: "NOT_ENDS_WITH";
13
+ readonly REGEX: "REGEX";
14
+ readonly NOT_REGEX: "NOT_REGEX";
15
+ }>;
16
+ value: z.ZodString;
17
+ caseSensitive: z.ZodBoolean;
18
+ }, "strip", z.ZodTypeAny, {
19
+ value: string;
20
+ headerName: string;
21
+ operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
22
+ caseSensitive: boolean;
23
+ }, {
24
+ value: string;
25
+ headerName: string;
26
+ operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
27
+ caseSensitive: boolean;
28
+ }>;
29
+ //# sourceMappingURL=response-rule-condition.schema.d.ts.map
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCtC,CAAC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ResponseRuleConditionSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const constants_1 = require("../../constants");
6
+ exports.ResponseRuleConditionSchema = zod_1.z.object({
7
+ headerName: zod_1.z
8
+ .string()
9
+ .regex(/^[!#$%&'*+\-.0-9A-Z^_`a-z|~]+$/, 'Invalid header name. Only letters(a-z, A-Z), numbers(0-9), underscores(_) and hyphens(-) are allowed.')
10
+ .describe(JSON.stringify({
11
+ title: 'Header Name',
12
+ markdownDescription: 'Name of the HTTP header to check, case insensitive, must comply with RFC 7230.',
13
+ })),
14
+ operator: zod_1.z.nativeEnum(constants_1.RESPONSE_RULES_CONDITION_OPERATORS).describe(JSON.stringify({
15
+ markdownDescription: `Comparison operator to compare the header value against.\n\n${Object.entries(constants_1.RESPONSE_RULES_CONDITION_OPERATORS_DESCRIPTION)
16
+ .map(([key, description]) => `- **${key}**: ${description}\n`)
17
+ .join('\n')}`,
18
+ })),
19
+ value: zod_1.z
20
+ .string()
21
+ .min(1, 'Value is required')
22
+ .max(255, 'Value must be less than 255 characters')
23
+ .describe(JSON.stringify({
24
+ markdownDescription: `Value to check against the header, case sensitive (excluding regex/not_regex operator). Maximum length is 255 characters.`,
25
+ })),
26
+ caseSensitive: zod_1.z.boolean().describe(JSON.stringify({
27
+ markdownDescription: 'Whether the value is case sensitive. If true, the value will be compared case sensitive. If false, the value will be lowercased before comparison.',
28
+ })),
29
+ });
@@ -22,50 +22,88 @@ export declare const ResponseRuleSchema: z.ZodObject<{
22
22
  readonly NOT_REGEX: "NOT_REGEX";
23
23
  }>;
24
24
  value: z.ZodString;
25
+ caseSensitive: z.ZodBoolean;
25
26
  }, "strip", z.ZodTypeAny, {
26
27
  value: string;
27
- operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
28
28
  headerName: string;
29
+ operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
30
+ caseSensitive: boolean;
29
31
  }, {
30
32
  value: string;
31
- operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
32
33
  headerName: string;
34
+ operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
35
+ caseSensitive: boolean;
33
36
  }>, "many">;
34
37
  responseType: z.ZodNativeEnum<{
38
+ readonly BROWSER: "BROWSER";
35
39
  readonly BLOCK: "BLOCK";
36
- readonly XRAY_BASE64: "XRAY_BASE64";
37
40
  readonly STATUS_CODE_404: "STATUS_CODE_404";
38
- readonly STATUS_CODE_403: "STATUS_CODE_403";
39
41
  readonly STATUS_CODE_451: "STATUS_CODE_451";
40
42
  readonly SOCKET_DROP: "SOCKET_DROP";
41
- readonly STASH: "STASH";
42
- readonly SINGBOX: "SINGBOX";
43
- readonly SINGBOX_LEGACY: "SINGBOX_LEGACY";
44
- readonly MIHOMO: "MIHOMO";
45
43
  readonly XRAY_JSON: "XRAY_JSON";
44
+ readonly XRAY_BASE64: "XRAY_BASE64";
45
+ readonly MIHOMO: "MIHOMO";
46
+ readonly STASH: "STASH";
46
47
  readonly CLASH: "CLASH";
48
+ readonly SINGBOX: "SINGBOX";
49
+ }>;
50
+ responseModifications: z.ZodObject<{
51
+ headers: z.ZodOptional<z.ZodArray<z.ZodObject<{
52
+ key: z.ZodString;
53
+ value: z.ZodString;
54
+ }, "strip", z.ZodTypeAny, {
55
+ value: string;
56
+ key: string;
57
+ }, {
58
+ value: string;
59
+ key: string;
60
+ }>, "many">>;
61
+ }, "strip", z.ZodTypeAny, {
62
+ headers?: {
63
+ value: string;
64
+ key: string;
65
+ }[] | undefined;
66
+ }, {
67
+ headers?: {
68
+ value: string;
69
+ key: string;
70
+ }[] | undefined;
47
71
  }>;
48
72
  }, "strip", z.ZodTypeAny, {
49
73
  name: string;
50
- enabled: boolean;
51
74
  operator: "AND" | "OR";
75
+ enabled: boolean;
52
76
  conditions: {
53
77
  value: string;
54
- operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
55
78
  headerName: string;
79
+ operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
80
+ caseSensitive: boolean;
56
81
  }[];
57
- responseType: "STASH" | "SINGBOX" | "SINGBOX_LEGACY" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "BLOCK" | "XRAY_BASE64" | "STATUS_CODE_404" | "STATUS_CODE_403" | "STATUS_CODE_451" | "SOCKET_DROP";
82
+ responseType: "STASH" | "SINGBOX" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "XRAY_BASE64" | "BROWSER" | "BLOCK" | "STATUS_CODE_404" | "STATUS_CODE_451" | "SOCKET_DROP";
83
+ responseModifications: {
84
+ headers?: {
85
+ value: string;
86
+ key: string;
87
+ }[] | undefined;
88
+ };
58
89
  description?: string | undefined;
59
90
  }, {
60
91
  name: string;
61
- enabled: boolean;
62
92
  operator: "AND" | "OR";
93
+ enabled: boolean;
63
94
  conditions: {
64
95
  value: string;
65
- operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
66
96
  headerName: string;
97
+ operator: "EQUALS" | "NOT_EQUALS" | "CONTAINS" | "NOT_CONTAINS" | "STARTS_WITH" | "NOT_STARTS_WITH" | "ENDS_WITH" | "NOT_ENDS_WITH" | "REGEX" | "NOT_REGEX";
98
+ caseSensitive: boolean;
67
99
  }[];
68
- responseType: "STASH" | "SINGBOX" | "SINGBOX_LEGACY" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "BLOCK" | "XRAY_BASE64" | "STATUS_CODE_404" | "STATUS_CODE_403" | "STATUS_CODE_451" | "SOCKET_DROP";
100
+ responseType: "STASH" | "SINGBOX" | "MIHOMO" | "XRAY_JSON" | "CLASH" | "XRAY_BASE64" | "BROWSER" | "BLOCK" | "STATUS_CODE_404" | "STATUS_CODE_451" | "SOCKET_DROP";
101
+ responseModifications: {
102
+ headers?: {
103
+ value: string;
104
+ key: string;
105
+ }[] | undefined;
106
+ };
69
107
  description?: string | undefined;
70
108
  }>;
71
109
  //# sourceMappingURL=response-rule.schema.d.ts.map
@@ -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;AAkCxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6G1B,CAAC"}
1
+ {"version":3,"file":"response-rule.schema.d.ts","sourceRoot":"","sources":["../../../../models/response-rules/response-rule.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAoCxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgH1B,CAAC"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ResponseRuleSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const constants_1 = require("../../constants");
6
+ const response_rule_condition_schema_1 = require("./response-rule-condition.schema");
6
7
  const RuleExampleJson = JSON.stringify({
7
8
  name: 'Block Legacy Clients',
8
9
  description: 'Block requests from legacy clients',
@@ -13,11 +14,13 @@ const RuleExampleJson = JSON.stringify({
13
14
  headerName: 'user-agent',
14
15
  operator: constants_1.RESPONSE_RULES_CONDITION_OPERATORS.CONTAINS,
15
16
  value: 'Hiddify',
17
+ caseSensitive: true,
16
18
  },
17
19
  {
18
20
  headerName: 'user-agent',
19
21
  operator: constants_1.RESPONSE_RULES_CONDITION_OPERATORS.CONTAINS,
20
22
  value: 'FoxRay',
23
+ caseSensitive: true,
21
24
  },
22
25
  ],
23
26
  responseType: constants_1.RESPONSE_RULES_RESPONSE_TYPES.BLOCK,
@@ -48,32 +51,35 @@ exports.ResponseRuleSchema = zod_1.z
48
51
  title: 'Operator',
49
52
  markdownDescription: 'Operator to use for combining conditions in the rule.',
50
53
  })),
51
- conditions: zod_1.z.array(zod_1.z.object({
52
- headerName: zod_1.z
53
- .string()
54
- .regex(/^[!#$%&'*+\-.0-9A-Z^_`a-z|~]+$/, 'Invalid header name. Only letters(a-z, A-Z), numbers(0-9), underscores(_) and hyphens(-) are allowed.')
55
- .describe(JSON.stringify({
56
- title: 'Header Name',
57
- markdownDescription: 'Name of the HTTP header to check, case insensitive, must comply with RFC 7230.',
58
- })),
59
- operator: zod_1.z.nativeEnum(constants_1.RESPONSE_RULES_CONDITION_OPERATORS).describe(JSON.stringify({
60
- markdownDescription: `Comparison operator to compare the header value against.\n\n${Object.entries(constants_1.RESPONSE_RULES_CONDITION_OPERATORS_DESCRIPTION)
61
- .map(([key, description]) => `- **${key}**: ${description}\n`)
62
- .join('\n')}`,
63
- })),
64
- value: zod_1.z
65
- .string()
66
- .min(1, 'Value is required')
67
- .max(255, 'Value must be less than 255 characters')
68
- .describe(JSON.stringify({
69
- markdownDescription: `Value to check against the header, case sensitive (excluding regex/not_regex operator). Maximum length is 255 characters.`,
70
- })),
71
- })),
54
+ conditions: zod_1.z.array(response_rule_condition_schema_1.ResponseRuleConditionSchema),
72
55
  responseType: zod_1.z.nativeEnum(constants_1.RESPONSE_RULES_RESPONSE_TYPES).describe(JSON.stringify({
73
56
  markdownDescription: `Type of the response. Determines the type of **response** to be returned when the rule is matched.\n\n${Object.entries(constants_1.RESPONSE_RULES_RESPONSE_TYPES_DESCRIPTION)
74
57
  .map(([key, description]) => `- **${key}**: ${description}\n`)
75
58
  .join('\n')}`,
76
59
  })),
60
+ responseModifications: zod_1.z.object({
61
+ headers: zod_1.z
62
+ .array(zod_1.z.object({
63
+ key: zod_1.z
64
+ .string()
65
+ .regex(/^[!#$%&'*+\-.0-9A-Z^_`a-z|~]+$/, 'Invalid header name. Only letters(a-z, A-Z), numbers(0-9), underscores(_) and hyphens(-) are allowed.')
66
+ .describe(JSON.stringify({
67
+ title: 'Key',
68
+ markdownDescription: 'Key of the response header. Must comply with RFC 7230.',
69
+ })),
70
+ value: zod_1.z
71
+ .string()
72
+ .min(1, 'Value is required')
73
+ .describe(JSON.stringify({
74
+ title: 'Value',
75
+ markdownDescription: 'Value of the response header. ',
76
+ })),
77
+ }))
78
+ .optional()
79
+ .describe(JSON.stringify({
80
+ markdownDescription: 'Response headers to be added when the rule is matched.',
81
+ })),
82
+ }),
77
83
  })
78
84
  .describe(JSON.stringify({
79
85
  title: 'Response Rule',
@@ -89,6 +95,7 @@ exports.ResponseRuleSchema = zod_1.z
89
95
  headerName: 'user-agent',
90
96
  operator: constants_1.RESPONSE_RULES_CONDITION_OPERATORS.CONTAINS,
91
97
  value: 'Example Rule Value, replace with your own value',
98
+ caseSensitive: true,
92
99
  },
93
100
  ],
94
101
  responseType: constants_1.RESPONSE_RULES_RESPONSE_TYPES.BLOCK,