@apolitical/server 2.5.4 → 2.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.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [2.5.5] - 2022-07-19
9
+ ### Added
10
+ - Unit tests for `buildOptions` helper
11
+
8
12
  ## [2.5.4] - 2022-07-08
9
13
  ### Added
10
14
  - Generating apolitical-auth token function
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apolitical/server",
3
- "version": "2.5.4",
3
+ "version": "2.5.5",
4
4
  "description": "Node.js module to encapsulate Apolitical's express server setup",
5
5
  "author": "Apolitical Group Limited <engineering@apolitical.co>",
6
6
  "license": "MIT",
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  module.exports = ({ jwtEncodeHelper, config }) => {
4
- const { SESSION_SECRET } = config.SERVER;
4
+ const { SESSION_SECRET } = config;
5
5
  const {
6
6
  APOLITICAL: { ISSUER, ADMIN_ROLE, COOKIE_KEY },
7
7
  } = config.JWT;
@@ -18,11 +18,11 @@ module.exports = ({ jwtEncodeHelper, config }) => {
18
18
 
19
19
  function buildHeaders({ authToken }) {
20
20
  const headers = {};
21
- if (typeof authToken === 'boolean' && authToken) {
21
+ if (authToken && typeof authToken === 'boolean') {
22
22
  // When authToken is a boolean then generate an admin token
23
23
  const adminToken = generateAdminToken();
24
24
  Object.assign(headers, { Cookie: `${COOKIE_KEY}=${adminToken}` });
25
- } else if (typeof authToken === 'string' && authToken) {
25
+ } else if (authToken && typeof authToken === 'string') {
26
26
  // When authToken is a string then use the it as the token
27
27
  Object.assign(headers, { Cookie: `${COOKIE_KEY}=${authToken}` });
28
28
  }