@tramvai/module-server 6.64.1 → 6.66.1

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.
@@ -6,6 +6,7 @@ import { Module, Scope, commandLineListTokens } from '@tramvai/core';
6
6
  import { parse } from '@tinkoff/url';
7
7
  import { EventEmitter } from 'events';
8
8
  import monkeypatch from '@tinkoff/monkeypatch';
9
+ import { subscribe } from 'diagnostics_channel';
9
10
  import http from 'http';
10
11
  import https from 'https';
11
12
 
@@ -31,6 +32,7 @@ class Interceptor {
31
32
  }
32
33
  }
33
34
  const INTERCEPTOR_TOKEN = 'debugRequestsInterceptor';
35
+ const requestAdditionalDataSymbol = Symbol('request-additional-data');
34
36
  let DebugHttpRequestsModule = class DebugHttpRequestsModule {
35
37
  };
36
38
  DebugHttpRequestsModule = __decorate([
@@ -85,6 +87,23 @@ ${parsed.href || `${parsed.protocol}//${parsed.hostname}${parsed.path}`}
85
87
  });
86
88
  });
87
89
  };
90
+ subscribe('undici:request:headers', ({ request, response, }) => {
91
+ request[requestAdditionalDataSymbol] = {
92
+ responseStatusCode: response.statusCode,
93
+ };
94
+ });
95
+ subscribe('undici:request:trailers', ({ request }) => {
96
+ log.debug(`${request[requestAdditionalDataSymbol]?.responseStatusCode || 'unknown status'}
97
+ ${request.origin}${request.path}
98
+ `);
99
+ });
100
+ subscribe('undici:request:error', ({ error, request }) => {
101
+ log.error({
102
+ event: 'request-failed',
103
+ error,
104
+ url: request.origin + request.path,
105
+ });
106
+ });
88
107
  monkeypatch({ obj: http, method: 'request', handler });
89
108
  monkeypatch({ obj: https, method: 'request', handler });
90
109
  monkeypatch({ obj: http, method: 'get', handler });
@@ -10,6 +10,7 @@ var core = require('@tramvai/core');
10
10
  var url = require('@tinkoff/url');
11
11
  var EventEmitter = require('events');
12
12
  var monkeypatch = require('@tinkoff/monkeypatch');
13
+ var diagnostics_channel = require('diagnostics_channel');
13
14
  var http = require('http');
14
15
  var https = require('https');
15
16
 
@@ -41,6 +42,7 @@ class Interceptor {
41
42
  }
42
43
  }
43
44
  const INTERCEPTOR_TOKEN = 'debugRequestsInterceptor';
45
+ const requestAdditionalDataSymbol = Symbol('request-additional-data');
44
46
  exports.DebugHttpRequestsModule = class DebugHttpRequestsModule {
45
47
  };
46
48
  exports.DebugHttpRequestsModule = tslib.__decorate([
@@ -95,6 +97,23 @@ ${parsed.href || `${parsed.protocol}//${parsed.hostname}${parsed.path}`}
95
97
  });
96
98
  });
97
99
  };
100
+ diagnostics_channel.subscribe('undici:request:headers', ({ request, response, }) => {
101
+ request[requestAdditionalDataSymbol] = {
102
+ responseStatusCode: response.statusCode,
103
+ };
104
+ });
105
+ diagnostics_channel.subscribe('undici:request:trailers', ({ request }) => {
106
+ log.debug(`${request[requestAdditionalDataSymbol]?.responseStatusCode || 'unknown status'}
107
+ ${request.origin}${request.path}
108
+ `);
109
+ });
110
+ diagnostics_channel.subscribe('undici:request:error', ({ error, request }) => {
111
+ log.error({
112
+ event: 'request-failed',
113
+ error,
114
+ url: request.origin + request.path,
115
+ });
116
+ });
98
117
  monkeypatch__default["default"]({ obj: http__default["default"], method: 'request', handler });
99
118
  monkeypatch__default["default"]({ obj: https__default["default"], method: 'request', handler });
100
119
  monkeypatch__default["default"]({ obj: http__default["default"], method: 'get', handler });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-server",
3
- "version": "6.64.1",
3
+ "version": "6.66.1",
4
4
  "description": "",
5
5
  "browser": "lib/browser.js",
6
6
  "main": "lib/server.js",
@@ -28,30 +28,31 @@
28
28
  "@loadable/server": "^5.15.0",
29
29
  "@tinkoff/errors": "0.7.1",
30
30
  "@tinkoff/monkeypatch": "6.0.0",
31
- "@tinkoff/terminus": "0.5.1",
31
+ "@tinkoff/terminus": "0.5.2",
32
32
  "@tinkoff/url": "0.12.1",
33
- "@tramvai/module-cache-warmup": "6.64.1",
34
- "@tramvai/module-metrics": "6.64.1",
35
- "@tramvai/papi": "6.64.1",
33
+ "@tramvai/module-cache-warmup": "6.66.1",
34
+ "@tramvai/module-metrics": "6.66.1",
35
+ "@tramvai/papi": "6.66.1",
36
36
  "@tramvai/safe-strings": "0.9.0",
37
- "@tramvai/tokens-router": "6.64.1",
38
- "@tramvai/tokens-server": "6.64.1",
39
- "@tramvai/tokens-server-private": "6.64.1",
37
+ "@tramvai/tokens-router": "6.66.1",
38
+ "@tramvai/tokens-server": "6.66.1",
39
+ "@tramvai/tokens-server-private": "6.66.1",
40
40
  "afterframe": "^1.0.2",
41
41
  "fastify": "^4.14.1",
42
- "http-proxy-middleware": "^2.0.2"
42
+ "http-proxy-middleware": "^2.0.2",
43
+ "undici": "^7.16.0"
43
44
  },
44
45
  "peerDependencies": {
45
46
  "@tinkoff/dippy": "0.12.3",
46
47
  "@tinkoff/utils": "^2.1.2",
47
- "@tramvai/cli": "6.64.1",
48
- "@tramvai/core": "6.64.1",
49
- "@tramvai/module-common": "6.64.1",
50
- "@tramvai/module-environment": "6.64.1",
51
- "@tramvai/react": "6.64.1",
52
- "@tramvai/tokens-common": "6.64.1",
53
- "@tramvai/tokens-core-private": "6.64.1",
54
- "@tramvai/tokens-render": "6.64.1",
48
+ "@tramvai/cli": "6.66.1",
49
+ "@tramvai/core": "6.66.1",
50
+ "@tramvai/module-common": "6.66.1",
51
+ "@tramvai/module-environment": "6.66.1",
52
+ "@tramvai/react": "6.66.1",
53
+ "@tramvai/tokens-common": "6.66.1",
54
+ "@tramvai/tokens-core-private": "6.66.1",
55
+ "@tramvai/tokens-render": "6.66.1",
55
56
  "react": ">=16.14.0",
56
57
  "react-dom": ">=16.14.0",
57
58
  "tslib": "^2.4.0"