@quintype/framework 7.30.9-host-to-api.0 → 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,
|
|
@@ -28,31 +29,16 @@ const {
|
|
|
28
29
|
const defaultClient = new Client(config.sketches_host);
|
|
29
30
|
const cachedSecondaryClients = {};
|
|
30
31
|
|
|
31
|
-
let config = require("./publisher-config");
|
|
32
|
-
|
|
33
|
-
const xHostAPIToken = config["x_host_mapping_token"];
|
|
34
|
-
const hostInternalDomain = config["x_host_internal_domain"];
|
|
35
|
-
const enableSketchesHostResolution = config["x_enable_sketches_host_resolution"];
|
|
36
|
-
|
|
37
|
-
if (enableSketchesHostResolution && xHostAPIToken && hostInternalDomain) {
|
|
38
|
-
const hostMapping = {};
|
|
39
|
-
const sketchesHostMapping = Client.getHostToAPIMappingCache(xHostAPIToken);
|
|
40
|
-
|
|
41
|
-
for (const [key, value] of Object.entries(sketchesHostMapping)) {
|
|
42
|
-
hostMapping[key] = `http://${value}${hostInternalDomain}`;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
config.host_to_api_host = { ...hostMapping, ...config["host_to_api_host"] };
|
|
46
|
-
}
|
|
47
|
-
|
|
48
32
|
function getClient(hostname) {
|
|
49
|
-
return
|
|
33
|
+
return (
|
|
34
|
+
getClientImpl(config, cachedSecondaryClients, hostname) || defaultClient
|
|
35
|
+
);
|
|
50
36
|
}
|
|
51
37
|
|
|
52
38
|
function initializeAllClients() {
|
|
53
39
|
const promises = [defaultClient.getConfig()];
|
|
54
40
|
if (!config.skip_warm_config) {
|
|
55
|
-
Object.entries(config
|
|
41
|
+
Object.entries(config.host_to_api_host || []).forEach(([host, apiHost]) => {
|
|
56
42
|
const client = new Client(apiHost);
|
|
57
43
|
cachedSecondaryClients[host] = client;
|
|
58
44
|
promises.push(client.getConfig());
|