@adobe/spacecat-shared-data-access 2.4.0 → 2.6.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 CHANGED
@@ -1,3 +1,17 @@
1
+ # [@adobe/spacecat-shared-data-access-v2.6.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.5.0...@adobe/spacecat-shared-data-access-v2.6.0) (2025-02-18)
2
+
3
+
4
+ ### Features
5
+
6
+ * **latest-metrics:** add latest metrics handling to config ([#607](https://github.com/adobe/spacecat-shared/issues/607)) ([0233958](https://github.com/adobe/spacecat-shared/commit/0233958f782e1cef24cc3df3c7445520697c1efa))
7
+
8
+ # [@adobe/spacecat-shared-data-access-v2.5.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.4.0...@adobe/spacecat-shared-data-access-v2.5.0) (2025-02-18)
9
+
10
+
11
+ ### Features
12
+
13
+ * adds site name ([#605](https://github.com/adobe/spacecat-shared/issues/605)) ([f066c3d](https://github.com/adobe/spacecat-shared/commit/f066c3da12e72ee85a97120ac8bb4b5deeca93fa))
14
+
1
15
  # [@adobe/spacecat-shared-data-access-v2.4.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.3.1...@adobe/spacecat-shared-data-access-v2.4.0) (2025-02-17)
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.4.0",
3
+ "version": "2.6.0",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "engines": {
@@ -38,6 +38,11 @@ export const configSchema = Joi.object({
38
38
  name: Joi.string(),
39
39
  pattern: Joi.string(),
40
40
  })).optional(),
41
+ latestMetrics: Joi.object({
42
+ pageViewsChange: Joi.number(),
43
+ ctrChange: Joi.number(),
44
+ projectedTrafficValue: Joi.number(),
45
+ }),
41
46
  }).unknown(true)).unknown(true),
42
47
  }).unknown(true);
43
48
 
@@ -73,6 +78,7 @@ export const Config = (data = {}) => {
73
78
  self.getFixedURLs = (type) => state?.handlers?.[type]?.fixedURLs;
74
79
  self.getIncludedURLs = (type) => state?.handlers?.[type]?.includedURLs;
75
80
  self.getGroupedURLs = (type) => state?.handlers?.[type]?.groupedURLs;
81
+ self.getLatestMetrics = (type) => state?.handlers?.[type]?.latestMetrics;
76
82
  self.getFetchConfig = () => state?.fetchConfig;
77
83
 
78
84
  self.updateSlackConfig = (channel, workspace, invitedUserCount) => {
@@ -120,6 +126,12 @@ export const Config = (data = {}) => {
120
126
  validateConfiguration(state);
121
127
  };
122
128
 
129
+ self.updateLatestMetrics = (type, latestMetrics) => {
130
+ state.handlers = state.handlers || {};
131
+ state.handlers[type] = state.handlers[type] || {};
132
+ state.handlers[type].latestMetrics = latestMetrics;
133
+ };
134
+
123
135
  self.updateFetchConfig = (fetchConfig) => {
124
136
  state.fetchConfig = fetchConfig;
125
137
  };
@@ -28,6 +28,7 @@ export interface Site extends BaseModel {
28
28
  getAuditsByAuditType(auditType: string): Promise<Audit>;
29
29
  getAuditsByAuditTypeAndAuditedAt(auditType: string, auditedAt: string): Promise<Audit>;
30
30
  getBaseURL(): string;
31
+ getName(): string;
31
32
  getConfig(): object;
32
33
  getDeliveryType(): string;
33
34
  getExperiments(): Promise<Experiment[]>;
@@ -59,6 +60,7 @@ export interface Site extends BaseModel {
59
60
  source: string, geo: string, traffic: string
60
61
  ): Promise<SiteTopPage[]>;
61
62
  setBaseURL(baseURL: string): Site;
63
+ setName(name: string): Site;
62
64
  setConfig(config: object): Site;
63
65
  setDeliveryType(deliveryType: string): Site;
64
66
  setGitHubURL(gitHubURL: string): Site;
@@ -48,6 +48,9 @@ const schema = new SchemaBuilder(Site, SiteCollection)
48
48
  required: true,
49
49
  validate: (value) => isValidUrl(value),
50
50
  })
51
+ .addAttribute('name', {
52
+ type: 'string',
53
+ })
51
54
  .addAttribute('config', {
52
55
  type: 'any',
53
56
  required: true,