serverless-offline 13.3.0 → 13.3.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.
package/README.md
CHANGED
|
@@ -835,7 +835,7 @@ For example:
|
|
|
835
835
|
plugins:
|
|
836
836
|
- serverless-middleware # modifies some of your handler based on configuration
|
|
837
837
|
- serverless-webpack # package your javascript handlers using webpack
|
|
838
|
-
- serverless-dynamodb
|
|
838
|
+
- serverless-dynamodb # adds a local dynamo db
|
|
839
839
|
- serverless-offline # runs last so your code has been pre-processed and dynamo is ready
|
|
840
840
|
```
|
|
841
841
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dedicatedTo": "Blue, a great migrating bird.",
|
|
3
3
|
"name": "serverless-offline",
|
|
4
|
-
"version": "13.3.
|
|
4
|
+
"version": "13.3.2",
|
|
5
5
|
"description": "Emulate AWS λ and API Gateway locally when developing your Serverless project",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"exports": {
|
|
@@ -10,19 +10,13 @@
|
|
|
10
10
|
},
|
|
11
11
|
"type": "module",
|
|
12
12
|
"scripts": {
|
|
13
|
-
"format": "eslint . --fix",
|
|
14
13
|
"lint": "eslint .",
|
|
15
|
-
"lint:
|
|
14
|
+
"lint:fix": "eslint . --fix",
|
|
16
15
|
"list-contributors": "echo 'clone https://github.com/mgechev/github-contributors-list.git first, then run npm install' && cd ../github-contributors-list && node bin/githubcontrib --owner dherault --repo serverless-offline --sortBy contributions --showlogin true --sortOrder desc > contributors.md",
|
|
17
|
-
"prepare": "
|
|
18
|
-
"prepare-release": "standard-version && prettier --write CHANGELOG.md",
|
|
16
|
+
"prepare-release": "commit-and-tag-version && prettier --write CHANGELOG.md",
|
|
19
17
|
"prepublishOnly": "npm run lint",
|
|
20
18
|
"prettier": "prettier --check .",
|
|
21
19
|
"prettier:fix": "prettier --write .",
|
|
22
|
-
"prettier-check": "prettier -c --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"",
|
|
23
|
-
"prettier-check:updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c",
|
|
24
|
-
"prettify": "prettier --write --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"",
|
|
25
|
-
"prettify:updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier --write",
|
|
26
20
|
"test": "mocha --require ./tests/mochaHooks.cjs",
|
|
27
21
|
"test:cov": "NODE_OPTIONS='--experimental-loader @istanbuljs/esm-loader-hook' nyc --reporter=html npm test",
|
|
28
22
|
"test:node": "TEST=unit mocha --require ./tests/mochaHooks.cjs",
|
|
@@ -54,7 +48,7 @@
|
|
|
54
48
|
"engines": {
|
|
55
49
|
"node": ">=18.12.0"
|
|
56
50
|
},
|
|
57
|
-
"
|
|
51
|
+
"commit-and-tag-version": {
|
|
58
52
|
"skip": {
|
|
59
53
|
"commit": true,
|
|
60
54
|
"tag": true
|
|
@@ -79,7 +73,7 @@
|
|
|
79
73
|
]
|
|
80
74
|
},
|
|
81
75
|
"dependencies": {
|
|
82
|
-
"@aws-sdk/client-lambda": "^3.
|
|
76
|
+
"@aws-sdk/client-lambda": "^3.470.0",
|
|
83
77
|
"@hapi/boom": "^10.0.1",
|
|
84
78
|
"@hapi/h2o2": "^10.0.4",
|
|
85
79
|
"@hapi/hapi": "^21.3.2",
|
|
@@ -89,10 +83,10 @@
|
|
|
89
83
|
"chalk": "^5.3.0",
|
|
90
84
|
"desm": "^1.3.0",
|
|
91
85
|
"execa": "^8.0.1",
|
|
92
|
-
"fs-extra": "^11.
|
|
86
|
+
"fs-extra": "^11.2.0",
|
|
93
87
|
"is-wsl": "^3.1.0",
|
|
94
88
|
"java-invoke-local": "0.0.6",
|
|
95
|
-
"jose": "^5.1.
|
|
89
|
+
"jose": "^5.1.2",
|
|
96
90
|
"js-string-escape": "^1.0.1",
|
|
97
91
|
"jsonpath-plus": "^7.2.0",
|
|
98
92
|
"jsonschema": "^1.4.1",
|
|
@@ -102,25 +96,22 @@
|
|
|
102
96
|
"p-memoize": "^7.1.1",
|
|
103
97
|
"p-retry": "^6.1.0",
|
|
104
98
|
"velocityjs": "^2.0.6",
|
|
105
|
-
"ws": "^8.
|
|
99
|
+
"ws": "^8.15.1"
|
|
106
100
|
},
|
|
107
101
|
"devDependencies": {
|
|
108
102
|
"@istanbuljs/esm-loader-hook": "^0.2.0",
|
|
109
103
|
"archiver": "^6.0.1",
|
|
110
|
-
"
|
|
104
|
+
"commit-and-tag-version": "^12.0.0",
|
|
105
|
+
"eslint": "^8.55.0",
|
|
111
106
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
112
|
-
"eslint-config-prettier": "^9.
|
|
107
|
+
"eslint-config-prettier": "^9.1.0",
|
|
113
108
|
"eslint-plugin-import": "^2.29.0",
|
|
114
109
|
"eslint-plugin-prettier": "^5.0.1",
|
|
115
110
|
"eslint-plugin-unicorn": "^49.0.0",
|
|
116
|
-
"git-list-updated": "^1.2.1",
|
|
117
|
-
"husky": "^8.0.3",
|
|
118
|
-
"lint-staged": "^15.1.0",
|
|
119
111
|
"mocha": "^10.2.0",
|
|
120
112
|
"nyc": "^15.1.0",
|
|
121
|
-
"prettier": "^3.1.
|
|
122
|
-
"serverless": "^3.
|
|
123
|
-
"standard-version": "^9.5.0"
|
|
113
|
+
"prettier": "^3.1.1",
|
|
114
|
+
"serverless": "^3.38.0"
|
|
124
115
|
},
|
|
125
116
|
"peerDependencies": {
|
|
126
117
|
"serverless": "^3.2.0"
|
|
@@ -748,33 +748,34 @@ export default class HttpServer {
|
|
|
748
748
|
// If there is a responseTemplate, we apply it to the result
|
|
749
749
|
const { responseTemplates } = chosenResponse
|
|
750
750
|
|
|
751
|
-
if (
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
751
|
+
if (
|
|
752
|
+
typeof responseTemplates === 'object' &&
|
|
753
|
+
keys(responseTemplates).length > 0
|
|
754
|
+
) {
|
|
755
|
+
// BAD IMPLEMENTATION: first key in responseTemplates
|
|
756
|
+
const responseTemplate = responseTemplates[responseContentType]
|
|
757
|
+
|
|
758
|
+
if (responseTemplate && responseTemplate !== '\n') {
|
|
759
|
+
log.debug('_____ RESPONSE TEMPLATE PROCCESSING _____')
|
|
760
|
+
log.debug(`Using responseTemplate '${responseContentType}'`)
|
|
761
|
+
|
|
762
|
+
try {
|
|
763
|
+
const reponseContext = new VelocityContext(
|
|
764
|
+
request,
|
|
765
|
+
stage,
|
|
766
|
+
result,
|
|
767
|
+
).getContext()
|
|
768
|
+
|
|
769
|
+
result = renderVelocityTemplateObject(
|
|
770
|
+
{
|
|
771
|
+
root: responseTemplate,
|
|
772
|
+
},
|
|
773
|
+
reponseContext,
|
|
774
|
+
).root
|
|
775
|
+
} catch (error) {
|
|
776
|
+
log.error(
|
|
777
|
+
`Error while parsing responseTemplate '${responseContentType}' for lambda ${functionKey}:\n${error.stack}`,
|
|
778
|
+
)
|
|
778
779
|
}
|
|
779
780
|
}
|
|
780
781
|
}
|
|
@@ -70,10 +70,8 @@ export default class InvocationsController {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
// Checking if the result of the Lambda Invoke is a primitive string to wrap it. this is for future post-processing such as Step Functions Tasks
|
|
73
|
-
if (result) {
|
|
74
|
-
|
|
75
|
-
result = `"${result}"`
|
|
76
|
-
}
|
|
73
|
+
if (result && typeof result === 'string') {
|
|
74
|
+
result = `"${result}"`
|
|
77
75
|
}
|
|
78
76
|
|
|
79
77
|
// result is actually the Payload.
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
export default function getApiKeysValues(apiKeys) {
|
|
2
2
|
return new Set(
|
|
3
3
|
apiKeys
|
|
4
|
-
.
|
|
5
|
-
|
|
4
|
+
.map((apiKey) => {
|
|
5
|
+
if (typeof apiKey === 'object' && apiKey.value != null) {
|
|
6
|
+
return apiKey.value
|
|
7
|
+
}
|
|
8
|
+
if (typeof apiKey === 'string') {
|
|
9
|
+
return apiKey
|
|
10
|
+
}
|
|
11
|
+
return undefined
|
|
12
|
+
})
|
|
13
|
+
.filter((apiKey) => !!apiKey),
|
|
6
14
|
)
|
|
7
15
|
}
|