@adobe/spacecat-shared-data-access 2.61.3 → 2.62.0
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/package.json +5 -6
- package/src/models/audit/audit.model.js +2 -0
- package/src/models/base/schema.builder.js +4 -6
- package/src/models/site-candidate/site-candidate.schema.js +2 -4
- package/src/models/site-top-form/site-top-form.schema.js +7 -4
- package/src/models/site-top-page/site-top-page.schema.js +7 -4
- package/src/util/guards.js +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-data-access-v2.62.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.61.4...@adobe/spacecat-shared-data-access-v2.62.0) (2025-09-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add security audit types ([#953](https://github.com/adobe/spacecat-shared/issues/953)) ([8d4827b](https://github.com/adobe/spacecat-shared/commit/8d4827be6f90689d4a49d8113bfaccc52d85b3a2))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-data-access-v2.61.4](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.61.3...@adobe/spacecat-shared-data-access-v2.61.4) (2025-09-09)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update external major (major) ([#795](https://github.com/adobe/spacecat-shared/issues/795)) ([b020e88](https://github.com/adobe/spacecat-shared/commit/b020e884bfcad48667da87ad9caee7a3669e43d0))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-data-access-v2.61.3](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.61.2...@adobe/spacecat-shared-data-access-v2.61.3) (2025-09-08)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/spacecat-shared-data-access",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.62.0",
|
|
4
4
|
"description": "Shared modules of the Spacecat Services - Data Access",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -41,16 +41,15 @@
|
|
|
41
41
|
"@types/joi": "17.2.3",
|
|
42
42
|
"aws-xray-sdk": "3.10.3",
|
|
43
43
|
"electrodb": "3.4.5",
|
|
44
|
-
"joi": "
|
|
45
|
-
"pluralize": "8.0.0"
|
|
46
|
-
"uuid": "11.1.0"
|
|
44
|
+
"joi": "18.0.1",
|
|
45
|
+
"pluralize": "8.0.0"
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|
|
49
|
-
"chai": "
|
|
48
|
+
"chai": "6.0.1",
|
|
50
49
|
"chai-as-promised": "8.0.2",
|
|
51
50
|
"dynamo-db-local": "9.6.0",
|
|
52
51
|
"nock": "14.0.10",
|
|
53
|
-
"sinon": "
|
|
52
|
+
"sinon": "21.0.0",
|
|
54
53
|
"sinon-chai": "4.0.1"
|
|
55
54
|
}
|
|
56
55
|
}
|
|
@@ -51,6 +51,8 @@ class Audit extends BaseModel {
|
|
|
51
51
|
ALT_TEXT: 'alt-text',
|
|
52
52
|
ACCESSIBILITY: 'accessibility',
|
|
53
53
|
SECURITY_CSP: 'security-csp',
|
|
54
|
+
SECURITY_VULNERABILITIES: 'security-vulnerabilities',
|
|
55
|
+
SECURITY_PERMISSIONS: 'security-permissions',
|
|
54
56
|
PAID: 'paid',
|
|
55
57
|
HREFLANG: 'hreflang',
|
|
56
58
|
HEADINGS: 'headings',
|
|
@@ -11,11 +11,9 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {
|
|
14
|
-
hasText, isBoolean, isInteger, isNonEmptyArray, isNonEmptyObject,
|
|
14
|
+
hasText, isBoolean, isInteger, isNonEmptyArray, isNonEmptyObject, isValidUUID,
|
|
15
15
|
} from '@adobe/spacecat-shared-utils';
|
|
16
16
|
|
|
17
|
-
import { v4 as uuid, validate as uuidValidate } from 'uuid';
|
|
18
|
-
|
|
19
17
|
import { SchemaBuilderError } from '../../errors/index.js';
|
|
20
18
|
import {
|
|
21
19
|
decapitalize,
|
|
@@ -41,9 +39,9 @@ const ID_ATTRIBUTE_DATA = {
|
|
|
41
39
|
required: true,
|
|
42
40
|
readOnly: true,
|
|
43
41
|
// https://electrodb.dev/en/modeling/attributes/#default
|
|
44
|
-
default: () =>
|
|
42
|
+
default: () => crypto.randomUUID(),
|
|
45
43
|
// https://electrodb.dev/en/modeling/attributes/#attribute-validation
|
|
46
|
-
validate: (value) =>
|
|
44
|
+
validate: (value) => isValidUUID(value),
|
|
47
45
|
};
|
|
48
46
|
|
|
49
47
|
/**
|
|
@@ -394,7 +392,7 @@ class SchemaBuilder {
|
|
|
394
392
|
required: reference.options.required,
|
|
395
393
|
validate: (
|
|
396
394
|
value,
|
|
397
|
-
) => (reference.options.required ?
|
|
395
|
+
) => (reference.options.required ? isValidUUID(value) : !value || isValidUUID(value)),
|
|
398
396
|
});
|
|
399
397
|
|
|
400
398
|
this.#internalAddIndex(
|
|
@@ -12,9 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
/* c8 ignore start */
|
|
14
14
|
|
|
15
|
-
import { isObject, isValidUrl } from '@adobe/spacecat-shared-utils';
|
|
16
|
-
|
|
17
|
-
import { validate as uuidValidate } from 'uuid';
|
|
15
|
+
import { isObject, isValidUrl, isValidUUID } from '@adobe/spacecat-shared-utils';
|
|
18
16
|
|
|
19
17
|
import SchemaBuilder from '../base/schema.builder.js';
|
|
20
18
|
import SiteCandidate from './site-candidate.model.js';
|
|
@@ -30,7 +28,7 @@ const schema = new SchemaBuilder(SiteCandidate, SiteCandidateCollection)
|
|
|
30
28
|
.addReference('belongs_to', 'Site')
|
|
31
29
|
.addAttribute('siteId', {
|
|
32
30
|
type: 'string',
|
|
33
|
-
validate: (value) => !value ||
|
|
31
|
+
validate: (value) => !value || isValidUUID(value),
|
|
34
32
|
})
|
|
35
33
|
.addAttribute('baseURL', {
|
|
36
34
|
type: 'string',
|
|
@@ -12,9 +12,12 @@
|
|
|
12
12
|
|
|
13
13
|
/* c8 ignore start */
|
|
14
14
|
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
import {
|
|
16
|
+
isInteger,
|
|
17
|
+
isIsoDate,
|
|
18
|
+
isValidUrl,
|
|
19
|
+
isValidUUID,
|
|
20
|
+
} from '@adobe/spacecat-shared-utils';
|
|
18
21
|
|
|
19
22
|
import SchemaBuilder from '../base/schema.builder.js';
|
|
20
23
|
import SiteTopForm from './site-top-form.model.js';
|
|
@@ -31,7 +34,7 @@ const schema = new SchemaBuilder(SiteTopForm, SiteTopFormCollection)
|
|
|
31
34
|
.addAttribute('siteId', {
|
|
32
35
|
type: 'string',
|
|
33
36
|
required: true,
|
|
34
|
-
validate: (value) =>
|
|
37
|
+
validate: (value) => isValidUUID(value),
|
|
35
38
|
})
|
|
36
39
|
.addAttribute('url', {
|
|
37
40
|
type: 'string',
|
|
@@ -12,9 +12,12 @@
|
|
|
12
12
|
|
|
13
13
|
/* c8 ignore start */
|
|
14
14
|
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
import {
|
|
16
|
+
isInteger,
|
|
17
|
+
isIsoDate,
|
|
18
|
+
isValidUrl,
|
|
19
|
+
isValidUUID,
|
|
20
|
+
} from '@adobe/spacecat-shared-utils';
|
|
18
21
|
|
|
19
22
|
import SchemaBuilder from '../base/schema.builder.js';
|
|
20
23
|
import SiteTopPage from './site-top-page.model.js';
|
|
@@ -31,7 +34,7 @@ const schema = new SchemaBuilder(SiteTopPage, SiteTopPageCollection)
|
|
|
31
34
|
.addAttribute('siteId', {
|
|
32
35
|
type: 'string',
|
|
33
36
|
required: true,
|
|
34
|
-
validate: (value) =>
|
|
37
|
+
validate: (value) => isValidUUID(value),
|
|
35
38
|
})
|
|
36
39
|
.addAttribute('url', {
|
|
37
40
|
type: 'string',
|
package/src/util/guards.js
CHANGED
|
@@ -10,8 +10,12 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {
|
|
14
|
-
|
|
13
|
+
import {
|
|
14
|
+
hasText,
|
|
15
|
+
isNumber,
|
|
16
|
+
isObject,
|
|
17
|
+
isValidUUID,
|
|
18
|
+
} from '@adobe/spacecat-shared-utils';
|
|
15
19
|
|
|
16
20
|
import { ValidationError } from '../errors/index.js';
|
|
17
21
|
|
|
@@ -146,7 +150,7 @@ export const guardEnum = (propertyName, value, enumValues, entityName, nullable
|
|
|
146
150
|
*/
|
|
147
151
|
export const guardId = (propertyName, value, entityName, nullable = false) => {
|
|
148
152
|
if (checkNullable(value, nullable)) return;
|
|
149
|
-
if (!
|
|
153
|
+
if (!isValidUUID(value)) {
|
|
150
154
|
throw new ValidationError(`Validation failed in ${entityName}: ${propertyName} must be a valid UUID`);
|
|
151
155
|
}
|
|
152
156
|
};
|