@contrail/util 2.0.1-alpha.5 → 2.1.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.
- package/CHANGELOG.md +7 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/lambda-util/lambda-util.d.ts +4 -0
- package/lib/lambda-util/lambda-util.js +10 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,13 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `lambda-util` — AWS Lambda response-size helpers shared across services.
|
|
13
|
+
- `MAX_LAMBDA_RESPONSE_MB` / `RESPONSE_SIZE_BUFFER_MB` — the 6MB Lambda response cap and the safety buffer held below it.
|
|
14
|
+
- `RESPONSE_BYTE_LIMIT` — the cap minus the buffer, in bytes, for size checks that work in bytes.
|
|
15
|
+
- `getSerializedByteSize` — serialized byte size of any value. Treats `undefined` as `null`, since `JSON.stringify(undefined)` returns `undefined` rather than a string and `Buffer.byteLength` throws on it.
|
|
16
|
+
|
|
10
17
|
## [1.2.1] - 2026-03-25
|
|
11
18
|
|
|
12
19
|
### Added
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './app-util/app-util';
|
|
2
2
|
export * from './compression-util';
|
|
3
3
|
export * from './date-util/date-util';
|
|
4
|
+
export * from './lambda-util/lambda-util';
|
|
4
5
|
export * from './map-util/map-util';
|
|
5
6
|
export * from './object-util/object-util';
|
|
6
7
|
export * from './order-util/order-util';
|
package/lib/index.js
CHANGED
|
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./app-util/app-util"), exports);
|
|
18
18
|
__exportStar(require("./compression-util"), exports);
|
|
19
19
|
__exportStar(require("./date-util/date-util"), exports);
|
|
20
|
+
__exportStar(require("./lambda-util/lambda-util"), exports);
|
|
20
21
|
__exportStar(require("./map-util/map-util"), exports);
|
|
21
22
|
__exportStar(require("./object-util/object-util"), exports);
|
|
22
23
|
__exportStar(require("./order-util/order-util"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RESPONSE_BYTE_LIMIT = exports.RESPONSE_SIZE_BUFFER_MB = exports.MAX_LAMBDA_RESPONSE_MB = void 0;
|
|
4
|
+
exports.getSerializedByteSize = getSerializedByteSize;
|
|
5
|
+
exports.MAX_LAMBDA_RESPONSE_MB = 6;
|
|
6
|
+
exports.RESPONSE_SIZE_BUFFER_MB = 0.5;
|
|
7
|
+
exports.RESPONSE_BYTE_LIMIT = (exports.MAX_LAMBDA_RESPONSE_MB - exports.RESPONSE_SIZE_BUFFER_MB) * 1024 * 1024;
|
|
8
|
+
function getSerializedByteSize(value) {
|
|
9
|
+
return Buffer.byteLength(JSON.stringify(value !== null && value !== void 0 ? value : null));
|
|
10
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrail/util",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "General JavaScript utilities",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"testEnvironment": "node"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@contrail/types": "^4.0.
|
|
42
|
+
"@contrail/types": "^4.0.0",
|
|
43
43
|
"fflate": "^0.8.2",
|
|
44
44
|
"lodash": "^4.17.21",
|
|
45
45
|
"p-limit": "^3.1.0"
|