@adobe/spacecat-shared-data-access 2.74.2 → 2.76.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 +1 -1
- 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/config.js +9 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-data-access-v2.76.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.75.0...@adobe/spacecat-shared-data-access-v2.76.0) (2025-10-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add tokowaka client ([#1025](https://github.com/adobe/spacecat-shared/issues/1025)) ([7af58b0](https://github.com/adobe/spacecat-shared/commit/7af58b03ef341c32b35a6614365024af6a636a56))
|
|
7
|
+
|
|
8
|
+
# [@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)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* scrape url access pattern ([#1059](https://github.com/adobe/spacecat-shared/issues/1059)) ([26facf6](https://github.com/adobe/spacecat-shared/commit/26facf63dfae4908ed88221f16266910205e2473))
|
|
14
|
+
|
|
1
15
|
# [@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)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -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();
|
|
@@ -305,6 +305,9 @@ export const configSchema = Joi.object({
|
|
|
305
305
|
).optional(),
|
|
306
306
|
outputLocation: Joi.string().required(),
|
|
307
307
|
}).optional(),
|
|
308
|
+
tokowakaConfig: Joi.object({
|
|
309
|
+
apiKey: Joi.string().required(),
|
|
310
|
+
}).optional(),
|
|
308
311
|
contentAiConfig: Joi.object({
|
|
309
312
|
index: Joi.string().optional(),
|
|
310
313
|
}).optional(),
|
|
@@ -410,6 +413,7 @@ export const Config = (data = {}) => {
|
|
|
410
413
|
};
|
|
411
414
|
self.getLlmoCdnlogsFilter = () => state?.llmo?.cdnlogsFilter;
|
|
412
415
|
self.getLlmoCdnBucketConfig = () => state?.llmo?.cdnBucketConfig;
|
|
416
|
+
self.getTokowakaConfig = () => state?.tokowakaConfig;
|
|
413
417
|
|
|
414
418
|
self.updateSlackConfig = (channel, workspace, invitedUserCount) => {
|
|
415
419
|
state.slack = {
|
|
@@ -657,6 +661,10 @@ export const Config = (data = {}) => {
|
|
|
657
661
|
state.cdnLogsConfig = cdnLogsConfig;
|
|
658
662
|
};
|
|
659
663
|
|
|
664
|
+
self.updateTokowakaConfig = (tokowakaConfig) => {
|
|
665
|
+
state.tokowakaConfig = tokowakaConfig;
|
|
666
|
+
};
|
|
667
|
+
|
|
660
668
|
return Object.freeze(self);
|
|
661
669
|
};
|
|
662
670
|
|
|
@@ -671,4 +679,5 @@ Config.toDynamoItem = (config) => ({
|
|
|
671
679
|
brandConfig: config.getBrandConfig(),
|
|
672
680
|
cdnLogsConfig: config.getCdnLogsConfig(),
|
|
673
681
|
llmo: config.getLlmoConfig(),
|
|
682
|
+
tokowakaConfig: config.getTokowakaConfig(),
|
|
674
683
|
});
|