@adobe/spacecat-shared-data-access 2.2.1 → 2.3.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.3.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.2.2...@adobe/spacecat-shared-data-access-v2.3.0) (2025-02-17)
2
+
3
+
4
+ ### Features
5
+
6
+ * audit step destinations ([#602](https://github.com/adobe/spacecat-shared/issues/602)) ([9aa9a8a](https://github.com/adobe/spacecat-shared/commit/9aa9a8a98aeeccd16e665140beae114bdd12924b))
7
+
8
+ # [@adobe/spacecat-shared-data-access-v2.2.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.2.1...@adobe/spacecat-shared-data-access-v2.2.2) (2025-02-16)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update external fixes ([#603](https://github.com/adobe/spacecat-shared/issues/603)) ([b58d4c7](https://github.com/adobe/spacecat-shared/commit/b58d4c7237fb2522bba9b722e9eed7b0ae9e5f70))
14
+
1
15
  # [@adobe/spacecat-shared-data-access-v2.2.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.2.0...@adobe/spacecat-shared-data-access-v2.2.1) (2025-02-14)
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.2.1",
3
+ "version": "2.3.0",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "engines": {
@@ -35,17 +35,17 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@adobe/spacecat-shared-utils": "1.26.4",
38
- "@aws-sdk/client-dynamodb": "3.744.0",
39
- "@aws-sdk/lib-dynamodb": "3.744.0",
38
+ "@aws-sdk/client-dynamodb": "3.749.0",
39
+ "@aws-sdk/lib-dynamodb": "3.749.0",
40
40
  "@types/joi": "17.2.3",
41
41
  "aws-xray-sdk": "3.10.3",
42
- "electrodb": "3.1.0",
42
+ "electrodb": "3.4.0",
43
43
  "joi": "17.13.3",
44
44
  "pluralize": "8.0.0",
45
45
  "uuid": "11.0.5"
46
46
  },
47
47
  "devDependencies": {
48
- "chai": "5.1.2",
48
+ "chai": "5.2.0",
49
49
  "chai-as-promised": "8.0.1",
50
50
  "dynamo-db-local": "9.4.0",
51
51
  "sinon": "19.0.2",
@@ -57,6 +57,74 @@ class Audit extends BaseModel {
57
57
  PROPERTIES: Audit.AUDIT_TYPE_PROPERTIES,
58
58
  };
59
59
 
60
+ /**
61
+ * The destinations for the audit steps. Used with AuditBuilder to determine the destination
62
+ * an audit step should trigger.
63
+ * @type {{CONTENT_SCRAPER: string, IMPORT_WORKER: string}}
64
+ */
65
+ static AUDIT_STEP_DESTINATIONS = {
66
+ CONTENT_SCRAPER: 'content-scraper',
67
+ IMPORT_WORKER: 'import-worker',
68
+ };
69
+
70
+ /**
71
+ * The configurations for the audit step destinations. Used with AuditBuilder to configure
72
+ * the destination queue URL and payload formatting.
73
+ * @type {{
74
+ * [Audit.AUDIT_STEP_DESTINATIONS.CONTENT_SCRAPER]: {queueUrl: string, formatPayload: function},
75
+ * [Audit.AUDIT_STEP_DESTINATIONS.IMPORT_WORKER]: {queueUrl: string, formatPayload: function}
76
+ * }}
77
+ */
78
+ static AUDIT_STEP_DESTINATION_CONFIGS = {
79
+ [Audit.AUDIT_STEP_DESTINATIONS.IMPORT_WORKER]: {
80
+ queueUrl: process.env.IMPORT_WORKER_QUEUE_URL,
81
+ /**
82
+ * Formats the payload for the import worker queue.
83
+ * @param {object} stepResult - The result of the audit step.
84
+ * @param {string} stepResult.type - The import type to trigger.
85
+ * @param {string} stepResult.siteId - The site ID for which the import is triggered.
86
+ * @param {object} auditContext - The audit context.
87
+ * @param {object} auditContext.next - The next audit step to run.
88
+ * @param {string} auditContext.auditId - The audit ID.
89
+ * @param {string} auditContext.auditType - The audit type.
90
+ * @param {string} auditContext.fullAuditRef - The full audit reference.
91
+ * @param {string} auditContext.<string> - Optional. Any additional context properties
92
+ * as needed by the audit type.
93
+ *
94
+ * @returns {object} - The formatted payload.
95
+ */
96
+ formatPayload: (stepResult, auditContext) => ({
97
+ type: stepResult.type,
98
+ siteId: stepResult.siteId,
99
+ auditContext,
100
+ }),
101
+ },
102
+ [Audit.AUDIT_STEP_DESTINATIONS.CONTENT_SCRAPER]: {
103
+ queueUrl: process.env.CONTENT_SCRAPER_QUEUE_URL,
104
+ /**
105
+ * Formats the payload for the content scraper queue.
106
+ * @param {object} stepResult - The result of the audit step.
107
+ * @param {object[]} stepResult.urls - The list of URLs to scrape.
108
+ * @param {string} stepResult.urls[].url - The URL to scrape.
109
+ * @param {string} stepResult.siteId - The site ID. Will be used as the job ID.
110
+ * @param {string} stepResult.processingType - The scraping processing type to trigger.
111
+ * @param {object} auditContext - The audit context.
112
+ * @param {object} auditContext.next - The next audit step to run.
113
+ * @param {string} auditContext.auditId - The audit ID.
114
+ * @param {string} auditContext.auditType - The audit type.
115
+ * @param {string} auditContext.fullAuditRef - The full audit reference.
116
+ *
117
+ * @returns {object} - The formatted payload.
118
+ */
119
+ formatPayload: (stepResult, auditContext) => ({
120
+ urls: stepResult.urls,
121
+ jobId: stepResult.siteId,
122
+ processingType: stepResult.processingType || 'default',
123
+ auditContext,
124
+ }),
125
+ },
126
+ };
127
+
60
128
  /**
61
129
  * Validates if the auditResult contains the required properties for the given audit type.
62
130
  * @param {object} auditResult - The audit result to validate.