@adobe/spacecat-shared-data-access 2.74.1 → 2.75.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 +2 -2
- package/src/models/audit/audit.model.js +1 -0
- package/src/models/scrape-url/index.d.ts +4 -0
- package/src/models/scrape-url/scrape-url.collection.js +14 -1
- package/src/models/scrape-url/scrape-url.schema.js +15 -2
- package/src/models/site/site.model.js +3 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-data-access-v2.75.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.74.2...@adobe/spacecat-shared-data-access-v2.75.0) (2025-10-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* scrape url access pattern ([#1059](https://github.com/adobe/spacecat-shared/issues/1059)) ([26facf6](https://github.com/adobe/spacecat-shared/commit/26facf63dfae4908ed88221f16266910205e2473))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-data-access-v2.74.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.74.1...@adobe/spacecat-shared-data-access-v2.74.2) (2025-10-28)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* remove cyclic deps in shared ([#1053](https://github.com/adobe/spacecat-shared/issues/1053)) ([acbbc93](https://github.com/adobe/spacecat-shared/commit/acbbc93f8c961fdef55edb5e7947958456538586))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-data-access-v2.74.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.74.0...@adobe/spacecat-shared-data-access-v2.74.1) (2025-10-25)
|
|
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.75.0",
|
|
4
4
|
"description": "Shared modules of the Spacecat Services - Data Access",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@adobe/spacecat-shared-utils": "1.
|
|
41
|
+
"@adobe/spacecat-shared-utils": "1.66.0",
|
|
42
42
|
"@aws-sdk/client-dynamodb": "3.917.0",
|
|
43
43
|
"@aws-sdk/lib-dynamodb": "3.917.0",
|
|
44
44
|
"@types/joi": "17.2.3",
|
|
@@ -67,6 +67,7 @@ class Audit extends BaseModel {
|
|
|
67
67
|
READABILITY: 'readability',
|
|
68
68
|
PRERENDER: 'prerender',
|
|
69
69
|
PRODUCT_METATAGS: 'product-metatags',
|
|
70
|
+
PRODUCT_METATAGS_AUTO_SUGGEST: 'product-metatags-auto-suggest',
|
|
70
71
|
SUMMARIZATION: 'summarization',
|
|
71
72
|
PAGE_TYPE_DETECTION: 'page-type-detection',
|
|
72
73
|
FAQS: 'faqs',
|
|
@@ -20,6 +20,7 @@ export interface ScrapeUrl extends BaseModel {
|
|
|
20
20
|
getReason(): string,
|
|
21
21
|
getStatus(): string,
|
|
22
22
|
getUrl(): string,
|
|
23
|
+
getProcessingType(): string,
|
|
23
24
|
getIsOriginal(): boolean,
|
|
24
25
|
setFile(file: string): void,
|
|
25
26
|
setScrapeJobId(ScrapeJobId: string): void,
|
|
@@ -27,12 +28,15 @@ export interface ScrapeUrl extends BaseModel {
|
|
|
27
28
|
setReason(reason: string): void,
|
|
28
29
|
setStatus(status: string): void,
|
|
29
30
|
setUrl(url: string): void,
|
|
31
|
+
setProcessingType(processingType: string): void,
|
|
30
32
|
setIsOriginal(isOriginal: boolean): void,
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
export interface ScrapeUrlCollection extends BaseCollection<ScrapeUrl> {
|
|
34
36
|
allByScrapeJobId(ScrapeJobId: string): Promise<ScrapeUrl[]>;
|
|
35
37
|
allByScrapeUrlsByJobIdAndStatus(ScrapeJobId: string, status: string): Promise<ScrapeUrl[]>;
|
|
38
|
+
allByUrlAndIsOriginalAndProcessingType(url: string, isOriginal: boolean, processingType: string): Promise<ScrapeUrl[]>;
|
|
39
|
+
allRecentByUrlAndProcessingType(url: string, processingType: string, maxAgeInHours?: number): Promise<ScrapeUrl[]>;
|
|
36
40
|
findByScrapeJobId(ScrapeJobId: string): Promise<ScrapeUrl | null>;
|
|
37
41
|
findByScrapeJobIdAndUrl(ScrapeJobId: string, url: string): Promise<ScrapeUrl | null>;
|
|
38
42
|
}
|
|
@@ -20,7 +20,20 @@ import BaseCollection from '../base/base.collection.js';
|
|
|
20
20
|
* @extends BaseCollection
|
|
21
21
|
*/
|
|
22
22
|
class ScrapeUrlCollection extends BaseCollection {
|
|
23
|
-
|
|
23
|
+
async allRecentByUrlAndProcessingType(url, processingType, maxAgeInHours = 168) {
|
|
24
|
+
const now = new Date();
|
|
25
|
+
const pastDate = new Date(now.getTime() - maxAgeInHours * 60 * 60 * 1000);
|
|
26
|
+
const pastDateIso = pastDate.toISOString();
|
|
27
|
+
const nowIso = now.toISOString();
|
|
28
|
+
|
|
29
|
+
return this.allByIndexKeys({ url, isOriginal: true, processingType }, {
|
|
30
|
+
between: {
|
|
31
|
+
attribute: 'createdAt',
|
|
32
|
+
start: pastDateIso,
|
|
33
|
+
end: nowIso,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}
|
|
24
37
|
}
|
|
25
38
|
|
|
26
39
|
export default ScrapeUrlCollection;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
/* c8 ignore start */
|
|
14
14
|
|
|
15
|
-
import { isValidUrl } from '@adobe/spacecat-shared-utils';
|
|
15
|
+
import { isObject, isString, isValidUrl } from '@adobe/spacecat-shared-utils';
|
|
16
16
|
|
|
17
17
|
import SchemaBuilder from '../base/schema.builder.js';
|
|
18
18
|
import ScrapeUrl from './scrape-url.model.js';
|
|
@@ -46,9 +46,22 @@ const schema = new SchemaBuilder(ScrapeUrl, ScrapeUrlCollection)
|
|
|
46
46
|
required: true,
|
|
47
47
|
validate: (value) => isValidUrl(value),
|
|
48
48
|
})
|
|
49
|
+
.addAttribute('processingType', {
|
|
50
|
+
type: 'string',
|
|
51
|
+
required: true,
|
|
52
|
+
validate: (value) => isString(value),
|
|
53
|
+
})
|
|
54
|
+
.addAttribute('options', {
|
|
55
|
+
type: 'any',
|
|
56
|
+
validate: (value) => !value || isObject(value),
|
|
57
|
+
})
|
|
49
58
|
.addAttribute('isOriginal', {
|
|
50
59
|
type: 'boolean',
|
|
51
60
|
default: true,
|
|
52
|
-
})
|
|
61
|
+
})
|
|
62
|
+
.addIndex(
|
|
63
|
+
{ composite: ['url'] },
|
|
64
|
+
{ composite: ['isOriginal', 'processingType', 'createdAt'] },
|
|
65
|
+
);
|
|
53
66
|
|
|
54
67
|
export default schema.build();
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
hasText,
|
|
16
16
|
isValidUrl,
|
|
17
17
|
DELIVERY_TYPES,
|
|
18
|
+
AUTHORING_TYPES,
|
|
18
19
|
} from '@adobe/spacecat-shared-utils';
|
|
19
20
|
import BaseModel from '../base/base.model.js';
|
|
20
21
|
|
|
@@ -71,15 +72,9 @@ export const getAuthoringType = (hostname, authoringTypes) => {
|
|
|
71
72
|
class Site extends BaseModel {
|
|
72
73
|
static DELIVERY_TYPES = DELIVERY_TYPES;
|
|
73
74
|
|
|
74
|
-
static DEFAULT_DELIVERY_TYPE =
|
|
75
|
+
static DEFAULT_DELIVERY_TYPE = DELIVERY_TYPES.AEM_EDGE;
|
|
75
76
|
|
|
76
|
-
static AUTHORING_TYPES =
|
|
77
|
-
CS_CW: 'cs/crosswalk',
|
|
78
|
-
CS: 'cs',
|
|
79
|
-
SP: 'sharepoint',
|
|
80
|
-
GD: 'googledocs',
|
|
81
|
-
DA: 'documentauthoring',
|
|
82
|
-
};
|
|
77
|
+
static AUTHORING_TYPES = AUTHORING_TYPES;
|
|
83
78
|
|
|
84
79
|
async toggleLive() {
|
|
85
80
|
const newIsLive = !this.getIsLive();
|