@middy/util 7.1.0 → 7.1.1

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
@@ -1,7 +1,7 @@
1
1
  <div align="center">
2
- <h1>Middy Utilities</h1>
2
+ <h1>Middy `util`</h1>
3
3
  <img alt="Middy logo" src="https://raw.githubusercontent.com/middyjs/middy/main/docs/img/middy-logo.svg"/>
4
- <p><strong>Util component of the middy middleware, the stylish Node.js middleware engine for AWS Lambda</strong></p>
4
+ <p><strong>Utilities component of the middy middleware, the stylish Node.js middleware engine for AWS Lambda</strong></p>
5
5
  <p>
6
6
  <a href="https://github.com/middyjs/middy/actions/workflows/test-unit.yml"><img src="https://github.com/middyjs/middy/actions/workflows/test-unit.yml/badge.svg" alt="GitHub Actions unit test status"></a>
7
7
  <a href="https://github.com/middyjs/middy/actions/workflows/test-dast.yml"><img src="https://github.com/middyjs/middy/actions/workflows/test-dast.yml/badge.svg" alt="GitHub Actions dast test status"></a>
package/index.d.ts CHANGED
@@ -11,7 +11,7 @@ import type {
11
11
  SanitizeKeys,
12
12
  } from "./type-utils.d.ts";
13
13
 
14
- interface Options<Client, ClientOptions> {
14
+ export interface Options<Client, ClientOptions> {
15
15
  AwsClient?: new (...[config]: [any] | any) => Client;
16
16
  awsClientOptions?: Partial<ClientOptions>;
17
17
  awsClientAssumeRole?: string;
@@ -23,7 +23,7 @@ interface Options<Client, ClientOptions> {
23
23
  setToContext?: boolean;
24
24
  }
25
25
 
26
- declare class HttpError extends Error {
26
+ export declare class HttpError extends Error {
27
27
  status: number;
28
28
  statusCode: number;
29
29
  expose: boolean;
@@ -143,3 +143,35 @@ declare function createError(
143
143
  ): HttpError;
144
144
 
145
145
  declare function modifyCache(cacheKey: string, value: any): void;
146
+
147
+ declare function catchInvalidSignatureException<Client, Command>(
148
+ e: Error & { __type?: string },
149
+ client: Client,
150
+ command: Command,
151
+ ): Promise<any>;
152
+
153
+ declare function jsonSafeStringify(
154
+ value: any,
155
+ replacer?: (key: string, value: any) => any,
156
+ space?: string | number,
157
+ ): string | any;
158
+
159
+ declare const lambdaContextKeys: string[];
160
+
161
+ declare const executionContextKeys: string[];
162
+
163
+ declare function isExecutionModeDurable(context: LambdaContext): boolean;
164
+
165
+ declare function executionContext(
166
+ request: middy.Request,
167
+ key: string,
168
+ context: LambdaContext,
169
+ ): any;
170
+
171
+ declare function lambdaContext(
172
+ request: middy.Request,
173
+ key: string,
174
+ context: LambdaContext,
175
+ ): any;
176
+
177
+ declare const httpErrorCodes: Record<number, string>;
package/index.js CHANGED
@@ -226,17 +226,17 @@ export const jsonSafeParse = (text, reviver) => {
226
226
  if (firstChar !== "{" && firstChar !== "[" && firstChar !== '"') return text;
227
227
  try {
228
228
  return JSON.parse(text, reviver);
229
- } catch (_e) {}
230
-
231
- return text;
229
+ } catch {
230
+ return text;
231
+ }
232
232
  };
233
233
 
234
234
  export const jsonSafeStringify = (value, replacer, space) => {
235
235
  try {
236
236
  return JSON.stringify(value, replacer, space);
237
- } catch (_e) {}
238
-
239
- return value;
237
+ } catch {
238
+ return value;
239
+ }
240
240
  };
241
241
 
242
242
  export const normalizeHttpResponse = (request) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@middy/util",
3
- "version": "7.1.0",
3
+ "version": "7.1.1",
4
4
  "description": "🛵 The stylish Node.js middleware engine for AWS Lambda (util package)",
5
5
  "type": "module",
6
6
  "engines": {
@@ -60,8 +60,8 @@
60
60
  },
61
61
  "devDependencies": {
62
62
  "@aws-sdk/client-ssm": "^3.0.0",
63
- "@middy/core": "7.1.0",
64
- "@types/aws-lambda": "^8.10.76",
63
+ "@middy/core": "7.1.1",
64
+ "@types/aws-lambda": "^8.0.0",
65
65
  "@types/node": "^22.0.0",
66
66
  "aws-xray-sdk": "^3.3.3"
67
67
  },