Skip to content

Commit 50451b3

Browse files
authored
chore(validation): add workspace pkg (#3592)
1 parent 5c4bfff commit 50451b3

12 files changed

+268
-2
lines changed

Diff for: .github/workflows/reusable-run-linting-check-and-unit-tests.yml

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ jobs:
5050
"packages/tracer",
5151
"packages/parser",
5252
"packages/parameters",
53+
"packages/validation",
5354
"packages/metrics"
5455
]
5556
fail-fast: false

Diff for: lerna.json

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"packages/jmespath",
1212
"packages/parser",
1313
"packages/event-handler",
14+
"packages/validation",
1415
"examples/app",
1516
"layers",
1617
"examples/snippets"

Diff for: package-lock.json

+69-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"examples/snippets",
1717
"layers",
1818
"examples/app",
19-
"packages/event-handler"
19+
"packages/event-handler",
20+
"packages/validation"
2021
],
2122
"scripts": {
2223
"test": "npm t -ws",

Diff for: packages/validation/README.md

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Powertools for AWS Lambda (TypeScript) - Validation Utility
2+
3+
> [!Warning]
4+
> This feature is currently under development. As such it's considered not stable and we might make significant breaking changes before going before its release. You are welcome to [provide feedback](https://github.com/aws-powertools/powertools-lambda-typescript/discussions/3519) and [contribute to the project](https://docs.powertools.aws.dev/lambda/typescript/latest/contributing/getting_started/).
5+
6+
Powertools for AWS Lambda (TypeScript) is a developer toolkit to implement Serverless [best practices and increase developer velocity](https://docs.powertools.aws.dev/lambda/typescript/latest/#features).
7+
8+
You can use the library in both TypeScript and JavaScript code bases.
9+
10+
## Intro
11+
12+
This utility provides JSON Schema validation for events and responses, including JMESPath support to unwrap events before validation.
13+
14+
## Usage
15+
16+
To get started, install the library by running:
17+
18+
```sh
19+
npm i @aws-lambda-powertools/validation
20+
```
21+
22+
> [!Note]
23+
> This readme is a work in progress.
24+
25+
## Contribute
26+
27+
If you are interested in contributing to this project, please refer to our [Contributing Guidelines](https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/CONTRIBUTING.md).
28+
29+
## Roadmap
30+
31+
The roadmap of Powertools for AWS Lambda (TypeScript) is driven by customers’ demand.
32+
Help us prioritize upcoming functionalities or utilities by [upvoting existing RFCs and feature requests](https://github.com/aws-powertools/powertools-lambda-typescript/issues), or [creating new ones](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new/choose), in this GitHub repository.
33+
34+
## Connect
35+
36+
- **Powertools for AWS Lambda on Discord**: `#typescript` - **[Invite link](https://discord.gg/B8zZKbbyET)**
37+
- **Email**: <[email protected]>
38+
39+
## How to support Powertools for AWS Lambda (TypeScript)?
40+
41+
### Becoming a reference customer
42+
43+
Knowing which companies are using this library is important to help prioritize the project internally. If your company is using Powertools for AWS Lambda (TypeScript), you can request to have your name and logo added to the README file by raising a [Support Powertools for AWS Lambda (TypeScript) (become a reference)](https://s12d.com/become-reference-pt-ts) issue.
44+
45+
The following companies, among others, use Powertools:
46+
47+
- [Alma Media](https://www.almamedia.fi)
48+
- [AppYourself](https://appyourself.net)
49+
- [Bailey Nelson](https://www.baileynelson.com.au)
50+
- [Banxware](https://www.banxware.com)
51+
- [Caylent](https://caylent.com/)
52+
- [Certible](https://www.certible.com/)
53+
- [Elva](https://elva-group.com)
54+
- [Flyweight](https://flyweight.io/)
55+
- [globaldatanet](https://globaldatanet.com/)
56+
- [Hashnode](https://hashnode.com/)
57+
- [LocalStack](https://localstack.cloud/)
58+
- [Perfect Post](https://www.perfectpost.fr)
59+
- [Sennder](https://sennder.com/)
60+
- [tecRacer GmbH & Co. KG](https://www.tecracer.com/)
61+
- [Trek10](https://www.trek10.com/)
62+
- [WeSchool](https://www.weschool.com)
63+
64+
### Sharing your work
65+
66+
Share what you did with Powertools for AWS Lambda (TypeScript) 💞💞. Blog post, workshops, presentation, sample apps and others. Check out what the community has already shared about Powertools for AWS Lambda (TypeScript) [here](https://docs.powertools.aws.dev/lambda/typescript/latest/we_made_this).
67+
68+
### Using Lambda Layer
69+
70+
This helps us understand who uses Powertools for AWS Lambda (TypeScript) in a non-intrusive way, and helps us gain future investments for other Powertools for AWS Lambda languages. When [using Layers](https://docs.powertools.aws.dev/lambda/typescript/latest/#lambda-layer), you can add Powertools as a dev dependency to not impact the development process.
71+
72+
## License
73+
74+
This library is licensed under the MIT-0 License. See the LICENSE file.

Diff for: packages/validation/package.json

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"name": "@aws-lambda-powertools/validation",
3+
"version": "2.14.0",
4+
"description": "An utility to validate events and responses using JSON Schemas",
5+
"author": {
6+
"name": "Amazon Web Services",
7+
"url": "https://aws.amazon.com"
8+
},
9+
"private": true,
10+
"scripts": {
11+
"test": "vitest --run",
12+
"test:unit": "vitest --run",
13+
"test:unit:coverage": "vitest --run tests/unit --coverage.enabled --coverage.thresholds.100 --coverage.include='src/**'",
14+
"test:unit:types": "echo 'Not Implemented'",
15+
"test:e2e:nodejs18x": "echo \"Not implemented\"",
16+
"test:e2e:nodejs20x": "echo \"Not implemented\"",
17+
"test:e2e:nodejs22x": "echo \"Not implemented\"",
18+
"test:e2e": "echo \"Not implemented\"",
19+
"build:cjs": "tsc --build tsconfig.json && echo '{ \"type\": \"commonjs\" }' > lib/cjs/package.json",
20+
"build:esm": "tsc --build tsconfig.esm.json && echo '{ \"type\": \"module\" }' > lib/esm/package.json",
21+
"build": "echo \"Not implemented\"",
22+
"lint": "biome lint .",
23+
"lint:fix": "biome check --write .",
24+
"prepack": "node ../../.github/scripts/release_patch_package_json.js ."
25+
},
26+
"homepage": "https://github.com/aws-powertools/powertools-lambda-typescript#readme",
27+
"license": "MIT-0",
28+
"type": "module",
29+
"exports": {
30+
".": {
31+
"require": {
32+
"types": "./lib/cjs/index.d.ts",
33+
"default": "./lib/cjs/index.js"
34+
},
35+
"import": {
36+
"types": "./lib/esm/index.d.ts",
37+
"default": "./lib/esm/index.js"
38+
}
39+
}
40+
},
41+
"types": "./lib/cjs/index.d.ts",
42+
"main": "./lib/cjs/index.js",
43+
"files": [
44+
"lib"
45+
],
46+
"repository": {
47+
"type": "git",
48+
"url": "git+https://github.com/aws-powertools/powertools-lambda-typescript.git"
49+
},
50+
"bugs": {
51+
"url": "https://github.com/aws-powertools/powertools-lambda-typescript/issues"
52+
},
53+
"dependencies": {
54+
"@aws-lambda-powertools/commons": "^2.14.0",
55+
"@aws-lambda-powertools/jmespath": "^2.14.0",
56+
"ajv": "^8.17.1"
57+
},
58+
"keywords": [
59+
"aws",
60+
"lambda",
61+
"powertools",
62+
"json-schema",
63+
"validation",
64+
"event",
65+
"handler",
66+
"nodejs",
67+
"serverless"
68+
]
69+
}

Diff for: packages/validation/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const foo = () => true;

Diff for: packages/validation/tests/tsconfig.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"rootDir": "../../",
5+
"noEmit": true
6+
},
7+
"include": ["../../testing/src/setupEnv.ts", "../src/**/*", "./**/*"]
8+
}

Diff for: packages/validation/tests/unit/index.test.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { beforeEach, describe, expect, it, vi } from 'vitest';
2+
import { foo } from '../../src/index.js';
3+
4+
describe('Validation', () => {
5+
beforeEach(() => {
6+
vi.clearAllMocks();
7+
});
8+
9+
it('should return true', () => {
10+
// Act
11+
const result = foo();
12+
13+
// Assess
14+
expect(result).toBe(true);
15+
});
16+
});

Diff for: packages/validation/tsconfig.esm.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"extends": "../../tsconfig.esm.json",
3+
"compilerOptions": {
4+
"baseUrl": ".",
5+
"outDir": "./lib/esm",
6+
"rootDir": "./src",
7+
"tsBuildInfoFile": ".tsbuildinfo/esm.json"
8+
},
9+
"include": ["./src/**/*"]
10+
}

Diff for: packages/validation/tsconfig.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "../../tsconfig.json",
3+
"compilerOptions": {
4+
"outDir": "./lib/cjs/",
5+
"rootDir": "./src",
6+
"tsBuildInfoFile": ".tsbuildinfo/cjs.json"
7+
},
8+
"include": ["./src/**/*"]
9+
}

Diff for: packages/validation/vitest.config.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { defineProject } from 'vitest/config';
2+
3+
export default defineProject({
4+
test: {
5+
environment: 'node',
6+
setupFiles: ['../testing/src/setupEnv.ts'],
7+
},
8+
});

0 commit comments

Comments
 (0)