exframe-middleware 1.5.4 → 1.5.5

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.
@@ -0,0 +1,7 @@
1
+ import exzeoBaseConfig from 'eslint-config-exzeo/base';
2
+ import exzeoMochaConfig from 'eslint-config-exzeo/mocha';
3
+
4
+ export default [
5
+ exzeoBaseConfig,
6
+ exzeoMochaConfig
7
+ ];
package/index.mjs CHANGED
@@ -2,8 +2,12 @@
2
2
 
3
3
  import middleware from './index.js';
4
4
 
5
- const { handleErrors, standardRouteResponseBuilder, authorizeUser, buildCsp, buildExpressRequestContext } = middleware;
5
+ const {
6
+ handleErrors, standardRouteResponseBuilder, authorizeUser, buildCsp, buildExpressRequestContext
7
+ } = middleware;
6
8
 
7
- export { handleErrors, standardRouteResponseBuilder, authorizeUser, buildCsp, buildExpressRequestContext };
9
+ export {
10
+ handleErrors, standardRouteResponseBuilder, authorizeUser, buildCsp, buildExpressRequestContext
11
+ };
8
12
 
9
13
  export default middleware;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exframe-middleware",
3
- "version": "1.5.4",
3
+ "version": "1.5.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -43,5 +43,5 @@
43
43
  "engines": {
44
44
  "node": ">=14.0.0"
45
45
  },
46
- "gitHead": "ba7c9645ee57695d84325e34379f4726eab6894f"
46
+ "gitHead": "8e1447625c9410c013a91372178dd8d0501776a1"
47
47
  }
@@ -8,8 +8,7 @@ const { authorizeUser } = require('../index');
8
8
  context('authorizeUser', () => {
9
9
  describe('mq', () => {
10
10
  it('throws unauthorized error when no user', () => {
11
- try { authorizeUser.mq({}); }
12
- catch (e) {
11
+ try { authorizeUser.mq({}); } catch (e) {
13
12
  expect(e).to.be.an.instanceOf(errors.Unauthorized);
14
13
  return;
15
14
  }
@@ -18,8 +17,8 @@ context('authorizeUser', () => {
18
17
  });
19
18
 
20
19
  it('does not throw an error when there is a user', () => {
21
- try { authorizeUser.mq({ user: 'something' }); }
22
- catch (e) { expect.fail('authorizeUser should not have thrown an error'); }
20
+ // eslint-disable-next-line no-unused-vars
21
+ try { authorizeUser.mq({ user: 'something' }); } catch (e) { expect.fail('authorizeUser should not have thrown an error'); }
23
22
  });
24
23
  });
25
24
 
@@ -34,8 +33,7 @@ context('authorizeUser', () => {
34
33
  it('throws unauthorized error when there is no user', () => {
35
34
  let called = 0;
36
35
  const next = () => ++called;
37
- try { authorizeUser.express({ }, {}, next); }
38
- catch (e) {
36
+ try { authorizeUser.express({ }, {}, next); } catch (e) {
39
37
  expect(e).to.be.an.instanceOf(errors.Unauthorized);
40
38
  return;
41
39
  }
@@ -54,8 +52,7 @@ context('authorizeUser', () => {
54
52
  it('throws unauthorized error when there is no user', () => {
55
53
  let called = 0;
56
54
  const next = () => ++called;
57
- try { authorizeUser.express({ context: {} }, {}, next); }
58
- catch (e) {
55
+ try { authorizeUser.express({ context: {} }, {}, next); } catch (e) {
59
56
  expect(e).to.be.an.instanceOf(errors.Unauthorized);
60
57
  return;
61
58
  }
@@ -1,12 +1,10 @@
1
1
  'use strict';
2
2
 
3
-
4
3
  const { expect } = require('chai');
5
4
  const sinon = require('sinon');
6
5
 
7
6
  const { buildExpressRequestContext } = require('../index');
8
7
 
9
-
10
8
  context('buildExpressRequestContext', () => {
11
9
  it('works', () => {
12
10
  const request = {
@@ -1,11 +1,9 @@
1
1
  'use strict';
2
2
 
3
-
4
3
  const { expect } = require('chai');
5
4
 
6
5
  const { standardRouteResponseBuilder } = require('../index');
7
6
 
8
-
9
7
  context('standardRouteResponseBuilder', () => {
10
8
  describe('single item responses', () => {
11
9
  const { singleItem } = standardRouteResponseBuilder;
@@ -51,7 +49,7 @@ context('standardRouteResponseBuilder', () => {
51
49
  });
52
50
 
53
51
  it('returns 200 ok when populated', () => {
54
- const response = multiItem([ 'some stuff', 'some more stuff' ]);
52
+ const response = multiItem(['some stuff', 'some more stuff']);
55
53
  expect(response).to.deep.equal({
56
54
  status: 200,
57
55
  message: 'ok',
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
-
4
3
  module.exports = {
5
4
  fakeLogger: {
6
5
  info: () => {},
package/.eslintrc.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "exzeo/base"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "exzeo/mocha"
3
- }