powr-sdk-api 2.3.1 → 2.3.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.
package/dist/config.js CHANGED
@@ -1,25 +1,9 @@
1
1
  "use strict";
2
2
 
3
- // Config for powr-sdk-api
4
- // Uses environment variables from host project
5
-
6
- const getConfig = () => {
7
- const config = {
8
- mongoUri: process.env.POWR_DB_URI,
9
- projectId: process.env.PROJECT_ID,
10
- jwtToken: process.env.JWT_TOKEN,
11
- storageBucket: process.env.STORAGE_BUCKET
12
- };
13
-
14
- // Validate required configs
15
- if (!config.mongoUri) {
16
- throw new Error('POWR_DB_URI environment variable is required');
17
- }
18
- if (!config.projectId) {
19
- throw new Error('PROJECT_ID environment variable is required');
20
- }
21
- return config;
3
+ const config = {
4
+ mongoUri: process.env.POWR_DB_URI,
5
+ projectId: process.env.PROJECT_ID,
6
+ jwtToken: process.env.JWT_TOKEN,
7
+ storageBucket: process.env.STORAGE_BUCKET
22
8
  };
23
- module.exports = {
24
- getConfig
25
- };
9
+ module.exports = config;
@@ -47,6 +47,4 @@ const cloudLogger = winston.createLogger({
47
47
  },
48
48
  transports
49
49
  });
50
- module.exports = {
51
- cloudLogger
52
- };
50
+ module.exports = cloudLogger;
@@ -4,9 +4,7 @@ const jwt = require('jsonwebtoken');
4
4
  const {
5
5
  ObjectId
6
6
  } = require('mongodb');
7
- const {
8
- config
9
- } = require('../config');
7
+ const config = require('../config');
10
8
  const generateJWTToken = user => {
11
9
  return jwt.sign({
12
10
  userId: user._id
@@ -49,7 +47,7 @@ const verifyToken = async (req, res, next) => {
49
47
  console.error("Error in auth middleware:", error);
50
48
  return res.status(401).json({
51
49
  success: false,
52
- message: "Invalid token."
50
+ message: error.message
53
51
  });
54
52
  }
55
53
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "powr-sdk-api",
3
- "version": "2.3.1",
3
+ "version": "2.3.3",
4
4
  "description": "Shared API core library for PowrStack projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",