@bedrock/validation 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/.eslintrc.cjs +9 -6
- package/.github/workflows/main.yml +11 -10
- package/CHANGELOG.md +19 -0
- package/README.md +2 -2
- package/lib/index.js +2 -2
- package/package.json +9 -9
- package/schemas/helpers/idOrObjectWithId.js +1 -1
- package/schemas/verifiableCredential.js +1 -1
- package/schemas/verifiablePresentation.js +2 -2
package/.eslintrc.cjs
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
root: true,
|
|
3
|
-
parserOptions: {
|
|
4
|
-
// this is required for dynamic import()
|
|
5
|
-
ecmaVersion: 2020
|
|
6
|
-
},
|
|
7
3
|
env: {
|
|
8
4
|
node: true
|
|
9
5
|
},
|
|
10
|
-
extends: [
|
|
11
|
-
|
|
6
|
+
extends: [
|
|
7
|
+
'digitalbazaar',
|
|
8
|
+
'digitalbazaar/jsdoc',
|
|
9
|
+
'digitalbazaar/module'
|
|
10
|
+
],
|
|
11
|
+
ignorePatterns: ['node_modules/'],
|
|
12
|
+
rules: {
|
|
13
|
+
'unicorn/prefer-node-protocol': 'error'
|
|
14
|
+
}
|
|
12
15
|
};
|
|
@@ -8,11 +8,11 @@ jobs:
|
|
|
8
8
|
timeout-minutes: 10
|
|
9
9
|
strategy:
|
|
10
10
|
matrix:
|
|
11
|
-
node-version: [
|
|
11
|
+
node-version: [22.x]
|
|
12
12
|
steps:
|
|
13
|
-
- uses: actions/checkout@
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
14
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
15
|
-
uses: actions/setup-node@
|
|
15
|
+
uses: actions/setup-node@v4
|
|
16
16
|
with:
|
|
17
17
|
node-version: ${{ matrix.node-version }}
|
|
18
18
|
- run: npm install
|
|
@@ -24,11 +24,11 @@ jobs:
|
|
|
24
24
|
timeout-minutes: 10
|
|
25
25
|
strategy:
|
|
26
26
|
matrix:
|
|
27
|
-
node-version: [
|
|
27
|
+
node-version: [18.x, 20.x, 22.x]
|
|
28
28
|
steps:
|
|
29
|
-
- uses: actions/checkout@
|
|
29
|
+
- uses: actions/checkout@v4
|
|
30
30
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
31
|
-
uses: actions/setup-node@
|
|
31
|
+
uses: actions/setup-node@v4
|
|
32
32
|
with:
|
|
33
33
|
node-version: ${{ matrix.node-version }}
|
|
34
34
|
- run: |
|
|
@@ -45,11 +45,11 @@ jobs:
|
|
|
45
45
|
timeout-minutes: 10
|
|
46
46
|
strategy:
|
|
47
47
|
matrix:
|
|
48
|
-
node-version: [
|
|
48
|
+
node-version: [22.x]
|
|
49
49
|
steps:
|
|
50
|
-
- uses: actions/checkout@
|
|
50
|
+
- uses: actions/checkout@v4
|
|
51
51
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
52
|
-
uses: actions/setup-node@
|
|
52
|
+
uses: actions/setup-node@v4
|
|
53
53
|
with:
|
|
54
54
|
node-version: ${{ matrix.node-version }}
|
|
55
55
|
- run: |
|
|
@@ -61,7 +61,8 @@ jobs:
|
|
|
61
61
|
cd test
|
|
62
62
|
npm run coverage-ci
|
|
63
63
|
- name: Upload coverage to Codecov
|
|
64
|
-
uses: codecov/codecov-action@
|
|
64
|
+
uses: codecov/codecov-action@v4
|
|
65
65
|
with:
|
|
66
66
|
file: ./test/coverage/lcov.info
|
|
67
67
|
fail_ci_if_error: true
|
|
68
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
# bedrock-validation ChangeLog
|
|
2
2
|
|
|
3
|
+
## 7.1.1 - 2024-11-14
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
- Test and support Node.js 18, 20, 22.
|
|
7
|
+
- Update dependencies:
|
|
8
|
+
- `ajv@6.12.6`
|
|
9
|
+
- `klona@2.0.6`
|
|
10
|
+
- Update dev dependencies.
|
|
11
|
+
- Fix lint issues.
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
- Errors now use the spelling `occurred` vs the typo `occured`.
|
|
15
|
+
- **NOTE**: This typo is known to be present in many tests of error message
|
|
16
|
+
and will require similar typo fixes.
|
|
17
|
+
|
|
3
18
|
## 7.1.0 - 2022-10-16
|
|
4
19
|
|
|
5
20
|
### Added
|
|
6
21
|
- Added a validator for `VerifiablePresentation`
|
|
7
22
|
- Added a validator for `VerifiableCredential`.
|
|
8
23
|
|
|
24
|
+
### Changed
|
|
25
|
+
- The `credential` and `presentation` schemas are now deprecated and
|
|
26
|
+
will be removed in a future major release.
|
|
27
|
+
|
|
9
28
|
## 7.0.0 - 2022-04-28
|
|
10
29
|
|
|
11
30
|
### Changed
|
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ bedrock.events.on('bedrock-express.configure.routes', function(app) {
|
|
|
29
29
|
app.post('/bar',
|
|
30
30
|
// validate the query using the 'postBarQueryValidator'
|
|
31
31
|
// validate the response body using the 'postBarValidator'
|
|
32
|
-
validate({
|
|
32
|
+
validate({querySchema: postBarQueryValidator, bodySchema: postBarValidator}),
|
|
33
33
|
function(req, res) {
|
|
34
34
|
// do something
|
|
35
35
|
});
|
|
@@ -51,7 +51,7 @@ For more documentation on configuration, see [config.js](./lib/config.js).
|
|
|
51
51
|
|
|
52
52
|
## API
|
|
53
53
|
|
|
54
|
-
### createValidateMiddleware({
|
|
54
|
+
### createValidateMiddleware({querySchema: schema, bodySchema: schema})
|
|
55
55
|
|
|
56
56
|
This method may be called with either `query` or `body` defined.
|
|
57
57
|
|
package/lib/index.js
CHANGED
|
@@ -241,8 +241,8 @@ function _createError({schema, instance}) {
|
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
const msg = schema.title ?
|
|
244
|
-
'A validation error
|
|
245
|
-
'A validation error
|
|
244
|
+
'A validation error occurred in the \'' + schema.title + '\' validator.' :
|
|
245
|
+
'A validation error occurred in an unnamed validator.';
|
|
246
246
|
const error = new BedrockError(
|
|
247
247
|
msg, 'ValidationError', {public: true, errors, httpStatusCode: 400});
|
|
248
248
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bedrock/validation",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Bedrock validation",
|
|
6
6
|
"main": "./lib/index.js",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"lint": "eslint ."
|
|
8
|
+
"lint": "eslint --ext .cjs,.js ."
|
|
9
9
|
},
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -24,19 +24,19 @@
|
|
|
24
24
|
},
|
|
25
25
|
"homepage": "https://github.com/digitalbazaar/bedrock-validation",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"ajv": "^6.12.
|
|
28
|
-
"klona": "^2.0.
|
|
27
|
+
"ajv": "^6.12.6",
|
|
28
|
+
"klona": "^2.0.6"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@bedrock/core": "^6.
|
|
31
|
+
"@bedrock/core": "^6.2.0"
|
|
32
32
|
},
|
|
33
33
|
"directories": {
|
|
34
34
|
"lib": "./lib"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"eslint": "^
|
|
38
|
-
"eslint-config-digitalbazaar": "^2.
|
|
39
|
-
"eslint-plugin-jsdoc": "^
|
|
40
|
-
"
|
|
37
|
+
"eslint": "^8.57.1",
|
|
38
|
+
"eslint-config-digitalbazaar": "^5.2.0",
|
|
39
|
+
"eslint-plugin-jsdoc": "^50.5.0",
|
|
40
|
+
"eslint-plugin-unicorn": "^56.0.0"
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) 2012-2022 Digital Bazaar, Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../../lib/helpers.js';
|
|
5
|
-
import {klona} from 'klona';
|
|
6
5
|
import identifier from '../identifier.js';
|
|
6
|
+
import {klona} from 'klona';
|
|
7
7
|
|
|
8
8
|
const schema = {
|
|
9
9
|
title: 'identifier or an object with an id',
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Copyright (c) 2012-2022 Digital Bazaar, Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
5
|
-
import proof from './proof.js';
|
|
6
5
|
import idOrObjectWithId from './helpers/idOrObjectWithId.js';
|
|
7
6
|
import {klona} from 'klona';
|
|
7
|
+
import proof from './proof.js';
|
|
8
8
|
import w3cDateTime from './w3cDateTime.js';
|
|
9
9
|
|
|
10
10
|
// https://www.w3.org/TR/vc-data-model/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (c) 2012-2022 Digital Bazaar, Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
import verifiableCredential from './verifiableCredential.js';
|
|
5
4
|
import {extend as _extend} from '../lib/helpers.js';
|
|
6
|
-
import proof from './proof.js';
|
|
7
5
|
import idOrObjectWithId from './helpers/idOrObjectWithId.js';
|
|
8
6
|
import {klona} from 'klona';
|
|
7
|
+
import proof from './proof.js';
|
|
8
|
+
import verifiableCredential from './verifiableCredential.js';
|
|
9
9
|
|
|
10
10
|
const schema = {
|
|
11
11
|
title: 'Verifiable Presentation',
|