@adobe/spacecat-shared-utils 1.30.0 → 1.30.2
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/index.d.ts +3 -2
- package/src/url-helpers.js +14 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-utils-v1.30.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.30.1...@adobe/spacecat-shared-utils-v1.30.2) (2025-02-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update external fixes ([#587](https://github.com/adobe/spacecat-shared/issues/587)) ([14cce0a](https://github.com/adobe/spacecat-shared/commit/14cce0aa900b4a1b3bbec2d48e6d37766c7769ee))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-utils-v1.30.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.30.0...@adobe/spacecat-shared-utils-v1.30.1) (2025-02-06)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* composeAuditURL user agent failing for some sites ([#583](https://github.com/adobe/spacecat-shared/issues/583)) ([81bd136](https://github.com/adobe/spacecat-shared/commit/81bd136693ded29130b73b1c0258b6727104f5e1))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-utils-v1.30.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.29.0...@adobe/spacecat-shared-utils-v1.30.0) (2025-02-06)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/spacecat-shared-utils",
|
|
3
|
-
"version": "1.30.
|
|
3
|
+
"version": "1.30.2",
|
|
4
4
|
"description": "Shared modules of the Spacecat Services - utils",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -39,15 +39,15 @@
|
|
|
39
39
|
"chai": "5.1.2",
|
|
40
40
|
"chai-as-promised": "8.0.1",
|
|
41
41
|
"husky": "9.1.7",
|
|
42
|
-
"nock": "14.0.
|
|
42
|
+
"nock": "14.0.1",
|
|
43
43
|
"sinon": "19.0.2",
|
|
44
44
|
"sinon-chai": "4.0.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@adobe/fetch": "4.1.11",
|
|
48
|
-
"@aws-sdk/client-s3": "3.
|
|
49
|
-
"@aws-sdk/client-secrets-manager": "3.
|
|
50
|
-
"@aws-sdk/client-sqs": "3.
|
|
48
|
+
"@aws-sdk/client-s3": "3.744.0",
|
|
49
|
+
"@aws-sdk/client-secrets-manager": "3.744.0",
|
|
50
|
+
"@aws-sdk/client-sqs": "3.744.0",
|
|
51
51
|
"@json2csv/plainjs": "7.0.6",
|
|
52
52
|
"aws-xray-sdk": "3.10.3",
|
|
53
53
|
"uuid": "11.0.5"
|
package/src/index.d.ts
CHANGED
|
@@ -99,10 +99,11 @@ declare function composeBaseURL(domain: string): string;
|
|
|
99
99
|
|
|
100
100
|
/**
|
|
101
101
|
* Composes an audit URL by applying a series of transformations to the given url.
|
|
102
|
-
* @param url - The url to compose the audit URL from.
|
|
102
|
+
* @param {string} url - The url to compose the audit URL from.
|
|
103
|
+
* @param {string} [userAgent] - Optional user agent to use in the audit URL.
|
|
103
104
|
* @returns a promise that resolves the composed audit URL.
|
|
104
105
|
*/
|
|
105
|
-
declare function composeAuditURL(url: string): Promise<string>;
|
|
106
|
+
declare function composeAuditURL(url: string, userAgent: string): Promise<string>;
|
|
106
107
|
|
|
107
108
|
/**
|
|
108
109
|
* Resolves the name of the secret based on the function version.
|
package/src/url-helpers.js
CHANGED
|
@@ -83,13 +83,23 @@ function composeBaseURL(domain) {
|
|
|
83
83
|
return baseURL;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Composes an audit URL by applying a series of transformations to the given url.
|
|
88
|
+
* @param {string} url - The url to compose the audit URL from.
|
|
89
|
+
* @param {string} [userAgent] - Optional user agent to use in the audit URL.
|
|
90
|
+
* @returns a promise that resolves the composed audit URL.
|
|
91
|
+
*/
|
|
92
|
+
async function composeAuditURL(url, userAgent) {
|
|
87
93
|
const urlWithScheme = prependSchema(url);
|
|
94
|
+
|
|
95
|
+
const headers = {};
|
|
96
|
+
if (userAgent) {
|
|
97
|
+
headers['User-Agent'] = userAgent;
|
|
98
|
+
}
|
|
99
|
+
|
|
88
100
|
const resp = await fetch(urlWithScheme, {
|
|
89
101
|
method: 'GET',
|
|
90
|
-
headers
|
|
91
|
-
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
|
|
92
|
-
},
|
|
102
|
+
headers,
|
|
93
103
|
});
|
|
94
104
|
const finalUrl = resp.url.split('://')[1];
|
|
95
105
|
return stripTrailingSlash(finalUrl);
|