serverless-offline 9.1.1 → 9.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.
package/README.md CHANGED
@@ -152,7 +152,6 @@ custom:
152
152
  serverless-offline:
153
153
  httpsProtocol: 'dev-certs'
154
154
  httpPort: 4000
155
- stageVariables:
156
155
  foo: 'bar'
157
156
  ```
158
157
 
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": "9.1.1",
4
+ "version": "9.1.2",
5
5
  "description": "Emulate AWS λ and API Gateway locally when developing your Serverless project",
6
6
  "license": "MIT",
7
7
  "main": "./src/index.js",
@@ -194,7 +194,7 @@
194
194
  "@hapi/boom": "^10.0.0",
195
195
  "@hapi/h2o2": "^9.1.0",
196
196
  "@hapi/hapi": "^20.2.2",
197
- "aws-sdk": "^2.1184.0",
197
+ "aws-sdk": "^2.1185.0",
198
198
  "boxen": "^7.0.0",
199
199
  "chalk": "^5.0.1",
200
200
  "execa": "^6.1.0",
@@ -206,7 +206,7 @@
206
206
  "jsonwebtoken": "^8.5.1",
207
207
  "jszip": "^3.10.0",
208
208
  "luxon": "^3.0.1",
209
- "node-fetch": "^3.2.9",
209
+ "node-fetch": "^3.2.10",
210
210
  "node-schedule": "^2.1.0",
211
211
  "object.hasown": "^1.1.1",
212
212
  "p-memoize": "^7.1.0",
@@ -641,24 +641,18 @@ export default class HttpServer {
641
641
  event = request.payload || {}
642
642
  }
643
643
  } else if (integration === 'AWS_PROXY') {
644
- const stageVariables = this.#serverless.service.custom
645
- ? this.#serverless.service.custom.stageVariables
646
- : null
647
-
648
644
  const lambdaProxyIntegrationEvent =
649
645
  endpoint.isHttpApi && endpoint.payload === '2.0'
650
646
  ? new LambdaProxyIntegrationEventV2(
651
647
  request,
652
648
  stage,
653
649
  endpoint.routeKey,
654
- stageVariables,
655
650
  additionalRequestContext,
656
651
  )
657
652
  : new LambdaProxyIntegrationEvent(
658
653
  request,
659
654
  stage,
660
655
  requestPath,
661
- stageVariables,
662
656
  endpoint.isHttpApi ? endpoint.routeKey : null,
663
657
  additionalRequestContext,
664
658
  )
@@ -30,22 +30,12 @@ export default class LambdaProxyIntegrationEvent {
30
30
 
31
31
  #stage = null
32
32
 
33
- #stageVariables = null
34
-
35
- constructor(
36
- request,
37
- stage,
38
- path,
39
- stageVariables,
40
- routeKey,
41
- additionalRequestContext,
42
- ) {
33
+ constructor(request, stage, path, routeKey, additionalRequestContext) {
43
34
  this.#additionalRequestContext = additionalRequestContext || {}
44
35
  this.#path = path
45
36
  this.#routeKey = routeKey
46
37
  this.#request = request
47
38
  this.#stage = stage
48
- this.#stageVariables = stageVariables
49
39
  }
50
40
 
51
41
  create() {
@@ -227,7 +217,7 @@ export default class LambdaProxyIntegrationEvent {
227
217
  stage: this.#stage,
228
218
  },
229
219
  resource,
230
- stageVariables: this.#stageVariables,
220
+ stageVariables: null,
231
221
  }
232
222
  }
233
223
  }
@@ -24,20 +24,11 @@ export default class LambdaProxyIntegrationEventV2 {
24
24
 
25
25
  #stage = null
26
26
 
27
- #stageVariables = null
28
-
29
- constructor(
30
- request,
31
- stage,
32
- routeKey,
33
- stageVariables,
34
- additionalRequestContext,
35
- ) {
27
+ constructor(request, stage, routeKey, additionalRequestContext) {
36
28
  this.#additionalRequestContext = additionalRequestContext || {}
37
29
  this.#routeKey = routeKey
38
30
  this.#request = request
39
31
  this.#stage = stage
40
- this.#stageVariables = stageVariables
41
32
  }
42
33
 
43
34
  create() {
@@ -183,7 +174,7 @@ export default class LambdaProxyIntegrationEventV2 {
183
174
  timeEpoch: requestTimeEpoch,
184
175
  },
185
176
  routeKey: this.#routeKey,
186
- stageVariables: this.#stageVariables,
177
+ stageVariables: null,
187
178
  version: '2.0',
188
179
  }
189
180
  }
@@ -39,9 +39,9 @@ export default class Schedule {
39
39
  const cron = this.#convertExpressionToCron(entry)
40
40
 
41
41
  log.notice(
42
- `Scheduling [${functionKey}] cron: [${cron}] input: ${stringify(
43
- input,
44
- )}`,
42
+ `Scheduling [${functionKey}] cron: [${cron}]${
43
+ input ? ` input: ${stringify(input)}` : ''
44
+ }`,
45
45
  )
46
46
 
47
47
  nodeSchedule.scheduleJob(cron, async () => {
@@ -7,9 +7,9 @@ import { execa } from 'execa'
7
7
 
8
8
  const { parse, stringify } = JSON
9
9
 
10
- const PAYLOAD_IDENTIFIER = 'offline_payload'
11
-
12
10
  export default class GoRunner {
11
+ static #payloadIdentifier = 'offline_payload'
12
+
13
13
  #codeDir = null
14
14
 
15
15
  #env = null
@@ -51,12 +51,10 @@ export default class GoRunner {
51
51
  let payload
52
52
 
53
53
  for (const item of value.split(EOL)) {
54
- if (item.indexOf(PAYLOAD_IDENTIFIER) === -1) {
55
- logs.push(item)
56
- } else if (item.indexOf(PAYLOAD_IDENTIFIER) !== -1) {
54
+ if (item.includes(GoRunner.#payloadIdentifier)) {
57
55
  try {
58
56
  const {
59
- offline_payload: { success, error },
57
+ [GoRunner.#payloadIdentifier]: { error, success },
60
58
  } = parse(item)
61
59
 
62
60
  if (success) {
@@ -67,6 +65,8 @@ export default class GoRunner {
67
65
  } catch {
68
66
  // @ignore
69
67
  }
68
+ } else {
69
+ logs.push(item)
70
70
  }
71
71
  }
72
72
 
@@ -4,9 +4,11 @@ import { log } from '@serverless/utils/log.js'
4
4
  import { invokeJavaLocal } from 'java-invoke-local'
5
5
 
6
6
  const { parse, stringify } = JSON
7
- const { has } = Reflect
7
+ const { hasOwn } = Object
8
8
 
9
9
  export default class JavaRunner {
10
+ static #payloadIdentifier = '__offline_payload__'
11
+
10
12
  #deployPackage = null
11
13
 
12
14
  #env = null
@@ -45,9 +47,9 @@ export default class JavaRunner {
45
47
  if (
46
48
  json &&
47
49
  typeof json === 'object' &&
48
- has(json, '__offline_payload__')
50
+ hasOwn(json, JavaRunner.#payloadIdentifier)
49
51
  ) {
50
- return json.__offline_payload__
52
+ return json[JavaRunner.#payloadIdentifier]
51
53
  }
52
54
  }
53
55
 
@@ -7,12 +7,13 @@ import { fileURLToPath } from 'node:url'
7
7
  import { log } from '@serverless/utils/log.js'
8
8
 
9
9
  const { parse, stringify } = JSON
10
- const { assign } = Object
11
- const { has } = Reflect
10
+ const { assign, hasOwn } = Object
12
11
 
13
12
  const __dirname = dirname(fileURLToPath(import.meta.url))
14
13
 
15
14
  export default class PythonRunner {
15
+ static #payloadIdentifier = '__offline_payload__'
16
+
16
17
  #env = null
17
18
 
18
19
  #handlerName = null
@@ -83,9 +84,9 @@ export default class PythonRunner {
83
84
  if (
84
85
  json &&
85
86
  typeof json === 'object' &&
86
- has(json, '__offline_payload__')
87
+ hasOwn(json, PythonRunner.#payloadIdentifier)
87
88
  ) {
88
- payload = json.__offline_payload__
89
+ payload = json[PythonRunner.#payloadIdentifier]
89
90
  // everything else is print(), logging, ...
90
91
  } else {
91
92
  log.notice(item)
@@ -6,11 +6,13 @@ import { log } from '@serverless/utils/log.js'
6
6
  import { execa } from 'execa'
7
7
 
8
8
  const { parse, stringify } = JSON
9
- const { has } = Reflect
9
+ const { hasOwn } = Object
10
10
 
11
11
  const __dirname = dirname(fileURLToPath(import.meta.url))
12
12
 
13
13
  export default class RubyRunner {
14
+ static #payloadIdentifier = '__offline_payload__'
15
+
14
16
  #env = null
15
17
 
16
18
  #handlerName = null
@@ -47,9 +49,9 @@ export default class RubyRunner {
47
49
  if (
48
50
  json &&
49
51
  typeof json === 'object' &&
50
- has(json, '__offline_payload__')
52
+ hasOwn(json, RubyRunner.#payloadIdentifier)
51
53
  ) {
52
- payload = json.__offline_payload__
54
+ payload = json[RubyRunner.#payloadIdentifier]
53
55
  } else {
54
56
  log.notice(item)
55
57
  }