@plasius/schema 1.0.13 → 1.0.18

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.
@@ -6,6 +6,7 @@ on:
6
6
  permissions:
7
7
  contents: write
8
8
  id-token: write # for npm provenance (requires Node 18+ and npm >=9)
9
+ attestations: write
9
10
 
10
11
  jobs:
11
12
  publish:
@@ -21,12 +22,6 @@ jobs:
21
22
  node-version-file: '.nvmrc'
22
23
  cache: 'npm'
23
24
 
24
- - name: Install deps (CI)
25
- run: npm ci
26
-
27
- - name: Build
28
- run: npm run build --if-present
29
-
30
25
  - name: Bump version & decide publish flags
31
26
  id: pkg
32
27
  env:
@@ -51,14 +46,42 @@ jobs:
51
46
  else
52
47
  echo "flags=--access public" >> "$GITHUB_OUTPUT"
53
48
  fi
49
+
50
+ - name: Install deps (CI)
51
+ run: npm ci
52
+
53
+ - name: Test (coverage)
54
+ run: npm run test -- --coverage
55
+
56
+ - name: Upload coverage to Codecov
57
+ uses: codecov/codecov-action@v4
58
+ with:
59
+ token: ${{ secrets.CODECOV_TOKEN }}
60
+ files: ./coverage/lcov.info
61
+ flags: unittests
62
+ fail_ci_if_error: true
63
+
64
+ - name: Build
65
+ run: npm run build --if-present
66
+
67
+ - name: Generate SBOM (CycloneDX)
68
+ run: npm sbom --sbom-format=cyclonedx --sbom-type=library --omit dev > sbom.cdx.json
69
+
70
+ - name: Attest SBOM (GitHub Artifact Attestations)
71
+ uses: actions/attest-build-provenance@v3
72
+ with:
73
+ subject-path: sbom.cdx.json
54
74
 
55
75
  - name: Update CHANGELOG.md (move Unreleased to new version)
56
76
  env:
57
77
  VERSION: ${{ steps.pkg.outputs.version }}
58
78
  TAG: ${{ steps.pkg.outputs.tag }}
59
79
  GITHUB_REPOSITORY: ${{ github.repository }}
80
+ verbose: true
60
81
  run: |
61
82
  set -euo pipefail
83
+ git config user.name "github-actions[bot]"
84
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
62
85
 
63
86
  FILE="CHANGELOG.md"
64
87
  if [ ! -f "$FILE" ]; then
@@ -88,7 +111,7 @@ jobs:
88
111
 
89
112
  # Prepare new Unreleased template (Keep a Changelog style) without tabs/indent issues
