@adobe/spacecat-shared-data-access 2.86.0 → 2.87.1
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/base/entity.registry.js +3 -0
- package/src/models/index.js +1 -0
- package/src/models/page-citability/index.d.ts +39 -0
- package/src/models/page-citability/index.js +19 -0
- package/src/models/page-citability/page-citability.collection.js +25 -0
- package/src/models/page-citability/page-citability.model.js +27 -0
- package/src/models/page-citability/page-citability.schema.js +83 -0
- package/src/models/site/config.js +1 -0
- package/src/models/site/site.schema.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-data-access-v2.87.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.87.0...@adobe/spacecat-shared-data-access-v2.87.1) (2025-11-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* edge preview feature for Tokowaka ([#1124](https://github.com/adobe/spacecat-shared/issues/1124)) ([cd2a06f](https://github.com/adobe/spacecat-shared/commit/cd2a06f62e3ca9e8c2b87e1810d420a06a002526))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-data-access-v2.87.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.86.0...@adobe/spacecat-shared-data-access-v2.87.0) (2025-11-19)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* add page citability ([#1140](https://github.com/adobe/spacecat-shared/issues/1140)) ([e4dfcdc](https://github.com/adobe/spacecat-shared/commit/e4dfcdccf44ad4a303c3b68b0655e00b25f3da3c))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-data-access-v2.86.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.85.1...@adobe/spacecat-shared-data-access-v2.86.0) (2025-11-19)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -40,6 +40,7 @@ import PageIntentCollection from '../page-intent/page-intent.collection.js';
|
|
|
40
40
|
import ReportCollection from '../report/report.collection.js';
|
|
41
41
|
import TrialUserCollection from '../trial-user/trial-user.collection.js';
|
|
42
42
|
import TrialUserActivityCollection from '../trial-user-activity/trial-user-activity.collection.js';
|
|
43
|
+
import PageCitabilityCollection from '../page-citability/page-citability.collection.js';
|
|
43
44
|
|
|
44
45
|
import ApiKeySchema from '../api-key/api-key.schema.js';
|
|
45
46
|
import AsyncJobSchema from '../async-job/async-job.schema.js';
|
|
@@ -68,6 +69,7 @@ import PageIntentSchema from '../page-intent/page-intent.schema.js';
|
|
|
68
69
|
import ReportSchema from '../report/report.schema.js';
|
|
69
70
|
import TrialUserSchema from '../trial-user/trial-user.schema.js';
|
|
70
71
|
import TrialUserActivitySchema from '../trial-user-activity/trial-user-activity.schema.js';
|
|
72
|
+
import PageCitabilitySchema from '../page-citability/page-citability.schema.js';
|
|
71
73
|
|
|
72
74
|
/**
|
|
73
75
|
* EntityRegistry - A registry class responsible for managing entities, their schema and collection.
|
|
@@ -165,5 +167,6 @@ EntityRegistry.registerEntity(PageIntentSchema, PageIntentCollection);
|
|
|
165
167
|
EntityRegistry.registerEntity(ReportSchema, ReportCollection);
|
|
166
168
|
EntityRegistry.registerEntity(TrialUserSchema, TrialUserCollection);
|
|
167
169
|
EntityRegistry.registerEntity(TrialUserActivitySchema, TrialUserActivityCollection);
|
|
170
|
+
EntityRegistry.registerEntity(PageCitabilitySchema, PageCitabilityCollection);
|
|
168
171
|
|
|
169
172
|
export default EntityRegistry;
|
package/src/models/index.js
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import type { BaseCollection, BaseModel, Site } from '../index.js';
|
|
14
|
+
|
|
15
|
+
export interface PageCitability extends BaseModel {
|
|
16
|
+
getSiteId(): string;
|
|
17
|
+
getSite(): Promise<Site>;
|
|
18
|
+
getUrl(): string;
|
|
19
|
+
getCitabilityScore(): number | undefined;
|
|
20
|
+
getContentRatio(): number | undefined;
|
|
21
|
+
getWordDifference(): number | undefined;
|
|
22
|
+
getBotWords(): number | undefined;
|
|
23
|
+
getNormalWords(): number | undefined;
|
|
24
|
+
|
|
25
|
+
setSiteId(siteId: string): PageCitability;
|
|
26
|
+
setUrl(url: string): PageCitability;
|
|
27
|
+
setCitabilityScore(citabilityScore?: number): PageCitability;
|
|
28
|
+
setContentRatio(contentRatio?: number): PageCitability;
|
|
29
|
+
setWordDifference(wordDifference?: number): PageCitability;
|
|
30
|
+
setBotWords(botWords?: number): PageCitability;
|
|
31
|
+
setNormalWords(normalWords?: number): PageCitability;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface PageCitabilityCollection extends BaseCollection<PageCitability> {
|
|
35
|
+
allBySiteId(siteId: string): Promise<PageCitability[]>;
|
|
36
|
+
findBySiteId(siteId: string): Promise<PageCitability | null>;
|
|
37
|
+
allByUrl(url: string): Promise<PageCitability[]>;
|
|
38
|
+
findByUrl(url: string): Promise<PageCitability | null>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import PageCitability from './page-citability.model.js';
|
|
14
|
+
import PageCitabilityCollection from './page-citability.collection.js';
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
PageCitability,
|
|
18
|
+
PageCitabilityCollection,
|
|
19
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import BaseCollection from '../base/base.collection.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* PageCitabilityCollection - Manages PageCitability entities.
|
|
17
|
+
*
|
|
18
|
+
* @class PageCitabilityCollection
|
|
19
|
+
* @extends BaseCollection
|
|
20
|
+
*/
|
|
21
|
+
class PageCitabilityCollection extends BaseCollection {
|
|
22
|
+
// add custom collection-level methods here, if needed
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default PageCitabilityCollection;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import BaseModel from '../base/base.model.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* PageCitability - Represents a page's citability metrics within a site.
|
|
17
|
+
*
|
|
18
|
+
* @class PageCitability
|
|
19
|
+
* @extends BaseModel
|
|
20
|
+
*/
|
|
21
|
+
class PageCitability extends BaseModel {
|
|
22
|
+
static DEFAULT_UPDATED_BY = 'spacecat';
|
|
23
|
+
|
|
24
|
+
// add any custom methods or overrides here
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default PageCitability;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { isValidUrl } from '@adobe/spacecat-shared-utils';
|
|
14
|
+
|
|
15
|
+
import SchemaBuilder from '../base/schema.builder.js';
|
|
16
|
+
import PageCitability from './page-citability.model.js';
|
|
17
|
+
import PageCitabilityCollection from './page-citability.collection.js';
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
Schema: https://electrodb.dev/en/modeling/schema/
|
|
21
|
+
Attributes: https://electrodb.dev/en/modeling/attributes/
|
|
22
|
+
Indexes: https://electrodb.dev/en/modeling/indexes/
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const schema = new SchemaBuilder(PageCitability, PageCitabilityCollection)
|
|
26
|
+
// link back to Site entity
|
|
27
|
+
.addReference('belongs_to', 'Site')
|
|
28
|
+
|
|
29
|
+
// page's full URL (must be unique)
|
|
30
|
+
.addAttribute('url', {
|
|
31
|
+
type: 'string',
|
|
32
|
+
required: true,
|
|
33
|
+
validate: (value) => isValidUrl(value),
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
// citation readability score
|
|
37
|
+
.addAttribute('citabilityScore', {
|
|
38
|
+
type: 'number',
|
|
39
|
+
required: false,
|
|
40
|
+
validate: (value) => !value || (typeof value === 'number' && !Number.isNaN(value)),
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
// content increase ratio
|
|
44
|
+
.addAttribute('contentRatio', {
|
|
45
|
+
type: 'number',
|
|
46
|
+
required: false,
|
|
47
|
+
validate: (value) => !value || (typeof value === 'number' && !Number.isNaN(value)),
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
// word difference between before and after
|
|
51
|
+
.addAttribute('wordDifference', {
|
|
52
|
+
type: 'number',
|
|
53
|
+
required: false,
|
|
54
|
+
validate: (value) => !value || (typeof value === 'number' && !Number.isNaN(value)),
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
// word count before processing (bot words)
|
|
58
|
+
.addAttribute('botWords', {
|
|
59
|
+
type: 'number',
|
|
60
|
+
required: false,
|
|
61
|
+
validate: (value) => !value || (typeof value === 'number' && !Number.isNaN(value)),
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
// word count after processing (normal words)
|
|
65
|
+
.addAttribute('normalWords', {
|
|
66
|
+
type: 'number',
|
|
67
|
+
required: false,
|
|
68
|
+
validate: (value) => !value || (typeof value === 'number' && !Number.isNaN(value)),
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
// optionally track who last updated
|
|
72
|
+
.addAttribute('updatedBy', {
|
|
73
|
+
type: 'string',
|
|
74
|
+
default: PageCitability.DEFAULT_UPDATED_BY,
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
// allow fetching the single record by its URL
|
|
78
|
+
.addIndex(
|
|
79
|
+
{ composite: ['url'] },
|
|
80
|
+
{ composite: ['updatedAt'] },
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
export default schema.build();
|
|
@@ -339,6 +339,7 @@ export const configSchema = Joi.object({
|
|
|
339
339
|
}).optional(),
|
|
340
340
|
tokowakaConfig: Joi.object({
|
|
341
341
|
apiKey: Joi.string().required(),
|
|
342
|
+
forwardedHost: Joi.string().optional(),
|
|
342
343
|
}).optional(),
|
|
343
344
|
contentAiConfig: Joi.object({
|
|
344
345
|
index: Joi.string().optional(),
|
|
@@ -47,6 +47,7 @@ const schema = new SchemaBuilder(Site, SiteCollection)
|
|
|
47
47
|
.addReference('has_many', 'SiteTopPages')
|
|
48
48
|
.addReference('has_many', 'TrialUserActivities')
|
|
49
49
|
.addReference('has_many', 'PageIntents')
|
|
50
|
+
.addReference('has_many', 'PageCitabilities')
|
|
50
51
|
.addAttribute('baseURL', {
|
|
51
52
|
type: 'string',
|
|
52
53
|
required: true,
|