@paralect/hive 0.1.31 → 0.1.33

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paralect/hive",
3
- "version": "0.1.31",
3
+ "version": "0.1.33",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -39,7 +39,14 @@ const main = async () => {
39
39
 
40
40
  qs(app);
41
41
 
42
- app.use(bodyParser({ enableTypes: ["json", "form", "text"] }));
42
+ app.use(bodyParser({
43
+ enableTypes: ["json", "form", "text"],
44
+
45
+ formLimit: '10mb',
46
+ textLimit: '10mb',
47
+ jsonLimit: '10mb',
48
+ }));
49
+
43
50
  app.use(mount("/health", get.handler));
44
51
  app.use(requestLogger());
45
52
 
@@ -0,0 +1,9 @@
1
+
2
+ const middleware = async (ctx, next) => {
3
+ ctx.state.isAllowAnonymous = true;
4
+ return next();
5
+ };
6
+
7
+ middleware.runOrder = -1;
8
+
9
+ export default middleware;
@@ -8,7 +8,7 @@ const storeTokenToState = async (ctx) => {
8
8
  let accessToken = ctx.cookies.get('access_token');
9
9
 
10
10
  const { authorization } = ctx.headers;
11
-
11
+
12
12
  if (!accessToken && authorization) {
13
13
  accessToken = authorization.replace('Bearer', '').trim();
14
14
  }
@@ -46,6 +46,10 @@ export default async (ctx, next) => {
46
46
  return next();
47
47
  }
48
48
 
49
+ if (ctx.state.isAllowAnonymous) {
50
+ return next();
51
+ }
52
+
49
53
  ctx.status = 401;
50
54
  ctx.body = {};
51
55
  return null;
@@ -4,13 +4,13 @@ const routeErrorHandler = async (ctx, next) => {
4
4
  try {
5
5
  await next();
6
6
  } catch (error) {
7
+ console.log("Route Error", error, error.stack);
8
+
7
9
  const clientError = error.errors;
8
10
  const serverError = { global: error.message };
9
11
 
10
12
  const errors = clientError || serverError;
11
13
 
12
- console.log("Route Error", errors);
13
-
14
14
  logger.error(errors);
15
15
 
16
16
  if (serverError && (error.status === 500 || !error.status) && process.env.APP_ENV === "production") {