@gravity-ui/gateway 4.7.1-alpha.0 → 4.7.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.
Files changed (94) hide show
  1. package/{dist/esm → build}/components/grpc.d.ts +5 -5
  2. package/{dist/commonjs → build}/components/grpc.js +84 -94
  3. package/{dist/esm → build}/components/mixed.d.ts +4 -4
  4. package/{dist/commonjs → build}/components/mixed.js +12 -11
  5. package/{dist/commonjs → build}/components/rest.d.ts +5 -5
  6. package/{dist/commonjs → build}/components/rest.js +34 -35
  7. package/{dist/esm → build}/constants.d.ts +3 -2
  8. package/{dist/commonjs → build}/constants.js +21 -30
  9. package/{dist/commonjs → build}/index.d.ts +8 -9
  10. package/{dist/commonjs → build}/index.js +46 -35
  11. package/{dist/esm → build}/models/common.d.ts +7 -12
  12. package/{dist/esm → build}/models/context.d.ts +1 -0
  13. package/{dist/esm → build}/utils/axios.d.ts +1 -1
  14. package/{dist/commonjs → build}/utils/axios.js +4 -3
  15. package/{dist/esm → build}/utils/common.d.ts +4 -4
  16. package/{dist/commonjs → build}/utils/common.js +8 -8
  17. package/{dist/commonjs → build}/utils/create-context-api.d.ts +2 -2
  18. package/{dist/commonjs → build}/utils/create-context-api.js +6 -5
  19. package/{dist/commonjs → build}/utils/grpc-reflection.js +35 -15
  20. package/{dist/commonjs → build}/utils/grpc.d.ts +1 -1
  21. package/{dist/commonjs → build}/utils/grpc.js +11 -10
  22. package/build/utils/overrideEndpoints/index.d.ts +2 -0
  23. package/build/utils/overrideEndpoints/index.js +4 -0
  24. package/{dist/esm → build}/utils/overrideEndpoints/overrideEndpoints.d.ts +1 -1
  25. package/{dist/commonjs → build}/utils/overrideEndpoints/overrideEndpoints.js +2 -1
  26. package/{dist/commonjs → build}/utils/parse-error.d.ts +5 -5
  27. package/{dist/commonjs → build}/utils/parse-error.js +19 -19
  28. package/{dist/commonjs → build}/utils/proto-path-resolver.d.ts +1 -1
  29. package/{dist/commonjs → build}/utils/proto-path-resolver.js +15 -24
  30. package/{dist/commonjs → build}/utils/redact-sensitive-headers.d.ts +2 -1
  31. package/{dist/commonjs → build}/utils/redact-sensitive-headers.js +2 -1
  32. package/{dist/commonjs → build}/utils/typed-api.d.ts +1 -1
  33. package/{dist/commonjs → build}/utils/typed-api.js +2 -1
  34. package/{dist/commonjs → build}/utils/validate.d.ts +0 -1
  35. package/{dist/commonjs → build}/utils/validate.js +20 -24
  36. package/package.json +16 -41
  37. package/dist/commonjs/components/grpc.d.ts +0 -24
  38. package/dist/commonjs/components/mixed.d.ts +0 -11
  39. package/dist/commonjs/constants.d.ts +0 -53
  40. package/dist/commonjs/models/common.d.ts +0 -289
  41. package/dist/commonjs/models/context.d.ts +0 -22
  42. package/dist/commonjs/package.json +0 -3
  43. package/dist/commonjs/utils/axios.d.ts +0 -4
  44. package/dist/commonjs/utils/common.d.ts +0 -16
  45. package/dist/commonjs/utils/overrideEndpoints/index.d.ts +0 -2
  46. package/dist/commonjs/utils/overrideEndpoints/index.js +0 -4
  47. package/dist/commonjs/utils/overrideEndpoints/overrideEndpoints.d.ts +0 -17
  48. package/dist/commonjs/utils/package-root.d.ts +0 -1
  49. package/dist/commonjs/utils/package-root.js +0 -44
  50. package/dist/commonjs/utils/source-dir.d.ts +0 -1
  51. package/dist/commonjs/utils/source-dir.js +0 -41
  52. package/dist/esm/components/grpc.js +0 -691
  53. package/dist/esm/components/mixed.js +0 -62
  54. package/dist/esm/components/rest.d.ts +0 -8
  55. package/dist/esm/components/rest.js +0 -357
  56. package/dist/esm/constants.js +0 -82
  57. package/dist/esm/index.d.ts +0 -13
  58. package/dist/esm/index.js +0 -274
  59. package/dist/esm/models/common.js +0 -5
  60. package/dist/esm/models/context.js +0 -1
  61. package/dist/esm/models/error.d.ts +0 -12
  62. package/dist/esm/models/error.js +0 -1
  63. package/dist/esm/package.json +0 -3
  64. package/dist/esm/utils/axios.js +0 -24
  65. package/dist/esm/utils/common.js +0 -48
  66. package/dist/esm/utils/create-context-api.d.ts +0 -4
  67. package/dist/esm/utils/create-context-api.js +0 -38
  68. package/dist/esm/utils/grpc-reflection.d.ts +0 -28
  69. package/dist/esm/utils/grpc-reflection.js +0 -72
  70. package/dist/esm/utils/grpc.d.ts +0 -15
  71. package/dist/esm/utils/grpc.js +0 -72
  72. package/dist/esm/utils/overrideEndpoints/index.d.ts +0 -2
  73. package/dist/esm/utils/overrideEndpoints/index.js +0 -2
  74. package/dist/esm/utils/overrideEndpoints/overrideEndpoints.js +0 -96
  75. package/dist/esm/utils/package-root.d.ts +0 -1
  76. package/dist/esm/utils/package-root.js +0 -8
  77. package/dist/esm/utils/parse-error.d.ts +0 -30
  78. package/dist/esm/utils/parse-error.js +0 -214
  79. package/dist/esm/utils/proto-path-resolver.d.ts +0 -2
  80. package/dist/esm/utils/proto-path-resolver.js +0 -23
  81. package/dist/esm/utils/redact-sensitive-headers.d.ts +0 -3
  82. package/dist/esm/utils/redact-sensitive-headers.js +0 -12
  83. package/dist/esm/utils/source-dir.d.ts +0 -1
  84. package/dist/esm/utils/source-dir.js +0 -4
  85. package/dist/esm/utils/typed-api.d.ts +0 -2
  86. package/dist/esm/utils/typed-api.js +0 -3
  87. package/dist/esm/utils/validate.d.ts +0 -4
  88. package/dist/esm/utils/validate.js +0 -47
  89. /package/bin/{patch.cjs → patch.js} +0 -0
  90. /package/{dist/commonjs → build}/models/common.js +0 -0
  91. /package/{dist/commonjs → build}/models/context.js +0 -0
  92. /package/{dist/commonjs → build}/models/error.d.ts +0 -0
  93. /package/{dist/commonjs → build}/models/error.js +0 -0
  94. /package/{dist/commonjs → build}/utils/grpc-reflection.d.ts +0 -0
