@adobe/spacecat-shared-data-access 1.3.0 → 1.3.1

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,10 @@
1
+ # [@adobe/spacecat-shared-data-access-v1.3.1](https://github.com/adobe-rnd/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.3.0...@adobe/spacecat-shared-data-access-v1.3.1) (2023-12-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * type def / jsdoc ([#61](https://github.com/adobe-rnd/spacecat-shared/issues/61)) ([078f9e6](https://github.com/adobe-rnd/spacecat-shared/commit/078f9e6855d3f475f3a746561758aaefb5cb3c79))
7
+
1
8
  # [@adobe/spacecat-shared-data-access-v1.3.0](https://github.com/adobe-rnd/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.2.7...@adobe/spacecat-shared-data-access-v1.3.0) (2023-12-16)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-data-access",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/index.d.ts CHANGED
@@ -24,15 +24,39 @@ export interface Audit {
24
24
  getScores: () => object;
25
25
  }
26
26
 
27
- // AuditConfigType defines the structure for specific audit type configurations
27
+ /**
28
+ * AuditConfigType defines the structure for specific audit type configurations
29
+ */
28
30
  export interface AuditConfigType {
31
+ /**
32
+ * Returns true if the audit type is disabled for the site. If an audit type is disabled, no
33
+ * audits of that type will be scheduled for the site.
34
+ * @returns True if the audit type is disabled for the site
35
+ */
29
36
  disabled(): boolean;
30
37
  }
31
38
 
32
- // AuditConfig defines the structure for the overall audit configuration of a site
39
+ /**
40
+ * AuditConfig defines the structure for the overall audit configuration of a site
41
+ */
33
42
  export interface AuditConfig {
43
+ /**
44
+ * Returns true if audits are disabled for the site. If audits are disabled, no audits will be
45
+ * scheduled for the site. Overrides any audit type specific configurations.
46
+ * @returns True if audits are disabled for the site
47
+ */
34
48
  auditsDisabled: () => boolean;
35
- getAuditConfigForType: (auditType: string) => AuditConfigType;
49
+ /**
50
+ * Returns the audit config for a specific audit type. The audit type is the key.
51
+ * @param auditType The audit type to get the config for
52
+ * @returns The audit config for the audit type
53
+ */
54
+ getAuditTypeConfig: (auditType: string) => AuditConfigType;
55
+ /**
56
+ * Returns the audit configs for all audit types. The keys are the audit types.
57
+ * @returns The audit configs for all audit types
58
+ */
59
+ getAuditTypeConfigs: () => object;
36
60
  }
37
61
 
38
62
  export interface Site {
@@ -11,6 +11,12 @@
11
11
  */
12
12
  import AuditConfigType from './audit-config-type.js';
13
13
 
14
+ /**
15
+ * Initializes the audit type configs. If auditsDisabled is true, all audit types will be disabled.
16
+ * @param {object} auditTypeConfigs - Object containing audit type configs.
17
+ * @param {boolean} auditsDisabled - Flag indicating if all audits are disabled.
18
+ * @return {object} Object containing audit type configs.
19
+ */
14
20
  function getAuditTypeConfigs(auditTypeConfigs, auditsDisabled) {
15
21
  return Object.entries(auditTypeConfigs || {}).reduce((acc, [key, value]) => {
16
22
  acc[key] = AuditConfigType(value, auditsDisabled);