serverless-offline 10.0.0 → 10.0.1

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,7 +1,7 @@
1
1
  {
2
2
  "dedicatedTo": "Blue, a great migrating bird.",
3
3
  "name": "serverless-offline",
4
- "version": "10.0.0",
4
+ "version": "10.0.1",
5
5
  "description": "Emulate AWS λ and API Gateway locally when developing your Serverless project",
6
6
  "license": "MIT",
7
7
  "exports": {
@@ -17,6 +17,7 @@
17
17
  "prepare": "husky install",
18
18
  "prepare-release": "standard-version && prettier --write CHANGELOG.md",
19
19
  "prepublishOnly": "npm run lint",
20
+ "prettier": "prettier --check .",
20
21
  "prettier-check": "prettier -c --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"",
21
22
  "prettier-check:updated": "pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c",
22
23
  "prettify": "prettier --write --ignore-path .gitignore \"**/*.{css,html,js,json,md,yaml,yml}\"",
@@ -52,12 +53,6 @@
52
53
  "websocket"
53
54
  ],
54
55
  "author": "David Hérault <dherault@gmail.com> (https://github.com/dherault)",
55
- "maintainers": [
56
- "Bilal Soylu (https://github.com/Bilal-S)",
57
- "Daniel Cottone <daniel.cottone@gmail.com> (https://github.com/daniel-cottone)",
58
- "Leonardo Alifraco (https://github.com/leonardoalifraco)",
59
- "Michael Staub (https://github.com/mikestaub)"
60
- ],
61
56
  "contributors": [
62
57
  "Adam Sweeting (https://github.com/adamelliottsweeting)",
63
58
  "Adrien (https://github.com/AdrienGiboire)",
@@ -191,7 +186,7 @@
191
186
  "@hapi/h2o2": "^9.1.0",
192
187
  "@hapi/hapi": "^20.2.2",
193
188
  "@serverless/utils": "^6.7.0",
194
- "aws-sdk": "^2.1209.0",
189
+ "aws-sdk": "^2.1213.0",
195
190
  "boxen": "^7.0.0",
196
191
  "chalk": "^5.0.1",
197
192
  "execa": "^6.1.0",
@@ -134,7 +134,7 @@ export default class ServerlessOffline {
134
134
  async #startWithExplicitEnd() {
135
135
  await this.start()
136
136
  await this.#ready()
137
- this.end()
137
+ await this.end()
138
138
  }
139
139
 
140
140
  async #listenForTermination() {
@@ -7,11 +7,12 @@ import {
7
7
  lowerCaseKeys,
8
8
  nullIfEmpty,
9
9
  parseHeaders,
10
+ parseQueryStringParametersForPayloadV2,
10
11
  } from '../../../utils/index.js'
11
12
 
12
13
  const { isArray } = Array
13
14
  const { parse } = JSON
14
- const { assign, entries, fromEntries } = Object
15
+ const { assign, entries } = Object
15
16
 
16
17
  // https://www.serverless.com/framework/docs/providers/aws/events/http-api/
17
18
  // https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
@@ -142,7 +143,7 @@ export default class LambdaProxyIntegrationEventV2 {
142
143
  isBase64Encoded: false,
143
144
  pathParameters: nullIfEmpty(pathParams),
144
145
  queryStringParameters: this.#request.url.search
145
- ? fromEntries(Array.from(this.#request.url.searchParams))
146
+ ? parseQueryStringParametersForPayloadV2(this.#request.url.searchParams)
146
147
  : null,
147
148
  rawPath: this.#request.url.pathname,
148
149
  rawQueryString: this.#request.url.searchParams.toString(),
@@ -12,6 +12,7 @@ export { default as parseHeaders } from './parseHeaders.js'
12
12
  export { default as parseMultiValueHeaders } from './parseMultiValueHeaders.js'
13
13
  export { default as parseMultiValueQueryStringParameters } from './parseMultiValueQueryStringParameters.js'
14
14
  export { default as parseQueryStringParameters } from './parseQueryStringParameters.js'
15
+ export { default as parseQueryStringParametersForPayloadV2 } from './parseQueryStringParametersForPayloadV2.js'
15
16
  export { default as splitHandlerPathAndName } from './splitHandlerPathAndName.js'
16
17
 
17
18
  // export { default as baseImage } from './baseImage.js'
@@ -0,0 +1,22 @@
1
+ /**
2
+ *
3
+ * @description Instead of using `multiValueQueryStringParameters` API Gateway HTTP API combines
4
+ * duplicate query string keys with commas in the `queryStringParameters` field.
5
+ * https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
6
+ *
7
+ * @param { URLSearchParams } searchParams
8
+ */
9
+ export default function parseQueryStringParametersForPayloadV2(searchParams) {
10
+ const keyValuePairs = Array.from(searchParams)
11
+
12
+ if (keyValuePairs.length === 0) {
13
+ return null
14
+ }
15
+
16
+ return keyValuePairs.reduce((previousValue, [key, value]) => {
17
+ if (!previousValue[key]) {
18
+ return { ...previousValue, [key]: value }
19
+ }
20
+ return { ...previousValue, [key]: [previousValue[key], value].join(',') }
21
+ }, {})
22
+ }