serverless-offline 13.3.2 → 13.3.3

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.
Files changed (112) hide show
  1. package/README.md +17 -17
  2. package/package.json +14 -13
  3. package/src/ServerlessOffline.js +42 -42
  4. package/src/config/colors.js +9 -9
  5. package/src/config/commandOptions.js +61 -61
  6. package/src/config/constants.js +5 -5
  7. package/src/config/defaultOptions.js +6 -6
  8. package/src/config/index.js +4 -4
  9. package/src/config/supportedRuntimes.js +18 -18
  10. package/src/errors/index.js +1 -1
  11. package/src/events/alb/Alb.js +2 -2
  12. package/src/events/alb/AlbEventDefinition.js +2 -2
  13. package/src/events/alb/HttpServer.js +54 -54
  14. package/src/events/alb/index.js +1 -1
  15. package/src/events/alb/lambda-events/LambdaAlbRequestEvent.js +2 -2
  16. package/src/events/alb/lambda-events/index.js +1 -1
  17. package/src/events/authCanExecuteResource.js +3 -3
  18. package/src/events/authFunctionNameExtractor.js +9 -9
  19. package/src/events/authMatchPolicyResource.js +8 -8
  20. package/src/events/authValidateContext.js +11 -11
  21. package/src/events/http/Endpoint.js +26 -26
  22. package/src/events/http/Http.js +2 -2
  23. package/src/events/http/HttpEventDefinition.js +2 -2
  24. package/src/events/http/HttpServer.js +156 -156
  25. package/src/events/http/OfflineEndpoint.js +7 -7
  26. package/src/events/http/authJWTSettingsExtractor.js +2 -2
  27. package/src/events/http/createAuthScheme.js +29 -27
  28. package/src/events/http/createJWTAuthScheme.js +12 -12
  29. package/src/events/http/index.js +1 -1
  30. package/src/events/http/javaHelpers.js +2 -2
  31. package/src/events/http/lambda-events/LambdaIntegrationEvent.js +5 -5
  32. package/src/events/http/lambda-events/LambdaProxyIntegrationEvent.js +47 -47
  33. package/src/events/http/lambda-events/LambdaProxyIntegrationEventV2.js +27 -27
  34. package/src/events/http/lambda-events/VelocityContext.js +28 -32
  35. package/src/events/http/lambda-events/index.js +4 -4
  36. package/src/events/http/lambda-events/renderVelocityTemplateObject.js +13 -13
  37. package/src/events/http/parseResources.js +6 -6
  38. package/src/events/http/payloadSchemaValidator.js +2 -2
  39. package/src/events/schedule/Schedule.js +21 -21
  40. package/src/events/schedule/ScheduleEvent.js +7 -7
  41. package/src/events/schedule/ScheduleEventDefinition.js +1 -1
  42. package/src/events/schedule/index.js +1 -1
  43. package/src/events/websocket/HttpServer.js +9 -9
  44. package/src/events/websocket/WebSocket.js +4 -4
  45. package/src/events/websocket/WebSocketClients.js +29 -29
  46. package/src/events/websocket/WebSocketEventDefinition.js +1 -1
  47. package/src/events/websocket/WebSocketServer.js +9 -9
  48. package/src/events/websocket/http-routes/_catchAll/catchAllRoute.js +3 -3
  49. package/src/events/websocket/http-routes/_catchAll/index.js +1 -1
  50. package/src/events/websocket/http-routes/connections/ConnectionsController.js +1 -1
  51. package/src/events/websocket/http-routes/connections/connectionsRoutes.js +6 -6
  52. package/src/events/websocket/http-routes/connections/index.js +1 -1
  53. package/src/events/websocket/http-routes/index.js +2 -2
  54. package/src/events/websocket/index.js +1 -1
  55. package/src/events/websocket/lambda-events/WebSocketAuthorizerEvent.js +5 -5
  56. package/src/events/websocket/lambda-events/WebSocketConnectEvent.js +7 -6
  57. package/src/events/websocket/lambda-events/WebSocketDisconnectEvent.js +5 -5
  58. package/src/events/websocket/lambda-events/WebSocketEvent.js +2 -2
  59. package/src/events/websocket/lambda-events/WebSocketRequestContext.js +12 -11
  60. package/src/events/websocket/lambda-events/index.js +4 -4
  61. package/src/index.js +1 -1
  62. package/src/lambda/HttpServer.js +11 -11
  63. package/src/lambda/Lambda.js +2 -2
  64. package/src/lambda/LambdaContext.js +1 -1
  65. package/src/lambda/LambdaFunction.js +34 -34
  66. package/src/lambda/LambdaFunctionPool.js +3 -3
  67. package/src/lambda/handler-runner/HandlerRunner.js +12 -12
  68. package/src/lambda/handler-runner/docker-runner/DockerContainer.js +59 -59
  69. package/src/lambda/handler-runner/docker-runner/DockerImage.js +6 -6
  70. package/src/lambda/handler-runner/docker-runner/DockerRunner.js +2 -2
  71. package/src/lambda/handler-runner/docker-runner/index.js +1 -1
  72. package/src/lambda/handler-runner/go-runner/GoRunner.js +34 -34
  73. package/src/lambda/handler-runner/go-runner/index.js +1 -1
  74. package/src/lambda/handler-runner/in-process-runner/InProcessRunner.js +7 -7
  75. package/src/lambda/handler-runner/in-process-runner/aws-lambda-ric/UserFunction.js +52 -52
  76. package/src/lambda/handler-runner/in-process-runner/index.js +1 -1
  77. package/src/lambda/handler-runner/index.js +1 -1
  78. package/src/lambda/handler-runner/java-runner/JavaRunner.js +13 -13
  79. package/src/lambda/handler-runner/java-runner/index.js +1 -1
  80. package/src/lambda/handler-runner/python-runner/PythonRunner.js +21 -21
  81. package/src/lambda/handler-runner/python-runner/index.js +1 -1
  82. package/src/lambda/handler-runner/ruby-runner/RubyRunner.js +11 -11
  83. package/src/lambda/handler-runner/ruby-runner/index.js +1 -1
  84. package/src/lambda/handler-runner/worker-thread-runner/WorkerThreadRunner.js +6 -6
  85. package/src/lambda/handler-runner/worker-thread-runner/index.js +1 -1
  86. package/src/lambda/handler-runner/worker-thread-runner/workerThreadHelper.js +4 -4
  87. package/src/lambda/index.js +1 -1
  88. package/src/lambda/routes/index.js +2 -2
  89. package/src/lambda/routes/invocations/InvocationsController.js +11 -11
  90. package/src/lambda/routes/invocations/index.js +1 -1
  91. package/src/lambda/routes/invocations/invocationsRoute.js +15 -15
  92. package/src/lambda/routes/invoke-async/index.js +1 -1
  93. package/src/lambda/routes/invoke-async/invokeAsyncRoute.js +6 -6
  94. package/src/utils/checkDockerDaemon.js +8 -8
  95. package/src/utils/checkGoVersion.js +3 -3
  96. package/src/utils/createApiKey.js +2 -2
  97. package/src/utils/detectExecutable.js +2 -2
  98. package/src/utils/formatToClfTime.js +2 -2
  99. package/src/utils/generateHapiPath.js +8 -8
  100. package/src/utils/getApiKeysValues.js +2 -2
  101. package/src/utils/getHttpApiCorsConfig.js +11 -11
  102. package/src/utils/getRawQueryParams.js +2 -2
  103. package/src/utils/index.js +25 -26
  104. package/src/utils/jsonPath.js +1 -1
  105. package/src/utils/logRoutes.js +13 -13
  106. package/src/utils/parseHeaders.js +1 -1
  107. package/src/utils/parseMultiValueHeaders.js +1 -1
  108. package/src/utils/parseMultiValueQueryStringParameters.js +1 -1
  109. package/src/utils/parseQueryStringParameters.js +1 -1
  110. package/src/utils/parseQueryStringParametersForPayloadV2.js +1 -1
  111. package/src/utils/splitHandlerPathAndName.js +3 -3
  112. package/src/utils/createUniqueId.js +0 -5
