@adobe/spacecat-shared-data-access 1.61.12 → 1.61.13
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
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-data-access-v1.61.13](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.61.12...@adobe/spacecat-shared-data-access-v1.61.13) (2025-01-03)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* audit result to validate array ([#522](https://github.com/adobe/spacecat-shared/issues/522)) ([a6978d5](https://github.com/adobe/spacecat-shared/commit/a6978d54c52e668ea2336e68c9dcb000ba1a45a3))
|
|
7
|
+
|
|
1
8
|
# [@adobe/spacecat-shared-data-access-v1.61.12](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.61.11...@adobe/spacecat-shared-data-access-v1.61.12) (2024-12-31)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { isObject } from '@adobe/spacecat-shared-utils';
|
|
13
|
+
import { isArray, isObject } from '@adobe/spacecat-shared-utils';
|
|
14
14
|
|
|
15
15
|
import { ValidationError } from '../../errors/index.js';
|
|
16
16
|
import BaseModel from '../base/base.model.js';
|
|
@@ -53,7 +53,7 @@ class Audit extends BaseModel {
|
|
|
53
53
|
* @returns {boolean} - True if valid, false otherwise.
|
|
54
54
|
*/
|
|
55
55
|
static validateAuditResult = (auditResult, auditType) => {
|
|
56
|
-
if (!isObject(auditResult) && !
|
|
56
|
+
if (!isObject(auditResult) && !isArray(auditResult)) {
|
|
57
57
|
throw new ValidationError('Audit result must be an object or array');
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
/* c8 ignore start */
|
|
14
14
|
|
|
15
|
-
import { isIsoDate, isNonEmptyObject } from '@adobe/spacecat-shared-utils';
|
|
15
|
+
import { isArray, isIsoDate, isNonEmptyObject } from '@adobe/spacecat-shared-utils';
|
|
16
16
|
|
|
17
17
|
import SchemaBuilder from '../base/schema.builder.js';
|
|
18
18
|
import Audit from './audit.model.js';
|
|
@@ -33,7 +33,7 @@ const schema = new SchemaBuilder(Audit, AuditCollection)
|
|
|
33
33
|
.addAttribute('auditResult', {
|
|
34
34
|
type: 'any',
|
|
35
35
|
required: true,
|
|
36
|
-
validate: (value) => isNonEmptyObject(value),
|
|
36
|
+
validate: (value) => isNonEmptyObject(value) || isArray(value),
|
|
37
37
|
set: (value, attributes) => {
|
|
38
38
|
// as the electroDb validate function does not provide access to the model instance
|
|
39
39
|
// we need to call the validate function from the model on setting the value
|