@adobe/spacecat-shared-data-access 2.2.2 → 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 +7 -0
- package/package.json +1 -1
- package/src/models/audit/audit.model.js +68 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
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
|
+
|
|
1
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)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -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.
|