90
113
  NEW_UNRELEASED=$(printf '%s\n' \
91
- '## [Unreleased]' \
114
+ '' \
92
115
  '- **Added**' \
93
116
  ' - (placeholder)' \
94
117
  '' \
@@ -123,8 +146,8 @@ jobs:
123
146
  # Update bottom compare links
124
147
  # Update [Unreleased] compare to start at v${VERSION}
125
148
  COMPARE_URL="https://github.com/${GITHUB_REPOSITORY}/compare/v${VERSION}...HEAD"
126
- sed -E -i.bak "s|^\[Unreleased\]: .*|[Unreleased]: ${COMPARE_URL}|" "$FILE" || true
127
- rm -f "$FILE.bak"
149
+ awk -v repl="[Unreleased]: ${COMPARE_URL}" 'BEGIN{OFS=FS} { if ($0 ~ /^\[Unreleased\]: /) { print repl } else { print } }' "$FILE" > "$FILE.tmp"
150
+ mv "$FILE.tmp" "$FILE"
128
151
 
129
152
  # Append a link for the new version if not present
130
153
  if ! grep -q "^\[${VERSION}\]:" "$FILE"; then
@@ -142,13 +165,19 @@ jobs:
142
165
  set -euo pipefail
143
166
  TAG="${{ steps.pkg.outputs.tag }}"
144
167
  if gh release view "$TAG" >/dev/null 2>&1; then
145
- echo "Release $TAG already exists; skipping creation."
168
+ echo "Release $TAG already exists; uploading SBOM asset."
146
169
  else
147
170
  gh release create "$TAG" \
148
171
  --title "Release $TAG" \
149
172
  --generate-notes \
150
173
  --latest
151
174
  fi
175
+ # Upload/overwrite the SBOM asset on the release
176
+ if [ -f sbom.cdx.json ]; then
177
+ gh release upload "$TAG" sbom.cdx.json --clobber
178
+ else
179
+ echo "No SBOM generated; skipping upload."
180
+ fi
152
181
 
153
182
  - name: Publish
154
183
  env:
package/CHANGELOG.md CHANGED
@@ -8,7 +8,7 @@ The format is based on **[Keep a Changelog](https://keepachangelog.com/en/1.1.0/
8
8
  ---
9
9
 
10
10
  ## [Unreleased]
11
- ## [Unreleased]
11
+
12
12
  - **Added**
13
13
  - (placeholder)
14
14
 
@@ -21,10 +21,17 @@ The format is based on **[Keep a Changelog](https://keepachangelog.com/en/1.1.0/
21
21
  - **Security**
22
22
  - (placeholder)
23
23
 
24
- ## [1.0.13] - 2025-09-16
24
+ ## [1.0.18] - 2025-09-17
25
+
26
+ - **Fixed**
27
+ - CD pipeline reorder fix to restore CHANGELOG.md versions
28
+
29
+ ## [1.0.17] - 2025-09-17
25
30
 
26
31
  - **Added**
27
- - (placeholder) Add new validators, field helpers, or PII utilities here.
32
+ - chore: Code coverage added
33
+
34
+ ## [1.0.13] - 2025-09-16
28
35
 
29
36
  - **Changed**
30
37
  - ./src/schema.ts Added comments defining functionality on all externally facing functions.
@@ -32,9 +39,6 @@ The format is based on **[Keep a Changelog](https://keepachangelog.com/en/1.1.0/
32
39
  - **Fixed**
33
40
  - ./src/schema.ts Validation no longer mutates the input, internal system fields are set only on result if not previously present.
34
41
 
35
- - **Security**
36
- - (placeholder)
37
-
38
42
  ---
39
43
 
40
44
  ## [1.0.0] - 2025-09-16
@@ -75,6 +79,8 @@ The format is based on **[Keep a Changelog](https://keepachangelog.com/en/1.1.0/
75
79
 
76
80
  ---
77
81
 
78
- [Unreleased]: https://github.com/Plasius-LTD/schema/compare/v1.0.13...HEAD
79
- [1.0.0]: https://github.com/Plasius-LTD/plasius-schema/releases/tag/v1.0.0
82
+ [Unreleased]: https://github.com/Plasius-LTD/schema/compare/v1.0.18...HEAD
83
+ [1.0.0]: https://github.com/Plasius-LTD/schema/releases/tag/v1.0.0
80
84
  [1.0.13]: https://github.com/Plasius-LTD/schema/releases/tag/v1.0.13
85
+ [1.0.17]: https://github.com/Plasius-LTD/schema/releases/tag/v1.0.17
86
+ [1.0.18]: https://github.com/Plasius-LTD/schema/releases/tag/v1.0.18
package/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@plasius/schema.svg)](https://www.npmjs.com/package/@plasius/schema)
4
4
  [![Build Status](https://img.shields.io/github/actions/workflow/status/Plasius-LTD/schema/ci.yml?branch=main&label=build&style=flat)](https://github.com/plasius/schema/actions/workflows/ci.yml)
5
+ [![coverage](https://img.shields.io/codecov/c/github/Plasius-LTD/schema)](https://codecov.io/gh/Plasius-LTD/schema)
5
6
  [![License](https://img.shields.io/github/license/Plasius-LTD/schema)](./LICENSE)
6
7
  [![Code of Conduct](https://img.shields.io/badge/code%20of%20conduct-yes-blue.svg)](./CODE_OF_CONDUCT.md)
7
8
  [![Security Policy](https://img.shields.io/badge/security%20policy-yes-orange.svg)](./SECURITY.md)
@@ -39,3 +39,7 @@ We will build a **schema library** (`@plasius/schema`) that:
39
39
 
40
40
  - **Do nothing:** Continue defining ad-hoc validation in each package. (Rejected: inconsistent and unsafe.)
41
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/)
@@ -62,4 +62,6 @@
62
62
 
63
63
  ## References
64
64
 
65
+ - [Architectural Decision Records (ADR) standard](https://adr.github.io/)
66
+
65
67
  > _Links to docs, benchmarks, discussions, or external resources that influenced this decision_
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasius/schema",
3
- "version": "1.0.13",
3
+ "version": "1.0.18",
4
4
  "description": "Entity schema definition & validation helpers for Plasius ecosystem",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -58,6 +58,7 @@
58
58
  "@types/node": "^24.3.1",
59
59
  "@typescript-eslint/eslint-plugin": "^8.43.0",
60
60
  "@typescript-eslint/parser": "^8.43.0",
61
+ "@vitest/coverage-v8": "^3.2.4",
61
62
  "eslint": "^9.35.0",
62
63
  "tsup": "^8.5.0",
63
64
  "tsx": "^4.20.5",
package/sbom.cdx.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
3
+ "bomFormat": "CycloneDX",
4
+ "specVersion": "1.5",
5
+ "serialNumber": "urn:uuid:5e59b78b-f6f8-47c0-8329-d6447041544f",
6
+ "version": 1,
7
+ "metadata": {
8
+ "timestamp": "2025-09-17T16:14:58.925Z",
9
+ "lifecycles": [
10
+ {
11
+ "phase": "build"
12
+ }
13
+ ],
14
+ "tools": [
15
+ {
16
+ "vendor": "npm",
17
+ "name": "cli",
18
+ "version": "10.9.3"
19
+ }
20
+ ],
21
+ "component": {
22
+ "bom-ref": "@plasius/schema@1.0.18",
23
+ "type": "library",
24
+ "name": "schema",
25
+ "version": "1.0.18",
26
+ "scope": "required",
27
+ "author": "Plasius LTD",
28
+ "description": "Entity schema definition & validation helpers for Plasius ecosystem",
29
+ "purl": "pkg:npm/%40plasius/schema@1.0.18",
30
+ "properties": [
31
+ {
32
+ "name": "cdx:npm:package:path",
33
+ "value": ""
34
+ }
35
+ ],
36
+ "externalReferences": [
37
+ {
38
+ "type": "vcs",
39
+ "url": "git+https://github.com/Plasius-LTD/schema.git"
40
+ },
41
+ {
42
+ "type": "website",
43
+ "url": "https://github.com/Plasius-LTD/schema#readme"
44
+ },
45
+ {
46
+ "type": "issue-tracker",
47
+ "url": "https://github.com/Plasius-LTD/schema/issues"
48
+ }
49
+ ],
50
+ "licenses": [
51
+ {
52
+ "license": {
53
+ "id": "Apache-2.0"
54
+ }
55
+ }
56
+ ]
57
+ }
58
+ },
59
+ "components": [],
60
+ "dependencies": [
61
+ {
62
+ "ref": "@plasius/schema@1.0.18",
63
+ "dependsOn": []
64
+ }
65
+ ]
66
+ }
package/vitest.config.js CHANGED
@@ -6,8 +6,15 @@ export default defineConfig({
6
6
  globals: true,
7
7
  include: ["tests/**/*.test.{ts,tsx}"],
8
8
  coverage: {
9
+ provider: "v8",
9
10
  reporter: ["text", "lcov"],
10
- exclude: ["tests/**", "dist/**"],
11
+ reportsDirectory: "./coverage",
12
+ exclude: [
13
+ "tests/**",
14
+ "dist/**",
15
+ "**/*.config.{js,ts}",
16
+ "**/.eslintrc.{js,cjs}",
17
+ ],
11
18
  },
12
19
  },
13
20
  });