ac-sanitizer 4.2.0 → 4.2.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/CHANGELOG.md +14 -0
- package/index.js +7 -1
- package/package.json +3 -3
- package/test/tests/array.js +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
## [4.2.1](https://github.com/mmpro/ac-sanitizer/compare/v4.2.0..v4.2.1) (2025-05-19 06:12:14)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fix
|
|
6
|
+
|
|
7
|
+
* **App:** Fixed and improved valueType with array | MP | [0bfa6135e4588a5f24a11ab2a3024d608fe8aa21](https://github.com/mmpro/ac-sanitizer/commit/0bfa6135e4588a5f24a11ab2a3024d608fe8aa21)
|
|
8
|
+
If you set valueType for an array, we will now check all properties and return an error is there is any issue.
|
|
9
|
+
Related issues:
|
|
10
|
+
### Chores
|
|
11
|
+
|
|
12
|
+
* **App:** Updated packages | MP | [699b8a2a7a4d41cc7f58318e400937dfba21cf30](https://github.com/mmpro/ac-sanitizer/commit/699b8a2a7a4d41cc7f58318e400937dfba21cf30)
|
|
13
|
+
Updated packages
|
|
14
|
+
Related issues:
|
|
1
15
|
|
|
2
16
|
# [4.2.0](https://github.com/mmpro/ac-sanitizer/compare/v4.1.4..v4.2.0) (2025-05-09 07:40:18)
|
|
3
17
|
|
package/index.js
CHANGED
|
@@ -274,9 +274,15 @@ const sanitizer = function() {
|
|
|
274
274
|
else if (field.valueType) {
|
|
275
275
|
// very value of the array must be of this type
|
|
276
276
|
_.every(value, (v, index, value) => {
|
|
277
|
+
const { valueType, type, ...fieldProps } = field
|
|
278
|
+
|
|
277
279
|
const fieldsToCheck = {
|
|
278
280
|
params: {},
|
|
279
|
-
fields: [{
|
|
281
|
+
fields: [{
|
|
282
|
+
field: fieldName,
|
|
283
|
+
type: valueType,
|
|
284
|
+
...fieldProps
|
|
285
|
+
}]
|
|
280
286
|
}
|
|
281
287
|
_.set(fieldsToCheck, `params.${fieldName}`, v)
|
|
282
288
|
const check = checkAndSanitizeValues(fieldsToCheck)
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"author": "Mark Poepping (https://www.admiralcloud.com)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "admiralcloud/ac-sanitizer",
|
|
7
|
-
"version": "4.2.
|
|
7
|
+
"version": "4.2.1",
|
|
8
8
|
"homepage": "https://www.admiralcloud.com",
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"ac-countrylist": "^1.0.13",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"ac-semantic-release": "^0.4.6",
|
|
21
21
|
"c8": "^10.1.3",
|
|
22
|
-
"eslint": "^9.
|
|
23
|
-
"mocha": "^11.
|
|
22
|
+
"eslint": "^9.27.0",
|
|
23
|
+
"mocha": "^11.3.0"
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"test": "mocha --reporter spec --bail",
|
package/test/tests/array.js
CHANGED
|
@@ -37,9 +37,11 @@ module.exports = {
|
|
|
37
37
|
value: [{ p1: 'isAString', p2: 'shouldBeRemoved' }, { p1: 'isAString2', p2: 'shouldBeRemoved2' }],
|
|
38
38
|
expected: [{ p1: 'isAString' }, { p1: 'isAString2' }]
|
|
39
39
|
},
|
|
40
|
-
{ name: 'Array of strings with enum - uppercase vs lowercase', type: 'array', valueType: 'string', value: ['ABC'], enum: ['abc'], error: '
|
|
41
|
-
{ name: 'Array of strings with enum - uppercase vs lowercase - with ignoreCase', type: 'array', valueType: 'string', ignoreCase: true, value: ['ABC', 'DEF'], enum: ['abc'],
|
|
42
|
-
|
|
40
|
+
{ name: 'Array of strings with enum - uppercase vs lowercase', type: 'array', valueType: 'string', value: ['ABC'], enum: ['abc'], error: 'array_atLeastOneValueFailed' },
|
|
41
|
+
{ name: 'Array of strings with enum - uppercase vs lowercase - with ignoreCase', type: 'array', valueType: 'string', ignoreCase: true, value: ['ABC', 'DEF'], enum: ['abc'], error: 'array_atLeastOneValueFailed' },
|
|
42
|
+
{ name: 'Array of urls with https', type: 'array', valueType: 'url', value: ['https://www.admiralcloud.com'], expected: ['https://www.admiralcloud.com'] },
|
|
43
|
+
{ name: 'Array of urls with http and https - only https is allowed', type: 'array', valueType: 'url', protocols: ['https'], value: ['http://www.admiralcloud.com'], error: 'array_atLeastOneValueFailed' },
|
|
44
|
+
]
|
|
43
45
|
|
|
44
46
|
runValidationTests(baseTests, 'array', { equalityCheck: 'eql' })
|
|
45
47
|
}
|