@plasius/schema 1.1.0 → 1.2.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/README.md +31 -18
- package/dist/index.cjs +2370 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +627 -0
- package/dist/index.d.ts +627 -0
- package/dist/index.js +2308 -0
- package/dist/index.js.map +1 -0
- package/package.json +18 -6
- package/.eslintrc.cjs +0 -7
- package/.github/workflows/cd.yml +0 -236
- package/.github/workflows/ci.yml +0 -16
- package/.nvmrc +0 -1
- package/.vscode/launch.json +0 -15
- package/CHANGELOG.md +0 -120
- package/CODE_OF_CONDUCT.md +0 -79
- package/CONTRIBUTING.md +0 -201
- package/CONTRIBUTORS.md +0 -27
- package/SECURITY.md +0 -17
- package/docs/adrs/adr-0001: schema.md +0 -45
- package/docs/adrs/adr-template.md +0 -67
- package/legal/CLA-REGISTRY.csv +0 -2
- package/legal/CLA.md +0 -22
- package/legal/CORPORATE_CLA.md +0 -57
- package/legal/INDIVIDUAL_CLA.md +0 -91
- package/sbom.cdx.json +0 -66
- package/src/components.ts +0 -39
- package/src/field.builder.ts +0 -239
- package/src/field.ts +0 -153
- package/src/index.ts +0 -7
- package/src/infer.ts +0 -34
- package/src/pii.ts +0 -165
- package/src/schema.ts +0 -893
- package/src/types.ts +0 -156
- package/src/validation/countryCode.ISO3166.ts +0 -256
- package/src/validation/currencyCode.ISO4217.ts +0 -191
- package/src/validation/dateTime.ISO8601.ts +0 -60
- package/src/validation/email.RFC5322.ts +0 -9
- package/src/validation/generalText.OWASP.ts +0 -39
- package/src/validation/index.ts +0 -13
- package/src/validation/languageCode.BCP47.ts +0 -299
- package/src/validation/name.OWASP.ts +0 -25
- package/src/validation/percentage.ISO80000-1.ts +0 -8
- package/src/validation/phone.E.164.ts +0 -9
- package/src/validation/richtext.OWASP.ts +0 -34
- package/src/validation/url.WHATWG.ts +0 -16
- package/src/validation/user.MS-GOOGLE-APPLE.ts +0 -31
- package/src/validation/uuid.RFC4122.ts +0 -10
- package/src/validation/version.SEMVER2.0.0.ts +0 -10
- package/tests/field.builder.test.ts +0 -81
- package/tests/fields.test.ts +0 -213
- package/tests/pii.test.ts +0 -139
- package/tests/schema.test.ts +0 -501
- package/tests/test-utils.ts +0 -97
- package/tests/validate.test.ts +0 -97
- package/tests/validation.test.ts +0 -98
- package/tsconfig.build.json +0 -19
- package/tsconfig.json +0 -7
- package/tsup.config.ts +0 -10
- package/vitest.config.js +0 -20
package/.github/workflows/ci.yml
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
on:
|
|
3
|
-
push: { branches: [main] }
|
|
4
|
-
pull_request: { branches: [main] }
|
|
5
|
-
jobs:
|
|
6
|
-
build-test:
|
|
7
|
-
runs-on: ubuntu-latest
|
|
8
|
-
steps:
|
|
9
|
-
- uses: actions/checkout@v4
|
|
10
|
-
- uses: actions/setup-node@v4
|
|
11
|
-
with:
|
|
12
|
-
node-version: "22"
|
|
13
|
-
cache: "npm"
|
|
14
|
-
- run: npm ci
|
|
15
|
-
- run: npm run build
|
|
16
|
-
- run: npm test
|
package/.nvmrc
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
22
|
package/.vscode/launch.json
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "0.2.0",
|
|
3
|
-
"configurations": [
|
|
4
|
-
{
|
|
5
|
-
"type": "node",
|
|
6
|
-
"request": "launch",
|
|
7
|
-
"name": "Debug Vitest",
|
|
8
|
-
"program": "${workspaceFolder}/node_modules/vitest/vitest.mjs",
|
|
9
|
-
"args": ["run"],
|
|
10
|
-
"cwd": "${workspaceFolder}",
|
|
11
|
-
"console": "integratedTerminal",
|
|
12
|
-
"skipFiles": ["<node_internals>/**"]
|
|
13
|
-
}
|
|
14
|
-
]
|
|
15
|
-
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
# Changelog
|
|
3
|
-
|
|
4
|
-
All notable changes to this project will be documented in this file.
|
|
5
|
-
|
|
6
|
-
The format is based on **[Keep a Changelog](https://keepachangelog.com/en/1.1.0/)**, and this project adheres to **[Semantic Versioning](https://semver.org/spec/v2.0.0.html)**.
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## [Unreleased]
|
|
11
|
-
|
|
12
|
-
- **Added**
|
|
13
|
-
- (placeholder)
|
|
14
|
-
|
|
15
|
-
- **Changed**
|
|
16
|
-
- (placeholder)
|
|
17
|
-
|
|
18
|
-
- **Fixed**
|
|
19
|
-
- (placeholder)
|
|
20
|
-
|
|
21
|
-
- **Security**
|
|
22
|
-
- (placeholder)
|
|
23
|
-
|
|
24
|
-
## [1.1.0] - 2025-09-18
|
|
25
|
-
|
|
26
|
-
- **Added**
|
|
27
|
-
- field().upgrade() function now added to allow upgrades of older data sets to newer data.
|
|
28
|
-
- min/max/pattern/default FieldBuilder elements added for validation.
|
|
29
|
-
- Added new validator for language code BCP 47 format.
|
|
30
|
-
- Added new validator options for ISO DATE TIME filtering to Date or Time or Both
|
|
31
|
-
- Added new pre-built field() types including PII flags and validators for:
|
|
32
|
-
- email
|
|
33
|
-
- phone
|
|
34
|
-
- url
|
|
35
|
-
- uuid
|
|
36
|
-
- dateTimeISO
|
|
37
|
-
- dateISO
|
|
38
|
-
- timeISO
|
|
39
|
-
- richText
|
|
40
|
-
- generalText
|
|
41
|
-
- latitude
|
|
42
|
-
- longitude
|
|
43
|
-
- version
|
|
44
|
-
- countryCode
|
|
45
|
-
- languageCode
|
|
46
|
-
- New field().xxx tests for the above types.
|
|
47
|
-
|
|
48
|
-
- **Changed**
|
|
49
|
-
- Updated CD Pipeline to accept a new param for version Major, Minor or Patch update
|
|
50
|
-
|
|
51
|
-
- **Fixed**
|
|
52
|
-
- validateISODateTime for dateTime now accepts string matches that might not be the same as the date.toISOString() return value but are still valid ISO Date Time Strings.
|
|
53
|
-
|
|
54
|
-
- **Security**
|
|
55
|
-
- (placeholder)
|
|
56
|
-
|
|
57
|
-
## [1.0.18] - 2025-09-17
|
|
58
|
-
|
|
59
|
-
- **Fixed**
|
|
60
|
-
- CD pipeline reorder fix to restore CHANGELOG.md versions
|
|
61
|
-
|
|
62
|
-
## [1.0.17] - 2025-09-17
|
|
63
|
-
|
|
64
|
-
- **Added**
|
|
65
|
-
- chore: Code coverage added
|
|
66
|
-
|
|
67
|
-
## [1.0.13] - 2025-09-16
|
|
68
|
-
|
|
69
|
-
- **Changed**
|
|
70
|
-
- ./src/schema.ts Added comments defining functionality on all externally facing functions.
|
|
71
|
-
|
|
72
|
-
- **Fixed**
|
|
73
|
-
- ./src/schema.ts Validation no longer mutates the input, internal system fields are set only on result if not previously present.
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
## [1.0.0] - 2025-09-16
|
|
78
|
-
|
|
79
|
-
- **Added**
|
|
80
|
-
- Initial public release of `@plasius/schema`.
|
|
81
|
-
- Fluent field builder API: `field().string().required()`, `field().number().min()`, etc.
|
|
82
|
-
- Type inference utilities to derive TypeScript types from schema definitions.
|
|
83
|
-
- Built-in validators for common standards:
|
|
84
|
-
- ISO-3166 country codes
|
|
85
|
-
- ISO-4217 currency codes
|
|
86
|
-
- RFC 5322 email format
|
|
87
|
-
- E.164 phone format
|
|
88
|
-
- WHATWG URL format
|
|
89
|
-
- ISO 8601 date/time
|
|
90
|
-
- OWASP-guided text/name constraints
|
|
91
|
-
- UUID (RFC 4122) and SemVer 2.0.0
|
|
92
|
-
- PII annotations and helpers for redaction/masking before logging.
|
|
93
|
-
- Lightweight validation runner with success/error result types.
|
|
94
|
-
|
|
95
|
-
- **Changed**
|
|
96
|
-
- N/A (initial release)
|
|
97
|
-
|
|
98
|
-
- **Fixed**
|
|
99
|
-
- N/A (initial release)
|
|
100
|
-
|
|
101
|
-
---
|
|
102
|
-
|
|
103
|
-
## Release process (maintainers)
|
|
104
|
-
|
|
105
|
-
1. Update `CHANGELOG.md` under **Unreleased** with user‑visible changes.
|
|
106
|
-
2. Bump version in `package.json` following SemVer (major/minor/patch).
|
|
107
|
-
3. Move entries from **Unreleased** to a new version section with the current date.
|
|
108
|
-
4. Tag the release in Git (`vX.Y.Z`) and push tags.
|
|
109
|
-
5. Publish to npm (via CI/CD or `npm publish`).
|
|
110
|
-
|
|
111
|
-
> Tip: Use Conventional Commits in PR titles/bodies to make changelog updates easier.
|
|
112
|
-
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
[Unreleased]: https://github.com/Plasius-LTD/schema/compare/v1.1.0...HEAD
|
|
116
|
-
[1.0.0]: https://github.com/Plasius-LTD/schema/releases/tag/v1.0.0
|
|
117
|
-
[1.0.13]: https://github.com/Plasius-LTD/schema/releases/tag/v1.0.13
|
|
118
|
-
[1.0.17]: https://github.com/Plasius-LTD/schema/releases/tag/v1.0.17
|
|
119
|
-
[1.0.18]: https://github.com/Plasius-LTD/schema/releases/tag/v1.0.18
|
|
120
|
-
[1.1.0]: https://github.com/Plasius-LTD/schema/releases/tag/v1.1.0
|
package/CODE_OF_CONDUCT.md
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
# Contributor Covenant Code of Conduct v2.1
|
|
2
|
-
|
|
3
|
-
## Our Pledge
|
|
4
|
-
|
|
5
|
-
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
|
6
|
-
|
|
7
|
-
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
|
8
|
-
|
|
9
|
-
## Our Standards
|
|
10
|
-
|
|
11
|
-
Examples of behavior that contributes to a positive environment for our community include:
|
|
12
|
-
|
|
13
|
-
- Demonstrating empathy and kindness toward other people
|
|
14
|
-
- Being respectful of differing opinions, viewpoints, and experiences
|
|
15
|
-
- Giving and gracefully accepting constructive feedback
|
|
16
|
-
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
|
17
|
-
- Focusing on what is best not just for us as individuals, but for the overall community
|
|
18
|
-
|
|
19
|
-
Examples of unacceptable behavior include:
|
|
20
|
-
|
|
21
|
-
- The use of sexualized language or imagery, and sexual attention or advances of any kind
|
|
22
|
-
- Trolling, insulting or derogatory comments, and personal or political attacks
|
|
23
|
-
- Public or private harassment
|
|
24
|
-
- Publishing others’ private information, such as a physical or email address, without their explicit permission
|
|
25
|
-
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
26
|
-
|
|
27
|
-
## Enforcement Responsibilities
|
|
28
|
-
|
|
29
|
-
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
|
30
|
-
|
|
31
|
-
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
|
32
|
-
|
|
33
|
-
## Scope
|
|
34
|
-
|
|
35
|
-
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
|
36
|
-
|
|
37
|
-
## Enforcement
|
|
38
|
-
|
|
39
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [conduct@plasius.co.uk](mailto:conduct@plasius.co.uk). All complaints will be reviewed and investigated promptly and fairly.
|
|
40
|
-
|
|
41
|
-
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
|
42
|
-
|
|
43
|
-
## Enforcement Guidelines
|
|
44
|
-
|
|
45
|
-
Community leaders will follow these Enforcement Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
|
46
|
-
|
|
47
|
-
### 1. Correction
|
|
48
|
-
|
|
49
|
-
**Community Impact:** Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
|
50
|
-
|
|
51
|
-
**Consequence:** A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
|
52
|
-
|
|
53
|
-
### 2. Warning
|
|
54
|
-
|
|
55
|
-
**Community Impact:** A violation through a single incident or series of actions.
|
|
56
|
-
|
|
57
|
-
**Consequence:** A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
|
58
|
-
|
|
59
|
-
### 3. Temporary Ban
|
|
60
|
-
|
|
61
|
-
**Community Impact:** A serious violation of community standards, including sustained inappropriate behavior.
|
|
62
|
-
|
|
63
|
-
**Consequence:** A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
|
64
|
-
|
|
65
|
-
### 4. Permanent Ban
|
|
66
|
-
|
|
67
|
-
**Community Impact:** Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
|
68
|
-
|
|
69
|
-
**Consequence:** A permanent ban from any sort of public interaction within the community.
|
|
70
|
-
|
|
71
|
-
## Attribution
|
|
72
|
-
|
|
73
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html)
|
|
74
|
-
|
|
75
|
-
For answers to common questions about this code of conduct, see the [FAQ](https://www.contributor-covenant.org/faq)
|
|
76
|
-
|
|
77
|
-
[homepage]: [https://www.contributor-covenant.org](https://www.contributor-covenant.org)
|
|
78
|
-
|
|
79
|
-
If you have any questions or concerns regarding this Code of Conduct, please contact us at [conduct@plasius.co.uk](mailto:conduct@plasius.co.uk).
|
package/CONTRIBUTING.md
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
# Contributing to @plasius/schema
|
|
2
|
-
|
|
3
|
-
First off: thanks for taking the time to contribute!
|
|
4
|
-
This document explains how to work on the project, how to propose changes, and what we expect in pull requests.
|
|
5
|
-
|
|
6
|
-
> TL;DR
|
|
7
|
-
>
|
|
8
|
-
> - Be respectful and follow the Code of Conduct.
|
|
9
|
-
> - Open an issue before large changes; small fixes can go straight to a PR.
|
|
10
|
-
> - Write tests, keep coverage steady or improving.
|
|
11
|
-
> - Use Conventional Commits.
|
|
12
|
-
> - Don’t include real PII in code, issues, tests, or logs.
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
## Code of Conduct
|
|
17
|
-
|
|
18
|
-
Participation in this project is governed by our **Code of Conduct** (see `CODE_OF_CONDUCT.md`). By participating, you agree to abide by it.
|
|
19
|
-
|
|
20
|
-
## Licensing & CLA
|
|
21
|
-
|
|
22
|
-
This project is open source (see `LICENSE`). To protect contributors and users, we require contributors to agree to our **Contributor License Agreement (CLA)** before we can merge PRs (see `legal/CLA.md`). You’ll be prompted automatically by the CLA bot on your first PR.
|
|
23
|
-
|
|
24
|
-
> If your company has special legal needs, please contact the maintainers before sending large PRs.
|
|
25
|
-
|
|
26
|
-
## Security
|
|
27
|
-
|
|
28
|
-
**Never** report security issues in public issues or PRs. Instead, follow the process in `SECURITY.md`.
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## What this project does
|
|
33
|
-
|
|
34
|
-
`@plasius/schema` provides a small, strongly-typed schema library:
|
|
35
|
-
|
|
36
|
-
- A fluent field builder (e.g. `field().string().required()`),
|
|
37
|
-
- Built-in validators for common standards (ISO/RFC/OWASP, etc.),
|
|
38
|
-
- PII annotations + redaction utilities,
|
|
39
|
-
- Type inference for safe, consistent entities across projects.
|
|
40
|
-
|
|
41
|
-
Contributions typically fall into: new validators, field builder features, type improvements, docs, and tooling quality.
|
|
42
|
-
|
|
43
|
-
---
|
|
44
|
-
|
|
45
|
-
## Getting started (local dev)
|
|
46
|
-
|
|
47
|
-
### Prerequisites
|
|
48
|
-
|
|
49
|
-
- Node.js (use the version specified in `.nvmrc` if present: `nvm use`).
|
|
50
|
-
- npm (we use npm scripts in this repo).
|
|
51
|
-
|
|
52
|
-
### Install
|
|
53
|
-
|
|
54
|
-
```bash
|
|
55
|
-
npm ci
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### Build
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
npm run build
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Test
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
npm test
|
|
68
|
-
# or, if using Vitest in watch mode
|
|
69
|
-
npm run test:watch
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Lint & format
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
npm run lint
|
|
76
|
-
npm run format
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
> Tip: set up your editor to run ESLint and Prettier on save.
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
## How to propose a change
|
|
84
|
-
|
|
85
|
-
### 1) For bugs
|
|
86
|
-
|
|
87
|
-
- Search existing issues first.
|
|
88
|
-
- Open a new issue with:
|
|
89
|
-
- Clear title, steps to reproduce, expected vs actual behaviour,
|
|
90
|
-
- Minimal repro (code snippet or small repo),
|
|
91
|
-
- Environment info (OS, Node, package version).
|
|
92
|
-
|
|
93
|
-
### 2) For features / refactors
|
|
94
|
-
|
|
95
|
-
- For anything non-trivial, open an issue first and outline the proposal.
|
|
96
|
-
- If the change affects public API or architecture, add an ADR draft (see `docs/adrs/`).
|
|
97
|
-
|
|
98
|
-
### 3) Good first issues
|
|
99
|
-
|
|
100
|
-
We label approachable tasks as **good first issue** and **help wanted**.
|
|
101
|
-
|
|
102
|
-
---
|
|
103
|
-
|
|
104
|
-
## Branch, commit, PR
|
|
105
|
-
|
|
106
|
-
**Branching**
|
|
107
|
-
|
|
108
|
-
- Fork or create a feature branch from `main`: `feat/xyz` or `fix/abc`.
|
|
109
|
-
|
|
110
|
-
**Commit messages** (Conventional Commits)
|
|
111
|
-
|
|
112
|
-
- `feat: add ISO-3166 alpha-3 validator`
|
|
113
|
-
- `fix: correct RFC5322 email regex edge-case`
|
|
114
|
-
- `docs: expand PII redaction examples`
|
|
115
|
-
- `refactor: simplify field builder pipeline`
|
|
116
|
-
- `test: add cases for currency code`
|
|
117
|
-
- `chore: bump dev deps`
|
|
118
|
-
|
|
119
|
-
**Pull Requests**
|
|
120
|
-
|
|
121
|
-
- Keep PRs focused and small when possible.
|
|
122
|
-
- Include tests for new/changed behaviour.
|
|
123
|
-
- Update docs (README, JSDoc, ADRs) as needed.
|
|
124
|
-
- Add a clear description of what & why, with before/after examples if useful.
|
|
125
|
-
- Ensure CI is green (lint, build, tests).
|
|
126
|
-
|
|
127
|
-
**PR checklist**
|
|
128
|
-
|
|
129
|
-
- [ ] Title uses Conventional Commits
|
|
130
|
-
- [ ] Tests added/updated
|
|
131
|
-
- [ ] Lint passes (`npm run lint`)
|
|
132
|
-
- [ ] Build passes (`npm run build`)
|
|
133
|
-
- [ ] Docs updated (README/ADR/CHANGELOG if needed)
|
|
134
|
-
- [ ] No real PII in code, tests, or logs
|
|
135
|
-
|
|
136
|
-
---
|
|
137
|
-
|
|
138
|
-
## Coding standards
|
|
139
|
-
|
|
140
|
-
- **Language:** TypeScript with `strict` types.
|
|
141
|
-
- **Style:** ESLint + Prettier.
|
|
142
|
-
- **Tests:** Prefer Vitest (or Jest) + `@testing-library/*` for React-facing bits.
|
|
143
|
-
- **Public API:** Aim for backward compatibility; use SemVer and mark breaking changes clearly (`feat!:` or `fix!:`).
|
|
144
|
-
- **Performance:** Avoid excessive allocations in hot paths; prefer immutable patterns but mind GC pressure.
|
|
145
|
-
- **Docs:** Add TSDoc comments for exported types/functions.
|
|
146
|
-
|
|
147
|
-
### Validators
|
|
148
|
-
|
|
149
|
-
- Add tests covering common/edge cases.
|
|
150
|
-
- Cite the source/standard (e.g., ISO/RFC) in comments.
|
|
151
|
-
- Keep regexes readable (use `x`/comments where possible) and benchmark if complex.
|
|
152
|
-
|
|
153
|
-
### PII handling
|
|
154
|
-
|
|
155
|
-
- Never include real PII in fixtures or examples.
|
|
156
|
-
- Ensure redaction/cleaning functions operate **before** logging.
|
|
157
|
-
- Add tests confirming no PII leaks to logs or thrown errors.
|
|
158
|
-
|
|
159
|
-
---
|
|
160
|
-
|
|
161
|
-
## Adding dependencies
|
|
162
|
-
|
|
163
|
-
- Minimise runtime dependencies; prefer dev dependencies.
|
|
164
|
-
- Justify any new runtime dependency in the PR description (size, security, maintenance).
|
|
165
|
-
- Avoid transitive heavy deps unless critical.
|
|
166
|
-
|
|
167
|
-
---
|
|
168
|
-
|
|
169
|
-
## Versioning & releases
|
|
170
|
-
|
|
171
|
-
- We follow **SemVer**.
|
|
172
|
-
- Breaking changes require a major bump and migration notes.
|
|
173
|
-
- Keep the `CHANGELOG.md` (or release notes) clear about user-facing changes.
|
|
174
|
-
|
|
175
|
-
---
|
|
176
|
-
|
|
177
|
-
## Documentation
|
|
178
|
-
|
|
179
|
-
- Update `README.md` with new features or setup steps.
|
|
180
|
-
- Add or update ADRs in `docs/adrs/` for architectural decisions.
|
|
181
|
-
- Keep examples minimal, copy-pasteable, and tested when feasible.
|
|
182
|
-
|
|
183
|
-
---
|
|
184
|
-
|
|
185
|
-
## Maintainers’ process (overview)
|
|
186
|
-
|
|
187
|
-
- Triage new issues weekly; label and assign.
|
|
188
|
-
- Review PRs for correctness, tests, and docs.
|
|
189
|
-
- Squash-merge with Conventional Commit titles.
|
|
190
|
-
- Publish from CI when applicable.
|
|
191
|
-
|
|
192
|
-
---
|
|
193
|
-
|
|
194
|
-
## Questions
|
|
195
|
-
|
|
196
|
-
If you have questions or want feedback before building:
|
|
197
|
-
|
|
198
|
-
- Open a discussion or issue with a short proposal,
|
|
199
|
-
- Or draft a PR early (mark as **Draft**) to get directional feedback.
|
|
200
|
-
|
|
201
|
-
Thanks again for contributing 💛
|
package/CONTRIBUTORS.md
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# Contributing Guidelines
|
|
2
|
-
|
|
3
|
-
Thank you for considering contributing to this project! We welcome contributions that improve the code, documentation, and overall project quality.
|
|
4
|
-
|
|
5
|
-
## Getting Started
|
|
6
|
-
|
|
7
|
-
- Fork the repository.
|
|
8
|
-
- Create a feature branch from `main`.
|
|
9
|
-
- Commit your changes with clear messages (we follow **Conventional Commits**).
|
|
10
|
-
- Push your branch and open a Pull Request (PR).
|
|
11
|
-
|
|
12
|
-
## Requirements
|
|
13
|
-
|
|
14
|
-
- Write tests alongside code where possible.
|
|
15
|
-
- Ensure all tests pass before submitting a PR.
|
|
16
|
-
- Follow the repository’s coding style and linting rules.
|
|
17
|
-
- Update documentation (README, ADRs, etc.) when making significant changes.
|
|
18
|
-
- When making architectural changes, create a new ADR (Architecture Decision Record) that **succeeds** the previous one rather than modifying old ADRs. This preserves history and ensures decisions are traceable.
|
|
19
|
-
- Use the [ADR template](./docs/adrs/adr-template.md) when writing new ADRs to ensure consistency.
|
|
20
|
-
- Before your first contribution, sign the appropriate Contributor License Agreement (CLA). See [legal/CLA.md](legal/CLA.md) for details, then email the signed document to [contributors@plasius.co.uk](mailto:contributors@plasius.co.uk).
|
|
21
|
-
|
|
22
|
-
## Communication
|
|
23
|
-
|
|
24
|
-
- Use GitHub Issues for bugs and feature requests.
|
|
25
|
-
- Pull Requests should describe the problem, solution, and trade-offs.
|
|
26
|
-
|
|
27
|
-
We appreciate your support in making this project better!
|
package/SECURITY.md
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Security Policy
|
|
2
|
-
|
|
3
|
-
## Supported Versions
|
|
4
|
-
|
|
5
|
-
We currently support the latest major version of this project. Older versions may not receive security updates.
|
|
6
|
-
|
|
7
|
-
## Reporting a Vulnerability
|
|
8
|
-
|
|
9
|
-
If you discover a security vulnerability, please report it privately by emailing us at [security@plasius.co.uk](mailto:security@plasius.co.uk). Please do not create a public issue for security-related matters.
|
|
10
|
-
|
|
11
|
-
## Response Timeline
|
|
12
|
-
|
|
13
|
-
We aim to acknowledge your report within 2 business days and to provide a more detailed response (including next steps and, if applicable, a timeline for a fix) within 7 business days.
|
|
14
|
-
|
|
15
|
-
## Disclosure Policy
|
|
16
|
-
|
|
17
|
-
We request that you give us the opportunity to address the vulnerability before publicly disclosing it. We will coordinate with you on public disclosure once a fix is available and deployed.
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# ADR-0001: Schema Library Purpose and Scope
|
|
2
|
-
|
|
3
|
-
## Status
|
|
4
|
-
|
|
5
|
-
- Proposed → Accepted
|
|
6
|
-
- Date: 2025-09-12
|
|
7
|
-
- Version: 1.0
|
|
8
|
-
- Supersedes: N/A
|
|
9
|
-
- Superseded by: N/A
|
|
10
|
-
|
|
11
|
-
## Context
|
|
12
|
-
|
|
13
|
-
Managing consistent data structures across a distributed system is difficult. Without a central schema library, each service or package can diverge in how it defines and validates entities, leading to duplication, mismatches, and security gaps (especially around handling Personally Identifiable Information, or PII).
|
|
14
|
-
|
|
15
|
-
We need a way to:
|
|
16
|
-
|
|
17
|
-
- Define entities and fields in a consistent, strongly-typed way.
|
|
18
|
-
- Provide validation functions for standard data types and codes (ISO, RFC, OWASP, etc).
|
|
19
|
-
- Support annotation of PII fields so they can be masked or cleaned when logged or transmitted.
|
|
20
|
-
- Offer a foundation that other Plasius packages (e.g. entity-types, state, renderer) can depend upon.
|
|
21
|
-
|
|
22
|
-
## Decision
|
|
23
|
-
|
|
24
|
-
We will build a **schema library** (`@plasius/schema`) that:
|
|
25
|
-
|
|
26
|
-
- Provides a fluent builder API (`field().string().required()` etc.).
|
|
27
|
-
- Exposes reusable validators for standards like ISO-3166 country codes, ISO-4217 currency codes, RFC 5322 emails, etc.
|
|
28
|
-
- Implements utilities for PII handling (masking, redaction).
|
|
29
|
-
- Exports TypeScript types that infer entity structures from schema definitions.
|
|
30
|
-
- Is published as an open source package for transparency and reuse.
|
|
31
|
-
|
|
32
|
-
## Consequences
|
|
33
|
-
|
|
34
|
-
- **Positive:** Consistent validation, stronger typing, centralised handling of PII, reduced duplication across Plasius projects, easier onboarding of new developers.
|
|
35
|
-
- **Negative:** Adds a dependency layer that all other packages must import, requiring careful versioning and backward compatibility management.
|
|
36
|
-
- **Neutral:** External adopters may use the library without adopting the full Plasius ecosystem, which is acceptable and encouraged.
|
|
37
|
-
|
|
38
|
-
## Alternatives Considered
|
|
39
|
-
|
|
40
|
-
- **Do nothing:** Continue defining ad-hoc validation in each package. (Rejected: inconsistent and unsafe.)
|
|
41
|
-
- **Use an existing library (e.g. Zod, Yup, Joi):** These provide schema validation but lack PII auditing integration and may not align with our field-builder pattern. (Rejected for core use, though we may draw inspiration.)
|
|
42
|
-
|
|
43
|
-
## References
|
|
44
|
-
|
|
45
|
-
- [Architectural Decision Records (ADR) standard](https://adr.github.io/)
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
# Architectural Decision Record (ADR)
|
|
2
|
-
|
|
3
|
-
## Title
|
|
4
|
-
|
|
5
|
-
> _Concise, descriptive title of the decision (e.g., “Use Azure Container Apps for n8n Deployment”)_
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## Status
|
|
10
|
-
|
|
11
|
-
- Proposed | Accepted | Rejected | Superseded | Deprecated
|
|
12
|
-
- Date: YYYY-MM-DD
|
|
13
|
-
- Version: 1.0
|
|
14
|
-
- Supersedes: ADR-XXXX (if applicable)
|
|
15
|
-
- Superseded by: ADR-YYYY (if applicable)
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## Tags
|
|
20
|
-
|
|
21
|
-
> _Short keywords to help search and group ADRs (e.g., infra, frontend, security, devops, ai, database)._
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## Context
|
|
26
|
-
|
|
27
|
-
> _Describe the problem we are solving, relevant background, and constraints.
|
|
28
|
-
> Why are we making this decision? What triggered it?_
|
|
29
|
-
|
|
30
|
-
---
|
|
31
|
-
|
|
32
|
-
## Decision
|
|
33
|
-
|
|
34
|
-
> _What is the decision we have made? Clear, affirmative statement of the chosen path._
|
|
35
|
-
|
|
36
|
-
---
|
|
37
|
-
|
|
38
|
-
## Alternatives Considered
|
|
39
|
-
|
|
40
|
-
- **Option A**: Description (pros/cons)
|
|
41
|
-
- **Option B**: Description (pros/cons)
|
|
42
|
-
- **Option C**: Description (pros/cons)
|
|
43
|
-
|
|
44
|
-
> _Why were these alternatives not chosen?_
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## Consequences
|
|
49
|
-
|
|
50
|
-
- Positive outcomes (benefits, opportunities)
|
|
51
|
-
- Negative outcomes (risks, trade-offs)
|
|
52
|
-
- Any technical debt created or avoided
|
|
53
|
-
- Impact on future decisions
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
## Related Decisions
|
|
58
|
-
|
|
59
|
-
> _Link to related ADRs (if any)_
|
|
60
|
-
|
|
61
|
-
---
|
|
62
|
-
|
|
63
|
-
## References
|
|
64
|
-
|
|
65
|
-
- [Architectural Decision Records (ADR) standard](https://adr.github.io/)
|
|
66
|
-
|
|
67
|
-
> _Links to docs, benchmarks, discussions, or external resources that influenced this decision_
|
package/legal/CLA-REGISTRY.csv
DELETED
package/legal/CLA.md
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# Contributor License Agreements (CLA)
|
|
2
|
-
|
|
3
|
-
To protect the intellectual property of this project and ensure clarity of rights, all contributors must sign a Contributor License Agreement (CLA) before their first contribution.
|
|
4
|
-
|
|
5
|
-
## Which CLA should I sign?
|
|
6
|
-
|
|
7
|
-
- **Individual CLA**: If you are contributing personally and not on behalf of an employer, sign the [Individual CLA](INDIVIDUAL_CLA.md).
|
|
8
|
-
- **Corporate CLA**: If you are contributing as part of your work for a company, the company should sign the [Corporate CLA](CORPORATE_CLA.md).
|
|
9
|
-
|
|
10
|
-
## How to sign
|
|
11
|
-
|
|
12
|
-
1. Download the appropriate CLA file (Individual or Corporate).
|
|
13
|
-
2. Fill in the required details, sign, and date it.
|
|
14
|
-
3. Email a PDF copy of the signed document to **[contributors@plasius.co.uk](mailto:contributors@plasius.co.uk)** with subject: `CLA – Individual` or `CLA – Corporate`.
|
|
15
|
-
|
|
16
|
-
## Registry
|
|
17
|
-
|
|
18
|
-
All signed CLAs are logged internally in the CLA registry (`CLA-REGISTRY.csv`).
|
|
19
|
-
|
|
20
|
-
## Questions?
|
|
21
|
-
|
|
22
|
-
If you have any questions about which CLA to sign or how the process works, please email **[contributors@plasius.co.uk](mailtocontributors@plasius.co.uk)**.
|
package/legal/CORPORATE_CLA.md
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# Corporate Contributor License Agreement (CLA)
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
|
|
5
|
-
This Corporate Contributor License Agreement ("Agreement") is intended to protect the intellectual property rights of the contributors and the project, ensure clear licensing terms for contributions, and maintain trust within the community. By signing this Agreement, the corporation agrees to the terms that facilitate the use, distribution, and modification of contributions under the project's licensing framework.
|
|
6
|
-
|
|
7
|
-
## Agreement
|
|
8
|
-
|
|
9
|
-
1. **Representation of Authority**
|
|
10
|
-
The undersigned individual represents and warrants that they have the full legal authority to enter into this Agreement on behalf of the corporation named below ("Corporation") and to grant the rights contained herein.
|
|
11
|
-
|
|
12
|
-
2. **Grant of Copyright License**
|
|
13
|
-
The Corporation hereby grants to the project maintainers and users a perpetual, worldwide, non-exclusive, royalty-free, irrevocable copyright license to use, reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute the contributions submitted to the project.
|
|
14
|
-
|
|
15
|
-
3. **Grant of Patent License**
|
|
16
|
-
The Corporation hereby grants to the project maintainers and users a perpetual, worldwide, non-exclusive, royalty-free, irrevocable license under any patent claims that are necessarily infringed by the contributions to make, use, sell, offer for sale, import, and otherwise dispose of the contributions or derivative works thereof.
|
|
17
|
-
|
|
18
|
-
4. **Warranties and Representations**
|
|
19
|
-
The Corporation represents and warrants that:
|
|
20
|
-
|
|
21
|
-
- The contributions are the original work of the Corporation or that the Corporation has sufficient rights to grant the licenses herein.
|
|
22
|
-
- The submission of the contributions does not violate any agreements or rights of third parties.
|
|
23
|
-
|
|
24
|
-
5. **No Revocation**
|
|
25
|
-
This license is granted on a perpetual basis and cannot be revoked, provided that the terms of this Agreement are met.
|
|
26
|
-
|
|
27
|
-
6. **Governing Law**
|
|
28
|
-
This Agreement shall be governed by and construed in accordance with the laws of the United Kingdom, without regard to its conflict of laws principles.
|
|
29
|
-
|
|
30
|
-
7. **Execution**
|
|
31
|
-
|
|
32
|
-
This Agreement is effective upon signature by the authorized representative of the Corporation. Please sign and date this document, then email a scanned PDF copy to [contributors@plasius.co.uk](mailto:contributors@plasius.co.uk).
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
### **@plasius/schema**
|
|
37
|
-
|
|
38
|
-
**Corporation Legal Name:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
|
|
39
|
-
|
|
40
|
-
**Authorized Representative:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
|
|
41
|
-
|
|
42
|
-
**Title:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
|
|
43
|
-
|
|
44
|
-
**Email:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
|
|
45
|
-
|
|
46
|
-
**Date:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
|
|
47
|
-
|
|
48
|
-
**Signature:** \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## How to Sign
|
|
53
|
-
|
|
54
|
-
- Download this file as a template.
|
|
55
|
-
- Fill in the Corporation’s legal name, authorized representative, title, email, date, and provide a signature.
|
|
56
|
-
- Sign and date the document.
|
|
57
|
-
- Send a scanned copy of the signed Agreement to [contributors@plasius.co.uk](mailto:contributors@plasius.co.uk).
|