@mimik/oauth-helper 1.10.0 → 1.10.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/.eslintrc CHANGED
@@ -11,8 +11,9 @@
11
11
  },
12
12
  "extends": "airbnb",
13
13
  "rules": {
14
- "import/no-extraneous-dependencies": ["error", {"devDependencies": true}],
15
- "brace-style": [1, "stroustrup", {"allowSingleLine": true}],
14
+ "import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
15
+ "import/no-unresolved": ["error", { "amd": true, "commonjs": true, "caseSensitiveStrict": true }],
16
+ "brace-style": [1, "stroustrup", { "allowSingleLine": true }],
16
17
  "no-confusing-arrow": [0], // arrow isnt confusing
17
18
  "max-len": [1, 180, { "ignoreComments": true }],
18
19
  "linebreak-style": 0,
@@ -22,12 +23,11 @@
22
23
  "@mimik/document-env/validate-document-env": 2,
23
24
  "@mimik/dependencies/case-sensitive": 2,
24
25
  "@mimik/dependencies/no-cycles": 2,
25
- "@mimik/dependencies/no-unresolved": 2,
26
26
  "@mimik/dependencies/require-json-ext": 2
27
27
  },
28
28
  "settings":{
29
29
  "react": {
30
- "version": "latest"
30
+ "version": "detect"
31
31
  }
32
32
  },
33
33
  "globals": {
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@mimik/oauth-helper",
3
- "version": "1.10.0",
3
+ "version": "1.10.2",
4
4
  "description": "Oauth helper for mimik microservices",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "lint": "gulp lint",
8
- "docs": "gulp docs",
9
- "test": "nyc gulp test",
10
- "prepublishOnly": "gulp docs; gulp lint; npm run test",
11
- "commit-ready": "gulp docs; gulp lint; npm run test",
7
+ "lint": "eslint --ignore-path .gitignore .",
8
+ "docs": "jsdoc2md index.js > README.md",
9
+ "test": "mocha --reporter mochawesome --bail --check-leaks test/",
10
+ "test-ci": "nyc --reporter=lcov --reporter=text npm test",
11
+ "prepublishOnly": "npm run docs && npm run lint && npm run test-ci",
12
+ "commit-ready": "npm run docs && npm run lint && npm run test-ci",
12
13
  "prepare": "husky install"
13
14
  },
14
15
  "husky": {
@@ -22,42 +23,37 @@
22
23
  "microservice"
23
24
  ],
24
25
  "author": "mimik technology inc <support@mimik.com> (https://developer.mimik.com/)",
25
- "license": "Apache-2.0",
26
+ "license": "MIT",
26
27
  "repository": {
27
28
  "type": "git",
28
29
  "url": "https://bitbucket.org/mimiktech/oauth-helper"
29
30
  },
30
31
  "dependencies": {
31
- "@mimik/request-retry": "^2.0.6",
32
- "@mimik/response-helper": "^2.6.0",
33
- "@mimik/sumologic-winston-logger": "^1.6.6",
34
- "@mimik/swagger-helper": "^2.5.1",
32
+ "@mimik/request-retry": "^2.0.11",
33
+ "@mimik/response-helper": "^2.6.2",
34
+ "@mimik/sumologic-winston-logger": "^1.6.11",
35
+ "@mimik/swagger-helper": "^2.5.5",
35
36
  "bluebird": "3.7.2",
36
37
  "jsonwebtoken": "8.5.1",
37
38
  "lodash": "4.17.21"
38
39
  },
39
40
  "devDependencies": {
40
- "@mimik/eslint-plugin-dependencies": "^2.4.1",
41
- "@mimik/eslint-plugin-document-env": "^1.0.1",
42
- "@mimik/request-helper": "^1.7.3",
43
- "body-parser": "1.19.2",
44
- "chai": "4.3.6",
45
- "eslint": "8.10.0",
46
- "eslint-config-airbnb": "18.2.1",
47
- "eslint-plugin-import": "2.25.4",
48
- "eslint-plugin-jsx-a11y": "6.5.1",
49
- "eslint-plugin-react": "7.27.1",
50
- "eslint-plugin-react-hooks": "4.3.0",
51
- "express": "4.17.3",
52
- "fancy-log": "2.0.0",
53
- "gulp": "4.0.2",
54
- "gulp-eslint": "6.0.0",
55
- "gulp-git": "2.10.1",
56
- "gulp-spawn-mocha": "6.0.0",
57
- "husky": "7.0.4",
58
- "jsdoc-to-markdown": "7.1.1",
59
- "mocha": "9.2.1",
60
- "mochawesome": "7.1.0",
41
+ "@mimik/eslint-plugin-dependencies": "^2.4.4",
42
+ "@mimik/eslint-plugin-document-env": "^1.0.4",
43
+ "@mimik/request-helper": "^1.7.7",
44
+ "body-parser": "1.20.1",
45
+ "chai": "4.3.7",
46
+ "eslint": "8.28.0",
47
+ "eslint-config-airbnb": "19.0.4",
48
+ "eslint-plugin-import": "2.26.0",
49
+ "eslint-plugin-jsx-a11y": "6.6.1",
50
+ "eslint-plugin-react": "7.31.11",
51
+ "eslint-plugin-react-hooks": "4.6.0",
52
+ "express": "4.18.2",
53
+ "husky": "8.0.2",
54
+ "jsdoc-to-markdown": "8.0.0",
55
+ "mocha": "10.1.0",
56
+ "mochawesome": "7.1.3",
61
57
  "nyc": "15.1.0"
62
58
  }
