@adobe/spacecat-shared-data-access 1.42.0 → 1.43.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,17 @@
1
+ # [@adobe/spacecat-shared-data-access-v1.43.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.43.0...@adobe/spacecat-shared-data-access-v1.43.1) (2024-08-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add Scoped API Key docs ([#342](https://github.com/adobe/spacecat-shared/issues/342)) ([2fbf707](https://github.com/adobe/spacecat-shared/commit/2fbf707dfeff914dc47ae1f9860629873927e03e))
7
+
8
+ # [@adobe/spacecat-shared-data-access-v1.43.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.42.0...@adobe/spacecat-shared-data-access-v1.43.0) (2024-08-21)
9
+
10
+
11
+ ### Features
12
+
13
+ * add initiatedBy attribute to import job ([#341](https://github.com/adobe/spacecat-shared/issues/341)) ([8a7634c](https://github.com/adobe/spacecat-shared/commit/8a7634c68cf0df01a71abc5d99a17519869f3c45))
14
+
1
15
  # [@adobe/spacecat-shared-data-access-v1.42.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.41.8...@adobe/spacecat-shared-data-access-v1.42.0) (2024-08-20)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-data-access",
3
- "version": "1.42.0",
3
+ "version": "1.43.1",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
+ "engines": {
7
+ "node": "^20.0.0 <21.0.0",
8
+ "npm": "^10.0.0 <11.0.0"
9
+ },
6
10
  "main": "src/index.js",
7
11
  "types": "src/index.d.ts",
8
12
  "scripts": {
@@ -40,7 +44,7 @@
40
44
  "devDependencies": {
41
45
  "chai": "5.1.1",
42
46
  "chai-as-promised": "8.0.0",
43
- "dynamo-db-local": "8.0.0",
47
+ "dynamo-db-local": "9.2.0",
44
48
  "sinon": "18.0.0",
45
49
  "sinon-chai": "4.0.0"
46
50
  }
@@ -38,6 +38,7 @@ export const ImportJobDto = {
38
38
  successCount: importJob.getSuccessCount(),
39
39
  failedCount: importJob.getFailedCount(),
40
40
  importQueueId: importJob.getImportQueueId(),
41
+ initiatedBy: importJob.getInitiatedBy(),
41
42
  GSI1PK: 'ALL_IMPORT_JOBS',
42
43
  }),
43
44
 
@@ -58,6 +59,7 @@ export const ImportJobDto = {
58
59
  successCount: dynamoItem.successCount,
59
60
  failedCount: dynamoItem.failedCount,
60
61
  importQueueId: dynamoItem.importQueueId,
62
+ initiatedBy: dynamoItem.initiatedBy,
61
63
  };
62
64
 
63
65
  return createImportJob(importJobData);
package/src/index.d.ts CHANGED
@@ -510,6 +510,11 @@ export interface ImportJob {
510
510
  */
511
511
  getImportQueueId: () => string;
512
512
 
513
+ /**
514
+ * Retrieves the initiatedBy metadata (name, imsOrgId, imsUserId, userAgent) of the import job.
515
+ */
516
+ getInitiatedBy: () => object;
517
+
513
518
  }
514
519
 
515
520
  export interface ImportUrl {
@@ -15,8 +15,18 @@ import {
15
15
  } from '@adobe/spacecat-shared-utils';
16
16
  import { Base } from './base.js';
17
17
 
18
- const scopeNames = ['sites.read_all', 'sites.write_all', 'organizations.read_all', 'organizations.write_all',
19
- 'audits.read_all', 'audits.write_all', 'imports.read', 'imports.write', 'imports.read_all'];
18
+ // List of known scope names that can be used with scoped API keys
19
+ const scopeNames = [
20
+ 'sites.read_all',
21
+ 'sites.write_all',
22
+ 'organizations.read_all',
23
+ 'organizations.write_all',
24
+ 'audits.read_all',
25
+ 'audits.write_all',
26
+ 'imports.read',
27
+ 'imports.write',
28
+ 'imports.read_all',
29
+ ];
20
30
 
21
31
  const ApiKey = (data) => {
22
32
  const self = Base(data);
@@ -41,6 +41,7 @@ const ImportJob = (data) => {
41
41
  self.getSuccessCount = () => self.state.successCount;
42
42
  self.getFailedCount = () => self.state.failedCount;
43
43
  self.getImportQueueId = () => self.state.importQueueId;
44
+ self.getInitiatedBy = () => self.state.initiatedBy;
44
45
 
45
46
  /**
46
47
  * Updates the end time of the ImportJob.