@quintype/framework 7.30.9-host-to-api.1 → 7.30.9
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
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [7.30.9](https://github.com/quintype/quintype-node-framework/compare/v7.30.8...v7.30.9) (2024-11-22)
|
|
6
|
+
|
|
5
7
|
### [7.30.8](https://github.com/quintype/quintype-node-framework/compare/v7.30.7...v7.30.8) (2024-11-05)
|
|
6
8
|
|
|
7
9
|
### [7.30.7](https://github.com/quintype/quintype-node-framework/compare/v7.30.6...v7.30.7) (2024-10-30)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quintype/framework",
|
|
3
|
-
"version": "7.30.9
|
|
3
|
+
"version": "7.30.9",
|
|
4
4
|
"description": "Libraries to help build Quintype Node.js apps",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"engines": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@ampproject/toolbox-optimizer": "2.8.3",
|
|
34
34
|
"@quintype/amp": "^2.20.0",
|
|
35
|
-
"@quintype/backend": "2.
|
|
35
|
+
"@quintype/backend": "2.5.1",
|
|
36
36
|
"@quintype/components": "^3.5.0",
|
|
37
37
|
"@quintype/prerender-node": "^3.2.26",
|
|
38
38
|
"@quintype/seo": "^1.46.1",
|
package/server/api-client.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
// istanbul ignore file
|
|
13
13
|
|
|
14
|
+
const config = require("./publisher-config");
|
|
14
15
|
const {
|
|
15
16
|
getClientImpl,
|
|
16
17
|
Client,
|
|
@@ -25,38 +26,19 @@ const {
|
|
|
25
26
|
AmpConfig,
|
|
26
27
|
} = require("./impl/api-client-impl");
|
|
27
28
|
|
|
28
|
-
let config = require("./publisher-config");
|
|
29
|
-
|
|
30
29
|
const defaultClient = new Client(config.sketches_host);
|
|
31
30
|
const cachedSecondaryClients = {};
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
async function mappingHost() {
|
|
38
|
-
if (enableSketchesHostResolution && xHostAPIToken && hostInternalDomain) {
|
|
39
|
-
const hostMapping = {};
|
|
40
|
-
const sketchesHostMapping = await defaultClient.getHostToAPIMappingCache(xHostAPIToken);
|
|
41
|
-
|
|
42
|
-
for (const [key, value] of Object.entries(sketchesHostMapping)) {
|
|
43
|
-
hostMapping[key] = `http://${value}${hostInternalDomain}`;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
config.host_to_api_host = { ...hostMapping, ...config["host_to_api_host"] };
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async function getClient(hostname) {
|
|
51
|
-
await mappingHost();
|
|
52
|
-
return getClientImpl(config, cachedSecondaryClients, hostname) || defaultClient;
|
|
32
|
+
function getClient(hostname) {
|
|
33
|
+
return (
|
|
34
|
+
getClientImpl(config, cachedSecondaryClients, hostname) || defaultClient
|
|
35
|
+
);
|
|
53
36
|
}
|
|
54
37
|
|
|
55
|
-
|
|
56
|
-
await mappingHost();
|
|
38
|
+
function initializeAllClients() {
|
|
57
39
|
const promises = [defaultClient.getConfig()];
|
|
58
40
|
if (!config.skip_warm_config) {
|
|
59
|
-
Object.entries(config
|
|
41
|
+
Object.entries(config.host_to_api_host || []).forEach(([host, apiHost]) => {
|
|
60
42
|
const client = new Client(apiHost);
|
|
61
43
|
cachedSecondaryClients[host] = client;
|
|
62
44
|
promises.push(client.getConfig());
|