@mimik/api-helper 1.0.0 → 1.0.2

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.
package/index.js CHANGED
@@ -2,7 +2,7 @@ const { OpenAPIBackend } = require('openapi-backend');
2
2
  const fs = require('fs');
3
3
  const pathLib = require('path');
4
4
  const yaml = require('js-yaml');
5
- const _ = require('lodash');
5
+ const compact = require('lodash.compact');
6
6
  const SwaggerClient = require('swagger-client');
7
7
  const { Base64 } = require('js-base64');
8
8
 
@@ -421,7 +421,7 @@ const extractProperties = (apiDefinition, controllersDirectory, buildDirectory,
421
421
  */
422
422
  const setupServerFiles = (apiFilename, controllersDirectory, buildDirectory, correlationId, options) => getAPIFile(apiFilename, correlationId, options)
423
423
  .then((apiDefinition) => {
424
- const existingSecuritySchemes = _.compact(validateSecuritySchemes(apiDefinition, correlationId));
424
+ const existingSecuritySchemes = compact(validateSecuritySchemes(apiDefinition, correlationId));
425
425
 
426
426
  extractProperties(apiDefinition, controllersDirectory, buildDirectory, correlationId);
427
427
  return { apiDefinition, apiFilename, existingSecuritySchemes };
@@ -33,17 +33,17 @@ const saveProperties = (extractResult, buildDirectory, controllersDirectoryName,
33
33
  controllers.forEach((controller) => {
34
34
  itemToSave = '';
35
35
  extractResult[controller].forEach((operationId) => {
36
- itemToSave = `${itemToSave} ${operationId},\n`;
36
+ itemToSave += ` ${operationId},\n`;
37
37
  operationIds.push(operationId);
38
38
  });
39
- stringToSave = `${stringToSave}const {\n${itemToSave}} = require('../${controllersDirectoryName}/${controller}');\n`;
39
+ stringToSave += `const {\n${itemToSave}} = require('../${controllersDirectoryName}/${controller}');\n`;
40
40
  });
41
- stringToSave = `${stringToSave}\nmodule.exports = {\n`;
41
+ stringToSave += '\nmodule.exports = {\n';
42
42
  itemToSave = '';
43
43
  operationIds.forEach((operationId) => {
44
- itemToSave = `${itemToSave} ${operationId},\n`;
44
+ itemToSave += ` ${operationId},\n`;
45
45
  });
46
- stringToSave = `${stringToSave}${itemToSave}};\n`;
46
+ stringToSave += `${itemToSave}};\n`;
47
47
  logger.info(`creating ${filename}`, { filename }, correlationId);
48
48
  try {
49
49
  fs.writeFileSync(filename, stringToSave);
@@ -1,5 +1,6 @@
1
1
  const jwt = require('jsonwebtoken');
2
- const _ = require('lodash');
2
+ const intersection = require('lodash.intersection');
3
+ const difference = require('lodash.difference');
3
4
 
4
5
  const { TOKEN_PARAMS } = require('@mimik/swagger-helper');
5
6
  const {
@@ -109,10 +110,10 @@ const checkScopes = (tokenScopes, defScopes, definition) => {
109
110
  }
110
111
  const includedClaims = analyzedScope[1].split(CLAIMS_SEPARATOR);
111
112
  const definitionClaims = Object.keys(includedDefinition);
112
- const claimsIntersects = _.intersection(includedClaims, definitionClaims);
113
+ const claimsIntersects = intersection(includedClaims, definitionClaims);
113
114
 
114
115
  if (claimsIntersects.length !== includedClaims.length) {
115
- throw getError(`incorrect claims included: ${_.difference(includedClaims, claimsIntersects)}`, 403);
116
+ throw getError(`incorrect claims included: ${difference(includedClaims, claimsIntersects)}`, 403);
116
117
  }
117
118
  claims = claims.concat(claimsIntersects);
118
119
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mimik/api-helper",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "helper for openAPI backend and mimik service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -30,27 +30,29 @@
30
30
  "url": "https://bitbucket.org/mimiktech/api-helper"
31
31
  },
32
32
  "dependencies": {
33
- "@mimik/request-helper":"^1.7.8",
34
- "@mimik/request-retry": "^3.0.0",
35
- "@mimik/response-helper": "^3.0.0",
36
- "@mimik/sumologic-winston-logger": "^1.6.15",
37
- "@mimik/swagger-helper": "^4.0.1",
38
- "ajv-formats": "^3.0.0-rc.0",
33
+ "@mimik/request-helper":"^1.7.10",
34
+ "@mimik/request-retry": "^3.0.1",
35
+ "@mimik/response-helper": "^3.0.1",
36
+ "@mimik/sumologic-winston-logger": "^1.6.20",
37
+ "@mimik/swagger-helper": "^4.0.9",
38
+ "ajv-formats": "3.0.0-rc.0",
39
39
  "js-base64": "3.7.5",
40
- "js-yaml":"^4.1.0",
41
- "jsonwebtoken": "^9.0.0",
42
- "lodash": "^4.17.21",
43
- "openapi-backend": "^5.9.1",
44
- "swagger-client": "3.19.6"
40
+ "js-yaml":"4.1.0",
41
+ "jsonwebtoken": "9.0.2",
42
+ "lodash.compact": "3.0.1",
43
+ "lodash.difference": "4.5.0",
44
+ "lodash.intersection": "4.4.0",
45
+ "openapi-backend": "5.10.5",
46
+ "swagger-client": "3.24.5"
45
47
  },
46
48
  "devDependencies": {
47
- "@mimik/eslint-plugin-dependencies": "^2.4.5",
48
- "@mimik/eslint-plugin-document-env": "^1.0.5",
49
- "eslint": "8.39.0",
49
+ "@mimik/eslint-plugin-dependencies": "^2.4.6",
50
+ "@mimik/eslint-plugin-document-env": "^1.0.6",
51
+ "eslint": "8.55.0",
50
52
  "eslint-config-airbnb": "19.0.4",
51
- "eslint-plugin-import": "2.27.5",
52
- "eslint-plugin-jsx-a11y": "6.7.1",
53
- "eslint-plugin-react": "7.32.2",
53
+ "eslint-plugin-import": "2.29.0",
54
+ "eslint-plugin-jsx-a11y": "6.8.0",
55
+ "eslint-plugin-react": "7.33.2",
54
56
  "eslint-plugin-react-hooks": "4.6.0",
55
57
  "husky": "8.0.3",
56
58
  "jsdoc-to-markdown": "8.0.0"