@aesop-fables/triginta 0.10.1 → 0.10.5

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,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createTrigintaApp = exports.useAwsServices = exports.useTriginta = void 0;
4
+ /* eslint-disable no-case-declarations */
4
5
  /* eslint-disable @typescript-eslint/no-explicit-any */
6
+ /* eslint-disable @typescript-eslint/no-empty-object-type */
5
7
  const containr_1 = require("@aesop-fables/containr");
6
8
  const http_1 = require("./http");
7
9
  const HttpLambda_1 = require("./http/HttpLambda");
package/lib/Decorators.js CHANGED
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getMiddleware = exports.useMiddleware = exports.middlewareMetadataKey = exports.httpPost = exports.httpDelete = exports.httpPut = exports.httpGet = exports.getRoute = exports.endpointMetadataKey = void 0;
7
7
  const RouteRegistry_1 = __importDefault(require("./RouteRegistry"));
8
- /* eslint-disable @typescript-eslint/ban-types */
8
+ /* eslint-disable @typescript-eslint/no-unsafe-function-type */
9
9
  exports.endpointMetadataKey = Symbol('@endpointMetadataKey');
10
10
  function defineEndpointMetadata(method, route) {
11
11
  return (target) => {
@@ -40,7 +40,7 @@ function trigintaMiddlware(options) {
40
40
  exports.trigintaMiddlware = trigintaMiddlware;
41
41
  function trigintafy(handler, middlewareMetadata, options) {
42
42
  let midHandler = (0, core_1.default)(handler).use(trigintaMiddlware(options));
43
- // eslint-disable-next-line @typescript-eslint/ban-types
43
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
44
44
  middlewareMetadata.forEach((midFunc) => {
45
45
  midHandler = midHandler.use(midFunc());
46
46
  });
@@ -22,7 +22,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22
22
  };
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.createBootstrappedHttpLambdaContext = exports.useTrigintaHttp = exports.HttpLambdaFactory = exports.HttpResponseGenerator = void 0;
25
- /* eslint-disable @typescript-eslint/ban-types */
26
25
  /* eslint-disable @typescript-eslint/no-explicit-any */
27
26
  /* eslint-disable @typescript-eslint/no-unused-vars */
28
27
  const containr_1 = require("@aesop-fables/containr");
@@ -22,8 +22,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22
22
  };
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.createBootstrappedS3LambdaContext = exports.S3LambdaFactory = exports.useTrigintaS3 = void 0;
25
- /* eslint-disable @typescript-eslint/ban-types */
26
- /* eslint-disable @typescript-eslint/no-explicit-any */
27
25
  /* eslint-disable @typescript-eslint/no-unused-vars */
28
26
  const containr_1 = require("@aesop-fables/containr");
29
27
  const Decorators_1 = require("../Decorators");
@@ -1,4 +1,4 @@
1
- import { CreateQueueRequest } from 'aws-sdk/clients/sqs';
1
+ import { CreateQueueRequest } from '@aws-sdk/client-sqs';
2
2
  import { SettingsExpression } from '../resolveEnvironmentSettings';
3
3
  export interface IQueue extends CreateQueueRequest {
4
4
  toEnvExpression(): SettingsExpression<string>;
@@ -1,9 +1,10 @@
1
- import { MessageBodyAttributeMap, SendMessageRequest, SendMessageResult } from 'aws-sdk/clients/sqs';
2
1
  import { ISqsPublisher } from './SqsPublisher';
3
2
  import { SQSMessageAttributes } from 'aws-lambda';
4
3
  import { ISqsMessage } from './ISqsMessage';
5
4
  import { LoggingLevel } from '../logging';
5
+ import { MessageAttributeValue, SendMessageRequest, SendMessageResult } from '@aws-sdk/client-sqs';
6
6
  declare type ConfigureSqsDelegate = (params: SendMessageRequest) => Promise<void>;
7
+ declare type MessageBodyAttributeMap = Record<string, MessageAttributeValue>;
7
8
  export interface IMessagePublisher {
8
9
  publish(event: ISqsMessage, defaultAttributes?: SQSMessageAttributes, configure?: ConfigureSqsDelegate): Promise<SendMessageResult>;
9
10
  }
@@ -27,7 +27,6 @@ const SqsLambdaServices_1 = require("./SqsLambdaServices");
27
27
  const logging_1 = require("../logging");
28
28
  const TrigintaHeaders_1 = require("../TrigintaHeaders");
29
29
  let MessagePublisher = class MessagePublisher {
30
- // eslint-disable-next-line prettier/prettier
31
30
  constructor(sqsPublisher, levels) {
32
31
  this.sqsPublisher = sqsPublisher;
33
32
  this.levels = levels;
@@ -34,6 +34,7 @@ const jsonSafeParse = (text) => {
34
34
  return text;
35
35
  try {
36
36
  return JSON.parse(text);
37
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars, no-empty
37
38
  }
38
39
  catch (e) { }
39
40
  return text;
@@ -83,9 +84,7 @@ SqsMessageDeserializer = __decorate([
83
84
  ], SqsMessageDeserializer);
84
85
  exports.SqsMessageDeserializer = SqsMessageDeserializer;
85
86
  // Test coverage in SqsLambda.test.ts
86
- function createMatcher(
87
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
88
- configuration) {
87
+ function createMatcher(configuration) {
89
88
  const { attributes: attributeMap, constructUsing, type } = configuration;
90
89
  const defaultMatcher = new DefaultSqsRecordMatcher();
91
90
  return {
@@ -22,8 +22,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
22
22
  };
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.createBootstrappedSqsLambdaContext = exports.useTrigintaSqs = exports.SqsLambdaFactory = void 0;
25
- /* eslint-disable @typescript-eslint/ban-types */
26
- /* eslint-disable @typescript-eslint/no-explicit-any */
27
25
  /* eslint-disable @typescript-eslint/no-unused-vars */
28
26
  const containr_1 = require("@aesop-fables/containr");
29
27
  const Decorators_1 = require("../Decorators");
@@ -61,6 +59,7 @@ let SqsLambdaFactory = class SqsLambdaFactory {
61
59
  };
62
60
  for (let i = 0; i < event.Records.length; i++) {
63
61
  const record = event.Records[i];
62
+ // eslint-disable-next-line no-useless-catch
64
63
  try {
65
64
  const { container } = (0, TrigintaMiddleware_1.resolveTrigintaRuntime)(context);
66
65
  if (!container) {
@@ -1,6 +1,6 @@
1
- import { SendMessageRequest, SendMessageResult } from 'aws-sdk/clients/sqs';
2
1
  import { SqsSettings } from './SqsSettings';
3
2
  import { ILogger } from '../logging/ILogger';
3
+ import { SendMessageRequest, SendMessageResult } from '@aws-sdk/client-sqs';
4
4
  export interface ISqsPublisher {
5
5
  sendMessage(message: SendMessageRequest): Promise<SendMessageResult>;
6
6
  }
@@ -20,26 +20,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
20
20
  step((generator = generator.apply(thisArg, _arguments || [])).next());
21
21
  });
22
22
  };
23
- var __importDefault = (this && this.__importDefault) || function (mod) {
24
- return (mod && mod.__esModule) ? mod : { "default": mod };
25
- };
26
23
  Object.defineProperty(exports, "__esModule", { value: true });
27
24
  exports.SqsPublisher = void 0;
28
25
  const containr_1 = require("@aesop-fables/containr");
29
- const aws_sdk_1 = __importDefault(require("aws-sdk"));
30
26
  const SqsLambdaServices_1 = require("./SqsLambdaServices");
31
27
  const logging_1 = require("../logging");
28
+ const client_sqs_1 = require("@aws-sdk/client-sqs");
32
29
  let SqsPublisher = class SqsPublisher {
33
30
  constructor(settings, logger) {
34
31
  this.settings = settings;
35
32
  this.logger = logger;
36
33
  this.logger.debug(JSON.stringify(this.settings, null, 2));
37
- this.sqs = new aws_sdk_1.default.SQS(this.settings);
34
+ this.sqs = new client_sqs_1.SQS(this.settings);
38
35
  }
39
36
  sendMessage(message) {
40
37
  return __awaiter(this, void 0, void 0, function* () {
41
- this.logger.debug(JSON.stringify(message, null, 2));
42
- const response = this.sqs.sendMessage(message).promise();
38
+ const response = this.sqs.sendMessage(message);
43
39
  if (!response) {
44
40
  throw new Error(`${response}`);
45
41
  }
@@ -1,2 +1,2 @@
1
- import AWS from 'aws-sdk';
2
- export declare type SqsSettings = AWS.SQS.ClientConfiguration;
1
+ import { SQSClientConfig } from '@aws-sdk/client-sqs';
2
+ export declare type SqsSettings = SQSClientConfig;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseRules = void 0;
4
4
  const ArrayContinuationRule_1 = require("./ArrayContinuationRule");
5
5
  const RequiredRule_1 = require("./RequiredRule");
6
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
6
  function parseRules(schema) {
8
7
  const rules = [];
9
8
  Object.keys(schema).forEach((field) => {
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ValidationError = void 0;
4
+ /* eslint-disable @typescript-eslint/no-explicit-any */
4
5
  class ValidationError extends Error {
5
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
6
  constructor(message, errors) {
7
7
  super(message);
8
8
  this.errors = errors;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aesop-fables/triginta",
3
- "version": "0.10.1",
3
+ "version": "0.10.5",
4
4
  "description": "A lightweight framework that wraps the basic infrastructure usages of AWS Lambda (SQS, Kinesis, etc.).",
5
5
  "type": "commonjs",
6
6
  "exports": {
@@ -12,20 +12,23 @@
12
12
  "main": "./lib/index.js",
13
13
  "types": "./lib/index.d.ts",
14
14
  "scripts": {
15
- "build": "yarn run lint && rimraf ./lib && tsc --p ./tsconfig.build.json",
15
+ "build": "yarn run lint && rm -rf ./lib && tsc --p ./tsconfig.build.json",
16
16
  "format": "prettier --write \"src/**/*.(js|ts)\"",
17
- "lint": "eslint src --ext .js,.ts",
18
- "lint:fix": "eslint src --fix --ext .js,.ts",
17
+ "lint": "eslint src",
18
+ "lint:fix": "eslint src --fix",
19
19
  "test": "jest --config jest.config.js --runInBand",
20
+ "test:ci": "jest --config jest.config.js --ci",
20
21
  "test:watch": "jest --config jest.config.js --watch",
21
22
  "prepublishOnly": "npm test && npm run lint",
22
23
  "preversion": "npm run lint",
23
- "version": "0.10.1",
24
+ "version": "0.10.5",
24
25
  "postversion": "git push && git push --tags"
25
26
  },
26
27
  "devDependencies": {
27
28
  "@aesop-fables/containr": "^0.6.1",
28
29
  "@aesop-fables/containr-testing": "^0.3.0",
30
+ "@aws-sdk/client-sqs": "^3.987.0",
31
+ "@eslint/js": "^9.17.0",
29
32
  "@middy/core": "^4.5.1",
30
33
  "@middy/http-error-handler": "^4.5.1",
31
34
  "@middy/http-json-body-parser": "^4.5.1",
@@ -33,30 +36,31 @@
33
36
  "@types/aws-lambda": "^8.10.109",
34
37
  "@types/jest": "^29.5.0",
35
38
  "@types/node": "^18.16.17",
36
- "@typescript-eslint/eslint-plugin": "^5.59.11",
37
- "@typescript-eslint/parser": "5.59.11",
38
- "aws-sdk": "^2.1386.0",
39
- "esbuild": "^0.18.16",
40
- "eslint": "8.42.0",
41
- "eslint-config-prettier": "^8.5.0",
42
- "eslint-plugin-jest": "27.2.3",
43
- "eslint-plugin-prettier": "^4.2.1",
44
- "jest": "29.6.1",
39
+ "@typescript-eslint/eslint-plugin": "^8.55.0",
40
+ "@typescript-eslint/parser": "^8.55.0",
41
+ "esbuild": "^0.27.3",
42
+ "eslint": "^9.0.0",
43
+ "eslint-config-prettier": "^10.1.8",
44
+ "eslint-plugin-jest": "^29.13.0",
45
+ "eslint-plugin-prettier": "^5.5.5",
46
+ "jest": "^29.0.0",
47
+ "jest-junit": "^16.0.0",
45
48
  "jest-mock-extended": "^3.0.1",
46
- "prettier": "^2.8.1",
49
+ "prettier": "^3.0.0",
47
50
  "reflect-metadata": "^0.1.13",
48
- "ts-jest": "29.1.0",
49
- "typescript": "4.9.5"
51
+ "ts-jest": "^29.4.6",
52
+ "typescript": "4.9.5",
53
+ "typescript-eslint": "^8.55.0"
50
54
  },
51
55
  "files": [
52
56
  "lib/**/*"
53
57
  ],
54
58
  "peerDependencies": {
55
59
  "@aesop-fables/containr": "0.5.x",
60
+ "@aws-sdk/client-sqs": "3.x",
56
61
  "@middy/core": "4.x",
57
62
  "@middy/http-error-handler": "4.x",
58
63
  "@middy/http-json-body-parser": "4.x",
59
- "aws-sdk": "2.x",
60
64
  "reflect-metadata": "0.1.x"
61
65
  },
62
66
  "repository": {
@@ -65,5 +69,14 @@
65
69
  },
66
70
  "publishConfig": {
67
71
  "access": "public"
72
+ },
73
+ "jest-junit": {
74
+ "outputDirectory": "reports",
75
+ "outputName": "jest-junit.xml",
76
+ "ancestorSeparator": " › ",
77
+ "uniqueOutputName": "false",
78
+ "suiteNameTemplate": "{filepath}",
79
+ "classNameTemplate": "{classname}",
80
+ "titleTemplate": "{title}"
68
81
  }
69
82
  }