@griddo/cx 11.7.6 → 11.7.7-rc.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/README.md +27 -226
- package/build/adapters/gatsby/actions/clean.js +10 -0
- package/build/adapters/gatsby/actions/clean.js.map +1 -0
- package/build/adapters/gatsby/actions/close.js +12 -0
- package/build/adapters/gatsby/actions/close.js.map +1 -0
- package/build/adapters/gatsby/actions/data.js +18 -0
- package/build/adapters/gatsby/actions/data.js.map +1 -0
- package/build/adapters/gatsby/actions/healthCheck.js +10 -0
- package/build/adapters/gatsby/actions/healthCheck.js.map +1 -0
- package/build/adapters/gatsby/actions/init.js +9 -0
- package/build/adapters/gatsby/actions/init.js.map +1 -0
- package/build/adapters/gatsby/actions/meta.js +14 -0
- package/build/adapters/gatsby/actions/meta.js.map +1 -0
- package/build/adapters/gatsby/actions/prepare.js +9 -0
- package/build/adapters/gatsby/actions/prepare.js.map +1 -0
- package/build/adapters/gatsby/actions/relocation.js +15 -0
- package/build/adapters/gatsby/actions/relocation.js.map +1 -0
- package/build/adapters/gatsby/actions/restore.js +26 -0
- package/build/adapters/gatsby/actions/restore.js.map +1 -0
- package/build/adapters/gatsby/actions/ssg.js +9 -0
- package/build/adapters/gatsby/actions/ssg.js.map +1 -0
- package/build/adapters/gatsby/actions/sync.js +51 -0
- package/build/adapters/gatsby/actions/sync.js.map +1 -0
- package/build/adapters/gatsby/index.js +79 -0
- package/build/adapters/gatsby/index.js.map +1 -0
- package/build/adapters/gatsby/shared/context.js +31 -0
- package/build/adapters/gatsby/shared/context.js.map +1 -0
- package/build/adapters/gatsby/shared/diff-assets.js +101 -0
- package/build/adapters/gatsby/shared/diff-assets.js.map +1 -0
- package/build/adapters/gatsby/shared/extract-assets.js +58 -0
- package/build/adapters/gatsby/shared/extract-assets.js.map +1 -0
- package/build/adapters/gatsby/shared/gatsby-build.js +49 -0
- package/build/adapters/gatsby/shared/gatsby-build.js.map +1 -0
- package/build/adapters/gatsby/shared/sync-render.js +210 -0
- package/build/adapters/gatsby/shared/sync-render.js.map +1 -0
- package/build/adapters/gatsby/shared/types.js +3 -0
- package/build/adapters/gatsby/shared/types.js.map +1 -0
- package/build/commands/end-render.js +88 -0
- package/build/commands/end-render.js.map +1 -0
- package/build/commands/prepare-assets-directory.js +32 -0
- package/build/commands/prepare-assets-directory.js.map +1 -0
- package/build/commands/prepare-domains-render.js +133 -0
- package/build/commands/prepare-domains-render.js.map +1 -0
- package/build/commands/reset-render.js +22 -0
- package/build/commands/reset-render.js.map +1 -0
- package/build/commands/start-render.js +45 -0
- package/build/commands/start-render.js.map +1 -0
- package/build/commands/upload-search-content.js +180 -0
- package/build/commands/upload-search-content.js.map +1 -0
- package/build/constants/endpoints.js +42 -0
- package/build/constants/endpoints.js.map +1 -0
- package/build/constants/envs.js +68 -0
- package/build/constants/envs.js.map +1 -0
- package/build/constants/errors.js +81 -0
- package/build/constants/errors.js.map +1 -0
- package/build/services/auth.js +40 -0
- package/build/services/auth.js.map +1 -0
- package/build/services/db-class.js +49 -0
- package/build/services/db-class.js.map +1 -0
- package/build/services/db.js +34 -0
- package/build/services/db.js.map +1 -0
- package/build/services/navigation.js +96 -0
- package/build/services/navigation.js.map +1 -0
- package/build/services/reference-fields.js +131 -0
- package/build/services/reference-fields.js.map +1 -0
- package/build/services/robots.js +60 -0
- package/build/services/robots.js.map +1 -0
- package/build/services/sites.js +109 -0
- package/build/services/sites.js.map +1 -0
- package/build/services/store.js +282 -0
- package/build/services/store.js.map +1 -0
- package/build/types/api.js +3 -0
- package/build/types/api.js.map +1 -0
- package/build/types/global.js +3 -0
- package/build/types/global.js.map +1 -0
- package/build/types/navigation.js +3 -0
- package/build/types/navigation.js.map +1 -0
- package/build/types/pages.js +3 -0
- package/build/types/pages.js.map +1 -0
- package/build/types/render.js +10 -0
- package/build/types/render.js.map +1 -0
- package/build/types/sites.js +3 -0
- package/build/types/sites.js.map +1 -0
- package/build/types/templates.js +3 -0
- package/build/types/templates.js.map +1 -0
- package/build/utils/api.js +161 -0
- package/build/utils/api.js.map +1 -0
- package/build/utils/artifacts.js +34 -0
- package/build/utils/artifacts.js.map +1 -0
- package/build/utils/brush.js +30 -0
- package/build/utils/brush.js.map +1 -0
- package/build/utils/cache.js +106 -0
- package/build/utils/cache.js.map +1 -0
- package/build/utils/check-health.js +68 -0
- package/build/utils/check-health.js.map +1 -0
- package/build/utils/core-utils.js +283 -0
- package/build/utils/core-utils.js.map +1 -0
- package/build/utils/domains.js +37 -0
- package/build/utils/domains.js.map +1 -0
- package/build/utils/errors.js +30 -0
- package/build/utils/errors.js.map +1 -0
- package/build/utils/folders.js +362 -0
- package/build/utils/folders.js.map +1 -0
- package/build/utils/images.js +45 -0
- package/build/utils/images.js.map +1 -0
- package/build/utils/instance.js +66 -0
- package/build/utils/instance.js.map +1 -0
- package/build/utils/loggin.js +108 -0
- package/build/utils/loggin.js.map +1 -0
- package/build/utils/pages.js +359 -0
- package/build/utils/pages.js.map +1 -0
- package/build/utils/render.js +144 -0
- package/build/utils/render.js.map +1 -0
- package/build/utils/sites.js +240 -0
- package/build/utils/sites.js.map +1 -0
- package/build/utils/store.js +193 -0
- package/build/utils/store.js.map +1 -0
- package/exporter/adapters/gatsby/actions/clean.ts +14 -0
- package/exporter/adapters/gatsby/actions/close.ts +17 -0
- package/exporter/adapters/gatsby/actions/data.ts +25 -0
- package/exporter/adapters/gatsby/actions/healthCheck.ts +10 -0
- package/exporter/adapters/gatsby/actions/init.ts +12 -0
- package/exporter/adapters/gatsby/actions/meta.ts +18 -0
- package/exporter/adapters/gatsby/actions/prepare.ts +9 -0
- package/exporter/adapters/gatsby/actions/relocation.ts +15 -0
- package/exporter/adapters/gatsby/actions/restore.ts +36 -0
- package/exporter/adapters/gatsby/actions/ssg.ts +12 -0
- package/exporter/adapters/gatsby/actions/sync.ts +71 -0
- package/exporter/adapters/gatsby/index.ts +67 -147
- package/exporter/adapters/gatsby/shared/context.ts +50 -0
- package/exporter/adapters/gatsby/shared/diff-assets.ts +113 -0
- package/exporter/adapters/gatsby/shared/extract-assets.ts +61 -0
- package/exporter/adapters/gatsby/shared/gatsby-build.ts +54 -0
- package/exporter/adapters/gatsby/shared/sync-render.ts +276 -0
- package/exporter/adapters/gatsby/shared/types.ts +35 -0
- package/exporter/build-esbuild.noop +42 -0
- package/exporter/build.sh +4 -38
- package/exporter/commands/end-render.ts +73 -69
- package/exporter/commands/prepare-assets-directory.ts +33 -0
- package/exporter/commands/prepare-domains-render.ts +144 -31
- package/exporter/commands/reset-render.ts +10 -1
- package/exporter/commands/start-render.ts +23 -44
- package/exporter/commands/upload-search-content.ts +194 -20
- package/exporter/constants/envs.ts +57 -55
- package/exporter/{errors/errors-data.ts → constants/errors.ts} +24 -14
- package/exporter/services/auth.ts +7 -6
- package/exporter/services/db-class.ts +54 -0
- package/exporter/services/db.ts +32 -0
- package/exporter/services/navigation.ts +4 -10
- package/exporter/services/reference-fields.ts +8 -23
- package/exporter/services/robots.ts +9 -16
- package/exporter/services/sites.ts +35 -24
- package/exporter/services/store.ts +120 -78
- package/exporter/types/api.ts +24 -27
- package/exporter/types/global.ts +7 -10
- package/exporter/types/navigation.ts +1 -1
- package/exporter/types/pages.ts +2 -3
- package/exporter/types/render.ts +59 -0
- package/exporter/types/sites.ts +1 -2
- package/exporter/utils/api.ts +46 -82
- package/exporter/utils/artifacts.ts +34 -0
- package/exporter/utils/brush.ts +34 -0
- package/exporter/utils/cache.ts +37 -62
- package/exporter/utils/check-health.ts +79 -0
- package/exporter/utils/core-utils.ts +129 -248
- package/exporter/utils/domains.ts +10 -7
- package/exporter/{errors/index.ts → utils/errors.ts} +10 -9
- package/exporter/utils/folders.ts +187 -95
- package/exporter/utils/images.ts +1 -6
- package/exporter/utils/instance.ts +9 -12
- package/exporter/utils/loggin.ts +32 -91
- package/exporter/utils/pages.ts +23 -88
- package/exporter/utils/render.ts +149 -48
- package/exporter/utils/sites.ts +81 -90
- package/exporter/utils/store.ts +87 -180
- package/gatsby-browser.tsx +41 -58
- package/gatsby-config.ts +6 -12
- package/gatsby-node.ts +15 -77
- package/gatsby-ssr.tsx +2 -1
- package/package.json +36 -78
- package/plugins/gatsby-plugin-svgr-loader/gatsby-node.js +55 -0
- package/plugins/gatsby-plugin-svgr-loader/package.json +8 -0
- package/{exporter/react → react}/Favicon/index.tsx +1 -7
- package/{exporter/react → react}/GriddoIntegrations/index.tsx +6 -14
- package/{exporter/react → react}/GriddoIntegrations/utils.ts +4 -9
- package/{build/react/index.d.ts → react/index.tsx} +1 -0
- package/src/components/Head.tsx +13 -46
- package/src/components/template.tsx +8 -30
- package/src/gatsby-node-utils.ts +91 -2
- package/src/html.tsx +2 -11
- package/src/types.ts +5 -5
- package/tsconfig.json +5 -3
- package/build/adapters/gatsby/index.d.ts +0 -4
- package/build/adapters/gatsby/utils.d.ts +0 -22
- package/build/artifacts/index.d.ts +0 -6
- package/build/commands/end-render.d.ts +0 -2
- package/build/commands/move-assets.d.ts +0 -1
- package/build/commands/prepare-domains-render.d.ts +0 -1
- package/build/commands/reset-render.d.ts +0 -2
- package/build/commands/start-render.d.ts +0 -2
- package/build/commands/upload-search-content.d.ts +0 -2
- package/build/constants/endpoints.d.ts +0 -19
- package/build/constants/envs.d.ts +0 -37
- package/build/constants/index.d.ts +0 -57
- package/build/end-render.js +0 -74
- package/build/end-render.js.map +0 -7
- package/build/errors/errors-data.d.ts +0 -22
- package/build/errors/index.d.ts +0 -15
- package/build/index.d.ts +0 -29
- package/build/index.js +0 -73
- package/build/index.js.map +0 -7
- package/build/prepare-domains-render.js +0 -73
- package/build/prepare-domains-render.js.map +0 -7
- package/build/react/Favicon/index.d.ts +0 -5
- package/build/react/Favicon/utils.d.ts +0 -9
- package/build/react/GriddoIntegrations/index.d.ts +0 -20
- package/build/react/GriddoIntegrations/utils.d.ts +0 -26
- package/build/react/index.js +0 -3
- package/build/registers/api.d.ts +0 -9
- package/build/registers/gatsby.d.ts +0 -9
- package/build/registers/index.d.ts +0 -3
- package/build/reset-render.js +0 -74
- package/build/reset-render.js.map +0 -7
- package/build/services/auth.d.ts +0 -10
- package/build/services/domains.d.ts +0 -6
- package/build/services/navigation.d.ts +0 -50
- package/build/services/reference-fields.d.ts +0 -20
- package/build/services/register.d.ts +0 -36
- package/build/services/robots.d.ts +0 -19
- package/build/services/settings.d.ts +0 -4
- package/build/services/sites.d.ts +0 -29
- package/build/services/store.d.ts +0 -6
- package/build/start-render.js +0 -100
- package/build/start-render.js.map +0 -7
- package/build/types/api.d.ts +0 -142
- package/build/types/global.d.ts +0 -84
- package/build/types/navigation.d.ts +0 -28
- package/build/types/pages.d.ts +0 -144
- package/build/types/sites.d.ts +0 -57
- package/build/types/templates.d.ts +0 -8
- package/build/upload-search-content.js +0 -74
- package/build/upload-search-content.js.map +0 -7
- package/build/utils/alerts.d.ts +0 -3
- package/build/utils/api.d.ts +0 -23
- package/build/utils/cache.d.ts +0 -35
- package/build/utils/core-utils.d.ts +0 -107
- package/build/utils/create-build-data.d.ts +0 -8
- package/build/utils/domains.d.ts +0 -13
- package/build/utils/folders.d.ts +0 -53
- package/build/utils/health-checks.d.ts +0 -7
- package/build/utils/images.d.ts +0 -16
- package/build/utils/instance.d.ts +0 -21
- package/build/utils/loggin.d.ts +0 -51
- package/build/utils/pages.d.ts +0 -34
- package/build/utils/render.d.ts +0 -13
- package/build/utils/searches.d.ts +0 -15
- package/build/utils/sites.d.ts +0 -31
- package/build/utils/store.d.ts +0 -81
- package/cx.config.d.ts +0 -5
- package/cx.config.js +0 -36
- package/exporter/adapters/gatsby/utils.ts +0 -161
- package/exporter/artifacts/README.md +0 -34
- package/exporter/artifacts/index.ts +0 -33
- package/exporter/commands/move-assets.ts +0 -11
- package/exporter/constants/index.ts +0 -129
- package/exporter/index.ts +0 -82
- package/exporter/react/index.tsx +0 -11
- package/exporter/registers/api.ts +0 -14
- package/exporter/registers/gatsby.ts +0 -14
- package/exporter/registers/index.ts +0 -4
- package/exporter/services/domains.ts +0 -16
- package/exporter/services/register.ts +0 -113
- package/exporter/services/settings.ts +0 -17
- package/exporter/utils/alerts.ts +0 -29
- package/exporter/utils/create-build-data.ts +0 -17
- package/exporter/utils/health-checks.ts +0 -64
- package/exporter/utils/searches.ts +0 -156
- package/src/README.md +0 -7
- package/start-render.js +0 -7
- /package/{exporter/react → react}/Favicon/utils.ts +0 -0
|
@@ -1,67 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
* Here are all the environment variables that the CX code uses.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import dotenv from "dotenv";
|
|
1
|
+
// Here are all the environment variables that the CX code uses.
|
|
6
2
|
|
|
7
3
|
import { isTruthy } from "../utils/core-utils";
|
|
8
4
|
|
|
9
|
-
dotenv.config();
|
|
10
|
-
|
|
11
|
-
//
|
|
12
5
|
// Credentials
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/* prettier-ignore */ const GRIDDO_BOT_PASSWORD = process.env.botPassword|| process.env.GRIDDO_BOT_PASSWORD;
|
|
6
|
+
const GRIDDO_API_URL = process.env.GRIDDO_API_URL || process.env.API_URL;
|
|
7
|
+
const GRIDDO_PUBLIC_API_URL = process.env.GRIDDO_PUBLIC_API_URL || process.env.PUBLIC_API_URL;
|
|
8
|
+
const GRIDDO_BOT_USER = process.env.botEmail || process.env.GRIDDO_BOT_USER;
|
|
9
|
+
const GRIDDO_BOT_PASSWORD = process.env.botPassword || process.env.GRIDDO_BOT_PASSWORD;
|
|
18
10
|
|
|
19
|
-
//
|
|
20
11
|
// Rendering
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
12
|
+
const GRIDDO_API_CONCURRENCY_COUNT = Number.parseInt(
|
|
13
|
+
process.env.GRIDDO_API_CONCURRENCY_COUNT || "10",
|
|
14
|
+
);
|
|
15
|
+
const GRIDDO_RENDER_ALL_SITES = isTruthy(
|
|
16
|
+
process.env.GRIDDO_RENDER_ALL_SITES || process.env.updateAllSites,
|
|
17
|
+
);
|
|
18
|
+
const GRIDDO_RENDER_SITE = Number.parseInt(process.env.GRIDDO_RENDER_SITE || "");
|
|
19
|
+
const GRIDDO_RENDER_PAGES = (process.env.GRIDDO_RENDER_PAGES || "")
|
|
20
|
+
.split(",")
|
|
21
|
+
.map((item) => Number.parseInt(item))
|
|
22
|
+
.filter(Boolean);
|
|
23
|
+
const GRIDDO_SKIP_BUILD_CHECKS = isTruthy(process.env.GRIDDO_SKIP_BUILD_CHECKS);
|
|
24
|
+
const GRIDDO_DEBUG_LOGS = isTruthy(process.env.GRIDDO_DEBUG_LOGS);
|
|
25
|
+
const GRIDDO_BUILD_LOGS = isTruthy(process.env.GRIDDO_BUILD_LOGS);
|
|
26
|
+
const GRIDDO_RENDER_BREAKPOINTS_FEATURE = isTruthy(process.env.GRIDDO_RENDER_BREAKPOINTS_FEATURE);
|
|
27
|
+
const GRIDDO_SSG_VERBOSE_LOGS = isTruthy(process.env.GRIDDO_SSG_VERBOSE_LOGS);
|
|
28
|
+
const GRIDDO_SEARCH_FEATURE = isTruthy(process.env.GRIDDO_SEARCH_FEATURE);
|
|
29
|
+
const GRIDDO_ASSET_PREFIX = process.env.GRIDDO_ASSET_PREFIX || process.env.ASSET_PREFIX;
|
|
30
|
+
const GRIDDO_REACT_APP_INSTANCE =
|
|
31
|
+
process.env.GRIDDO_REACT_APP_INSTANCE || process.env.REACT_APP_INSTANCE;
|
|
32
|
+
const GRIDDO_AI_EMBEDDINGS = isTruthy(process.env.GRIDDO_AI_EMBEDDINGS);
|
|
33
|
+
const GRIDDO_VERBOSE_LOGS = isTruthy(process.env.GRIDDO_VERBOSE_LOGS);
|
|
39
34
|
|
|
40
|
-
//
|
|
41
35
|
// LifeCycle
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
36
|
+
const GRIDDO_INIT_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(
|
|
37
|
+
process.env.GRIDDO_INIT_LIFECYCLE_MAX_ATTEMPTS || "1",
|
|
38
|
+
);
|
|
39
|
+
const GRIDDO_CLEAN_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(
|
|
40
|
+
process.env.GRIDDO_CLEAN_LIFECYCLE_MAX_ATTEMPTS || "1",
|
|
41
|
+
);
|
|
42
|
+
const GRIDDO_CLOSE_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(
|
|
43
|
+
process.env.GRIDDO_CLOSE_LIFECYCLE_MAX_ATTEMPTS || "1",
|
|
44
|
+
);
|
|
45
|
+
const GRIDDO_PREPARE_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(
|
|
46
|
+
process.env.GRIDDO_PREPARE_LIFECYCLE_MAX_ATTEMPTS || "1",
|
|
47
|
+
);
|
|
48
|
+
const GRIDDO_RESTORE_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(
|
|
49
|
+
process.env.GRIDDO_RESTORE_LIFECYCLE_MAX_ATTEMPTS || "1",
|
|
50
|
+
);
|
|
51
|
+
const GRIDDO_DATA_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(
|
|
52
|
+
process.env.GRIDDO_DATA_LIFECYCLE_MAX_ATTEMPTS || "1",
|
|
53
|
+
);
|
|
54
|
+
const GRIDDO_SSG_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(
|
|
55
|
+
process.env.GRIDDO_SSG_LIFECYCLE_MAX_ATTEMPTS || "2",
|
|
56
|
+
);
|
|
57
|
+
const GRIDDO_RELOCATION_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(
|
|
58
|
+
process.env.GRIDDO_RELOCATION_LIFECYCLE_MAX_ATTEMPTS || "1",
|
|
59
|
+
);
|
|
60
|
+
const GRIDDO_META_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(
|
|
61
|
+
process.env.GRIDDO_META_LIFECYCLE_MAX_ATTEMPTS || "4",
|
|
62
|
+
);
|
|
63
|
+
const GRIDDO_ARCHIVE_LIFECYCLE_MAX_ATTEMPTS = Number.parseInt(
|
|
64
|
+
process.env.GRIDDO_ARCHIVE_LIFECYCLE_MAX_ATTEMPTS || "1",
|
|
65
|
+
);
|
|
59
66
|
|
|
60
67
|
export {
|
|
61
68
|
GRIDDO_AI_EMBEDDINGS,
|
|
62
|
-
GRIDDO_ALERT_FEATURE,
|
|
63
69
|
GRIDDO_API_CONCURRENCY_COUNT,
|
|
64
|
-
GRIDDO_API_MAX_RESPONSE_SIZE,
|
|
65
70
|
GRIDDO_API_URL,
|
|
66
71
|
GRIDDO_ARCHIVE_LIFECYCLE_MAX_ATTEMPTS,
|
|
67
72
|
GRIDDO_ASSET_PREFIX,
|
|
@@ -72,8 +77,6 @@ export {
|
|
|
72
77
|
GRIDDO_CLOSE_LIFECYCLE_MAX_ATTEMPTS,
|
|
73
78
|
GRIDDO_DATA_LIFECYCLE_MAX_ATTEMPTS,
|
|
74
79
|
GRIDDO_DEBUG_LOGS,
|
|
75
|
-
GRIDDO_FIXTURES_DOMAIN_NAMES,
|
|
76
|
-
GRIDDO_FIXTURES_SITE_NAMES,
|
|
77
80
|
GRIDDO_INIT_LIFECYCLE_MAX_ATTEMPTS,
|
|
78
81
|
GRIDDO_META_LIFECYCLE_MAX_ATTEMPTS,
|
|
79
82
|
GRIDDO_PREPARE_LIFECYCLE_MAX_ATTEMPTS,
|
|
@@ -88,7 +91,6 @@ export {
|
|
|
88
91
|
GRIDDO_SEARCH_FEATURE,
|
|
89
92
|
GRIDDO_SKIP_BUILD_CHECKS,
|
|
90
93
|
GRIDDO_SSG_LIFECYCLE_MAX_ATTEMPTS,
|
|
91
|
-
GRIDDO_SSG_MAX_PAGE_SIZE,
|
|
92
94
|
GRIDDO_SSG_VERBOSE_LOGS,
|
|
93
95
|
GRIDDO_VERBOSE_LOGS,
|
|
94
96
|
};
|
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
* obligatorily.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type { ErrorData } from ".";
|
|
11
10
|
import type { SpawnSyncReturns } from "node:child_process";
|
|
11
|
+
import type { ErrorData } from "../utils/errors";
|
|
12
12
|
|
|
13
13
|
type ErrorsType =
|
|
14
14
|
| "ArtifactError"
|
|
15
|
+
| "BundlesInconsistencyError"
|
|
16
|
+
| "CheckHealthError"
|
|
15
17
|
| "ErrorInSSGBuildProcess"
|
|
16
18
|
| "LifecycleExecutionError"
|
|
17
19
|
| "LoginError"
|
|
@@ -20,6 +22,7 @@ type ErrorsType =
|
|
|
20
22
|
| "ReadFromStoreError"
|
|
21
23
|
| "ReferenceFieldSourcesNotFoundError"
|
|
22
24
|
| "RenderUUIDError"
|
|
25
|
+
| "UploadSearchError"
|
|
23
26
|
| "WriteToStoreError";
|
|
24
27
|
|
|
25
28
|
const ArtifactError: ErrorData = {
|
|
@@ -30,19 +33,13 @@ const ArtifactError: ErrorData = {
|
|
|
30
33
|
hint: "Have there been any recent deployments? These can delete directories from the current render.",
|
|
31
34
|
};
|
|
32
35
|
|
|
33
|
-
const ErrorInSSGBuildProcess = (
|
|
34
|
-
command: SpawnSyncReturns<string>,
|
|
35
|
-
): ErrorData => ({
|
|
36
|
+
const ErrorInSSGBuildProcess = (command: SpawnSyncReturns<string>): ErrorData => ({
|
|
36
37
|
error: "ErrorInSSGBuildProcess",
|
|
37
38
|
message: `Error in SSG build process: ${JSON.stringify(command)}`,
|
|
38
|
-
expected:
|
|
39
|
-
"This can happen if there was a problem with the SSG build process.",
|
|
39
|
+
expected: "This can happen if there was a problem with the SSG build process.",
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
const LifecycleExecutionError = (
|
|
43
|
-
attempts: number,
|
|
44
|
-
name: string,
|
|
45
|
-
): ErrorData => ({
|
|
42
|
+
const LifecycleExecutionError = (attempts: number, name: string): ErrorData => ({
|
|
46
43
|
error: "LifecycleExecutionError",
|
|
47
44
|
message: `Exceeded maximum retry attempts (${attempts}) for ${name} LifeCycle`,
|
|
48
45
|
});
|
|
@@ -50,14 +47,12 @@ const LifecycleExecutionError = (
|
|
|
50
47
|
const LoginError: ErrorData = {
|
|
51
48
|
error: "LoginError",
|
|
52
49
|
message: "There was a problem logging in to the API",
|
|
53
|
-
expected:
|
|
54
|
-
"This happens if the API is currently not working or the credentials are incorrect.",
|
|
50
|
+
expected: "This happens if the API is currently not working or the credentials are incorrect.",
|
|
55
51
|
};
|
|
56
52
|
|
|
57
53
|
const NoDomainsFoundError: ErrorData = {
|
|
58
54
|
error: "NoDomainsFoundError",
|
|
59
|
-
message:
|
|
60
|
-
"No domains were found in this instance. The process cannot continue.",
|
|
55
|
+
message: "No domains were found in this instance. The process cannot continue.",
|
|
61
56
|
expected:
|
|
62
57
|
"This may happen if the API is not functioning, or the site is not properly configured, or the domains are not registered.",
|
|
63
58
|
hint: "You can contact the instance administrator.",
|
|
@@ -98,8 +93,22 @@ const WriteToStoreError: ErrorData = {
|
|
|
98
93
|
hint: "There may be an issue such as lack of space or permissions preventing the file from being written.",
|
|
99
94
|
};
|
|
100
95
|
|
|
96
|
+
const UploadSearchError: ErrorData = {
|
|
97
|
+
error: "UploadSearchError",
|
|
98
|
+
message: "There was an error uploading content to API for search",
|
|
99
|
+
hint: "This happens if the API is currently not working or the credentials are incorrect.",
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const CheckHealthError: ErrorData = {
|
|
103
|
+
error: "CheckHealthError",
|
|
104
|
+
message: "There was a problem with environment vars configuration.",
|
|
105
|
+
expected: "Some of the required environment variables are not set correctly or are missing",
|
|
106
|
+
hint: "Are the environment variables correctly set?",
|
|
107
|
+
};
|
|
108
|
+
|
|
101
109
|
export {
|
|
102
110
|
ArtifactError,
|
|
111
|
+
CheckHealthError,
|
|
103
112
|
ErrorInSSGBuildProcess,
|
|
104
113
|
LifecycleExecutionError,
|
|
105
114
|
LoginError,
|
|
@@ -108,6 +117,7 @@ export {
|
|
|
108
117
|
ReadFromStoreError,
|
|
109
118
|
ReferenceFieldSourcesNotFoundError,
|
|
110
119
|
RenderUUIDError,
|
|
120
|
+
UploadSearchError,
|
|
111
121
|
WriteToStoreError,
|
|
112
122
|
type ErrorsType,
|
|
113
123
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { AuthHeaders } from "../types/api";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { LoginError } from "../
|
|
3
|
+
import { LOGIN } from "../constants/endpoints";
|
|
4
|
+
import { GRIDDO_BOT_PASSWORD, GRIDDO_BOT_USER } from "../constants/envs";
|
|
5
|
+
import { LoginError } from "../constants/errors";
|
|
6
|
+
import { throwError } from "../utils/errors";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Service for authentication in the Griddo Private API
|
|
@@ -12,12 +13,12 @@ class AuthService {
|
|
|
12
13
|
|
|
13
14
|
async login() {
|
|
14
15
|
try {
|
|
15
|
-
const response = await fetch(
|
|
16
|
+
const response = await fetch(LOGIN, {
|
|
16
17
|
method: "POST",
|
|
17
18
|
headers: { "Content-Type": "application/json", Connection: "close" },
|
|
18
19
|
body: JSON.stringify({
|
|
19
|
-
username:
|
|
20
|
-
password:
|
|
20
|
+
username: GRIDDO_BOT_USER,
|
|
21
|
+
password: GRIDDO_BOT_PASSWORD,
|
|
21
22
|
}),
|
|
22
23
|
});
|
|
23
24
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { RenderDB } from "../types/render";
|
|
2
|
+
|
|
3
|
+
import fsp from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
|
|
6
|
+
import { pkgDirSync } from "../utils/folders";
|
|
7
|
+
|
|
8
|
+
// Interfaz para abstraer la DB
|
|
9
|
+
export interface Database {
|
|
10
|
+
read(): Promise<RenderDB>;
|
|
11
|
+
write(renderDB: RenderDB): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export class JsonDatabase implements Database {
|
|
15
|
+
private readonly dbFilePath: string;
|
|
16
|
+
|
|
17
|
+
constructor(customDBPath?: string) {
|
|
18
|
+
this.dbFilePath =
|
|
19
|
+
customDBPath ??
|
|
20
|
+
path.join(
|
|
21
|
+
pkgDirSync({ cwd: path.resolve(__dirname, "../../..") }) ?? "",
|
|
22
|
+
".cx-cache",
|
|
23
|
+
"db.json",
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async read(customDBFilePath?: string): Promise<RenderDB> {
|
|
28
|
+
try {
|
|
29
|
+
const raw = await fsp.readFile(customDBFilePath || this.dbFilePath, "utf-8");
|
|
30
|
+
return JSON.parse(raw) as RenderDB;
|
|
31
|
+
} catch (error) {
|
|
32
|
+
if (error instanceof Error) {
|
|
33
|
+
console.error(`Error reading DB file at ${this.dbFilePath}:`, error.message);
|
|
34
|
+
} else {
|
|
35
|
+
console.error(`Unknown error reading DB file at ${this.dbFilePath}:`, error);
|
|
36
|
+
}
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async write(renderDB: RenderDB): Promise<void> {
|
|
42
|
+
try {
|
|
43
|
+
await fsp.mkdir(path.dirname(this.dbFilePath), { recursive: true });
|
|
44
|
+
await fsp.writeFile(this.dbFilePath, JSON.stringify(renderDB, null, 2));
|
|
45
|
+
} catch (error) {
|
|
46
|
+
if (error instanceof Error) {
|
|
47
|
+
console.error(`Error writing to DB file at ${this.dbFilePath}:`, error.message);
|
|
48
|
+
} else {
|
|
49
|
+
console.error(`Unknown error writing to DB file at ${this.dbFilePath}:`, error);
|
|
50
|
+
}
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { RenderDB } from "../types/render";
|
|
2
|
+
|
|
3
|
+
import fsp from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
|
|
6
|
+
import { pkgDirSync } from "../utils/folders";
|
|
7
|
+
|
|
8
|
+
const root = pkgDirSync({ cwd: path.resolve(__dirname, "../../..") }) || "";
|
|
9
|
+
const cache = path.join(root, ".cx-cache");
|
|
10
|
+
const dbFilePath = path.join(cache, "db.json");
|
|
11
|
+
|
|
12
|
+
async function readDB(customDBPath = "") {
|
|
13
|
+
const file = customDBPath || dbFilePath;
|
|
14
|
+
try {
|
|
15
|
+
return JSON.parse(await fsp.readFile(file, "utf-8")) as RenderDB;
|
|
16
|
+
} catch (error) {
|
|
17
|
+
console.error(`Failed to read DB file at ${file}:`, error);
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async function writeDB(renderDB: RenderDB, customDBPath = "") {
|
|
23
|
+
const file = customDBPath || dbFilePath;
|
|
24
|
+
try {
|
|
25
|
+
await fsp.writeFile(file, JSON.stringify(renderDB));
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error(`Failed to write DB file at ${file}:`, error);
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { readDB, writeDB };
|
|
@@ -68,9 +68,7 @@ class NavigationService {
|
|
|
68
68
|
const rightLanguageItem = list.find(
|
|
69
69
|
(item) =>
|
|
70
70
|
item.language === language &&
|
|
71
|
-
item.navigationLanguages?.find(
|
|
72
|
-
(version) => version.navigationId === id,
|
|
73
|
-
),
|
|
71
|
+
item.navigationLanguages?.find((version) => version.navigationId === id),
|
|
74
72
|
);
|
|
75
73
|
|
|
76
74
|
const result = rightLanguageItem || list.find((item) => item.id === id);
|
|
@@ -87,13 +85,9 @@ class NavigationService {
|
|
|
87
85
|
}
|
|
88
86
|
|
|
89
87
|
getPageNavigations(page: APIPageObject) {
|
|
90
|
-
const {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
language,
|
|
94
|
-
template: { templateType },
|
|
95
|
-
templateConfig: { defaultHeader, defaultFooter, templates },
|
|
96
|
-
} = page;
|
|
88
|
+
const { header: pageHeader, footer: pageFooter, language, template, templateConfig } = page;
|
|
89
|
+
const { templateType } = template;
|
|
90
|
+
const { defaultHeader, defaultFooter, templates } = templateConfig;
|
|
97
91
|
|
|
98
92
|
// The navigations would be:
|
|
99
93
|
// - The one with the page or ...
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import type { Core, Fields } from "@griddo/core";
|
|
1
2
|
import type { FetchDataProps } from "../types/global";
|
|
2
3
|
import type { APIPageObject } from "../types/pages";
|
|
3
|
-
import type { Core, Fields } from "@griddo/core";
|
|
4
4
|
|
|
5
|
-
import { getReferenceFieldSiteData } from "./sites";
|
|
6
5
|
import { boxLog } from "../utils/loggin";
|
|
6
|
+
import { getReferenceFieldSiteData } from "./sites";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Get the body data from a ReferenceField.
|
|
@@ -54,9 +54,7 @@ function getBody(data: Fields.Reference<unknown>, page: Core.Page) {
|
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
console.log(
|
|
58
|
-
`Error: ReferenceField mode: ${mode} is not recognized on page ${page?.id}.`,
|
|
59
|
-
);
|
|
57
|
+
console.log(`Error: ReferenceField mode: ${mode} is not recognized on page ${page?.id}.`);
|
|
60
58
|
|
|
61
59
|
return data;
|
|
62
60
|
}
|
|
@@ -71,11 +69,8 @@ function getBody(data: Fields.Reference<unknown>, page: Core.Page) {
|
|
|
71
69
|
* @returns The ContentType data.
|
|
72
70
|
*/
|
|
73
71
|
async function fetchContentTypeData(props: FetchDataProps) {
|
|
74
|
-
const {
|
|
75
|
-
|
|
76
|
-
component: { data },
|
|
77
|
-
cacheKey,
|
|
78
|
-
} = props;
|
|
72
|
+
const { page, component, cacheKey } = props;
|
|
73
|
+
const { data } = component;
|
|
79
74
|
|
|
80
75
|
// Distrubutor with `hasDistributorData: true` / `getStaticData: true` but without `data` prop
|
|
81
76
|
if (!data) {
|
|
@@ -109,13 +104,7 @@ async function fetchContentTypeData(props: FetchDataProps) {
|
|
|
109
104
|
|
|
110
105
|
const body = getBody(data, page);
|
|
111
106
|
|
|
112
|
-
const response = await getReferenceFieldSiteData(
|
|
113
|
-
page,
|
|
114
|
-
body,
|
|
115
|
-
cacheKey,
|
|
116
|
-
site,
|
|
117
|
-
lang,
|
|
118
|
-
);
|
|
107
|
+
const response = await getReferenceFieldSiteData(page, body, cacheKey, site, lang);
|
|
119
108
|
|
|
120
109
|
return response;
|
|
121
110
|
}
|
|
@@ -165,10 +154,7 @@ async function getReferenceFieldData({
|
|
|
165
154
|
continue;
|
|
166
155
|
}
|
|
167
156
|
|
|
168
|
-
const _key = key as
|
|
169
|
-
| "hasDistributorData"
|
|
170
|
-
| "queriedItems"
|
|
171
|
-
| "getStaticData";
|
|
157
|
+
const _key = key as "hasDistributorData" | "queriedItems" | "getStaticData";
|
|
172
158
|
const component = templateChunk[_key] as unknown as {
|
|
173
159
|
data: Fields.Reference<unknown>;
|
|
174
160
|
queriedItems: Fields.QueriedData<unknown>;
|
|
@@ -181,8 +167,7 @@ async function getReferenceFieldData({
|
|
|
181
167
|
continue;
|
|
182
168
|
}
|
|
183
169
|
|
|
184
|
-
const componentHasRequestForData =
|
|
185
|
-
component.hasDistributorData || component.getStaticData;
|
|
170
|
+
const componentHasRequestForData = component.hasDistributorData || component.getStaticData;
|
|
186
171
|
|
|
187
172
|
if (componentHasRequestForData) {
|
|
188
173
|
component.queriedItems = await fetchContentTypeData({
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import type { Robots } from "../types/global";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import fsp from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { ROBOTS } from "../constants/endpoints";
|
|
7
7
|
import { get } from "../utils/api";
|
|
8
|
-
import {
|
|
8
|
+
import { pathExists } from "../utils/folders";
|
|
9
9
|
import { verboseLog } from "../utils/loggin";
|
|
10
|
+
import { getRenderPathsFromDB } from "../utils/render";
|
|
10
11
|
|
|
11
|
-
const config = getConfig();
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* TODO: JSDoc
|
|
15
|
-
*/
|
|
16
12
|
class RobotsService {
|
|
17
13
|
robots: Robots;
|
|
18
14
|
settings: Record<string, unknown>;
|
|
@@ -22,12 +18,9 @@ class RobotsService {
|
|
|
22
18
|
this.settings = {};
|
|
23
19
|
}
|
|
24
20
|
|
|
25
|
-
/**
|
|
26
|
-
* TODO: JSDoc
|
|
27
|
-
*/
|
|
28
21
|
private async getRobots() {
|
|
29
22
|
try {
|
|
30
|
-
const apiRobots = await get<Robots>({ endpoint:
|
|
23
|
+
const apiRobots = await get<Robots>({ endpoint: ROBOTS });
|
|
31
24
|
this.robots =
|
|
32
25
|
apiRobots
|
|
33
26
|
?.filter((r) => !!r.path)
|
|
@@ -44,8 +37,8 @@ class RobotsService {
|
|
|
44
37
|
* Write robots.txt files for the domain.
|
|
45
38
|
*/
|
|
46
39
|
async writeFiles(domain: string) {
|
|
47
|
-
const {
|
|
48
|
-
const distDirectory = path.join(
|
|
40
|
+
const { __root } = await getRenderPathsFromDB({ domain });
|
|
41
|
+
const distDirectory = path.join(__root, "dist");
|
|
49
42
|
|
|
50
43
|
await this.getRobots();
|
|
51
44
|
|
|
@@ -56,9 +49,9 @@ class RobotsService {
|
|
|
56
49
|
return;
|
|
57
50
|
}
|
|
58
51
|
|
|
59
|
-
if (
|
|
52
|
+
if (await pathExists(distDirectory)) {
|
|
60
53
|
const fileLocation = path.join(distDirectory, "robots.txt");
|
|
61
|
-
|
|
54
|
+
await fsp.writeFile(fileLocation, robot?.content);
|
|
62
55
|
verboseLog(`wrote robots.txt to ${fileLocation}`);
|
|
63
56
|
} else {
|
|
64
57
|
console.log(`${distDirectory} not found`);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Core } from "@griddo/core";
|
|
1
2
|
import type {
|
|
2
3
|
AllSitesReponse,
|
|
3
4
|
EndPageInfoResponse,
|
|
@@ -11,17 +12,26 @@ import type {
|
|
|
11
12
|
StartPageRenderResponse,
|
|
12
13
|
} from "../types/api";
|
|
13
14
|
import type { Site } from "../types/sites";
|
|
14
|
-
import type { Core } from "@griddo/core";
|
|
15
15
|
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
BUILD_END,
|
|
18
|
+
BUILD_START,
|
|
19
|
+
GET_ALL,
|
|
20
|
+
GET_PAGE,
|
|
21
|
+
GET_REFERENCE_FIELD_DATA,
|
|
22
|
+
GET_SITEMAP,
|
|
23
|
+
INFO,
|
|
24
|
+
LANGUAGES,
|
|
25
|
+
SOCIALS,
|
|
26
|
+
} from "../constants/endpoints";
|
|
17
27
|
import { get, post } from "../utils/api";
|
|
18
28
|
|
|
19
29
|
/**
|
|
20
30
|
* Get a list of site objects.
|
|
21
31
|
*/
|
|
22
32
|
async function getAllSites(domain: string) {
|
|
23
|
-
return
|
|
24
|
-
endpoint: `${
|
|
33
|
+
return get<AllSitesReponse>({
|
|
34
|
+
endpoint: `${GET_ALL}?domainSlug=${domain}`,
|
|
25
35
|
});
|
|
26
36
|
}
|
|
27
37
|
|
|
@@ -29,7 +39,7 @@ async function getAllSites(domain: string) {
|
|
|
29
39
|
* Get a list of site objects from a domain.
|
|
30
40
|
*/
|
|
31
41
|
async function getAllSitesFromDomain(domain: string) {
|
|
32
|
-
const allSites = await get<AllSitesReponse>({ endpoint:
|
|
42
|
+
const allSites = await get<AllSitesReponse>({ endpoint: GET_ALL });
|
|
33
43
|
|
|
34
44
|
if (allSites.length) {
|
|
35
45
|
for (const site of allSites) {
|
|
@@ -40,8 +50,7 @@ async function getAllSitesFromDomain(domain: string) {
|
|
|
40
50
|
site.domains = items
|
|
41
51
|
.filter(
|
|
42
52
|
(item) =>
|
|
43
|
-
item.domain &&
|
|
44
|
-
(item.domain.slug === domain || item.domain.slug === `/${domain}`),
|
|
53
|
+
item.domain && (item.domain.slug === domain || item.domain.slug === `/${domain}`),
|
|
45
54
|
)
|
|
46
55
|
.map((item) => ({ [item.id]: `${item.domain.slug}${item.path}` }));
|
|
47
56
|
}
|
|
@@ -54,8 +63,8 @@ async function getAllSitesFromDomain(domain: string) {
|
|
|
54
63
|
* Fetch a page object from API.
|
|
55
64
|
*/
|
|
56
65
|
async function getPage(id: number, cacheKey: string) {
|
|
57
|
-
return
|
|
58
|
-
endpoint: `${
|
|
66
|
+
return get<PageResponse>({
|
|
67
|
+
endpoint: `${GET_PAGE}/${id}`,
|
|
59
68
|
cacheKey,
|
|
60
69
|
});
|
|
61
70
|
}
|
|
@@ -64,27 +73,27 @@ async function getPage(id: number, cacheKey: string) {
|
|
|
64
73
|
* Get site info
|
|
65
74
|
*/
|
|
66
75
|
async function getSiteInfo(id: number, cacheKey = "") {
|
|
67
|
-
const [prefix, suffix] =
|
|
76
|
+
const [prefix, suffix] = INFO;
|
|
68
77
|
|
|
69
|
-
return
|
|
78
|
+
return get<Site>({
|
|
70
79
|
endpoint: `${prefix}${id}${suffix}`,
|
|
71
80
|
cacheKey,
|
|
72
81
|
});
|
|
73
82
|
}
|
|
74
83
|
|
|
75
84
|
async function getSiteLanguages(id: number, cacheKey = "") {
|
|
76
|
-
const [prefix, suffix] =
|
|
85
|
+
const [prefix, suffix] = LANGUAGES;
|
|
77
86
|
|
|
78
|
-
return
|
|
87
|
+
return get<LanguagesResponse>({
|
|
79
88
|
endpoint: `${prefix}${id}${suffix}`,
|
|
80
89
|
cacheKey,
|
|
81
90
|
});
|
|
82
91
|
}
|
|
83
92
|
|
|
84
93
|
async function startSiteRender(id: number) {
|
|
85
|
-
const [prefix, suffix] =
|
|
94
|
+
const [prefix, suffix] = BUILD_START;
|
|
86
95
|
|
|
87
|
-
return
|
|
96
|
+
return get<StartPageRenderResponse>({
|
|
88
97
|
endpoint: `${prefix}${id}${suffix}`,
|
|
89
98
|
});
|
|
90
99
|
}
|
|
@@ -93,9 +102,9 @@ async function startSiteRender(id: number) {
|
|
|
93
102
|
* Send the end signal to API for a render site.
|
|
94
103
|
*/
|
|
95
104
|
async function endSiteRender(id: number, body: EndSiteRenderBody) {
|
|
96
|
-
const [prefix, suffix] =
|
|
105
|
+
const [prefix, suffix] = BUILD_END;
|
|
97
106
|
|
|
98
|
-
return
|
|
107
|
+
return post<EndPageInfoResponse>({
|
|
99
108
|
endpoint: `${prefix}${id}${suffix}`,
|
|
100
109
|
body,
|
|
101
110
|
useApiCacheDir: false,
|
|
@@ -109,11 +118,11 @@ async function getReferenceFieldSiteData(
|
|
|
109
118
|
dataSiteId?: number,
|
|
110
119
|
dataLangID?: number,
|
|
111
120
|
) {
|
|
112
|
-
const [prefix, suffix] =
|
|
121
|
+
const [prefix, suffix] = GET_REFERENCE_FIELD_DATA;
|
|
113
122
|
const site = dataSiteId || page.site;
|
|
114
123
|
const lang = dataLangID || page.language;
|
|
115
124
|
|
|
116
|
-
return
|
|
125
|
+
return post<ReferenceFieldResponse>({
|
|
117
126
|
endpoint: `${prefix}${site}${suffix}`,
|
|
118
127
|
body,
|
|
119
128
|
headers: { lang },
|
|
@@ -121,18 +130,20 @@ async function getReferenceFieldSiteData(
|
|
|
121
130
|
});
|
|
122
131
|
}
|
|
123
132
|
|
|
124
|
-
async function getSitemap(
|
|
125
|
-
const
|
|
133
|
+
async function getSitemap(options: { siteId: number; headers?: Record<string, string> }) {
|
|
134
|
+
const { siteId, headers } = options;
|
|
135
|
+
const [prefix, suffix] = GET_SITEMAP;
|
|
126
136
|
|
|
127
137
|
return get<SitemapAPIResponse>({
|
|
128
|
-
endpoint: `${prefix}${
|
|
138
|
+
endpoint: `${prefix}${siteId}${suffix}`,
|
|
139
|
+
headers,
|
|
129
140
|
});
|
|
130
141
|
}
|
|
131
142
|
|
|
132
143
|
async function getSiteSocials(id: number, cacheKey = "") {
|
|
133
|
-
const [prefix, suffix] =
|
|
144
|
+
const [prefix, suffix] = SOCIALS;
|
|
134
145
|
|
|
135
|
-
return
|
|
146
|
+
return get<SocialsResponse>({
|
|
136
147
|
endpoint: `${prefix}${id}${suffix}`,
|
|
137
148
|
cacheKey,
|
|
138
149
|
});
|