@jaypie/express 1.0.13 → 1.0.15
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/module.cjs +19 -4
- package/dist/module.esm.js +19 -4
- package/package.json +5 -5
- package/src/constants.js +1 -0
- package/src/expressHandler.js +18 -4
package/dist/module.cjs
CHANGED
|
@@ -11,6 +11,7 @@ var serverlessExpress = require('@codegenie/serverless-express');
|
|
|
11
11
|
const EXPRESS = {
|
|
12
12
|
PATH: {
|
|
13
13
|
ANY: "*",
|
|
14
|
+
ID: "/:id",
|
|
14
15
|
ROOT: /^\/?$/,
|
|
15
16
|
},
|
|
16
17
|
};
|
|
@@ -167,14 +168,28 @@ function summarizeResponse(res, extras) {
|
|
|
167
168
|
// Main
|
|
168
169
|
//
|
|
169
170
|
|
|
170
|
-
const expressHandler = (
|
|
171
|
-
handler,
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
const expressHandler = (handler, options = {}) => {
|
|
172
|
+
// If handler is an object and options is a function, swap them
|
|
173
|
+
if (typeof handler === "object" && typeof options === "function") {
|
|
174
|
+
const temp = handler;
|
|
175
|
+
handler = options;
|
|
176
|
+
options = temp;
|
|
177
|
+
}
|
|
178
|
+
|
|
174
179
|
//
|
|
175
180
|
//
|
|
176
181
|
// Validate
|
|
177
182
|
//
|
|
183
|
+
/* eslint-disable no-autofix/prefer-const */
|
|
184
|
+
let {
|
|
185
|
+
locals,
|
|
186
|
+
name,
|
|
187
|
+
setup = [],
|
|
188
|
+
teardown = [],
|
|
189
|
+
unavailable,
|
|
190
|
+
validate,
|
|
191
|
+
} = options;
|
|
192
|
+
/* eslint-enable no-autofix/prefer-const */
|
|
178
193
|
core.validate.function(handler);
|
|
179
194
|
core.validate.optional.object(locals);
|
|
180
195
|
setup = core.force.array(setup); // allows a single item
|
package/dist/module.esm.js
CHANGED
|
@@ -9,6 +9,7 @@ import { getCurrentInvoke } from '@codegenie/serverless-express';
|
|
|
9
9
|
const EXPRESS = {
|
|
10
10
|
PATH: {
|
|
11
11
|
ANY: "*",
|
|
12
|
+
ID: "/:id",
|
|
12
13
|
ROOT: /^\/?$/,
|
|
13
14
|
},
|
|
14
15
|
};
|
|
@@ -165,14 +166,28 @@ function summarizeResponse(res, extras) {
|
|
|
165
166
|
// Main
|
|
166
167
|
//
|
|
167
168
|
|
|
168
|
-
const expressHandler = (
|
|
169
|
-
handler,
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
const expressHandler = (handler, options = {}) => {
|
|
170
|
+
// If handler is an object and options is a function, swap them
|
|
171
|
+
if (typeof handler === "object" && typeof options === "function") {
|
|
172
|
+
const temp = handler;
|
|
173
|
+
handler = options;
|
|
174
|
+
options = temp;
|
|
175
|
+
}
|
|
176
|
+
|
|
172
177
|
//
|
|
173
178
|
//
|
|
174
179
|
// Validate
|
|
175
180
|
//
|
|
181
|
+
/* eslint-disable no-autofix/prefer-const */
|
|
182
|
+
let {
|
|
183
|
+
locals,
|
|
184
|
+
name,
|
|
185
|
+
setup = [],
|
|
186
|
+
teardown = [],
|
|
187
|
+
unavailable,
|
|
188
|
+
validate: validate$1,
|
|
189
|
+
} = options;
|
|
190
|
+
/* eslint-enable no-autofix/prefer-const */
|
|
176
191
|
validate.function(handler);
|
|
177
192
|
validate.optional.object(locals);
|
|
178
193
|
setup = force.array(setup); // allows a single item
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jaypie/express",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"author": "Finlayson Studio",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"test:spec:supertest": "vitest run ./src/__tests__/supertest.spec.js"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@codegenie/serverless-express": "^4.
|
|
45
|
-
"@jaypie/core": "^1.0.
|
|
44
|
+
"@codegenie/serverless-express": "^4.15.0",
|
|
45
|
+
"@jaypie/core": "^1.0.44"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@jaypie/testkit": "^1.0.
|
|
48
|
+
"@jaypie/testkit": "^1.0.29",
|
|
49
49
|
"@rollup/plugin-commonjs": "^26.0.1",
|
|
50
50
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
51
51
|
"eslint": "^8.57.0",
|
|
@@ -59,6 +59,6 @@
|
|
|
59
59
|
"rollup-plugin-auto-external": "^2.0.0",
|
|
60
60
|
"sort-package-json": "^2.10.0",
|
|
61
61
|
"supertest": "^7.0.0",
|
|
62
|
-
"vitest": "^1.
|
|
62
|
+
"vitest": "^2.1.3"
|
|
63
63
|
}
|
|
64
64
|
}
|
package/src/constants.js
CHANGED
package/src/expressHandler.js
CHANGED
|
@@ -18,14 +18,28 @@ import summarizeResponse from "./summarizeResponse.helper.js";
|
|
|
18
18
|
// Main
|
|
19
19
|
//
|
|
20
20
|
|
|
21
|
-
const expressHandler = (
|
|
22
|
-
handler,
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
const expressHandler = (handler, options = {}) => {
|
|
22
|
+
// If handler is an object and options is a function, swap them
|
|
23
|
+
if (typeof handler === "object" && typeof options === "function") {
|
|
24
|
+
const temp = handler;
|
|
25
|
+
handler = options;
|
|
26
|
+
options = temp;
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
//
|
|
26
30
|
//
|
|
27
31
|
// Validate
|
|
28
32
|
//
|
|
33
|
+
/* eslint-disable no-autofix/prefer-const */
|
|
34
|
+
let {
|
|
35
|
+
locals,
|
|
36
|
+
name,
|
|
37
|
+
setup = [],
|
|
38
|
+
teardown = [],
|
|
39
|
+
unavailable,
|
|
40
|
+
validate,
|
|
41
|
+
} = options;
|
|
42
|
+
/* eslint-enable no-autofix/prefer-const */
|
|
29
43
|
validateIs.function(handler);
|
|
30
44
|
validateIs.optional.object(locals);
|
|
31
45
|
setup = force.array(setup); // allows a single item
|