@yopdev/dev-server 1.6.0-alpha.1 → 1.7.0-alpha.0

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.
@@ -1,5 +1,4 @@
1
- import { SQSEvent } from 'aws-lambda';
2
- import { MessageAttributeValue } from '@aws-sdk/client-sqs';
1
+ import { SNSMessageAttributes, SQSEvent } from 'aws-lambda';
3
2
  import { Service } from './services';
4
3
  export declare const newEventsProxy: (name: string, config: {
5
4
  handlers: EventHandler[];
@@ -8,5 +7,5 @@ export declare const newEventsProxy: (name: string, config: {
8
7
  export type EventHandler = {
9
8
  name: string;
10
9
  handler: (event: SQSEvent) => Promise<unknown>;
11
- matcher: (subject: string, attributes: Record<string, MessageAttributeValue>) => boolean;
10
+ matcher: (subject: string, attributes: SNSMessageAttributes) => boolean;
12
11
  };
@@ -94,8 +94,10 @@ var EventsProxy = /** @class */ (function () {
94
94
  return;
95
95
  }
96
96
  var body = (0, assert_1.assertNotUndefined)(message.Body, 'body is not present');
97
- var subject = JSON.parse(body).Subject;
98
- var handlers = _this.handlers.filter(function (handler) { var _a; return handler.matcher(subject, (_a = message.MessageAttributes) !== null && _a !== void 0 ? _a : {}); });
97
+ var json = JSON.parse(body);
98
+ var attributes = json.MessageAttributes;
99
+ var subject = json.Subject;
100
+ var handlers = _this.handlers.filter(function (handler) { return handler.matcher(subject, attributes); });
99
101
  if (handlers.length === 0) {
100
102
  _this.LOGGER.warn('no handlers found for message %o', message);
101
103
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yopdev/dev-server",
3
- "version": "1.6.0-alpha.1",
3
+ "version": "1.7.0-alpha.0",
4
4
  "scripts": {
5
5
  "compile": "tsc",
6
6
  "pretest": "npm run compile",