@adobe/spacecat-shared-data-access 2.10.1 → 2.11.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.11.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.10.2...@adobe/spacecat-shared-data-access-v2.11.0) (2025-03-05)
2
+
3
+
4
+ ### Features
5
+
6
+ * Brand client ([#640](https://github.com/adobe/spacecat-shared/issues/640)) ([8d82f45](https://github.com/adobe/spacecat-shared/commit/8d82f45349ea9be2b1359fe5ebebf5a350f52666))
7
+
8
+ # [@adobe/spacecat-shared-data-access-v2.10.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.10.1...@adobe/spacecat-shared-data-access-v2.10.2) (2025-03-04)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * add all-traffic to import schema ([#647](https://github.com/adobe/spacecat-shared/issues/647)) ([9fb3ee5](https://github.com/adobe/spacecat-shared/commit/9fb3ee56b332d095ff73b8dda235192d6ef31aa7))
14
+
1
15
  # [@adobe/spacecat-shared-data-access-v2.10.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.10.0...@adobe/spacecat-shared-data-access-v2.10.1) (2025-03-04)
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.10.1",
3
+ "version": "2.11.0",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "engines": {
@@ -32,6 +32,8 @@ const handlerSchema = Joi.object().pattern(Joi.string(), Joi.object(
32
32
  orgs: Joi.array().items(Joi.string()),
33
33
  }),
34
34
  enabledByDefault: Joi.boolean().required(),
35
+ movingAvgThreshold: Joi.number().min(1).optional(),
36
+ percentageChangeThreshold: Joi.number().min(1).optional(),
35
37
  dependencies: Joi.array().items(Joi.object(
36
38
  {
37
39
  handler: Joi.string(),
@@ -16,6 +16,7 @@ export const IMPORT_TYPES = {
16
16
  ORGANIC_KEYWORDS: 'organic-keywords',
17
17
  ORGANIC_TRAFFIC: 'organic-traffic',
18
18
  TOP_PAGES: 'top-pages',
19
+ ALL_TRAFFIC: 'all-traffic',
19
20
  };
20
21
 
21
22
  export const IMPORT_DESTINATIONS = {
@@ -25,6 +26,7 @@ export const IMPORT_DESTINATIONS = {
25
26
  export const IMPORT_SOURCES = {
26
27
  AHREFS: 'ahrefs',
27
28
  GSC: 'google',
29
+ RUM: 'rum',
28
30
  };
29
31
 
30
32
  const IMPORT_BASE_KEYS = {
@@ -48,6 +50,10 @@ export const IMPORT_TYPE_SCHEMAS = {
48
50
  type: Joi.string().valid(IMPORT_TYPES.ORGANIC_TRAFFIC).required(),
49
51
  ...IMPORT_BASE_KEYS,
50
52
  }),
53
+ [IMPORT_TYPES.ALL_TRAFFIC]: Joi.object({
54
+ type: Joi.string().valid(IMPORT_TYPES.ALL_TRAFFIC).required(),
55
+ ...IMPORT_BASE_KEYS,
56
+ }),
51
57
  [IMPORT_TYPES.TOP_PAGES]: Joi.object({
52
58
  type: Joi.string().valid(IMPORT_TYPES.TOP_PAGES).required(),
53
59
  ...IMPORT_BASE_KEYS,
@@ -70,6 +76,12 @@ export const DEFAULT_IMPORT_CONFIGS = {
70
76
  sources: ['ahrefs'],
71
77
  enabled: true,
72
78
  },
79
+ 'all-traffic': {
80
+ type: 'all-traffic',
81
+ destinations: ['default'],
82
+ sources: ['rum'],
83
+ enabled: true,
84
+ },
73
85
  'top-pages': {
74
86
  type: 'top-pages',
75
87
  destinations: ['default'],
@@ -88,6 +100,9 @@ export const configSchema = Joi.object({
88
100
  imports: Joi.array().items(
89
101
  Joi.alternatives().try(...Object.values(IMPORT_TYPE_SCHEMAS)),
90
102
  ),
103
+ brandConfig: Joi.object({
104
+ brandId: Joi.string().required(),
105
+ }).optional(),
91
106
  fetchConfig: Joi.object({
92
107
  headers: Joi.object().pattern(Joi.string(), Joi.string()),
93
108
  overrideBaseURL: Joi.string().uri().optional(),
@@ -108,6 +123,8 @@ export const configSchema = Joi.object({
108
123
  name: Joi.string(),
109
124
  pattern: Joi.string(),
110
125
  })).optional(),
126
+ movingAvgThreshold: Joi.number().min(1).optional(),
127
+ percentageChangeThreshold: Joi.number().min(1).optional(),
111
128
  latestMetrics: Joi.object({
112
129
  pageViewsChange: Joi.number(),
113
130
  ctrChange: Joi.number(),
@@ -150,6 +167,7 @@ export const Config = (data = {}) => {
150
167
  self.getGroupedURLs = (type) => state?.handlers?.[type]?.groupedURLs;
151
168
  self.getLatestMetrics = (type) => state?.handlers?.[type]?.latestMetrics;
152
169
  self.getFetchConfig = () => state?.fetchConfig;
170
+ self.getBrandConfig = () => state?.brandConfig;
153
171
 
154
172
  self.updateSlackConfig = (channel, workspace, invitedUserCount) => {
155
173
  state.slack = {
@@ -206,6 +224,10 @@ export const Config = (data = {}) => {
206
224
  state.fetchConfig = fetchConfig;
207
225
  };
208
226
 
227
+ self.updateBrandConfig = (brandConfig) => {
228
+ state.brandConfig = brandConfig;
229
+ };
230
+
209
231
  self.enableImport = (type, config = {}) => {
210
232
  if (!IMPORT_TYPE_SCHEMAS[type]) {
211
233
  throw new Error(`Unknown import type: ${type}`);
@@ -257,4 +279,5 @@ Config.toDynamoItem = (config) => ({
257
279
  handlers: config.getHandlers(),
258
280
  imports: config.getImports(),
259
281
  fetchConfig: config.getFetchConfig(),
282
+ brandConfig: config.getBrandConfig(),
260
283
  });
@@ -81,6 +81,8 @@ export interface SiteConfig {
81
81
  ctrChange: number;
82
82
  projectedTrafficValue: number;
83
83
  };
84
+ movingAvgThreshold?: number;
85
+ percentageChangeThreshold?: number;
84
86
  }>;
85
87
  fetchConfig?: {
86
88
  headers?: Record<string, string>;