From eef6e0fb49af6899ff15d578e41ecde38c7ab4fa Mon Sep 17 00:00:00 2001 From: Damian Zehnder Date: Fri, 3 Jan 2025 10:41:25 +0100 Subject: [PATCH] fix: latest audit result to validate array --- package-lock.json | 24 +++---------------- .../spacecat-shared-data-access/package.json | 2 +- .../latest-audit/latest-audit.schema.js | 4 ++-- 3 files changed, 6 insertions(+), 24 deletions(-) diff --git a/package-lock.json b/package-lock.json index bdac23db..b7ed8e0e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19849,11 +19849,11 @@ }, "packages/spacecat-shared-data-access": { "name": "@adobe/spacecat-shared-data-access", - "version": "1.61.12", + "version": "1.61.13", "license": "Apache-2.0", "dependencies": { "@adobe/spacecat-shared-dynamo": "1.5.1", - "@adobe/spacecat-shared-utils": "1.25.2", + "@adobe/spacecat-shared-utils": "1.25.4", "@aws-sdk/client-dynamodb": "3.716.0", "@aws-sdk/lib-dynamodb": "3.716.0", "@types/joi": "17.2.3", @@ -19909,24 +19909,6 @@ "npm": ">=10.0.0 <12.0.0" } }, - "packages/spacecat-shared-data-access/node_modules/@adobe/spacecat-shared-utils": { - "version": "1.25.2", - "resolved": "https://registry.npmjs.org/@adobe/spacecat-shared-utils/-/spacecat-shared-utils-1.25.2.tgz", - "integrity": "sha512-pVT5i7/ejMNGTEaiwGtzAa0zBHuCLjOm+HueZKsqc+wuQl7odvDXVFhsTQTqU3op/K45ZPXzDok8kv+u+PYc0w==", - "license": "Apache-2.0", - "dependencies": { - "@adobe/fetch": "4.1.11", - "@aws-sdk/client-s3": "3.717.0", - "@aws-sdk/client-secrets-manager": "3.716.0", - "@aws-sdk/client-sqs": "3.716.0", - "@json2csv/plainjs": "7.0.6", - "aws-xray-sdk": "3.10.2" - }, - "engines": { - "node": ">=20.0.0 <23.0.0", - "npm": ">=10.0.0 <12.0.0" - } - }, "packages/spacecat-shared-dynamo": { "name": "@adobe/spacecat-shared-dynamo", "version": "1.5.2", @@ -22837,7 +22819,7 @@ }, "packages/spacecat-shared-utils": { "name": "@adobe/spacecat-shared-utils", - "version": "1.25.3", + "version": "1.25.4", "license": "Apache-2.0", "dependencies": { "@adobe/fetch": "4.1.11", diff --git a/packages/spacecat-shared-data-access/package.json b/packages/spacecat-shared-data-access/package.json index 17cb9bfc..ef729a43 100644 --- a/packages/spacecat-shared-data-access/package.json +++ b/packages/spacecat-shared-data-access/package.json @@ -35,7 +35,7 @@ }, "dependencies": { "@adobe/spacecat-shared-dynamo": "1.5.1", - "@adobe/spacecat-shared-utils": "1.25.2", + "@adobe/spacecat-shared-utils": "1.25.4", "@aws-sdk/client-dynamodb": "3.716.0", "@aws-sdk/lib-dynamodb": "3.716.0", "@types/joi": "17.2.3", diff --git a/packages/spacecat-shared-data-access/src/v2/models/latest-audit/latest-audit.schema.js b/packages/spacecat-shared-data-access/src/v2/models/latest-audit/latest-audit.schema.js index 7bc93a25..903af7e7 100644 --- a/packages/spacecat-shared-data-access/src/v2/models/latest-audit/latest-audit.schema.js +++ b/packages/spacecat-shared-data-access/src/v2/models/latest-audit/latest-audit.schema.js @@ -12,7 +12,7 @@ /* c8 ignore start */ -import { isIsoDate, isNonEmptyObject } from '@adobe/spacecat-shared-utils'; +import { isArray, isIsoDate, isNonEmptyObject } from '@adobe/spacecat-shared-utils'; import Audit from '../audit/audit.model.js'; import SchemaBuilder from '../base/schema.builder.js'; @@ -37,7 +37,7 @@ const schema = new SchemaBuilder(LatestAudit, LatestAuditCollection) .addAttribute('auditResult', { type: 'any', required: true, - validate: (value) => isNonEmptyObject(value), + validate: (value) => isNonEmptyObject(value) || isArray(value), set: (value, attributes) => { // as the electroDb validate function does not provide access to the model instance // we need to call the validate function from the model on setting the value