@adobe/spacecat-shared-data-access 1.39.1 → 1.41.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
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-data-access-v1.41.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.40.0...@adobe/spacecat-shared-data-access-v1.41.0) (2024-08-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* Introduce scoped API keys ([#312](https://github.com/adobe/spacecat-shared/issues/312)) ([449d273](https://github.com/adobe/spacecat-shared/commit/449d2736154d7e92fb4a3d1f9f290e15e665aa5e))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-data-access-v1.40.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.39.1...@adobe/spacecat-shared-data-access-v1.40.0) (2024-08-08)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* update import job models to include hashed key ([#318](https://github.com/adobe/spacecat-shared/issues/318)) ([cd90252](https://github.com/adobe/spacecat-shared/commit/cd902522629d13e2707b7a78a38bdffc5d6194c0))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-data-access-v1.39.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v1.39.0...@adobe/spacecat-shared-data-access-v1.39.1) (2024-08-06)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/dto/import-job.js
CHANGED
|
@@ -28,7 +28,7 @@ export const ImportJobDto = {
|
|
|
28
28
|
toDynamoItem: (importJob) => ({
|
|
29
29
|
id: importJob.getId(),
|
|
30
30
|
baseURL: importJob.getBaseURL(),
|
|
31
|
-
|
|
31
|
+
hashedApiKey: importJob.getHashedApiKey(),
|
|
32
32
|
options: importJob.getOptions(),
|
|
33
33
|
startTime: importJob.getStartTime(),
|
|
34
34
|
endTime: importJob.getEndTime(),
|
|
@@ -48,7 +48,7 @@ export const ImportJobDto = {
|
|
|
48
48
|
const importJobData = {
|
|
49
49
|
id: dynamoItem.id,
|
|
50
50
|
baseURL: dynamoItem.baseURL,
|
|
51
|
-
|
|
51
|
+
hashedApiKey: dynamoItem.hashedApiKey,
|
|
52
52
|
options: dynamoItem.options,
|
|
53
53
|
startTime: dynamoItem.startTime,
|
|
54
54
|
endTime: dynamoItem.endTime,
|
package/src/index.d.ts
CHANGED
|
@@ -455,9 +455,9 @@ export interface ImportJob {
|
|
|
455
455
|
getId: () => string;
|
|
456
456
|
|
|
457
457
|
/**
|
|
458
|
-
* Retrieves the apiKey of the import job.
|
|
458
|
+
* Retrieves the hashed apiKey of the import job.
|
|
459
459
|
*/
|
|
460
|
-
|
|
460
|
+
getHashedApiKey: () => string;
|
|
461
461
|
|
|
462
462
|
/**
|
|
463
463
|
* Retrieves the status of the import job.
|
package/src/models/api-key.js
CHANGED
|
@@ -82,12 +82,14 @@ export const createApiKey = (data) => {
|
|
|
82
82
|
throw new Error(`Scope name is not part of the pre-defined scopes: ${scope.name}`);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
if (scope.domains) {
|
|
86
|
+
if (!Array.isArray(scope.domains)) {
|
|
87
|
+
throw new Error(`Scope domains should be an array: ${scope.domains}`);
|
|
88
|
+
}
|
|
89
|
+
for (const domain of scope.domains) {
|
|
90
|
+
if (!isValidUrl(domain)) {
|
|
91
|
+
throw new Error(`Invalid domain: ${domain}`);
|
|
92
|
+
}
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
}
|
|
@@ -31,7 +31,7 @@ const ImportJob = (data) => {
|
|
|
31
31
|
const self = Base(data);
|
|
32
32
|
|
|
33
33
|
self.getBaseURL = () => self.state.baseURL;
|
|
34
|
-
self.
|
|
34
|
+
self.getHashedApiKey = () => self.state.hashedApiKey;
|
|
35
35
|
self.getOptions = () => self.state.options;
|
|
36
36
|
self.getStartTime = () => self.state.startTime;
|
|
37
37
|
self.getEndTime = () => self.state.endTime;
|
|
@@ -168,8 +168,8 @@ export const createImportJob = (data) => {
|
|
|
168
168
|
throw new Error(`Invalid base URL: ${newState.baseURL}`);
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
if (!isString(newState.
|
|
172
|
-
throw new Error(`Invalid API key: ${newState.
|
|
171
|
+
if (!isString(newState.hashedApiKey)) {
|
|
172
|
+
throw new Error(`Invalid API key: ${newState.hashedApiKey}`);
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
if (hasText(newState.startTime) && !isIsoDate(newState.startTime)) {
|