addons-scanner-utils 15.0.0 → 15.1.0
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.
|
@@ -16,11 +16,15 @@ export type RequestWithExtraProps = Request & {
|
|
|
16
16
|
* @property _process - Process object for environment variables (for testing
|
|
17
17
|
* purposes)
|
|
18
18
|
* @property apiKeyEnvVarName - Environment variable name for the API key
|
|
19
|
+
* @property maxRequestBodySize - Controls the maximum request body size. If
|
|
20
|
+
* this is a number, then the value specifies the number of bytes; if it is a
|
|
21
|
+
* string, the value is passed to the bytes library for parsing.
|
|
19
22
|
*/
|
|
20
23
|
export type FunctionConfig = {
|
|
21
24
|
_console?: typeof console;
|
|
22
25
|
_process?: typeof process;
|
|
23
26
|
apiKeyEnvVarName?: string;
|
|
27
|
+
maxRequestBodySize?: string | number;
|
|
24
28
|
};
|
|
25
29
|
/**
|
|
26
30
|
* Easily create a new scanner application with built-in authentication
|
|
@@ -44,7 +48,7 @@ export type FunctionConfig = {
|
|
|
44
48
|
* - HMAC-SHA256: `Authorization: HMAC-SHA256 <digest>` (digest of request
|
|
45
49
|
* body)
|
|
46
50
|
*/
|
|
47
|
-
export declare const createExpressApp: ({ _console, _process, apiKeyEnvVarName, }?: FunctionConfig) => (handler: RequestHandler) => import("express-serve-static-core").Express;
|
|
51
|
+
export declare const createExpressApp: ({ _console, _process, apiKeyEnvVarName, maxRequestBodySize, }?: FunctionConfig) => (handler: RequestHandler) => import("express-serve-static-core").Express;
|
|
48
52
|
export * from './api';
|
|
49
53
|
export * from './auth';
|
|
50
54
|
export * from './download';
|
package/dist/functions/index.js
CHANGED
|
@@ -53,7 +53,7 @@ const error_1 = require("./error");
|
|
|
53
53
|
* - HMAC-SHA256: `Authorization: HMAC-SHA256 <digest>` (digest of request
|
|
54
54
|
* body)
|
|
55
55
|
*/
|
|
56
|
-
const createExpressApp = ({ _console = console, _process = process, apiKeyEnvVarName = 'LAMBDA_API_KEY', } = {}) => (handler) => {
|
|
56
|
+
const createExpressApp = ({ _console = console, _process = process, apiKeyEnvVarName = 'LAMBDA_API_KEY', maxRequestBodySize = '1mb', } = {}) => (handler) => {
|
|
57
57
|
const app = (0, express_1.default)();
|
|
58
58
|
const apiKey = _process.env[apiKeyEnvVarName] || null;
|
|
59
59
|
if (apiKey) {
|
|
@@ -63,6 +63,7 @@ const createExpressApp = ({ _console = console, _process = process, apiKeyEnvVar
|
|
|
63
63
|
}
|
|
64
64
|
// This is the options we pass to the `json()` middleware.
|
|
65
65
|
const jsonOptions = {
|
|
66
|
+
limit: maxRequestBodySize,
|
|
66
67
|
// This is a hack to retain the raw body on the request object. We need
|
|
67
68
|
// this to verify the signature of the request.
|
|
68
69
|
verify(req, res, buf) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "addons-scanner-utils",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.1.0",
|
|
4
4
|
"description": "Various addons related helpers to build CLIs.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"first-chunk-stream": "3.0.0",
|
|
41
41
|
"jsonwebtoken": "^9.0.3",
|
|
42
42
|
"strip-bom-stream": "4.0.0",
|
|
43
|
-
"upath": "
|
|
44
|
-
"yauzl": "3.
|
|
43
|
+
"upath": "3.0.7",
|
|
44
|
+
"yauzl": "3.3.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"express": "5.2.1",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"eslint-plugin-amo": "^3.0.0",
|
|
73
73
|
"express": "5.2.1",
|
|
74
74
|
"jest": "^30.2.0",
|
|
75
|
-
"prettier": "3.8.
|
|
75
|
+
"prettier": "3.8.3",
|
|
76
76
|
"pretty-quick": "4.2.2",
|
|
77
77
|
"rimraf": "^6.1.0",
|
|
78
78
|
"safe-compare": "1.1.4",
|