package/README.md CHANGED
@@ -304,45 +304,45 @@ the Lambda handler process is running in a child process.
304
304
  To use `Lambda.invoke` you need to set the lambda endpoint to the `serverless-offline` endpoint:
305
305
 
306
306
  ```js
307
- import { env } from 'node:process'
308
- import aws from 'aws-sdk'
307
+ import { env } from "node:process"
308
+ import aws from "aws-sdk"
309
309
 
310
310
  const lambda = new aws.Lambda({
311
- apiVersion: '2015-03-31',
311
+ apiVersion: "2015-03-31",
312
312
  // endpoint needs to be set only if it deviates from the default
313
313
  endpoint: env.IS_OFFLINE
314
- ? 'http://localhost:3002'
315
- : 'https://lambda.us-east-1.amazonaws.com',
314
+ ? "http://localhost:3002"
315
+ : "https://lambda.us-east-1.amazonaws.com",
316
316
  })
317
317
  ```
318
318
 
319
319
  All your lambdas can then be invoked in a handler using
320
320
 
321
321
  ```js
322
- import { Buffer } from 'node:buffer'
323
- import aws from 'aws-sdk'
322
+ import { Buffer } from "node:buffer"
323
+ import aws from "aws-sdk"
324
324
 
325
325
  const { stringify } = JSON
326
326
 
327
327
  const lambda = new aws.Lambda({
328
- apiVersion: '2015-03-31',
329
- endpoint: 'http://localhost:3002',
328
+ apiVersion: "2015-03-31",
329
+ endpoint: "http://localhost:3002",
330
330
  })
331
331
 
332
332
  export async function handler() {
333
333
  const clientContextData = stringify({
334
- foo: 'foo',
334
+ foo: "foo",
335
335
  })
336
336
 
337
337
  const payload = stringify({
338
- data: 'foo',
338
+ data: "foo",
339
339
  })
340
340
 
341
341
  const params = {
342
- ClientContext: Buffer.from(clientContextData).toString('base64'),
342
+ ClientContext: Buffer.from(clientContextData).toString("base64"),
343
343
  // FunctionName is composed of: service name - stage - function name, e.g.
344
- FunctionName: 'myServiceName-dev-invokedHandler',
345
- InvocationType: 'RequestResponse',
344
+ FunctionName: "myServiceName-dev-invokedHandler",
345
+ InvocationType: "RequestResponse",
346
346
  Payload: payload,
347
347
  }
348
348
 
@@ -544,8 +544,8 @@ module.exports = function (endpoint, functionKey, method, path) {
544
544
  }
545
545
  },
546
546
 
547
- name: 'your strategy name',
548
- scheme: 'your scheme name',
547
+ name: "your strategy name",
548
+ scheme: "your scheme name",
549
549
  }
550
550
  }
551
551
  ```
