@e22m4u/ts-rest-router 0.6.8 → 0.6.9

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.
@@ -566,11 +566,11 @@ function requestContext(propertyName) {
566
566
  }
567
567
  __name(requestContext, "requestContext");
568
568
  function httpRequest() {
569
- return requestContext("req");
569
+ return requestContext("request");
570
570
  }
571
571
  __name(httpRequest, "httpRequest");
572
572
  function httpResponse() {
573
- return requestContext("res");
573
+ return requestContext("response");
574
574
  }
575
575
  __name(httpResponse, "httpResponse");
576
576
  function requestContainer() {
@@ -19,13 +19,13 @@ export function requestContext(propertyName) {
19
19
  * HttpRequest decorator.
20
20
  */
21
21
  export function httpRequest() {
22
- return requestContext('req');
22
+ return requestContext('request');
23
23
  }
24
24
  /**
25
25
  * HttpResponse decorator.
26
26
  */
27
27
  export function httpResponse() {
28
- return requestContext('res');
28
+ return requestContext('response');
29
29
  }
30
30
  /**
31
31
  * RequestContainer decorator.
@@ -36,16 +36,16 @@ describe('requestContext', function () {
36
36
  method(prop) { }
37
37
  }
38
38
  __decorate([
39
- __param(0, requestContext('res')),
39
+ __param(0, requestContext('response')),
40
40
  __metadata("design:type", Function),
41
41
  __metadata("design:paramtypes", [Object]),
42
42
  __metadata("design:returntype", void 0)
43
43
  ], Target.prototype, "method", null);
44
44
  const res = RequestContextReflector.getMetadata(Target, 'method');
45
- expect(res.get(0)).to.be.eql({ property: 'res' });
45
+ expect(res.get(0)).to.be.eql({ property: 'response' });
46
46
  });
47
47
  describe('httpRequest', function () {
48
- it('should set the "req" property to target metadata', function () {
48
+ it('should set the "request" property to target metadata', function () {
49
49
  class Target {
50
50
  method(prop) { }
51
51
  }
@@ -56,11 +56,11 @@ describe('requestContext', function () {
56
56
  __metadata("design:returntype", void 0)
57
57
  ], Target.prototype, "method", null);
58
58
  const res = RequestContextReflector.getMetadata(Target, 'method');
59
- expect(res.get(0)).to.be.eql({ property: 'req' });
59
+ expect(res.get(0)).to.be.eql({ property: 'request' });
60
60
  });
61
61
  });
62
62
  describe('httpResponse', function () {
63
- it('should set the "res" property to target metadata', function () {
63
+ it('should set the "response" property to target metadata', function () {
64
64
  class Target {
65
65
  method(prop) { }
66
66
  }
@@ -71,7 +71,7 @@ describe('requestContext', function () {
71
71
  __metadata("design:returntype", void 0)
72
72
  ], Target.prototype, "method", null);
73
73
  const res = RequestContextReflector.getMetadata(Target, 'method');
74
- expect(res.get(0)).to.be.eql({ property: 'res' });
74
+ expect(res.get(0)).to.be.eql({ property: 'response' });
75
75
  });
76
76
  });
77
77
  describe('requestContainer', function () {
@@ -7,8 +7,8 @@ describe('RequestContextReflector', function () {
7
7
  it('sets a given value as target metadata', function () {
8
8
  class Target {
9
9
  }
10
- const md1 = { property: 'req' };
11
- const md2 = { property: 'res' };
10
+ const md1 = { property: 'request' };
11
+ const md2 = { property: 'response' };
12
12
  RequestContextReflector.setMetadata(md1, Target, 0, 'propertyKey');
13
13
  RequestContextReflector.setMetadata(md2, Target, 1, 'propertyKey');
14
14
  const res = Reflector.getOwnMetadata(REQUEST_CONTEXT_METADATA_KEY, Target, 'propertyKey');
@@ -19,8 +19,8 @@ describe('RequestContextReflector', function () {
19
19
  it('overrides existing metadata', function () {
20
20
  class Target {
21
21
  }
22
- const md1 = { property: 'req' };
23
- const md2 = { property: 'res' };
22
+ const md1 = { property: 'request' };
23
+ const md2 = { property: 'response' };
24
24
  RequestContextReflector.setMetadata(md1, Target, 0, 'propertyKey');
25
25
  const res1 = Reflector.getOwnMetadata(REQUEST_CONTEXT_METADATA_KEY, Target, 'propertyKey');
26
26
  expect(res1).to.be.instanceof(Map);
@@ -35,8 +35,8 @@ describe('RequestContextReflector', function () {
35
35
  it('returns an existing metadata of the target', function () {
36
36
  class Target {
37
37
  }
38
- const md1 = { property: 'req' };
39
- const md2 = { property: 'res' };
38
+ const md1 = { property: 'request' };
39
+ const md2 = { property: 'response' };
40
40
  const mdMap = new Map([
41
41
  [0, md1],
42
42
  [1, md2],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e22m4u/ts-rest-router",
3
- "version": "0.6.8",
3
+ "version": "0.6.9",
4
4
  "description": "Декларативный REST-маршрутизатор на основе контроллеров для TypeScript",
5
5
  "author": "Mikhail Evstropov <e22m4u@yandex.ru>",
6
6
  "license": "MIT",
@@ -41,11 +41,11 @@
41
41
  "prepare": "husky"
42
42
  },
43
43
  "dependencies": {
44
- "@e22m4u/js-data-schema": "~0.4.6",
45
- "@e22m4u/js-debug": "~0.3.2",
46
- "@e22m4u/js-format": "~0.2.0",
47
- "@e22m4u/js-service": "~0.4.5",
48
- "@e22m4u/js-trie-router": "~0.3.4",
44
+ "@e22m4u/js-data-schema": "~0.4.8",
45
+ "@e22m4u/js-debug": "~0.3.3",
46
+ "@e22m4u/js-format": "~0.2.1",
47
+ "@e22m4u/js-service": "~0.4.6",
48
+ "@e22m4u/js-trie-router": "~0.4.1",
49
49
  "@e22m4u/ts-reflector": "~0.1.8",
50
50
  "http-errors": "~2.0.0"
51
51
  },
@@ -57,10 +57,10 @@
57
57
  "@types/debug": "~4.1.12",
58
58
  "@types/http-errors": "~2.0.5",
59
59
  "@types/mocha": "~10.0.10",
60
- "@types/node": "~24.10.0",
60
+ "@types/node": "~24.10.1",
61
61
  "c8": "~10.1.3",
62
- "chai": "~6.2.0",
63
- "esbuild": "~0.25.12",
62
+ "chai": "~6.2.1",
63
+ "esbuild": "~0.27.0",
64
64
  "eslint": "~9.39.1",
65
65
  "eslint-config-prettier": "~10.1.8",
66
66
  "eslint-plugin-chai-expect": "~3.1.0",
@@ -71,6 +71,6 @@
71
71
  "rimraf": "~6.1.0",
72
72
  "tsx": "~4.20.6",
73
73
  "typescript": "~5.9.3",
74
- "typescript-eslint": "~8.46.3"
74
+ "typescript-eslint": "~8.46.4"
75
75
  }
76
76
  }
@@ -21,16 +21,16 @@ describe('requestContext', function () {
21
21
  it('should set the given property to target metadata', function () {
22
22
  class Target {
23
23
  method(
24
- @requestContext('res')
24
+ @requestContext('response')
25
25
  prop: unknown,
26
26
  ) {}
27
27
  }
28
28
  const res = RequestContextReflector.getMetadata(Target, 'method');
29
- expect(res.get(0)).to.be.eql({property: 'res'});
29
+ expect(res.get(0)).to.be.eql({property: 'response'});
30
30
  });
31
31
 
32
32
  describe('httpRequest', function () {
33
- it('should set the "req" property to target metadata', function () {
33
+ it('should set the "request" property to target metadata', function () {
34
34
  class Target {
35
35
  method(
36
36
  @httpRequest()
@@ -38,12 +38,12 @@ describe('requestContext', function () {
38
38
  ) {}
39
39
  }
40
40
  const res = RequestContextReflector.getMetadata(Target, 'method');
41
- expect(res.get(0)).to.be.eql({property: 'req'});
41
+ expect(res.get(0)).to.be.eql({property: 'request'});
42
42
  });
43
43
  });
44
44
 
45
45
  describe('httpResponse', function () {
46
- it('should set the "res" property to target metadata', function () {
46
+ it('should set the "response" property to target metadata', function () {
47
47
  class Target {
48
48
  method(
49
49
  @httpResponse()
@@ -51,7 +51,7 @@ describe('requestContext', function () {
51
51
  ) {}
52
52
  }
53
53
  const res = RequestContextReflector.getMetadata(Target, 'method');
54
- expect(res.get(0)).to.be.eql({property: 'res'});
54
+ expect(res.get(0)).to.be.eql({property: 'response'});
55
55
  });
56
56
  });
57
57
 
@@ -41,14 +41,14 @@ export function requestContext<T extends object>(
41
41
  * HttpRequest decorator.
42
42
  */
43
43
  export function httpRequest() {
44
- return requestContext('req');
44
+ return requestContext('request');
45
45
  }
46
46
 
47
47
  /**
48
48
  * HttpResponse decorator.
49
49
  */
50
50
  export function httpResponse() {
51
- return requestContext('res');
51
+ return requestContext('response');
52
52
  }
53
53
 
54
54
  /**
@@ -8,8 +8,8 @@ describe('RequestContextReflector', function () {
8
8
  describe('setMetadata', function () {
9
9
  it('sets a given value as target metadata', function () {
10
10
  class Target {}
11
- const md1 = {property: 'req' as const};
12
- const md2 = {property: 'res' as const};
11
+ const md1 = {property: 'request' as const};
12
+ const md2 = {property: 'response' as const};
13
13
  RequestContextReflector.setMetadata(md1, Target, 0, 'propertyKey');
14
14
  RequestContextReflector.setMetadata(md2, Target, 1, 'propertyKey');
15
15
  const res = Reflector.getOwnMetadata(
@@ -24,8 +24,8 @@ describe('RequestContextReflector', function () {
24
24
 
25
25
  it('overrides existing metadata', function () {
26
26
  class Target {}
27
- const md1 = {property: 'req' as const};
28
- const md2 = {property: 'res' as const};
27
+ const md1 = {property: 'request' as const};
28
+ const md2 = {property: 'response' as const};
29
29
  RequestContextReflector.setMetadata(md1, Target, 0, 'propertyKey');
30
30
  const res1 = Reflector.getOwnMetadata(
31
31
  REQUEST_CONTEXT_METADATA_KEY,
@@ -48,8 +48,8 @@ describe('RequestContextReflector', function () {
48
48
  describe('getMetadata', function () {
49
49
  it('returns an existing metadata of the target', function () {
50
50
  class Target {}
51
- const md1 = {property: 'req' as const};
52
- const md2 = {property: 'res' as const};
51
+ const md1 = {property: 'request' as const};
52
+ const md2 = {property: 'response' as const};
53
53
  const mdMap = new Map<number, RequestContextMetadata>([
54
54
  [0, md1],
55
55
  [1, md2],