@remnawave/backend-contract 2.2.1 → 2.2.4

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 (60) hide show
  1. package/build/backend/api/controllers/subscription-template.d.ts +4 -1
  2. package/build/backend/api/controllers/subscription-template.d.ts.map +1 -1
  3. package/build/backend/api/controllers/subscription-template.js +5 -2
  4. package/build/backend/api/routes.d.ts +4 -1
  5. package/build/backend/api/routes.d.ts.map +1 -1
  6. package/build/backend/api/routes.js +4 -1
  7. package/build/backend/commands/subscription/get-subscription-by-short-uuid-by-client-type.command.d.ts.map +1 -1
  8. package/build/backend/commands/subscription/get-subscription-by-short-uuid-by-client-type.command.js +3 -1
  9. package/build/backend/commands/subscription-settings/get-subscription-settings.command.d.ts +33 -22
  10. package/build/backend/commands/subscription-settings/get-subscription-settings.command.d.ts.map +1 -1
  11. package/build/backend/commands/subscription-settings/update-subscription-settings.command.d.ts +60 -40
  12. package/build/backend/commands/subscription-settings/update-subscription-settings.command.d.ts.map +1 -1
  13. package/build/backend/commands/subscription-template/create-template.command.d.ts +70 -0
  14. package/build/backend/commands/subscription-template/create-template.command.d.ts.map +1 -0
  15. package/build/backend/commands/subscription-template/create-template.command.js +26 -0
  16. package/build/backend/commands/subscription-template/delete-subscription-template.command.d.ts +33 -0
  17. package/build/backend/commands/subscription-template/delete-subscription-template.command.d.ts.map +1 -0
  18. package/build/backend/commands/subscription-template/delete-subscription-template.command.js +20 -0
  19. package/build/backend/commands/subscription-template/get-template.command.d.ts +9 -11
  20. package/build/backend/commands/subscription-template/get-template.command.d.ts.map +1 -1
  21. package/build/backend/commands/subscription-template/get-template.command.js +4 -3
  22. package/build/backend/commands/subscription-template/get-templates.command.d.ts +79 -0
  23. package/build/backend/commands/subscription-template/get-templates.command.d.ts.map +1 -0
  24. package/build/backend/commands/subscription-template/get-templates.command.js +25 -0
  25. package/build/backend/commands/subscription-template/index.d.ts +3 -0
  26. package/build/backend/commands/subscription-template/index.d.ts.map +1 -1
  27. package/build/backend/commands/subscription-template/index.js +3 -0
  28. package/build/backend/commands/subscription-template/update-template.command.d.ts +11 -10
  29. package/build/backend/commands/subscription-template/update-template.command.d.ts.map +1 -1
  30. package/build/backend/commands/subscription-template/update-template.command.js +4 -2
  31. package/build/backend/commands/system/testers/test-srr-matcher.command.d.ts +54 -36
  32. package/build/backend/commands/system/testers/test-srr-matcher.command.d.ts.map +1 -1
  33. package/build/backend/constants/cache-keys/cache-keys.constants.d.ts +2 -0
  34. package/build/backend/constants/cache-keys/cache-keys.constants.d.ts.map +1 -1
  35. package/build/backend/constants/cache-keys/cache-keys.constants.js +1 -0
  36. package/build/backend/constants/errors/errors.d.ts +60 -0
  37. package/build/backend/constants/errors/errors.d.ts.map +1 -1
  38. package/build/backend/constants/errors/errors.js +60 -0
  39. package/build/backend/models/response-rules/response-rule-modifications.schema.d.ts +9 -6
  40. package/build/backend/models/response-rules/response-rule-modifications.schema.d.ts.map +1 -1
  41. package/build/backend/models/response-rules/response-rule-modifications.schema.js +8 -0
  42. package/build/backend/models/response-rules/response-rule.schema.d.ts +30 -20
  43. package/build/backend/models/response-rules/response-rule.schema.d.ts.map +1 -1
  44. package/build/backend/models/response-rules/response-rules-config.schema.d.ts +21 -14
  45. package/build/backend/models/response-rules/response-rules-config.schema.d.ts.map +1 -1
  46. package/build/backend/models/subscription-settings.schema.d.ts +27 -18
  47. package/build/backend/models/subscription-settings.schema.d.ts.map +1 -1
  48. package/build/frontend/api/controllers/subscription-template.js +5 -2
  49. package/build/frontend/api/routes.js +4 -1
  50. package/build/frontend/commands/subscription/get-subscription-by-short-uuid-by-client-type.command.js +3 -1
  51. package/build/frontend/commands/subscription-template/create-template.command.js +26 -0
  52. package/build/frontend/commands/subscription-template/delete-subscription-template.command.js +20 -0
  53. package/build/frontend/commands/subscription-template/get-template.command.js +4 -3
  54. package/build/frontend/commands/subscription-template/get-templates.command.js +25 -0
  55. package/build/frontend/commands/subscription-template/index.js +3 -0
  56. package/build/frontend/commands/subscription-template/update-template.command.js +4 -2
  57. package/build/frontend/constants/cache-keys/cache-keys.constants.js +1 -0
  58. package/build/frontend/constants/errors/errors.js +60 -0
  59. package/build/frontend/models/response-rules/response-rule-modifications.schema.js +8 -0
  60. package/package.json +1 -1
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GetSubscriptionTemplatesCommand = void 0;
4
+ const zod_1 = require("zod");
5
+ const api_1 = require("../../api");
6
+ const constants_1 = require("../../constants");
7
+ const constants_2 = require("../../constants");
8
+ var GetSubscriptionTemplatesCommand;
9
+ (function (GetSubscriptionTemplatesCommand) {
10
+ GetSubscriptionTemplatesCommand.url = api_1.REST_API.SUBSCRIPTION_TEMPLATE.GET_ALL;
11
+ GetSubscriptionTemplatesCommand.TSQ_url = GetSubscriptionTemplatesCommand.url;
12
+ GetSubscriptionTemplatesCommand.endpointDetails = (0, constants_2.getEndpointDetails)(api_1.SUBSCRIPTION_TEMPLATE_ROUTES.GET_ALL, 'get', 'Get all subscription templates (wihout content)');
13
+ GetSubscriptionTemplatesCommand.ResponseSchema = zod_1.z.object({
14
+ response: zod_1.z.object({
15
+ total: zod_1.z.number(),
16
+ templates: zod_1.z.array(zod_1.z.object({
17
+ uuid: zod_1.z.string().uuid(),
18
+ name: zod_1.z.string(),
19
+ templateType: zod_1.z.nativeEnum(constants_1.SUBSCRIPTION_TEMPLATE_TYPE),
20
+ templateJson: zod_1.z.nullable(zod_1.z.unknown()),
21
+ encodedTemplateYaml: zod_1.z.nullable(zod_1.z.string()),
22
+ })),
23
+ }),
24
+ });
25
+ })(GetSubscriptionTemplatesCommand || (exports.GetSubscriptionTemplatesCommand = GetSubscriptionTemplatesCommand = {}));
@@ -14,5 +14,8 @@ 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("./create-template.command"), exports);
18
+ __exportStar(require("./delete-subscription-template.command"), exports);
17
19
  __exportStar(require("./get-template.command"), exports);