63
59
  }
@@ -1,9 +1,11 @@
1
1
  const jwt = require('jsonwebtoken');
2
2
  const chai = require('chai');
3
3
 
4
+ require('./testEnv');
5
+
4
6
  const { getCorrelationId } = require('@mimik/request-helper');
7
+ const { rpRetry } = require('@mimik/request-retry');
5
8
 
6
- require('./testEnv');
7
9
  const oauthHelper = require('../index');
8
10
  const {
9
11
  config,
@@ -499,5 +501,19 @@ describe('OauthHelper Unit Tests', () => {
499
501
  .then((response) => {
500
502
  expect(response).to.equal(undefined);
501
503
  }));
504
+ it('should stop mock server', () => rpRetry({
505
+ method: 'GET',
506
+ headers: {
507
+ 'x-correlation-id': correlationId,
508
+ },
509
+ url: 'http://localhost:9070/stop',
510
+ retry: {
511
+ delayStrategy: () => 100,
512
+ retries: 1,
513
+ },
514
+ })
515
+ .catch((err) => {
516
+ expect(err.name).to.equal('System');
517
+ }));
502
518
  });
503
519
  });
@@ -103,6 +103,14 @@ app.delete('/mIDUrl/users/:id', (req, res) => {
103
103
  res.statusCode = 400;
104
104
  res.send({ statusCode: 400 });
105
105
  });
106
+ app.get('/stop', (req, res) => {
107
+ console.log('----->', 'Received a stop');
108
+ res.statusCode = 200;
109
+ res.send({ statusCode: 200 });
110
+ setTimeout(() => {
111
+ process.exit(0);
112
+ }, 3000);
113
+ });
106
114
 
107
115
  const listen = () => {
108
116
  app.listen(mockConfig.port, () => {
package/Gulpfile.js DELETED
@@ -1,41 +0,0 @@
1
- /* eslint-disable import/no-extraneous-dependencies */
2
- const fs = require('fs');
3
- const log = require('fancy-log');
4
- const gulp = require('gulp');
5
- const eslint = require('gulp-eslint');
6
- const git = require('gulp-git');
7
- const jsdoc2md = require('jsdoc-to-markdown');
8
- const mocha = require('gulp-spawn-mocha');
9
-
10
- const files = [
11
- 'index.js',
12
- 'Gulpfile.js',
13
- 'test/**.js',
14
- 'lib/**.js',
15
- ];
16
-
17
- const createDocs = (done) => {
18
- jsdoc2md.render({ files: 'index.js' })
19
- .then((output) => fs.writeFileSync('README.md', output))
20
- .catch((err) => log.error('docs creation failed:', err.message))
21
- .finally(() => done());
22
- };
23
-
24
- const lint = () => gulp.src(files)
25
- .pipe(eslint({}))
26
- .pipe(eslint.format());
27
-
28
- const add = () => gulp.src('README.md')
29
- .pipe(git.add({ quiet: true }));
30
-
31
- const test = () => gulp.src(['test/*.spec.js'])
32
- .pipe(mocha({
33
- reporter: 'mochawesome',
34
- exit: true,
35
- }));
36
-
37
- const docs = gulp.series(createDocs, add);
38
-
39
- gulp.task('lint', lint);
40
- gulp.task('docs', docs);
41
- gulp.task('test', test);
@@ -1,10 +0,0 @@
1
- const rp = require('request-promise');
2
-
3
- const options = {
4
- method: 'GET',
5
- url: 'http://google.com',
6
- uri: 'http//google.com',
7
- json: true,
8
- };
9
-
10
- rp(options).then(() => console.log('ok')).catch((err) => console.log(err));