@gravity-ui/gateway 4.10.1 → 4.10.3

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.
@@ -157,6 +157,7 @@ const reflectionServiceInstancesMap = {};
157
157
  function clearInstancesCache(service, instancesMap, cachePath, closeTimeout, ctx) {
158
158
  const cachedService = lodash_1.default.get(instancesMap, cachePath);
159
159
  if (cachedService !== service) {
160
+ ctx.log(`Service client not matched cached service for cachePath '${cachePath}'`);
160
161
  return;
161
162
  }
162
163
  // Remove cached service instance
@@ -677,7 +678,7 @@ function createGrpcAction({ root, credentials }, endpoints, config, serviceKey,
677
678
  ((_b = (_a = options.grpcRetryCondition) === null || _a === void 0 ? void 0 : _a.call(options, error)) !== null && _b !== void 0 ? _b : (0, grpc_1.isRetryableGrpcError)(error));
678
679
  if (shouldRecreateService) {
679
680
  ctx.log(`Service client for ${config.protoKey} is going to be re-created`);
680
- recreateService(service, timeout * 1.5, ctx, args);
681
+ recreateService(service, 5000, ctx, args);
681
682
  }
682
683
  if (shouldRetry) {
683
684
  (0, common_2.handleError)(ErrorConstructor, error, ctx, `Request failed, retrying ${retries--} more times`, {
@@ -99,7 +99,7 @@ function createRestAction(endpoints, config, serviceKey, actionName, options, Er
99
99
  ? endpointData.axiosConfig
100
100
  : undefined;
101
101
  const actionPath = typeof config.path === 'function'
102
- ? config.path((0, validate_1.getPathArgsProxy)(args, options.encodePathArgs))
102
+ ? config.path((0, validate_1.getPathArgsProxy)(args, options.encodePathArgs, !validationSchema))
103
103
  : config.path;
104
104
  const actionURL = actionEndpoint + actionPath;
105
105
  const parsedActionURL = url_1.default.parse(actionURL);
@@ -1,3 +1,3 @@
1
1
  export declare function validateArgs<TParams>(args: TParams, schema: object): string | false;
2
2
  export declare function getPathParam(value: string): string;
3
- export declare function getPathArgsProxy<TParams extends {}>(args: TParams, encodePathArgs?: boolean): TParams;
3
+ export declare function getPathArgsProxy<TParams extends {}>(args: TParams, encodePathArgs?: boolean, validatePathArgs?: boolean): TParams;
@@ -16,8 +16,7 @@ function getPathParam(value) {
16
16
  return /^((?!(\.\.|\?|#|\\|\/)).)*$/i.test(value) ? value : constants_1.GATEWAY_INVALID_PARAM_VALUE;
17
17
  }
18
18
  exports.getPathParam = getPathParam;
19
- function getPathArgsProxy(args, encodePathArgs) {
20
- const encodePathArgsVal = encodePathArgs !== null && encodePathArgs !== void 0 ? encodePathArgs : true;
19
+ function getPathArgsProxy(args, encodePathArgs = true, validatePathArgs = true) {
21
20
  if (!args) {
22
21
  return args;
23
22
  }
@@ -28,11 +27,11 @@ function getPathArgsProxy(args, encodePathArgs) {
28
27
  return value;
29
28
  }
30
29
  if (typeof value === 'object' && value !== null) {
31
- return getPathArgsProxy(value);
30
+ return getPathArgsProxy(value, encodePathArgs, validatePathArgs);
32
31
  }
33
32
  if (typeof value === 'string') {
34
- const pathParam = getPathParam(value);
35
- if (encodePathArgsVal) {
33
+ const pathParam = validatePathArgs ? getPathParam(value) : value;
34
+ if (encodePathArgs) {
36
35
  try {
37
36
  return encodeURIComponent(pathParam);
38
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/gateway",
3
- "version": "4.10.1",
3
+ "version": "4.10.3",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "main": "build/index.js",