@adobe/spacecat-shared-data-access 1.61.5 → 1.61.7

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-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)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * job groups & schedules, engine version ([#514](https://github.com/adobe/spacecat-shared/issues/514)) ([995f81e](https://github.com/adobe/spacecat-shared/commit/995f81eedb76d45a09cfd2ae3952f3676033a235))
7
+
8
+ # [@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)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * isNonEmptyArray from utils ([#512](https://github.com/adobe/spacecat-shared/issues/512)) ([21b87ed](https://github.com/adobe/spacecat-shared/commit/21b87edc507f20285355becd5d51a9b7010e9651))
14
+
1
15
  # [@adobe/spacecat-shared-data-access-v1.61.5](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.61.4...@adobe/spacecat-shared-data-access-v1.61.5) (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.5",
3
+ "version": "1.61.7",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "engines": {
7
- "node": ">=20.0.0 <23.0.0",
8
- "npm": ">=10.0.0 <12.0.0"
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.0",
38
- "@adobe/spacecat-shared-utils": "1.25.0",
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",
@@ -12,6 +12,7 @@
12
12
 
13
13
  import {
14
14
  hasText,
15
+ isNonEmptyArray,
15
16
  isNonEmptyObject,
16
17
  isObject,
17
18
  } from '@adobe/spacecat-shared-utils';
@@ -24,7 +25,6 @@ import { createAccessors } from '../../util/accessor.utils.js';
24
25
  import { guardId } from '../../util/guards.js';
25
26
  import {
26
27
  entityNameToAllPKValue,
27
- isNonEmptyArray,
28
28
  removeElectroProperties,
29
29
  } from '../../util/util.js';
30
30
 
@@ -10,7 +10,7 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { isNonEmptyObject } from '@adobe/spacecat-shared-utils';
13
+ import { isNonEmptyArray, isNonEmptyObject } from '@adobe/spacecat-shared-utils';
14
14
 
15
15
  import { DataAccessError } from '../../errors/index.js';
16
16
  import { createAccessors } from '../../util/accessor.utils.js';
@@ -19,7 +19,6 @@ import {
19
19
  capitalize,
20
20
  entityNameToIdName,
21
21
  idNameToEntityName,
22
- isNonEmptyArray,
23
22
  } from '../../util/util.js';
24
23
 
25
24
  import Reference from './reference.js';
@@ -10,13 +10,12 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { hasText, isNonEmptyObject } from '@adobe/spacecat-shared-utils';
13
+ import { hasText, isNonEmptyArray, isNonEmptyObject } from '@adobe/spacecat-shared-utils';
14
14
 
15
15
  import ReferenceError from '../../errors/reference.error.js';
16
16
  import {
17
17
  entityNameToCollectionName,
18
18
  entityNameToIdName,
19
- isNonEmptyArray,
20
19
  keyNamesToMethodName,
21
20
  referenceToBaseMethodName,
22
21
  } from '../../util/util.js';
@@ -11,7 +11,7 @@
11
11
  */
12
12
 
13
13
  import {
14
- hasText, isBoolean, isInteger, isNonEmptyObject,
14
+ hasText, isBoolean, isInteger, isNonEmptyArray, isNonEmptyObject,
15
15
  } from '@adobe/spacecat-shared-utils';
16
16
 
17
17
  import { v4 as uuid, validate as uuidValidate } from 'uuid';
@@ -21,7 +21,6 @@ import {
21
21
  decapitalize,
22
22
  entityNameToAllPKValue,
23
23
  entityNameToIdName,
24
- isNonEmptyArray,
25
24
  isPositiveInteger,
26
25
  } from '../../util/util.js';
27
26
 
@@ -10,14 +10,13 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { hasText, isNonEmptyObject } from '@adobe/spacecat-shared-utils';
13
+ import { hasText, isNonEmptyArray, isNonEmptyObject } from '@adobe/spacecat-shared-utils';
14
14
 
15
15
  import { SchemaError, SchemaValidationError } from '../../errors/index.js';
16
16
  import {
17
17
  classExtends,
18
18
  entityNameToCollectionName,
19
19
  entityNameToIdName,
20
- isNonEmptyArray,
21
20
  isPositiveInteger,
22
21
  keyNamesToMethodName,
23
22
  modelNameToEntityName,
@@ -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: ['audits', 'imports', 'reports', 'scrapes'] },
81
+ group: { type: Object.values(Configuration.JOB_GROUPS), required: true },
82
82
  type: { type: 'string', required: true },
83
- interval: { type: ['daily', 'weekly', 'every-saturday', 'every-sunday', 'fortnightly', 'monthly'] },
83
+ interval: { type: Object.values(Configuration.JOB_INTERVALS), required: true },
84
84
  },
85
85
  },
86
86
  })
@@ -10,7 +10,7 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { isObject } from '@adobe/spacecat-shared-utils';
13
+ import { isNonEmptyArray, isObject } from '@adobe/spacecat-shared-utils';
14
14
 
15
15
  import ValidationError from '../errors/validation.error.js';
16
16
 
@@ -25,7 +25,6 @@ import {
25
25
  guardSet,
26
26
  guardString,
27
27
  } from './index.js';
28
- import { isNonEmptyArray } from './util.js';
29
28
 
30
29
  /**
31
30
  * Checks if a property is read-only and throws an error if it is.
@@ -80,8 +80,6 @@ const sanitizeIdAndAuditFields = (entityName, data) => {
80
80
 
81
81
  const incrementVersion = (version) => (isInteger(version) ? parseInt(version, 10) + 1 : 1);
82
82
 
83
- const isNonEmptyArray = (value) => Array.isArray(value) && value.length > 0;
84
-
85
83
  const zeroPad = (num, length) => {
86
84
  const str = String(num);
87
85
  return str.length >= length
@@ -99,7 +97,6 @@ export {
99
97
  entityNameToIdName,
100
98
  idNameToEntityName,
101
99
  incrementVersion,
102
- isNonEmptyArray,
103
100
  isPositiveInteger,
104
101
  keyNamesToIndexName,
105
102
  keyNamesToMethodName,