@@ -3,25 +3,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createRestAction = createRestAction;
7
6
  const querystring_1 = __importDefault(require("querystring"));
8
7
  const url_1 = __importDefault(require("url"));
9
8
  const lodash_1 = __importDefault(require("lodash"));
10
9
  const uuid_1 = require("uuid");
11
- const constants_js_1 = require("../constants.js");
12
- const axios_js_1 = require("../utils/axios.js");
13
- const common_js_1 = require("../utils/common.js");
14
- const parse_error_js_1 = require("../utils/parse-error.js");
15
- const redact_sensitive_headers_js_1 = require("../utils/redact-sensitive-headers.js");
16
- const validate_js_1 = require("../utils/validate.js");
10
+ const constants_1 = require("../constants");
11
+ const axios_1 = require("../utils/axios");
12
+ const common_1 = require("../utils/common");
13
+ const parse_error_1 = require("../utils/parse-error");
14
+ const redact_sensitive_headers_1 = require("../utils/redact-sensitive-headers");
15
+ const validate_1 = require("../utils/validate");
17
16
  function getRestResponseSize(data, ctx, ErrorConstructor) {
18
17
  var _a;
19
18
  let responseSize = 0;
20
19
  try {
21
- responseSize = constants_js_1.ECMA_STRING_SIZE * ((_a = JSON.stringify(data)) === null || _a === void 0 ? void 0 : _a.length);
20
+ responseSize = constants_1.ECMA_STRING_SIZE * ((_a = JSON.stringify(data)) === null || _a === void 0 ? void 0 : _a.length);
22
21
  }
23
22
  catch (error) {
24
- (0, common_js_1.handleError)(ErrorConstructor, error, ctx, 'Calculate response size failed');
23
+ (0, common_1.handleError)(ErrorConstructor, error, ctx, 'Calculate response size failed');
25
24
  }
26
25
  return responseSize;
27
26
  }
