@adobe/spacecat-shared-data-access 2.14.1 → 2.15.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 +12 -0
- package/README.md +22 -0
- package/package.json +1 -1
- package/src/models/audit/audit.model.js +6 -1
- package/src/models/site/config.js +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-data-access-v2.15.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.14.1...@adobe/spacecat-shared-data-access-v2.15.0) (2025-04-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* completionUrl not sent to content scraper and introduce skip property ([#685](https://github.com/adobe/spacecat-shared/issues/685)) ([4d89a29](https://github.com/adobe/spacecat-shared/commit/4d89a297495fa69ebbcc0429ed879b2edafbd760))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Add contentAiConfig validation to Config class ([#686](https://github.com/adobe/spacecat-shared/issues/686)) ([077fbbd](https://github.com/adobe/spacecat-shared/commit/077fbbd583f5567c265fe47e724ea5ce9f1a722d))
|
|
12
|
+
|
|
1
13
|
# [@adobe/spacecat-shared-data-access-v2.14.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v2.14.0...@adobe/spacecat-shared-data-access-v2.14.1) (2025-04-15)
|
|
2
14
|
|
|
3
15
|
|
package/README.md
CHANGED
|
@@ -184,6 +184,28 @@ export const main = wrap(run)
|
|
|
184
184
|
|
|
185
185
|
Contributions to `spacecat-shared-data-access` are welcome. Please adhere to the standard Git workflow and submit pull requests for proposed changes.
|
|
186
186
|
|
|
187
|
+
## Local Development and Testing
|
|
188
|
+
|
|
189
|
+
### Testing with Dependent Projects Before Merging
|
|
190
|
+
|
|
191
|
+
When making changes to this package, you can test them in dependent projects (like `spacecat-api-service`) before merging using the following approach:
|
|
192
|
+
|
|
193
|
+
1. Commit and push your changes to a branch in this repository
|
|
194
|
+
2. Get the commit ID of your push
|
|
195
|
+
3. In your dependent project, temporarily modify the package.json dependency:
|
|
196
|
+
|
|
197
|
+
```json
|
|
198
|
+
// From:
|
|
199
|
+
"@adobe/spacecat-shared-data-access": "2.13.1",
|
|
200
|
+
|
|
201
|
+
// To:
|
|
202
|
+
"@adobe/spacecat-shared-data-access": "https://gitpkg.now.sh/adobe/spacecat-shared/packages/spacecat-shared-data-access?YOUR_COMMIT_ID",
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
4. Run `npm install` in your dependent project
|
|
206
|
+
5. Test your changes
|
|
207
|
+
6. Once testing is complete and your PR is merged, update the dependent project to use the released version
|
|
208
|
+
|
|
187
209
|
## License
|
|
188
210
|
|
|
189
211
|
Licensed under the Apache-2.0 License.
|
package/package.json
CHANGED
|
@@ -104,6 +104,7 @@ class Audit extends BaseModel {
|
|
|
104
104
|
formatPayload: (stepResult, auditContext) => ({
|
|
105
105
|
type: stepResult.type,
|
|
106
106
|
siteId: stepResult.siteId,
|
|
107
|
+
allowCache: true,
|
|
107
108
|
auditContext,
|
|
108
109
|
}),
|
|
109
110
|
},
|
|
@@ -117,6 +118,7 @@ class Audit extends BaseModel {
|
|
|
117
118
|
* @param {string} stepResult.siteId - The site ID. Will be used as the job ID.
|
|
118
119
|
* @param {string} stepResult.processingType - The scraping processing type to trigger.
|
|
119
120
|
* @param {object} auditContext - The audit context.
|
|
121
|
+
* @param {object} context - The context object.
|
|
120
122
|
* @param {object} auditContext.next - The next audit step to run.
|
|
121
123
|
* @param {string} auditContext.auditId - The audit ID.
|
|
122
124
|
* @param {string} auditContext.auditType - The audit type.
|
|
@@ -124,10 +126,13 @@ class Audit extends BaseModel {
|
|
|
124
126
|
*
|
|
125
127
|
* @returns {object} - The formatted payload.
|
|
126
128
|
*/
|
|
127
|
-
formatPayload: (stepResult, auditContext) => ({
|
|
129
|
+
formatPayload: (stepResult, auditContext, context) => ({
|
|
128
130
|
urls: stepResult.urls,
|
|
129
131
|
jobId: stepResult.siteId,
|
|
130
132
|
processingType: stepResult.processingType || 'default',
|
|
133
|
+
skipMessage: false,
|
|
134
|
+
allowCache: true,
|
|
135
|
+
completionQueueUrl: stepResult.completionQueueUrl || context.env?.AUDIT_RESULTS_QUEUE_URL,
|
|
131
136
|
auditContext,
|
|
132
137
|
}),
|
|
133
138
|
},
|
|
@@ -107,6 +107,9 @@ export const configSchema = Joi.object({
|
|
|
107
107
|
headers: Joi.object().pattern(Joi.string(), Joi.string()),
|
|
108
108
|
overrideBaseURL: Joi.string().uri().optional(),
|
|
109
109
|
}).optional(),
|
|
110
|
+
contentAiConfig: Joi.object({
|
|
111
|
+
index: Joi.string().required(),
|
|
112
|
+
}).optional(),
|
|
110
113
|
handlers: Joi.object().pattern(Joi.string(), Joi.object({
|
|
111
114
|
mentions: Joi.object().pattern(Joi.string(), Joi.array().items(Joi.string())),
|
|
112
115
|
excludedURLs: Joi.array().items(Joi.string()),
|
|
@@ -136,6 +139,7 @@ export const configSchema = Joi.object({
|
|
|
136
139
|
export const DEFAULT_CONFIG = {
|
|
137
140
|
slack: {},
|
|
138
141
|
handlers: {},
|
|
142
|
+
contentAiConfig: {},
|
|
139
143
|
};
|
|
140
144
|
|
|
141
145
|
// Function to validate incoming configuration
|
|
@@ -158,6 +162,7 @@ export const Config = (data = {}) => {
|
|
|
158
162
|
self.isInternalCustomer = () => state?.slack?.workspace === 'internal';
|
|
159
163
|
self.getSlackMentions = (type) => state?.handlers?.[type]?.mentions?.slack;
|
|
160
164
|
self.getHandlerConfig = (type) => state?.handlers?.[type];
|
|
165
|
+
self.getContentAiConfig = () => state?.contentAiConfig;
|
|
161
166
|
self.getHandlers = () => state.handlers;
|
|
162
167
|
self.getImports = () => state.imports;
|
|
163
168
|
self.getExcludedURLs = (type) => state?.handlers?.[type]?.excludedURLs;
|
|
@@ -277,6 +282,7 @@ Config.fromDynamoItem = (dynamoItem) => Config(dynamoItem);
|
|
|
277
282
|
Config.toDynamoItem = (config) => ({
|
|
278
283
|
slack: config.getSlackConfig(),
|
|
279
284
|
handlers: config.getHandlers(),
|
|
285
|
+
contentAiConfig: config.getContentAiConfig(),
|
|
280
286
|
imports: config.getImports(),
|
|
281
287
|
fetchConfig: config.getFetchConfig(),
|
|
282
288
|
brandConfig: config.getBrandConfig(),
|