@yopdev/dev-server 1.5.6 → 1.5.7

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.
@@ -16,7 +16,8 @@ class CloudFormationEventsProxy extends cloudformation_1.CloudFormationSetup {
16
16
  const actual = Object.entries(attributes).flatMap((entry) => entry[1].Value + entry[0]);
17
17
  return required.filter((e) => actual.includes(e)).length > 0;
18
18
  },
19
- }), config.prepare, (_name, _config, routes) => routes, config);
19
+ }), config.prepare, config);
20
+ this.afterStart = (_name, _config, routes) => routes;
20
21
  }
21
22
  logHandler(handler) {
22
23
  return `detected sns handler ${handler.name}`;
@@ -15,15 +15,15 @@ class CloudFormationLambdaProxy extends cloudformation_1.CloudFormationSetup {
15
15
  path: new RegExp(`^${pathWithCapturingGroups}${QUERY_STRING_OR_LOCATION_REG_EXP}?$`),
16
16
  weight: this.computeWeight(pathWithCapturingGroups),
17
17
  handler: this.pathParameterCapture(new RegExp(pathWithCapturingGroups), handler, config.context),
18
- })), config.prepare, (name, cfg, routes) => {
19
- return (0, lambda_http_proxy_1.newLambdaHttpProxy)(`${name}:apigw`, {
20
- settings: this.settings,
21
- routes: this.extraRoutes.concat(routes),
22
- authorizer: (config?.authorizer || (() => undefined))(cfg),
23
- }, callback);
24
- }, config);
18
+ })), config.prepare, config);
25
19
  this.settings = settings;
26
20
  this.extraRoutes = extraRoutes;
21
+ this.callback = callback;
22
+ this.afterStart = (name, cfg, routes) => (0, lambda_http_proxy_1.newLambdaHttpProxy)(`${name}:apigw`, {
23
+ settings: this.settings,
24
+ routes: this.extraRoutes.concat(routes),
25
+ authorizer: (this.authorizer || (() => undefined))(cfg),
26
+ }, this.callback);
27
27
  this.computeWeight = (path) => this.segments(path) - this.variables(path);
28
28
  this.segments = (path) => path.split('/').length;
29
29
  this.variables = (path) => path.split('(?<').length;
@@ -35,6 +35,7 @@ class CloudFormationLambdaProxy extends cloudformation_1.CloudFormationSetup {
35
35
  .map(([k, v]) => [k, decodeURIComponent(v)]));
36
36
  return handler(event, context?.());
37
37
  };
38
+ this.authorizer = config?.authorizer;
38
39
  }
39
40
  logHandler(handler) {
40
41
  return `detected handler for ${handler.method} on ${handler.path} with weight ${handler.weight}`;
@@ -5,13 +5,13 @@ export declare abstract class CloudFormationSetup<P, H, R, F> implements Startab
5
5
  private readonly eventFilter;
6
6
  private readonly handlerResolver;
7
7
  private readonly beforeStart;
8
- private readonly afterStart;
9
8
  private readonly template;
10
9
  private readonly handlers;
11
10
  private readonly handlerNameResolver;
12
11
  private readonly LOGGER;
13
- constructor(name: string, eventFilter: (event: Event<P>) => boolean, handlerResolver: (event: Event<P>, handler: H) => Promise<R>, beforeStart: ((config: DevServerConfig) => Promise<void>) | undefined, afterStart: (name: string, config: DevServerConfig, routes: R[]) => F, config: CloudFormationSetupConfig);
12
+ constructor(name: string, eventFilter: (event: Event<P>) => boolean, handlerResolver: (event: Event<P>, handler: H) => Promise<R>, beforeStart: ((config: DevServerConfig) => Promise<void>) | undefined, config: CloudFormationSetupConfig);
14
13
  start: (config: DevServerConfig) => Promise<F>;
14
+ protected abstract afterStart: (name: string, config: DevServerConfig, routes: R[]) => F;
15
15
  private resolvedHandlers;
16
16
  abstract logHandler(handler: R): string;
17
17
  private parseApiEvents;
@@ -6,12 +6,11 @@ const fs_1 = require("fs");
6
6
  const js_yaml_1 = require("js-yaml");
7
7
  const logging_1 = require("@yopdev/logging");
8
8
  class CloudFormationSetup {
9
- constructor(name, eventFilter, handlerResolver, beforeStart, afterStart, config) {
9
+ constructor(name, eventFilter, handlerResolver, beforeStart, config) {
10
10
  this.name = name;
11
11
  this.eventFilter = eventFilter;
12
12
  this.handlerResolver = handlerResolver;
13
13
  this.beforeStart = beforeStart;
14
- this.afterStart = afterStart;
15
14
  this.start = async (config) => (this.beforeStart || Promise.resolve)(config)
16
15
  .then(this.resolvedHandlers)
17
16
  .then(async (routes) => this.afterStart(this.name, config, routes));
package/dist/src/sqs.js CHANGED
@@ -14,7 +14,7 @@ class Sqs {
14
14
  .send(new client_sqs_1.CreateQueueCommand({
15
15
  QueueName: fifo ? `${name}.fifo` : name,
16
16
  Attributes: {
17
- FifoQueue: fifo ? 'true' : 'false',
17
+ FifoQueue: fifo ? 'true' : undefined,
18
18
  }
19
19
  }))
20
20
  .then((create) => this.client
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yopdev/dev-server",
3
- "version": "1.5.6",
3
+ "version": "1.5.7",
4
4
  "scripts": {
5
5
  "compile": "tsc",
6
6
  "pretest": "npm run compile",