@@ -697,7 +697,7 @@ custom:
697
697
  serverless-offline:
698
698
  resourceRoutes:
699
699
  YourCloudFormationMethodId:
700
- Uri: 'http://localhost:3001/assets/{proxy}'
700
+ Uri: "http://localhost:3001/assets/{proxy}"
701
701
  ```
702
702
 
703
703
  ### Response parameters
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.2",
4
+ "version": "13.3.3",
5
5
  "description": "Emulate AWS λ and API Gateway locally when developing your Serverless project",
6
6
  "license": "MIT",
7
7
  "exports": {
@@ -10,6 +10,7 @@
10
10
  },
11
11
  "type": "module",
12
12
  "scripts": {
13
+ "code-quality": "npm run prettier && npm run lint",
13
14
  "lint": "eslint .",
14
15
  "lint:fix": "eslint . --fix",
15
16
  "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",
@@ -73,7 +74,7 @@
73
74
  ]
74
75
  },
75
76
  "dependencies": {
76
- "@aws-sdk/client-lambda": "^3.470.0",
77
+ "@aws-sdk/client-lambda": "^3.496.0",
77
78
  "@hapi/boom": "^10.0.1",
78
79
  "@hapi/h2o2": "^10.0.4",
79
80
  "@hapi/hapi": "^21.3.2",
@@ -81,36 +82,36 @@
81
82
  "array-unflat-js": "^0.1.3",
82
83
  "boxen": "^7.1.1",
83
84
  "chalk": "^5.3.0",
84
- "desm": "^1.3.0",
85
+ "desm": "^1.3.1",
85
86
  "execa": "^8.0.1",
86
87
  "fs-extra": "^11.2.0",
87
88
  "is-wsl": "^3.1.0",
88
89
  "java-invoke-local": "0.0.6",
89
- "jose": "^5.1.2",
90
+ "jose": "^5.2.0",
90
91
  "js-string-escape": "^1.0.1",
91
- "jsonpath-plus": "^7.2.0",
92
+ "jsonpath-plus": "^8.0.0",
92
93
  "jsonschema": "^1.4.1",
93
94
  "jszip": "^3.10.1",
94
95
  "luxon": "^3.4.4",
95
96
  "node-schedule": "^2.1.1",
96
97
  "p-memoize": "^7.1.1",
97
- "p-retry": "^6.1.0",
98
+ "p-retry": "^6.2.0",
98
99
  "velocityjs": "^2.0.6",
99
- "ws": "^8.15.1"
100
+ "ws": "^8.16.0"
100
101
  },
101
102
  "devDependencies": {
102
103
  "@istanbuljs/esm-loader-hook": "^0.2.0",
103
104
  "archiver": "^6.0.1",
104
- "commit-and-tag-version": "^12.0.0",
105
- "eslint": "^8.55.0",
105
+ "commit-and-tag-version": "^12.2.0",
106
+ "eslint": "^8.56.0",
106
107
  "eslint-config-airbnb-base": "^15.0.0",
107
108
  "eslint-config-prettier": "^9.1.0",
108
- "eslint-plugin-import": "^2.29.0",
109
- "eslint-plugin-prettier": "^5.0.1",
110
- "eslint-plugin-unicorn": "^49.0.0",
109
+ "eslint-plugin-import": "^2.29.1",
110
+ "eslint-plugin-prettier": "^5.1.3",
111
+ "eslint-plugin-unicorn": "^50.0.1",
111
112
  "mocha": "^10.2.0",
112
113
  "nyc": "^15.1.0",
113
- "prettier": "^3.1.1",
114
+ "prettier": "^3.2.4",
114
115
  "serverless": "^3.38.0"
115
116
  },
116
117
  "peerDependencies": {
@@ -1,12 +1,12 @@
1
- import process, { exit } from 'node:process'
2
- import { log } from '@serverless/utils/log.js'
1
+ import process, { exit } from "node:process"
2
+ import { log } from "@serverless/utils/log.js"
3
3
  import {
4
4
  commandOptions,
5
5
  CUSTOM_OPTION,
6
6
  defaultOptions,
7
7
  SERVER_SHUTDOWN_TIMEOUT,
8
- } from './config/index.js'
9
- import { gray } from './config/colors.js'
8
+ } from "./config/index.js"
9
+ import { gray } from "./config/colors.js"
10
10
 
11
11
  export default class ServerlessOffline {
12
12
  #alb = null
@@ -30,28 +30,28 @@ export default class ServerlessOffline {
30
30
  // add start nested options
31
31
  commands: {
32
32
  functionsUpdated: {
33
- lifecycleEvents: ['cleanup'],
34
- type: 'entrypoint',
33
+ lifecycleEvents: ["cleanup"],
34
+ type: "entrypoint",
35
35
  },
36
36
  start: {
37
- lifecycleEvents: ['init', 'ready', 'end'],
37
+ lifecycleEvents: ["init", "ready", "end"],
38
38
  options: commandOptions,
39
39
  usage:
40
- 'Simulates API Gateway to call your lambda functions offline using backward compatible initialization.',
40
+ "Simulates API Gateway to call your lambda functions offline using backward compatible initialization.",
41
41
  },
42
42
  },
43
- lifecycleEvents: ['start'],
43
+ lifecycleEvents: ["start"],
44
44
  options: commandOptions,
45
- usage: 'Simulates API Gateway to call your lambda functions offline.',
45
+ usage: "Simulates API Gateway to call your lambda functions offline.",
46
46
  },
47
47
  }
48
48
 
49
49
  hooks = {
50
- 'offline:functionsUpdated:cleanup': this.#cleanupFunctions.bind(this),
51
- 'offline:start': this.#startWithExplicitEnd.bind(this),
52
- 'offline:start:end': this.end.bind(this),
53
- 'offline:start:init': this.start.bind(this),
54
- 'offline:start:ready': this.#ready.bind(this),
50
+ "offline:functionsUpdated:cleanup": this.#cleanupFunctions.bind(this),
51
+ "offline:start": this.#startWithExplicitEnd.bind(this),
52
+ "offline:start:end": this.end.bind(this),
53
+ "offline:start:init": this.start.bind(this),
54
+ "offline:start:ready": this.#ready.bind(this),
55
55
  }
56
56
 
57
57
  constructor(serverless, cliOptions) {
@@ -102,7 +102,7 @@ export default class ServerlessOffline {
102
102
  }
103
103
 
104
104
  async end(skipExit) {
105
- log.info('Halting offline server')
105
+ log.info("Halting offline server")
106
106
 
107
107
  const eventModules = []
108
108
 
@@ -138,7 +138,7 @@ export default class ServerlessOffline {
138
138
 
139
139
  async #cleanupFunctions() {
140
140
  if (this.#lambda) {
141
- log.debug('Forcing cleanup of Lambda functions')
141
+ log.debug("Forcing cleanup of Lambda functions")
142
142
  await this.#lambda.cleanup()
143
143
  }
144
144
  }
@@ -159,18 +159,18 @@ export default class ServerlessOffline {
159
159
  const command = await new Promise((resolve) => {
160
160
  process
161
161
  // SIGINT will be usually sent when user presses ctrl+c
162
- .on('SIGINT', () => resolve('SIGINT'))
162
+ .on("SIGINT", () => resolve("SIGINT"))
163
163
  // SIGTERM is a default termination signal in many cases,
164
164
  // for example when "killing" a subprocess spawned in node
165
165
  // with child_process methods
166
- .on('SIGTERM', () => resolve('SIGTERM'))
166
+ .on("SIGTERM", () => resolve("SIGTERM"))
167
167
  })
168
168
 
169
169
  log.info(`Got ${command} signal. Offline Halting...`)
170
170
  }
171
171
 
172
172
  async #createLambda(lambdas, skipStart) {
173
- const { default: Lambda } = await import('./lambda/index.js')
173
+ const { default: Lambda } = await import("./lambda/index.js")
174
174
 
175
175
  this.#lambda = new Lambda(this.#serverless, this.#options)
176
176
 
@@ -182,7 +182,7 @@ export default class ServerlessOffline {
182
182
  }
183
183
 
184
184
  async #createHttp(events, skipStart) {
185
- const { default: Http } = await import('./events/http/index.js')
185
+ const { default: Http } = await import("./events/http/index.js")
186
186
 
187
187
  this.#http = new Http(this.#serverless, this.#options, this.#lambda)
188
188
 
@@ -204,7 +204,7 @@ export default class ServerlessOffline {
204
204
  }
205
205
 
206
206
  async #createSchedule(events) {
207
- const { default: Schedule } = await import('./events/schedule/index.js')
207
+ const { default: Schedule } = await import("./events/schedule/index.js")
208
208
 
209
209
  this.#schedule = new Schedule(
210
210
  this.#lambda,
@@ -215,7 +215,7 @@ export default class ServerlessOffline {
215
215
  }
216
216
 
217
217
  async #createWebSocket(events) {
218
- const { default: WebSocket } = await import('./events/websocket/index.js')
218
+ const { default: WebSocket } = await import("./events/websocket/index.js")
219
219
 
220
220
  this.#webSocket = new WebSocket(
221
221
  this.#serverless,
@@ -231,7 +231,7 @@ export default class ServerlessOffline {
231
231
  }
232
232
 
233
233
  async #createAlb(events, skipStart) {
234
- const { default: Alb } = await import('./events/alb/index.js')
234
+ const { default: Alb } = await import("./events/alb/index.js")
235
235
 
236
236
  this.#alb = new Alb(this.#serverless, this.#options, this.#lambda)
237
237
 
@@ -261,14 +261,14 @@ export default class ServerlessOffline {
261
261
 
262
262
  // Parse CORS options
263
263
  this.#options.corsAllowHeaders = this.#options.corsAllowHeaders
264
- .replaceAll(' ', '')
265
- .split(',')
264
+ .replaceAll(" ", "")
265
+ .split(",")
266
266
  this.#options.corsAllowOrigin = this.#options.corsAllowOrigin
267
- .replaceAll(' ', '')
268
- .split(',')
267
+ .replaceAll(" ", "")
268
+ .split(",")
269
269
  this.#options.corsExposedHeaders = this.#options.corsExposedHeaders
270
- .replaceAll(' ', '')
271
- .split(',')
270
+ .replaceAll(" ", "")
271
+ .split(",")
272
272
 
273
273
  this.#options.corsConfig = {
274
274
  credentials: !this.#options.corsDisallowCredentials,
@@ -284,7 +284,7 @@ export default class ServerlessOffline {
284
284
  } ${gray(`(${this.#options.region || provider.region})`)}`,
285
285
  )
286
286
  log.notice()
287
- log.debug('options:', this.#options)
287
+ log.debug("options:", this.#options)
288
288
  }
289
289
 
290
290
  #getEvents() {
@@ -339,27 +339,27 @@ export default class ServerlessOffline {
339
339
 
340
340
  // Ensure definitions for 'httpApi' events are objects so that they can be marked
341
341
  // with an 'isHttpApi' property (they are handled differently to 'http' events)
342
- if (typeof httpApiEvent.http === 'string') {
342
+ if (typeof httpApiEvent.http === "string") {
343
343
  httpApiEvent.http = {
344
344
  routeKey:
345
- httpApiEvent.http === '*' ? '$default' : httpApiEvent.http,
345
+ httpApiEvent.http === "*" ? "$default" : httpApiEvent.http,
346
346
  }
347
- } else if (typeof httpApiEvent.http === 'object') {
347
+ } else if (typeof httpApiEvent.http === "object") {
348
348
  if (!httpApiEvent.http.method) {
349
349
  log.warning(
350
350
  `Event definition is missing a method for function "${functionKey}"`,
351
351
  )
352
- httpApiEvent.http.method = ''
352
+ httpApiEvent.http.method = ""
353
353
  }
354
354
  if (
355
- httpApiEvent.http.method === '*' &&
356
- httpApiEvent.http.path === '*'
355
+ httpApiEvent.http.method === "*" &&
356
+ httpApiEvent.http.path === "*"
357
357
  ) {
358
- httpApiEvent.http.routeKey = '$default'
358
+ httpApiEvent.http.routeKey = "$default"
359
359
  } else {
360
360
  const resolvedMethod =
361
- httpApiEvent.http.method === '*'
362
- ? 'ANY'
361
+ httpApiEvent.http.method === "*"
362
+ ? "ANY"
363
363
  : httpApiEvent.http.method.toUpperCase()
364
364
  httpApiEvent.http.routeKey = `${resolvedMethod} ${httpApiEvent.http.path}`
365
365
  }
@@ -371,7 +371,7 @@ export default class ServerlessOffline {
371
371
  log.warning(
372
372
  `Event definition must be a string or object but received ${typeof httpApiEvent.http} for function "${functionKey}"`,
373
373
  )
374
- httpApiEvent.http.routeKey = ''
374
+ httpApiEvent.http.routeKey = ""
375
375
  }
376
376
 
377
377
  httpApiEvent.http.isHttpApi = true
@@ -385,7 +385,7 @@ export default class ServerlessOffline {
385
385
  httpApiEvent.http.payload =
386
386
  service.provider.httpApi && service.provider.httpApi.payload
387
387
  ? service.provider.httpApi.payload
388
- : '2.0'
388
+ : "2.0"
389
389
  }
390
390
 
391
391
  httpApiEvents.push(httpApiEvent)
@@ -1,10 +1,10 @@
1
- import chalk from 'chalk'
1
+ import chalk from "chalk"
2
2
 
3
- export const dodgerblue = chalk.hex('#1e90ff')
4
- export const gray = chalk.hex('#808080')
5
- export const lime = chalk.hex('#00ff00')
6
- export const orange = chalk.hex('#ffa500')
7
- export const peachpuff = chalk.hex('#ffdab9')
8
- export const plum = chalk.hex('#dda0dd')
9
- export const red = chalk.hex('#ff0000')
10
- export const yellow = chalk.hex('#ffff00')
3
+ export const dodgerblue = chalk.hex("#1e90ff")
4
+ export const gray = chalk.hex("#808080")
5
+ export const lime = chalk.hex("#00ff00")
6
+ export const orange = chalk.hex("#ffa500")
7
+ export const peachpuff = chalk.hex("#ffdab9")
8
+ export const plum = chalk.hex("#dda0dd")
9
+ export const red = chalk.hex("#ff0000")
10
+ export const yellow = chalk.hex("#ffff00")
@@ -1,138 +1,138 @@
1
1
  export default {
2
2
  albPort: {
3
- type: 'string',
4
- usage: 'ALB port to listen on. Default: 3003.',
3
+ type: "string",
4
+ usage: "ALB port to listen on. Default: 3003.",
5
5
  },
6
6
  corsAllowHeaders: {
7
- type: 'string',
7
+ type: "string",
8
8
  usage:
9
- 'Used to build the Access-Control-Allow-Headers header for CORS support.',
9
+ "Used to build the Access-Control-Allow-Headers header for CORS support.",
10
10
  },
11
11
  corsAllowOrigin: {
12
- type: 'string',
12
+ type: "string",
13
13
  usage:
14
- 'Used to build the Access-Control-Allow-Origin header for CORS support.',
14
+ "Used to build the Access-Control-Allow-Origin header for CORS support.",
15
15
  },
16
16
  corsDisallowCredentials: {
17
- type: 'boolean',
17
+ type: "boolean",
18
18
  usage:
19
- 'Used to override the Access-Control-Allow-Credentials default (which is true) to false.',
19
+ "Used to override the Access-Control-Allow-Credentials default (which is true) to false.",
20
20
  },
21
21
  corsExposedHeaders: {
22
- type: 'string',
22
+ type: "string",
23
23
  usage:
24
- 'Used to build the Access-Control-Exposed-Headers response header for CORS support.',
24
+ "Used to build the Access-Control-Exposed-Headers response header for CORS support.",
25
25
  },
26
26
  disableCookieValidation: {
27
- type: 'boolean',
28
- usage: 'Used to disable cookie-validation on hapi.js-server.',
27
+ type: "boolean",
28
+ usage: "Used to disable cookie-validation on hapi.js-server.",
29
29
  },
30
30
  dockerHost: {
31
- type: 'string',
32
- usage: 'The host name of Docker. Default: localhost.',
31
+ type: "string",
32
+ usage: "The host name of Docker. Default: localhost.",
33
33
  },
34
34
  dockerHostServicePath: {
35
- type: 'string',
35
+ type: "string",
36
36
  usage:
37
- 'Defines service path which is used by SLS running inside Docker container.',
37
+ "Defines service path which is used by SLS running inside Docker container.",
38
38
  },
39
39
  dockerNetwork: {
40
- type: 'string',
41
- usage: 'The network that the Docker container will connect to.',
40
+ type: "string",
41
+ usage: "The network that the Docker container will connect to.",
42
42
  },
43
43
  dockerReadOnly: {
44
- type: 'boolean',
45
- usage: 'Marks if the docker code layer should be read only. Default: true.',
44
+ type: "boolean",
45
+ usage: "Marks if the docker code layer should be read only. Default: true.",
46
46
  },
47
47
  enforceSecureCookies: {
48
- type: 'boolean',
49
- usage: 'Enforce secure cookies.',
48
+ type: "boolean",
49
+ usage: "Enforce secure cookies.",
50
50
  },
51
51
  host: {
52
- shortcut: 'o',
53
- type: 'string',
54
- usage: 'The host name to listen on. Default: localhost.',
52
+ shortcut: "o",
53
+ type: "string",
54
+ usage: "The host name to listen on. Default: localhost.",
55
55
  },
56
56
  httpPort: {
57
- type: 'string',
58
- usage: 'HTTP port to listen on. Default: 3000.',
57
+ type: "string",
58
+ usage: "HTTP port to listen on. Default: 3000.",
59
59
  },
60
60
  httpsProtocol: {
61
- shortcut: 'H',
62
- type: 'string',
61
+ shortcut: "H",
62
+ type: "string",
63
63
  usage:
64
- 'To enable HTTPS, specify directory (relative to your cwd, typically your project dir) for both cert.pem and key.pem files.',
64
+ "To enable HTTPS, specify directory (relative to your cwd, typically your project dir) for both cert.pem and key.pem files.",
65
65
  },
66
66
  ignoreJWTSignature: {
67
- type: 'boolean',
67
+ type: "boolean",
68
68
  usage:
69
69
  "When using HttpApi with a JWT authorizer, don't check the signature of the JWT token.",
70
70
  },
71
71
  lambdaPort: {
72
- type: 'string',
73
- usage: 'Lambda http port to listen on. Default: 3002.',
72
+ type: "string",
73
+ usage: "Lambda http port to listen on. Default: 3002.",
74
74
  },
75
75
  layersDir: {
76
- type: 'string',
76
+ type: "string",
77
77
  usage:
78
- 'The directory layers should be stored in. Default: {codeDir}/.serverless-offline/layers.',
78
+ "The directory layers should be stored in. Default: {codeDir}/.serverless-offline/layers.",
79
79
  },
80
80
  localEnvironment: {
81
- type: 'boolean',
82
- usage: 'Copy local environment variables. Default: false.',
81
+ type: "boolean",
82
+ usage: "Copy local environment variables. Default: false.",
83
83
  },
84
84
  noAuth: {
85
- type: 'boolean',
86
- usage: 'Turns off all authorizers.',
85
+ type: "boolean",
86
+ usage: "Turns off all authorizers.",
87
87
  },
88
88
  noPrependStageInUrl: {
89
- type: 'boolean',
89
+ type: "boolean",
90
90
  usage: "Don't prepend http routes with the stage.",
91
91
  },
92
92
  noTimeout: {
93
- shortcut: 't',
94
- type: 'boolean',
95
- usage: 'Disables the timeout feature.',
93
+ shortcut: "t",
94
+ type: "boolean",
95
+ usage: "Disables the timeout feature.",
96
96
  },
97
97
  prefix: {
98
- shortcut: 'p',
99
- type: 'string',
98
+ shortcut: "p",
99
+ type: "string",
100
100
  usage:
101
- 'Adds a prefix to every path, to send your requests to http://localhost:3000/prefix/[your_path] instead.',
101
+ "Adds a prefix to every path, to send your requests to http://localhost:3000/prefix/[your_path] instead.",
102
102
  },
103
103
  reloadHandler: {
104
- type: 'boolean',
105
- usage: 'Reloads handler with each request.',
104
+ type: "boolean",
105
+ usage: "Reloads handler with each request.",
106
106
  },
107
107
  resourceRoutes: {
108
- type: 'boolean',
109
- usage: 'Turns on loading of your HTTP proxy settings from serverless.yml.',
108
+ type: "boolean",
109
+ usage: "Turns on loading of your HTTP proxy settings from serverless.yml.",
110
110
  },
111
111
  terminateIdleLambdaTime: {
112
- type: 'string',
112
+ type: "string",
113
113
  usage:
114
- 'Number of seconds until an idle function is eligible for termination.',
114
+ "Number of seconds until an idle function is eligible for termination.",
115
115
  },
116
116
  useDocker: {
117
- type: 'boolean',
118
- usage: 'Uses docker for node/python/ruby/provided.',
117
+ type: "boolean",
118
+ usage: "Uses docker for node/python/ruby/provided.",
119
119
  },
120
120
  useInProcess: {
121
- type: 'boolean',
121
+ type: "boolean",
122
122
  usage: "Run handlers in the same process as 'serverless-offline'.",
123
123
  },
124
124
  webSocketHardTimeout: {
125
- type: 'string',
125
+ type: "string",
126
126
  usage:
127
- 'Set WebSocket hard timeout in seconds to reproduce AWS limits (https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html#apigateway-execution-service-websocket-limits-table). Default: 7200 (2 hours).',
127
+ "Set WebSocket hard timeout in seconds to reproduce AWS limits (https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html#apigateway-execution-service-websocket-limits-table). Default: 7200 (2 hours).",
128
128
  },
129
129
  webSocketIdleTimeout: {
130
- type: 'string',
130
+ type: "string",
131
131
  usage:
132
- 'Set WebSocket idle timeout in seconds to reproduce AWS limits (https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html#apigateway-execution-service-websocket-limits-table). Default: 600 (10 minutes).',
132
+ "Set WebSocket idle timeout in seconds to reproduce AWS limits (https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html#apigateway-execution-service-websocket-limits-table). Default: 600 (10 minutes).",
133
133
  },
134
134
  websocketPort: {
135
- type: 'string',
136
- usage: 'Websocket port to listen on. Default: 3001.',
135
+ type: "string",
136
+ usage: "Websocket port to listen on. Default: 3001.",
137
137
  },
138
138
  }
@@ -1,10 +1,10 @@
1
1
  // dummy placeholder url for the WHATWG URL constructor
2
2
  // https://github.com/nodejs/node/issues/12682
3
- export const BASE_URL_PLACEHOLDER = 'http://example'
3
+ export const BASE_URL_PLACEHOLDER = "http://example"
4
4
 
5
- export const CUSTOM_OPTION = 'serverless-offline'
5
+ export const CUSTOM_OPTION = "serverless-offline"
6
6
 
7
- export const DEFAULT_LAMBDA_RUNTIME = 'nodejs14.x'
7
+ export const DEFAULT_LAMBDA_RUNTIME = "nodejs14.x"
8
8
 
9
9
  // https://docs.aws.amazon.com/lambda/latest/dg/limits.html
10
10
  export const DEFAULT_LAMBDA_MEMORY_SIZE = 1024
@@ -15,8 +15,8 @@ export const DEFAULT_LAMBDA_TIMEOUT = 6 // 6 seconds
15
15
  export const SERVER_SHUTDOWN_TIMEOUT = 5000
16
16
 
17
17
  export const DEFAULT_WEBSOCKETS_API_ROUTE_SELECTION_EXPRESSION =
18
- '$request.body.action'
18
+ "$request.body.action"
19
19
 
20
- export const DEFAULT_WEBSOCKETS_ROUTE = '$default'
20
+ export const DEFAULT_WEBSOCKETS_ROUTE = "$default"
21
21
 
22
22
  export const DEFAULT_DOCKER_CONTAINER_PORT = 9001
@@ -1,16 +1,16 @@
1
1
  export default {
2
2
  albPort: 3003,
3
- corsAllowHeaders: 'accept,content-type,x-api-key,authorization',
4
- corsAllowOrigin: '*',
3
+ corsAllowHeaders: "accept,content-type,x-api-key,authorization",
4
+ corsAllowOrigin: "*",
5
5
  corsDisallowCredentials: true,
6
- corsExposedHeaders: 'WWW-Authenticate,Server-Authorization',
6
+ corsExposedHeaders: "WWW-Authenticate,Server-Authorization",
7
7
  disableCookieValidation: false,
8
- dockerHost: 'localhost',
8
+ dockerHost: "localhost",
9
9
  dockerHostServicePath: null,
10
10
  dockerNetwork: null,
11
11
  dockerReadOnly: true,
12
12
  enforceSecureCookies: false,
13
- host: 'localhost',
13
+ host: "localhost",
14
14
  httpPort: 3000,
15
15
  httpsProtocol: null,
16
16
  lambdaPort: 3002,
@@ -19,7 +19,7 @@ export default {
19
19
  noAuth: false,
20
20
  noPrependStageInUrl: false,
21
21
  noTimeout: false,
22
- prefix: '',
22
+ prefix: "",
23
23
  reloadHandler: false,
24
24
  resourceRoutes: false,
25
25
  terminateIdleLambdaTime: 60,
@@ -1,4 +1,4 @@
1
- export { default as commandOptions } from './commandOptions.js'
2
- export * from './constants.js'
3
- export { default as defaultOptions } from './defaultOptions.js'
4
- export * from './supportedRuntimes.js'
1
+ export { default as commandOptions } from "./commandOptions.js"
2
+ export * from "./constants.js"
3
+ export { default as defaultOptions } from "./defaultOptions.js"
4
+ export * from "./supportedRuntimes.js"