@adobe/spacecat-shared-data-access 2.3.1 → 2.5.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.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)
2
+
3
+
4
+ ### Features
5
+
6
+ * adds site name ([#605](https://github.com/adobe/spacecat-shared/issues/605)) ([f066c3d](https://github.com/adobe/spacecat-shared/commit/f066c3da12e72ee85a97120ac8bb4b5deeca93fa))
7
+
8
+ # [@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)
9
+
10
+
11
+ ### Features
12
+
13
+ * introduce fetch config for site to use custom headers ([#585](https://github.com/adobe/spacecat-shared/issues/585)) ([10a2892](https://github.com/adobe/spacecat-shared/commit/10a28928c3946ea05c4644f16971ccff8d43e994))
14
+
1
15
  # [@adobe/spacecat-shared-data-access-v2.3.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.3.0...@adobe/spacecat-shared-data-access-v2.3.1) (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.3.1",
3
+ "version": "2.5.0",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "engines": {
@@ -19,6 +19,9 @@ export const configSchema = Joi.object({
19
19
  invitedUserCount: Joi.number().integer().min(0),
20
20
  }),
21
21
  imports: Joi.array().items(Joi.object({ type: Joi.string() }).unknown(true)),
22
+ fetchConfig: Joi.object({
23
+ headers: Joi.object().pattern(Joi.string(), Joi.string()),
24
+ }).optional(),
22
25
  handlers: Joi.object().pattern(Joi.string(), Joi.object({
23
26
  mentions: Joi.object().pattern(Joi.string(), Joi.array().items(Joi.string())),
24
27
  excludedURLs: Joi.array().items(Joi.string()),
@@ -40,8 +43,7 @@ export const configSchema = Joi.object({
40
43
 
41
44
  export const DEFAULT_CONFIG = {
42
45
  slack: {},
43
- handlers: {
44
- },
46
+ handlers: {},
45
47
  };
46
48
 
47
49
  // Function to validate incoming configuration
@@ -71,6 +73,7 @@ export const Config = (data = {}) => {
71
73
  self.getFixedURLs = (type) => state?.handlers?.[type]?.fixedURLs;
72
74
  self.getIncludedURLs = (type) => state?.handlers?.[type]?.includedURLs;
73
75
  self.getGroupedURLs = (type) => state?.handlers?.[type]?.groupedURLs;
76
+ self.getFetchConfig = () => state?.fetchConfig;
74
77
 
75
78
  self.updateSlackConfig = (channel, workspace, invitedUserCount) => {
76
79
  state.slack = {
@@ -117,6 +120,10 @@ export const Config = (data = {}) => {
117
120
  validateConfiguration(state);
118
121
  };
119
122
 
123
+ self.updateFetchConfig = (fetchConfig) => {
124
+ state.fetchConfig = fetchConfig;
125
+ };
126
+
120
127
  return Object.freeze(self);
121
128
  };
122
129
 
@@ -126,4 +133,5 @@ Config.toDynamoItem = (config) => ({
126
133
  slack: config.getSlackConfig(),
127
134
  handlers: config.getHandlers(),
128
135
  imports: config.getImports(),
136
+ fetchConfig: config.getFetchConfig(),
129
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,