20
+ __exportStar(require("./get-templates.command"), exports);
18
21
  __exportStar(require("./update-template.command"), exports);
@@ -9,15 +9,17 @@ var UpdateSubscriptionTemplateCommand;
9
9
  (function (UpdateSubscriptionTemplateCommand) {
10
10
  UpdateSubscriptionTemplateCommand.url = api_1.REST_API.SUBSCRIPTION_TEMPLATE.UPDATE;
11
11
  UpdateSubscriptionTemplateCommand.TSQ_url = UpdateSubscriptionTemplateCommand.url;
12
- UpdateSubscriptionTemplateCommand.endpointDetails = (0, constants_2.getEndpointDetails)(api_1.SUBSCRIPTION_TEMPLATE_ROUTES.UPDATE, 'put', 'Update subscription template');
12
+ UpdateSubscriptionTemplateCommand.endpointDetails = (0, constants_2.getEndpointDetails)(api_1.SUBSCRIPTION_TEMPLATE_ROUTES.UPDATE, 'patch', 'Update subscription template');
13
13
  UpdateSubscriptionTemplateCommand.RequestSchema = zod_1.z.object({
14
- templateType: zod_1.z.nativeEnum(constants_1.SUBSCRIPTION_TEMPLATE_TYPE),
14
+ uuid: zod_1.z.string().uuid(),
15
+ name: zod_1.z.optional(zod_1.z.string()),
15
16
  templateJson: zod_1.z.optional(zod_1.z.object({}).passthrough()),
16
17
  encodedTemplateYaml: zod_1.z.optional(zod_1.z.string()),
17
18
  });
18
19
  UpdateSubscriptionTemplateCommand.ResponseSchema = zod_1.z.object({
19
20
  response: zod_1.z.object({
20
21
  uuid: zod_1.z.string().uuid(),
22
+ name: zod_1.z.string(),
21
23
  templateType: zod_1.z.nativeEnum(constants_1.SUBSCRIPTION_TEMPLATE_TYPE),
22
24
  templateJson: zod_1.z.nullable(zod_1.z.unknown()),
23
25
  encodedTemplateYaml: zod_1.z.nullable(zod_1.z.string()),
@@ -3,4 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CACHE_KEYS = void 0;
4
4
  exports.CACHE_KEYS = {
5
5
  SUBSCRIPTION_SETTINGS: 'subscription_settings',
6
+ SUBSCRIPTION_TEMPLATE: (name, type) => `subscription_template:${name}:${type}`,
6
7
  };
@@ -835,4 +835,64 @@ exports.ERRORS = {
835
835
  message: 'Snippet cannot contain empty objects',
836
836
  httpCode: 400,
837
837
  },
838
+ GET_ALL_SUBSCRIPTION_TEMPLATES_ERROR: {
839
+ code: 'A168',
840
+ message: 'Get all subscription templates error',
841
+ httpCode: 500,
842
+ },
843
+ GET_SUBSCRIPTION_TEMPLATE_BY_UUID_ERROR: {
844
+ code: 'A169',
845
+ message: 'Get subscription template by UUID error',
846
+ httpCode: 500,
847
+ },
848
+ SUBSCRIPTION_TEMPLATE_NOT_FOUND: {
849
+ code: 'A170',
850
+ message: 'Subscription template not found',
851
+ httpCode: 404,
852
+ },
853
+ UPDATE_SUBSCRIPTION_TEMPLATE_ERROR: {
854
+ code: 'A171',
855
+ message: 'Update subscription template error',
856
+ httpCode: 500,
857
+ },
858
+ RESERVED_TEMPLATE_NAME: {
859
+ code: 'A172',
860
+ message: 'This name is reserved. Please use a different name.',
861
+ httpCode: 400,
862
+ },
863
+ TEMPLATE_JSON_NOT_ALLOWED_FOR_YAML_TEMPLATE: {
864
+ code: 'A173',
865
+ message: 'Template JSON is not allowed for YAML template',
866
+ httpCode: 400,
867
+ },
868
+ TEMPLATE_YAML_NOT_ALLOWED_FOR_JSON_TEMPLATE: {
869
+ code: 'A174',
870
+ message: 'Template YAML is not allowed for JSON template',
871
+ httpCode: 400,
872
+ },
873
+ TEMPLATE_JSON_AND_YAML_CANNOT_BE_UPDATED_SIMULTANEOUSLY: {
874
+ code: 'A175',
875
+ message: 'Template JSON and YAML cannot be updated simultaneously',
876
+ httpCode: 400,
877
+ },
878
+ TEMPLATE_NAME_ALREADY_EXISTS_FOR_THIS_TYPE: {
879
+ code: 'A176',
880
+ message: 'Template name already exists for this type',
881
+ httpCode: 400,
882
+ },
883
+ DELETE_SUBSCRIPTION_TEMPLATE_ERROR: {
884
+ code: 'A177',
885
+ message: 'Delete subscription template error',
886
+ httpCode: 500,
887
+ },
888
+ RESERVED_TEMPLATE_CANNOT_BE_DELETED: {
889
+ code: 'A178',
890
+ message: 'Reserved template cannot be deleted',
891
+ httpCode: 400,
892
+ },
893
+ CREATE_SUBSCRIPTION_TEMPLATE_ERROR: {
894
+ code: 'A179',
895
+ message: 'Create subscription template error',
896
+ httpCode: 500,
897
+ },
838
898
  };
@@ -40,6 +40,14 @@ exports.ResponseRuleModificationsSchema = zod_1.default
40
40
  },
41
41
  ],
42
42
  markdownDescription: 'Array of headers to be added when the rule is matched.',
43
+ }))
44
+ .optional(),
45
+ overrideSubscriptionTemplateWith: zod_1.default
46
+ .string()
47
+ .min(1, 'Override subscription template with is required')
48
+ .optional()
49
+ .describe(JSON.stringify({
50
+ markdownDescription: 'Override the subscription template with the given name. If not provided, the default subscription template will be used. If the template name is not found, the default subscription template for this type will be used.',
43
51
  })),
44
52
  })
45
53
  .optional()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnawave/backend-contract",
3
- "version": "2.2.1",
3
+ "version": "2.2.4",
4
4
  "public": true,
5
5
  "license": "AGPL-3.0-only",
6
6
  "description": "A contract library for Remnawave Backend. It can be used in backend and frontend.",