@adobe/spacecat-shared-data-access 1.61.6 → 1.61.8
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 +14 -0
- package/package.json +5 -5
- package/src/v2/models/base/base.collection.js +7 -1
- package/src/v2/models/base/schema.js +1 -1
- package/src/v2/models/configuration/configuration.model.js +18 -0
- package/src/v2/models/configuration/configuration.schema.js +2 -2
- package/src/v2/models/suggestion/suggestion.collection.js +2 -0
- package/src/v2/util/accessor.utils.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-data-access-v1.61.8](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.61.7...@adobe/spacecat-shared-data-access-v1.61.8) (2024-12-31)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* logging ([#515](https://github.com/adobe/spacecat-shared/issues/515)) ([a0010ea](https://github.com/adobe/spacecat-shared/commit/a0010eae6ff87b04c065568c1af135736cfdbcfd))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-data-access-v1.61.7](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.61.6...@adobe/spacecat-shared-data-access-v1.61.7) (2024-12-31)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* job groups & schedules, engine version ([#514](https://github.com/adobe/spacecat-shared/issues/514)) ([995f81e](https://github.com/adobe/spacecat-shared/commit/995f81eedb76d45a09cfd2ae3952f3676033a235))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-data-access-v1.61.6](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.61.5...@adobe/spacecat-shared-data-access-v1.61.6) (2024-12-30)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/spacecat-shared-data-access",
|
|
3
|
-
"version": "1.61.
|
|
3
|
+
"version": "1.61.8",
|
|
4
4
|
"description": "Shared modules of the Spacecat Services - Data Access",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
|
-
"node": ">=
|
|
8
|
-
"npm": ">=10.
|
|
7
|
+
"node": ">=22.0.0 <23.0.0",
|
|
8
|
+
"npm": ">=10.9.0 <12.0.0"
|
|
9
9
|
},
|
|
10
10
|
"main": "src/index.js",
|
|
11
11
|
"types": "src/index.d.ts",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@adobe/spacecat-shared-dynamo": "1.5.
|
|
38
|
-
"@adobe/spacecat-shared-utils": "1.25.
|
|
37
|
+
"@adobe/spacecat-shared-dynamo": "1.5.1",
|
|
38
|
+
"@adobe/spacecat-shared-utils": "1.25.2",
|
|
39
39
|
"@aws-sdk/client-dynamodb": "3.716.0",
|
|
40
40
|
"@aws-sdk/lib-dynamodb": "3.716.0",
|
|
41
41
|
"@types/joi": "17.2.3",
|
|
@@ -377,6 +377,9 @@ class BaseCollection {
|
|
|
377
377
|
const instance = this.#createInstance(record.data);
|
|
378
378
|
|
|
379
379
|
this.#invalidateCache();
|
|
380
|
+
|
|
381
|
+
this.log.info(`Created item for [${this.entityName}]`);
|
|
382
|
+
|
|
380
383
|
await this.#onCreate(instance);
|
|
381
384
|
|
|
382
385
|
return instance;
|
|
@@ -491,6 +494,8 @@ class BaseCollection {
|
|
|
491
494
|
this.log.error(`Failed to process all items in batch write for [${this.entityName}]: ${JSON.stringify(response.unprocessed)}`);
|
|
492
495
|
}
|
|
493
496
|
|
|
497
|
+
this.log.info(`Updated ${items.length} items for [${this.entityName}]`);
|
|
498
|
+
|
|
494
499
|
return this.#invalidateCache();
|
|
495
500
|
} catch (error) {
|
|
496
501
|
return this.#logAndThrowError('Failed to save many', error);
|
|
@@ -513,11 +518,12 @@ class BaseCollection {
|
|
|
513
518
|
}
|
|
514
519
|
|
|
515
520
|
try {
|
|
516
|
-
this.log.info(`Removing ${ids.length} items for [${this.entityName}]`);
|
|
517
521
|
// todo: consider removing dependent records
|
|
518
522
|
|
|
519
523
|
await this.entity.delete(ids.map((id) => ({ [this.idName]: id }))).go();
|
|
520
524
|
|
|
525
|
+
this.log.info(`Removed ${ids.length} items for [${this.entityName}]`);
|
|
526
|
+
|
|
521
527
|
return this.#invalidateCache();
|
|
522
528
|
} catch (error) {
|
|
523
529
|
return this.#logAndThrowError('Failed to remove by IDs', error);
|
|
@@ -346,7 +346,7 @@ class Schema {
|
|
|
346
346
|
requiredKeys: subset,
|
|
347
347
|
});
|
|
348
348
|
|
|
349
|
-
log.
|
|
349
|
+
log.debug(`Created accessors for index [${indexName}] with keys [${subset.join(', ')}]`);
|
|
350
350
|
});
|
|
351
351
|
});
|
|
352
352
|
|
|
@@ -23,6 +23,24 @@ import BaseModel from '../base/base.model.js';
|
|
|
23
23
|
* @extends BaseModel
|
|
24
24
|
*/
|
|
25
25
|
class Configuration extends BaseModel {
|
|
26
|
+
static JOB_GROUPS = {
|
|
27
|
+
AUDITS: 'audits',
|
|
28
|
+
IMPORTS: 'imports',
|
|
29
|
+
REPORTS: 'reports',
|
|
30
|
+
SCRAPES: 'scrapes',
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
static JOB_INTERVALS = {
|
|
34
|
+
EVERY_HOUR: 'every-hour',
|
|
35
|
+
DAILY: 'daily',
|
|
36
|
+
WEEKLY: 'weekly',
|
|
37
|
+
EVERY_SATURDAY: 'every-saturday',
|
|
38
|
+
EVERY_SUNDAY: 'every-sunday',
|
|
39
|
+
FORTNIGHTLY: 'fortnightly',
|
|
40
|
+
FORTNIGHTLY_SATURDAY: 'fortnightly-saturday',
|
|
41
|
+
FORTNIGHTLY_SUNDAY: 'fortnightly-sunday',
|
|
42
|
+
MONTHLY: 'monthly',
|
|
43
|
+
};
|
|
26
44
|
// add your custom methods or overrides here
|
|
27
45
|
|
|
28
46
|
getHandler(type) {
|
|
@@ -78,9 +78,9 @@ const schema = new SchemaBuilder(Configuration, ConfigurationCollection)
|
|
|
78
78
|
items: {
|
|
79
79
|
type: 'map',
|
|
80
80
|
properties: {
|
|
81
|
-
group: { type:
|
|
81
|
+
group: { type: Object.values(Configuration.JOB_GROUPS), required: true },
|
|
82
82
|
type: { type: 'string', required: true },
|
|
83
|
-
interval: { type:
|
|
83
|
+
interval: { type: Object.values(Configuration.JOB_INTERVALS), required: true },
|
|
84
84
|
},
|
|
85
85
|
},
|
|
86
86
|
})
|
|
@@ -153,6 +153,6 @@ export function createAccessor(config) { /* eslint-disable no-underscore-dangle
|
|
|
153
153
|
export function createAccessors(configs, log) {
|
|
154
154
|
configs.forEach((config) => {
|
|
155
155
|
createAccessor(config);
|
|
156
|
-
log.
|
|
156
|
+
log.debug(`Created accessor ${config.name} for ${config.context.schema.getModelName()} to ${config.collection.schema.getModelName()}`);
|
|
157
157
|
});
|
|
158
158
|
}
|