@@ -37,13 +36,13 @@ function getConfigSerializerFunction(config) {
37
36
  function createRestAction(endpoints, config, serviceKey, actionName, options, ErrorConstructor) {
38
37
  var _a, _b, _c, _d;
39
38
  const timeout = (_c = (_a = config === null || config === void 0 ? void 0 : config.timeout) !== null && _a !== void 0 ? _a : (_b = options === null || options === void 0 ? void 0 : options.axiosConfig) === null || _b === void 0 ? void 0 : _b.timeout) !== null && _c !== void 0 ? _c : options === null || options === void 0 ? void 0 : options.timeout;
40
- const defaultAxiosClient = (0, axios_js_1.getAxiosClient)(timeout, config === null || config === void 0 ? void 0 : config.retries, (_d = config === null || config === void 0 ? void 0 : config.axiosRetryCondition) !== null && _d !== void 0 ? _d : options === null || options === void 0 ? void 0 : options.axiosRetryCondition, options === null || options === void 0 ? void 0 : options.axiosConfig, options === null || options === void 0 ? void 0 : options.axiosInterceptors);
39
+ const defaultAxiosClient = (0, axios_1.getAxiosClient)(timeout, config === null || config === void 0 ? void 0 : config.retries, (_d = config === null || config === void 0 ? void 0 : config.axiosRetryCondition) !== null && _d !== void 0 ? _d : options === null || options === void 0 ? void 0 : options.axiosRetryCondition, options === null || options === void 0 ? void 0 : options.axiosConfig, options === null || options === void 0 ? void 0 : options.axiosInterceptors);
41
40
  /* eslint-disable complexity */
42
41
  return async function action(actionConfig) {
43
42
  var _a, _b, _c, _d, _e, _f, _g, _h;
44
43
  const { args, requestId, headers: requestHeaders, ctx: parentCtx, authArgs, userId, abortSignal, } = actionConfig;
45
44
  const debugHeaders = {};
46
- const lang = requestHeaders[constants_js_1.DEFAULT_LANG_HEADER] || constants_js_1.Lang.Ru; // header might be empty string
45
+ const lang = requestHeaders[constants_1.DEFAULT_LANG_HEADER] || constants_1.Lang.Ru; // header might be empty string
47
46
  const serviceName = (options === null || options === void 0 ? void 0 : options.serviceName) || serviceKey;
48
47
  const idempotency = config.idempotency;
49
48
  const ctx = parentCtx.create(`Gateway ${serviceName} ${actionName} [rest]`, {
@@ -56,7 +55,7 @@ function createRestAction(endpoints, config, serviceKey, actionName, options, Er
56
55
  ctx.log('Initiating request');
57
56
  const validationSchema = config.validationSchema || options.validationSchema;
58
57
  if (validationSchema) {
59
- const invalidParams = (0, validate_js_1.validateArgs)(args, validationSchema);
58
+ const invalidParams = (0, validate_1.validateArgs)(args, validationSchema);
60
59
  if (invalidParams) {
61
60
  ctx.log('Invalid params', { invalidParams });
62
61
  ctx.end();
@@ -93,31 +92,30 @@ function createRestAction(endpoints, config, serviceKey, actionName, options, Er
93
92
  },
94
93
  });
95
94
  }
96
- const actionEndpoint = (0, common_js_1.isExtendedActionEndpoint)(endpointData)
95
+ const actionEndpoint = (0, common_1.isExtendedActionEndpoint)(endpointData)
97
96
  ? endpointData.path
98
97
  : endpointData;
99
- const endpointAxiosConfig = (0, common_js_1.isExtendedRestActionEndpoint)(endpointData)
98
+ const endpointAxiosConfig = (0, common_1.isExtendedRestActionEndpoint)(endpointData)
100
99
  ? endpointData.axiosConfig
101
100
  : undefined;
102
- const pathArgs = config.validationSchema
103
- ? (0, validate_js_1.encodePathParams)(args)
104
- : (0, validate_js_1.getPathArgsProxy)(args, options.encodePathArgs);
105
- const actionPath = typeof config.path === 'function' ? config.path(pathArgs) : config.path;
101
+ const actionPath = typeof config.path === 'function'
102
+ ? config.path((0, validate_1.getPathArgsProxy)(args, options.encodePathArgs))
103
+ : config.path;
106
104
  const actionURL = actionEndpoint + actionPath;
107
105
  const parsedActionURL = url_1.default.parse(actionURL);
108
- const proxyHeaders = [...constants_js_1.DEFAULT_PROXY_HEADERS];
106
+ const proxyHeaders = [...constants_1.DEFAULT_PROXY_HEADERS];
109
107
  let actionHeaders = {
110
108
  // It's important not to lose the port in HOST header
111
109
  host: (_a = parsedActionURL.host) !== null && _a !== void 0 ? _a : undefined,
112
110
  accept: 'application/json, */*',
113
111
  'accept-encoding': 'gzip, deflate',
114
112
  'accept-language': lang,
115
- 'x-gateway-version': constants_js_1.VERSION,
113
+ 'x-gateway-version': constants_1.VERSION,
116
114
  };
117
115
  let proxyHeadersExtra;
118
116
  const proxyHeadersCaller = (proxyHeadersFunc) => {
119
117
  if (proxyHeadersExtra === undefined) {
120
- proxyHeadersExtra = (0, common_js_1.getProxyHeadersArgs)(serviceName, actionName);
118
+ proxyHeadersExtra = (0, common_1.getProxyHeadersArgs)(serviceName, actionName);
121
119
  }
122
120
  return proxyHeadersFunc(Object.assign({}, requestHeaders), 'rest', proxyHeadersExtra);
123
121
  };
@@ -158,7 +156,7 @@ function createRestAction(endpoints, config, serviceKey, actionName, options, Er
158
156
  params = await config.params(args, actionHeaders, { ctx });
159
157
  }
160
158
  catch (error) {
161
- (0, common_js_1.handleError)(ErrorConstructor, error, ctx, 'Getting config params failed');
159
+ (0, common_1.handleError)(ErrorConstructor, error, ctx, 'Getting config params failed');
162
160
  }
163
161
  }
164
162
  const { body = undefined, query = undefined, headers = actionHeaders } = params !== null && params !== void 0 ? params : {};
@@ -179,7 +177,7 @@ function createRestAction(endpoints, config, serviceKey, actionName, options, Er
179
177
  }
180
178
  }
181
179
  catch (error) {
182
- (0, common_js_1.handleError)(ErrorConstructor, error, ctx, 'Stringify request body failed');
180
+ (0, common_1.handleError)(ErrorConstructor, error, ctx, 'Stringify request body failed');
183
181
  }
184
182
  Object.assign(debugHeaders, {
185
183
  'x-api-request-method': config.method,
@@ -187,7 +185,7 @@ function createRestAction(endpoints, config, serviceKey, actionName, options, Er
187
185
  'x-api-request-body': requestBody ? requestBody : null,
188
186
  'x-api-request-lang': lang,
189
187
  'x-request-id': requestId,
190
- 'x-gateway-version': constants_js_1.VERSION,
188
+ 'x-gateway-version': constants_1.VERSION,
191
189
  });
192
190
  if (headers['content-type']) {
193
191
  debugHeaders['x-api-content-type'] = headers['content-type'];
@@ -207,10 +205,10 @@ function createRestAction(endpoints, config, serviceKey, actionName, options, Er
207
205
  const customActionTimeout = (_e = (_d = (_c = actionConfig.timeout) !== null && _c !== void 0 ? _c : config.timeout) !== null && _d !== void 0 ? _d : endpointAxiosConfig === null || endpointAxiosConfig === void 0 ? void 0 : endpointAxiosConfig.timeout) !== null && _e !== void 0 ? _e : timeout;
208
206
  if (actionConfig.timeout || endpointAxiosConfig) {
209
207
  const customActionAxiosConfig = Object.assign(Object.assign({}, ((options === null || options === void 0 ? void 0 : options.axiosConfig) || {})), (endpointAxiosConfig || {}));
210
- axiosClient = (0, axios_js_1.getAxiosClient)(customActionTimeout, config === null || config === void 0 ? void 0 : config.retries, options.axiosRetryCondition, customActionAxiosConfig, options === null || options === void 0 ? void 0 : options.axiosInterceptors);
208
+ axiosClient = (0, axios_1.getAxiosClient)(customActionTimeout, config === null || config === void 0 ? void 0 : config.retries, options.axiosRetryCondition, customActionAxiosConfig, options === null || options === void 0 ? void 0 : options.axiosInterceptors);
211
209
  }
212
- headers['x-request-timeout'] = customActionTimeout !== null && customActionTimeout !== void 0 ? customActionTimeout : constants_js_1.DEFAULT_TIMEOUT;
213
- ctx.log('Starting request', { debugHeaders: (0, common_js_1.sanitizeDebugHeaders)(debugHeaders) });
210
+ headers['x-request-timeout'] = customActionTimeout !== null && customActionTimeout !== void 0 ? customActionTimeout : constants_1.DEFAULT_TIMEOUT;
211
+ ctx.log('Starting request', { debugHeaders: (0, common_1.sanitizeDebugHeaders)(debugHeaders) });
214
212
  const requestData = {
215
213
  timestamp: startRequestTime,
216
214
  service: serviceName,
@@ -286,7 +284,7 @@ function createRestAction(endpoints, config, serviceKey, actionName, options, Er
286
284
  ctx.log('Transformed response data');
287
285
  }
288
286
  catch (error) {
289
- (0, common_js_1.handleError)(ErrorConstructor, error, ctx, 'Transform response data failed');
287
+ (0, common_1.handleError)(ErrorConstructor, error, ctx, 'Transform response data failed');
290
288
  }
291
289
  }
292
290
  if (config.proxyResponseHeaders) {
@@ -304,12 +302,12 @@ function createRestAction(endpoints, config, serviceKey, actionName, options, Er
304
302
  }
305
303
  }
306
304
  if (options === null || options === void 0 ? void 0 : options.sendStats) {
307
- options.sendStats(Object.assign(Object.assign({}, requestData), { responseSize: getRestResponseSize(response === null || response === void 0 ? void 0 : response.data, ctx, ErrorConstructor), restStatus: 200 }), (0, redact_sensitive_headers_js_1.redactSensitiveHeaders)(parentCtx, headers), parentCtx, { debugHeaders: (0, common_js_1.sanitizeDebugHeaders)(debugHeaders) });
305
+ options.sendStats(Object.assign(Object.assign({}, requestData), { responseSize: getRestResponseSize(response === null || response === void 0 ? void 0 : response.data, ctx, ErrorConstructor), restStatus: 200 }), (0, redact_sensitive_headers_1.redactSensitiveHeaders)(parentCtx, headers), parentCtx, { debugHeaders: (0, common_1.sanitizeDebugHeaders)(debugHeaders) });
308
306
  }
309
307
  else {
310
308
  ctx.stats(Object.assign(Object.assign({}, requestData), { responseStatus: 200 }));
311
309
  }
312
- ctx.log('Request completed', { debugHeaders: (0, common_js_1.sanitizeDebugHeaders)(debugHeaders) });
310
+ ctx.log('Request completed', { debugHeaders: (0, common_1.sanitizeDebugHeaders)(debugHeaders) });
313
311
  ctx.end();
314
312
  return { responseData: response.data, responseHeaders, debugHeaders };
315
313
  }
@@ -329,20 +327,20 @@ function createRestAction(endpoints, config, serviceKey, actionName, options, Er
329
327
  ctx.log('Transformed response error');
330
328
  }
331
329
  catch (error) {
332
- (0, common_js_1.handleError)(ErrorConstructor, error, ctx, 'Transform response error failed');
330
+ (0, common_1.handleError)(ErrorConstructor, error, ctx, 'Transform response error failed');
333
331
  }
334
332
  }
335
333
  if (!parsedError) {
336
334
  try {
337
- parsedError = (0, parse_error_js_1.parseRestError)(error, lang);
335
+ parsedError = (0, parse_error_1.parseRestError)(error, lang);
338
336
  }
339
337
  catch (error) {
340
- (0, common_js_1.handleError)(ErrorConstructor, error, ctx, 'Error parse rest error');
338
+ (0, common_1.handleError)(ErrorConstructor, error, ctx, 'Error parse rest error');
341
339
  }
342
340
  }
343
341
  const responseStatus = lodash_1.default.get(parsedError, 'status') || lodash_1.default.get(error, 'status', 500);
344
342
  if (options === null || options === void 0 ? void 0 : options.sendStats) {
345
- options.sendStats(Object.assign(Object.assign({}, requestData), { responseSize: getRestResponseSize((_h = error === null || error === void 0 ? void 0 : error.response) === null || _h === void 0 ? void 0 : _h.data, ctx, ErrorConstructor), restStatus: responseStatus, userId }), (0, redact_sensitive_headers_js_1.redactSensitiveHeaders)(parentCtx, headers), parentCtx, { debugHeaders: (0, common_js_1.sanitizeDebugHeaders)(debugHeaders) });
343
+ options.sendStats(Object.assign(Object.assign({}, requestData), { responseSize: getRestResponseSize((_h = error === null || error === void 0 ? void 0 : error.response) === null || _h === void 0 ? void 0 : _h.data, ctx, ErrorConstructor), restStatus: responseStatus, userId }), (0, redact_sensitive_headers_1.redactSensitiveHeaders)(parentCtx, headers), parentCtx, { debugHeaders: (0, common_1.sanitizeDebugHeaders)(debugHeaders) });
346
344
  }
347
345
  else {
348
346
  ctx.stats(Object.assign(Object.assign({}, requestData), { responseStatus }));
@@ -351,7 +349,7 @@ function createRestAction(endpoints, config, serviceKey, actionName, options, Er
351
349
  actionURL,
352
350
  parsedError,
353
351
  serviceName,
354
- debugHeaders: (0, common_js_1.sanitizeDebugHeaders)(debugHeaders),
352
+ debugHeaders: (0, common_1.sanitizeDebugHeaders)(debugHeaders),
355
353
  });
356
354
  ctx.end();
357
355
  return Promise.reject({
@@ -361,3 +359,4 @@ function createRestAction(endpoints, config, serviceKey, actionName, options, Er
361
359
  }
362
360
  };
363
361
  }
362
+ exports.default = createRestAction;
@@ -1,5 +1,5 @@
1
- import * as http from 'http';
2
- import * as https from 'https';
1
+ import http from 'http';
2
+ import https from 'https';
3
3
  import * as grpc from '@grpc/grpc-js';
4
4
  export declare const VERSION: any;
5
5
  export declare enum Lang {
@@ -51,3 +51,4 @@ export declare const DEFAULT_VALIDATION_SCHEMA: {
51
51
  };
52
52
  };
53
53
  export declare const AXIOS_RETRY_NAMESPACE = "axios-retry";
54
+ export declare const GATEWAY_INVALID_PARAM_VALUE = "GATEWAY_INVALID_PARAM_VALUE";
@@ -15,32 +15,22 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
35
28
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.AXIOS_RETRY_NAMESPACE = exports.DEFAULT_VALIDATION_SCHEMA = exports.RECREATE_SERVICE_CODES = exports.RETRYABLE_STATUS_CODES = exports.ANY_ACTION_SYMBOL = exports.ECMA_STRING_SIZE = exports.DEFAULT_PROTO_LOADER_OPTIONS = exports.DEFAULT_GRPC_OPTIONS = exports.DEFAULT_AXIOS_OPTIONS = exports.DEFAULT_PROXY_HEADERS = exports.DEFAULT_LANG_HEADER = exports.DEFAULT_TIMEOUT = exports.Lang = exports.VERSION = void 0;
37
- const fs = __importStar(require("fs"));
38
- const http = __importStar(require("http"));
39
- const https = __importStar(require("https"));
40
- const path = __importStar(require("path"));
29
+ exports.GATEWAY_INVALID_PARAM_VALUE = exports.AXIOS_RETRY_NAMESPACE = exports.DEFAULT_VALIDATION_SCHEMA = exports.RECREATE_SERVICE_CODES = exports.RETRYABLE_STATUS_CODES = exports.ANY_ACTION_SYMBOL = exports.ECMA_STRING_SIZE = exports.DEFAULT_PROTO_LOADER_OPTIONS = exports.DEFAULT_GRPC_OPTIONS = exports.DEFAULT_AXIOS_OPTIONS = exports.DEFAULT_PROXY_HEADERS = exports.DEFAULT_LANG_HEADER = exports.DEFAULT_TIMEOUT = exports.Lang = exports.VERSION = void 0;
30
+ const http_1 = __importDefault(require("http"));
31
+ const https_1 = __importDefault(require("https"));
41
32
  const grpc = __importStar(require("@grpc/grpc-js"));
42
- const package_root_js_1 = require("./utils/package-root.js");
43
- const packageJson = JSON.parse(fs.readFileSync(path.resolve(package_root_js_1.packageRoot, 'package.json'), 'utf-8'));
33
+ const packageJson = require('../package.json');
44
34
  exports.VERSION = packageJson.version;
45
35
  var Lang;
46
36
  (function (Lang) {
@@ -57,18 +47,18 @@ exports.DEFAULT_PROXY_HEADERS = [
57
47
  'x-forwarded-for',
58
48
  ];
59
49
  exports.DEFAULT_AXIOS_OPTIONS = {
60
- maxContentLength: 1024 * 1024 * 100, // 100 Mb
61
- httpAgent: new http.Agent({
62
- // https://github.com/nodejs/node/blob/master/lib/_http_agent.js#L233
50
+ maxContentLength: 1024 * 1024 * 100,
51
+ httpAgent: new http_1.default.Agent({
52
+ //@ts-ignore https://github.com/nodejs/node/blob/master/lib/_http_agent.js#L233
63
53
  family: 6,
64
54
  }),
65
- httpsAgent: new https.Agent({
66
- // https://github.com/nodejs/node/blob/master/lib/_http_agent.js#L233
55
+ httpsAgent: new https_1.default.Agent({
56
+ //@ts-ignore https://github.com/nodejs/node/blob/master/lib/_http_agent.js#L233
67
57
  family: 6,
68
58
  }),
69
59
  };
70
60
  exports.DEFAULT_GRPC_OPTIONS = {
71
- 'grpc.max_receive_message_length': 1024 * 1024 * 100, // 100 Mb
61
+ 'grpc.max_receive_message_length': 1024 * 1024 * 100,
72
62
  'grpc.keepalive_time_ms': 10000,
73
63
  'grpc.keepalive_timeout_ms': 1000,
74
64
  'grpc.keepalive_permit_without_calls': 1,
@@ -116,3 +106,4 @@ exports.DEFAULT_VALIDATION_SCHEMA = {
116
106
  },
117
107
  };
118
108
  exports.AXIOS_RETRY_NAMESPACE = 'axios-retry';
109
+ exports.GATEWAY_INVALID_PARAM_VALUE = 'GATEWAY_INVALID_PARAM_VALUE';
@@ -1,13 +1,12 @@
1
- import { ApiWithRoot, GatewayConfig, GatewayRequest, GatewayResponse, SchemasByScope } from './models/common.js';
2
- import { GatewayContext } from './models/context.js';
3
- export * from './utils/typed-api.js';
4
- export * from './utils/grpc-reflection.js';
5
- export { isRetryableGrpcError } from './utils/grpc.js';
6
- export * from './models/common.js';
7
- export * from './models/context.js';
8
- export * from './models/error.js';
1
+ import { ApiWithRoot, GatewayConfig, GatewayRequest, GatewayResponse, SchemasByScope } from './models/common';
2
+ import { GatewayContext } from './models/context';
3
+ export * from './utils/typed-api';
4
+ export * from './utils/grpc-reflection';
5
+ export { isRetryableGrpcError } from './utils/grpc';
6
+ export * from './models/common';
7
+ export * from './models/context';
8
+ export * from './models/error';
9
9
  export declare function getGatewayControllers<TSchema extends SchemasByScope, Context extends GatewayContext, Req extends GatewayRequest<Context>, Res extends GatewayResponse>(schemasByScope: TSchema, config: GatewayConfig<Context, Req, Res>): {
10
10
  controller: (req: Req, res: Res) => Promise<any>;
11
11
  api: ApiWithRoot<TSchema, Context, Req, Res>;
12
12
  };
13
- export default getGatewayControllers;
@@ -10,6 +10,18 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
12
  }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
13
25
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
26
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
27
  };
@@ -17,22 +29,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
29
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
30
  };
19
31
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.isRetryableGrpcError = void 0;
21
- exports.getGatewayControllers = getGatewayControllers;
32
+ exports.getGatewayControllers = exports.isRetryableGrpcError = void 0;
22
33
  const lodash_1 = __importDefault(require("lodash"));
23
- const grpc_js_1 = require("./components/grpc.js");
24
- const mixed_js_1 = require("./components/mixed.js");
25
- const rest_js_1 = require("./components/rest.js");
26
- const constants_js_1 = require("./constants.js");
27
- const common_js_1 = require("./utils/common.js");
28
- const overrideEndpoints_js_1 = require("./utils/overrideEndpoints/overrideEndpoints.js");
29
- __exportStar(require("./utils/typed-api.js"), exports);
30
- __exportStar(require("./utils/grpc-reflection.js"), exports);
31
- var grpc_js_2 = require("./utils/grpc.js");
32
- Object.defineProperty(exports, "isRetryableGrpcError", { enumerable: true, get: function () { return grpc_js_2.isRetryableGrpcError; } });
33
- __exportStar(require("./models/common.js"), exports);
34
- __exportStar(require("./models/context.js"), exports);
35
- __exportStar(require("./models/error.js"), exports);
34
+ const grpc_1 = __importStar(require("./components/grpc"));
35
+ const mixed_1 = require("./components/mixed");
36
+ const rest_1 = __importDefault(require("./components/rest"));
37
+ const constants_1 = require("./constants");
38
+ const common_1 = require("./utils/common");
39
+ const overrideEndpoints_1 = __importDefault(require("./utils/overrideEndpoints"));
40
+ __exportStar(require("./utils/typed-api"), exports);
41
+ __exportStar(require("./utils/grpc-reflection"), exports);
42
+ var grpc_2 = require("./utils/grpc");
43
+ Object.defineProperty(exports, "isRetryableGrpcError", { enumerable: true, get: function () { return grpc_2.isRetryableGrpcError; } });
44
+ __exportStar(require("./models/common"), exports);
45
+ __exportStar(require("./models/context"), exports);
46
+ __exportStar(require("./models/error"), exports);
36
47
  function isMixedActionConfig(actionConfig) {
37
48
  return typeof actionConfig === 'function';
38
49
  }
@@ -58,11 +69,11 @@ function createApiAction(schema, config, serviceKey, actionName, api, grpcContex
58
69
  const env = config.env || '';
59
70
  if (isMixedActionConfig(action)) {
60
71
  const resultServiceName = serviceName || serviceKey;
61
- return (0, mixed_js_1.createMixedAction)(action, api, resultServiceName, actionName, { config, grpcContext }, config.ErrorConstructor);
72
+ return (0, mixed_1.createMixedAction)(action, api, resultServiceName, actionName, { config, grpcContext }, config.ErrorConstructor);
62
73
  }
63
74
  const endpointsConfig = lodash_1.default.get(serviceSchema.endpoints, [installation, env]);
64
75
  if (isRestActionConfig(action)) {
65
- return (0, rest_js_1.createRestAction)(endpointsConfig, action, serviceKey, actionName, {
76
+ return (0, rest_1.default)(endpointsConfig, action, serviceKey, actionName, {
66
77
  serviceName,
67
78
  timeout: config.timeout,
68
79
  sendStats: config.sendStats,
@@ -77,7 +88,7 @@ function createApiAction(schema, config, serviceKey, actionName, api, grpcContex
77
88
  }, config.ErrorConstructor);
78
89
  }
79
90
  const grpcRecreateService = (_a = config.grpcRecreateService) !== null && _a !== void 0 ? _a : true;
80
- return (0, grpc_js_1.createGrpcAction)(grpcContext, endpointsConfig, action, serviceKey, actionName, {
91
+ return (0, grpc_1.default)(grpcContext, endpointsConfig, action, serviceKey, actionName, {
81
92
  serviceName,
82
93
  timeout: config.timeout,
83
94
  sendStats: config.sendStats,
@@ -154,8 +165,8 @@ function generateGatewayApiController(schemasByScope, Api, config, controllerAct
154
165
  });
155
166
  }
156
167
  if (controllerActions &&
157
- lodash_1.default.get(controllerActions, [scope]) !== constants_js_1.ANY_ACTION_SYMBOL &&
158
- lodash_1.default.get(controllerActions, [scope, service]) !== constants_js_1.ANY_ACTION_SYMBOL &&
168
+ lodash_1.default.get(controllerActions, [scope]) !== constants_1.ANY_ACTION_SYMBOL &&
169
+ lodash_1.default.get(controllerActions, [scope, service]) !== constants_1.ANY_ACTION_SYMBOL &&
159
170
  !lodash_1.default.get(controllerActions, [scope, service, action])) {
160
171
  return res.status(404).send({
161
172
  status: 404,
@@ -177,7 +188,7 @@ function generateGatewayApiController(schemasByScope, Api, config, controllerAct
177
188
  await onBeforeAction(req, res, scope, service, action, actionConfig);
178
189
  }
179
190
  catch (error) {
180
- (0, common_js_1.handleError)(config.ErrorConstructor, error, req.ctx, 'Before action handler error');
191
+ (0, common_1.handleError)(config.ErrorConstructor, error, req.ctx, 'Before action handler error');
181
192
  throw { error, debugHeaders: {} };
182
193
  }
183
194
  }
@@ -239,25 +250,25 @@ function getGatewayControllers(schemasByScope, config) {
239
250
  if (process.env.GATEWAY_ENDPOINTS_OVERRIDES) {
240
251
  try {
241
252
  // eslint-disable-next-line no-param-reassign
242
- schemasByScope = (0, overrideEndpoints_js_1.overrideEndpoints)(schemasByScope, JSON.parse(process.env.GATEWAY_ENDPOINTS_OVERRIDES), config.installation, config.env);
253
+ schemasByScope = (0, overrideEndpoints_1.default)(schemasByScope, JSON.parse(process.env.GATEWAY_ENDPOINTS_OVERRIDES), config.installation, config.env);
243
254
  }
244
255
  catch (err) {
245
256
  console.warn('Error when parse GATEWAY_ENDPOINTS_OVERRIDES', err);
246
257
  }
247
258
  }
248
- const credentials = (0, grpc_js_1.getCredentialsMap)(config.caCertificatePath);
249
- for (const scope of (0, common_js_1.getKeys)(schemasByScope)) {
250
- apiByScope[scope] = generateGatewayApi(schemasByScope[scope], config, { root: (0, grpc_js_1.createRoot)(config.includeProtoRoots), credentials }, apiByScope);
259
+ const credentials = (0, grpc_1.getCredentialsMap)(config.caCertificatePath);
260
+ for (const scope of (0, common_1.getKeys)(schemasByScope)) {
261
+ apiByScope[scope] = generateGatewayApi(schemasByScope[scope], config, { root: (0, grpc_1.createRoot)(config.includeProtoRoots), credentials }, apiByScope);
251
262
  }
252
263
  const api = Object.assign({}, apiByScope);
253
264
  const rootScope = apiByScope.root;
254
265
  if (rootScope) {
255
- for (const rootService of (0, common_js_1.getKeys)(rootScope)) {
266
+ for (const rootService of (0, common_1.getKeys)(rootScope)) {
256
267
  const curScope = (_a = api[rootService]) !== null && _a !== void 0 ? _a : {};
257
- for (const rootAction of (0, common_js_1.getKeys)(rootScope[rootService])) {
268
+ for (const rootAction of (0, common_1.getKeys)(rootScope[rootService])) {
258
269
  const rootServiceFunc = rootScope[rootService][rootAction];
259
270
  if (curScope[rootAction]) {
260
- for (const curScopeAction of (0, common_js_1.getKeys)(curScope[rootAction])) {
271
+ for (const curScopeAction of (0, common_1.getKeys)(curScope[rootAction])) {
261
272
  rootServiceFunc[curScopeAction] = curScope[rootAction][curScopeAction];
262
273
  }
263
274
  }
@@ -270,15 +281,15 @@ function getGatewayControllers(schemasByScope, config) {
270
281
  ? config.actions.reduce((acc, item) => {
271
282
  const [scope, service, action] = item.split('.');
272
283
  // Ignore option '*' for scopes
273
- if (scope === constants_js_1.ANY_ACTION_SYMBOL) {
284
+ if (scope === constants_1.ANY_ACTION_SYMBOL) {
274
285
  return acc;
275
286
  }
276
- if (service === constants_js_1.ANY_ACTION_SYMBOL) {
277
- lodash_1.default.set(acc, [scope], constants_js_1.ANY_ACTION_SYMBOL);
287
+ if (service === constants_1.ANY_ACTION_SYMBOL) {
288
+ lodash_1.default.set(acc, [scope], constants_1.ANY_ACTION_SYMBOL);
278
289
  }
279
- else if (action === constants_js_1.ANY_ACTION_SYMBOL) {
280
- if (acc[scope] !== constants_js_1.ANY_ACTION_SYMBOL) {
281
- lodash_1.default.set(acc, [scope, service], constants_js_1.ANY_ACTION_SYMBOL);
290
+ else if (action === constants_1.ANY_ACTION_SYMBOL) {
291
+ if (acc[scope] !== constants_1.ANY_ACTION_SYMBOL) {
292
+ lodash_1.default.set(acc, [scope, service], constants_1.ANY_ACTION_SYMBOL);
282
293
  }
283
294
  }
284
295
  else {
@@ -293,4 +304,4 @@ function getGatewayControllers(schemasByScope, config) {
293
304
  api,
294
305
  };
295
306
  }
296
- exports.default = getGatewayControllers;
307
+ exports.getGatewayControllers = getGatewayControllers;
@@ -1,14 +1,15 @@
1
+ /// <reference types="node" />
1
2
  import { IncomingHttpHeaders } from 'http';
2
3
  import { ClientDuplexStream, ClientReadableStream, ClientWritableStream, type ServiceError } from '@grpc/grpc-js';
3
- import type { HandlerType } from '@grpc/grpc-js/build/src/server-call.js';
4
+ import { HandlerType } from '@grpc/grpc-js/build/src/server-call';
4
5
  import { AxiosInterceptorManager, AxiosRequestConfig, AxiosResponse, InternalAxiosRequestConfig } from 'axios';
5
6
  import { IAxiosRetryConfig } from 'axios-retry';
6
7
  import type { Request, Response } from 'express';
7
- import protobufjs from 'protobufjs';
8
- import type { GrpcContext } from '../components/grpc.js';
9
- import { Lang } from '../constants.js';
10
- import { GatewayContext } from './context.js';
11
- import { AppErrorConstructor } from './error.js';
8
+ import * as protobufjs from 'protobufjs';
9
+ import type { GrpcContext } from '../components/grpc';
10
+ import { Lang } from '../constants';
11
+ import { GatewayContext } from './context';
12
+ import { AppErrorConstructor } from './error';
12
13
  export interface GatewayRequest<Context extends GatewayContext> extends Request {
13
14
  id: string;
14
15
  ctx: Context;
@@ -216,18 +217,12 @@ export interface GatewayActionUnaryResponse<TAction> extends GatewayActionHeader
216
217
  }
217
218
  export interface GatewayActionClientStreamResponse<TAction> extends GatewayActionHeaders {
218
219
  stream: ClientWritableStream<ApiActionResponseType<TAction>>;
219
- responseData?: never;
220
- responseHeaders?: never;
221
220
  }
222
221
  export interface GatewayActionServerStreamResponse<TAction> extends GatewayActionHeaders {
223
222
  stream: ClientReadableStream<ApiActionResponseType<TAction>>;
224
- responseData?: never;
225
- responseHeaders?: never;
226
223
  }
227
224
  export interface GatewayActionDuplexStreamResponse<TAction> extends GatewayActionHeaders {
228
225
  stream: ClientDuplexStream<ApiActionParams<TAction>, ApiActionResponseType<TAction>>;
229
- responseData?: never;
230
- responseHeaders?: never;
231
226
  }
232
227
  export type GatewayActionResponseData<Context extends GatewayContext, Req extends GatewayRequest<Context>, Res extends GatewayResponse, TAction extends ApiServiceActionConfig<Context, Req, Res, unknown, unknown, unknown>> = TAction extends ApiServiceGrpcActionConfig<Context, unknown, unknown, unknown> ? TAction['type'] extends 'clientStream' ? GatewayActionClientStreamResponse<TAction> : TAction['type'] extends 'serverStream' ? GatewayActionServerStreamResponse<TAction> : TAction['type'] extends 'bidi' ? GatewayActionDuplexStreamResponse<TAction> : GatewayActionUnaryResponse<TAction> : GatewayActionUnaryResponse<TAction>;
233
228
  type GatewayAction<Context extends GatewayContext, Req extends GatewayRequest<Context>, Res extends GatewayResponse, TAction extends ApiServiceActionConfig<Context, Req, Res, unknown, unknown, unknown>> = undefined extends ApiActionParams<TAction> ? (params?: ApiActionConfig<Context, ApiActionParams<TAction>, ApiActionResponseType<TAction>>) => Promise<GatewayActionResponseData<Context, Req, Res, TAction>> : (params: ApiActionConfig<Context, ApiActionParams<TAction>, ApiActionResponseType<TAction>>) => Promise<GatewayActionResponseData<Context, Req, Res, TAction>>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import { IncomingHttpHeaders } from 'http';
2
3
  export interface GatewayContextParams {
3
4
  tags?: Record<string, string | number | boolean | undefined>;
@@ -1,4 +1,4 @@
1
1
  import { AxiosRequestConfig } from 'axios';
2
2
  import { IAxiosRetryConfig } from 'axios-retry';
3
- import { AxiosInterceptorsConfig } from '../models/common.js';
3
+ import { AxiosInterceptorsConfig } from '../models/common';
4
4
  export declare function getAxiosClient(timeout?: number, retries?: number, customRetryCondition?: IAxiosRetryConfig['retryCondition'], axiosConfig?: AxiosRequestConfig, { request: reqInterceptors, response: resInterceptors }?: AxiosInterceptorsConfig): import("axios").AxiosInstance;
@@ -3,12 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getAxiosClient = getAxiosClient;
6
+ exports.getAxiosClient = void 0;
7
7
  const axios_1 = __importDefault(require("axios"));
8
8
  const axios_retry_1 = __importDefault(require("axios-retry"));
9
9
  const lodash_1 = __importDefault(require("lodash"));
10
- const constants_js_1 = require("../constants.js");
11
- function getAxiosClient(timeout = constants_js_1.DEFAULT_TIMEOUT, retries = 0, customRetryCondition, axiosConfig = constants_js_1.DEFAULT_AXIOS_OPTIONS, { request: reqInterceptors, response: resInterceptors } = {}) {
10
+ const constants_1 = require("../constants");
11
+ function getAxiosClient(timeout = constants_1.DEFAULT_TIMEOUT, retries = 0, customRetryCondition, axiosConfig = constants_1.DEFAULT_AXIOS_OPTIONS, { request: reqInterceptors, response: resInterceptors } = {}) {
12
12
  const client = axios_1.default.create(Object.assign(Object.assign({}, axiosConfig), { timeout }));
13
13
  reqInterceptors === null || reqInterceptors === void 0 ? void 0 : reqInterceptors.forEach(({ callback, errorCallback }) => client.interceptors.request.use(callback, errorCallback));
14
14
  resInterceptors === null || resInterceptors === void 0 ? void 0 : resInterceptors.forEach(({ callback, errorCallback }) => client.interceptors.response.use(callback, errorCallback));
@@ -28,3 +28,4 @@ function getAxiosClient(timeout = constants_js_1.DEFAULT_TIMEOUT, retries = 0, c
28
28
  });
29
29
  return client;
30
30
  }
31
+ exports.getAxiosClient = getAxiosClient;
@@ -1,8 +1,8 @@
1
1
  import * as grpc from '@grpc/grpc-js';
2
2
  import _ from 'lodash';
3
- import { ActionEndpoint, ApiServiceGrpcActionConfig, ExtendedActionEndpoint, ExtendedGrpcActionEndpoint, ExtendedRestActionEndpoint, Headers, ProxyHeadersFunctionExtra } from '../models/common.js';
4
- import { Dict, GatewayContext } from '../models/context.js';
5
- import { AppErrorConstructor } from '../models/error.js';
3
+ import { ActionEndpoint, ApiServiceGrpcActionConfig, ExtendedActionEndpoint, ExtendedGrpcActionEndpoint, ExtendedRestActionEndpoint, Headers, ProxyHeadersFunctionExtra } from '../models/common';
4
+ import { Dict, GatewayContext } from '../models/context';
5
+ import { AppErrorConstructor } from '../models/error';
6
6
  export declare function isExtendedActionEndpoint(endpoint: ActionEndpoint): endpoint is ExtendedActionEndpoint;
7
7
  export declare function isExtendedGrpcActionEndpoint(endpoint: ActionEndpoint): endpoint is ExtendedGrpcActionEndpoint;
8
8
  export declare function isExtendedRestActionEndpoint(endpoint: ActionEndpoint): endpoint is ExtendedRestActionEndpoint;
@@ -13,4 +13,4 @@ export declare function getKeys<T extends object>(obj: T): (keyof T)[];
13
13
  export declare function sanitizeDebugHeaders(debugHeaders: Headers): _.Omit<Headers, "x-api-request-body">;
14
14
  export declare function getHeadersFromMetadata(metadata: Record<string, grpc.MetadataValue[]>, prefix?: string): Record<string, string>;
15
15
  export declare function handleError<Context extends GatewayContext>(ErrorConstructor: AppErrorConstructor, error: unknown, ctx: Context, message: string, extra?: Dict): void;
16
- export declare const getProxyHeadersArgs: <Context extends GatewayContext>(serviceName: string, actionName: string, grpcConfig?: ApiServiceGrpcActionConfig<Context, any, any>) => ProxyHeadersFunctionExtra;
16
+ export declare const getProxyHeadersArgs: <Context extends GatewayContext>(serviceName: string, actionName: string, grpcConfig?: ApiServiceGrpcActionConfig<Context, any, any> | undefined) => ProxyHeadersFunctionExtra;