@ladjs/api 14.1.0 → 14.1.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.
Files changed (2) hide show
  1. package/index.js +18 -2
  2. package/package.json +14 -13
package/index.js CHANGED
@@ -2,7 +2,6 @@ const process = require('node:process');
2
2
  const http = require('node:http');
3
3
  const https = require('node:https');
4
4
  const util = require('node:util');
5
-
6
5
  const Cabin = require('cabin');
7
6
  const I18N = require('@ladjs/i18n');
8
7
  const Passport = require('@ladjs/passport');
@@ -20,6 +19,7 @@ const etag = require('koa-etag');
20
19
  const json = require('koa-json');
21
20
  const koa404Handler = require('koa-404-handler');
22
21
  const koaConnect = require('koa-connect');
22
+ const multimatch = require('multimatch');
23
23
  const ratelimit = require('@ladjs/koa-simple-ratelimit');
24
24
  const removeTrailingSlashes = require('koa-no-trailing-slash');
25
25
  const requestId = require('express-request-id');
@@ -130,7 +130,23 @@ class API {
130
130
  }
131
131
 
132
132
  // Body parser
133
- app.use(bodyParser());
133
+ // POST /v1/logs (1 MB max so 1.1 MB w/overhead)
134
+ // POST /v1/emails (50 MB max so 51 MB w/overhead)
135
+ app.use((ctx, next) => {
136
+ // check against ignored paths
137
+ if (
138
+ Array.isArray(this.config.bodyParserIgnoredPathGlobs) &&
139
+ this.config.bodyParserIgnoredPathGlobs.length > 0
140
+ ) {
141
+ const match = multimatch(
142
+ ctx.path,
143
+ this.config.bodyParserIgnoredPathGlobs
144
+ );
145
+ if (Array.isArray(match) && match.length > 0) return next();
146
+ }
147
+
148
+ return bodyParser()(ctx, next);
149
+ });
134
150
 
135
151
  // Pretty-printed json responses
136
152
  app.use(json());
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ladjs/api",
3
3
  "description": "API server for Lad",
4
- "version": "14.1.0",
4
+ "version": "14.1.2",
5
5
  "author": "Nick Baugh <niftylettuce@gmail.com> (http://niftylettuce.com/)",
6
6
  "bugs": {
7
7
  "url": "https://github.com/ladjs/api/issues",
@@ -16,47 +16,48 @@
16
16
  "@ladjs/koa-simple-ratelimit": "^4.1.1",
17
17
  "@ladjs/passport": "^5.0.3",
18
18
  "@ladjs/redis": "^1.1.1",
19
- "@ladjs/shared-config": "^9.1.0",
19
+ "@ladjs/shared-config": "^9.1.2",
20
20
  "@ladjs/store-ip-address": "^0.0.7",
21
21
  "boolean": "^3.2.0",
22
22
  "express-request-id": "1.4.1",
23
23
  "kcors": "^2.2.2",
24
- "koa": "^2.14.1",
24
+ "koa": "^2.14.2",
25
25
  "koa-404-handler": "^0.1.0",
26
26
  "koa-basic-auth": "^4.0.0",
27
27
  "koa-better-error-handler": "^11.0.4",
28
28
  "koa-better-timeout": "^0.0.6",
29
29
  "koa-bodyparser": "^4.4.0",
30
- "koa-compress": "^5.1.0",
30
+ "koa-compress": "^5.1.1",
31
31
  "koa-conditional-get": "^3.0.0",
32
32
  "koa-connect": "^2.1.0",
33
33
  "koa-etag": "^4.0.0",
34
34
  "koa-json": "^2.0.2",
35
35
  "koa-no-trailing-slash": "^2.1.0",
36
36
  "lodash": "^4.17.21",
37
+ "multimatch": "5",
37
38
  "request-received": "^0.0.3",
38
39
  "response-time": "^2.3.2"
39
40
  },
40
41
  "devDependencies": {
41
- "@commitlint/cli": "^17.5.1",
42
- "@commitlint/config-conventional": "^17.4.4",
42
+ "@commitlint/cli": "^17.6.1",
43
+ "@commitlint/config-conventional": "^17.6.1",
43
44
  "ava": "^5.2.0",
44
- "axe": "^12.1.0",
45
- "cabin": "^13.1.0",
45
+ "axe": "^12.1.1",
46
+ "cabin": "^13.1.1",
46
47
  "cross-env": "^7.0.3",
47
- "eslint": "^8.36.0",
48
+ "eslint": "^8.39.0",
48
49
  "eslint-config-xo-lass": "^2.0.1",
49
50
  "fixpack": "^4.0.0",
50
51
  "husky": "^8.0.3",
51
- "ioredis": "^5.3.1",
52
- "ioredis-mock": "^8.2.7",
53
- "lint-staged": "13.2.0",
52
+ "ioredis": "^5.3.2",
53
+ "ioredis-mock": "^8.7.0",
54
+ "lint-staged": "13.2.2",
54
55
  "mongoose": "6",
55
56
  "nyc": "^15.1.0",
56
57
  "remark-cli": "^11.0.0",
57
58
  "remark-preset-github": "^4.0.4",
58
59
  "supertest": "^6.3.3",
59
- "xo": "^0.53.1"
60
+ "xo": "^0.54.2"
60
61
  },
61
62
  "engines": {
62
63
  "node": ">=14"