@griddo/cx 10.4.12 → 10.4.13
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 +1 -1
- package/build/adapters/gatsby/index.d.ts +2 -0
- package/build/adapters/gatsby/utils.d.ts +26 -0
- package/build/adapters/index.d.ts +3 -0
- package/build/browser/index.d.ts +5 -0
- package/build/browser/index.js +1 -0
- package/build/build-complete.d.ts +18 -0
- package/build/index.d.ts +29 -0
- package/build/index.js +37 -38
- package/build/move-assets.d.ts +1 -0
- package/build/react/index.d.ts +2 -0
- package/build/reset-render.d.ts +1 -0
- package/build/run-start-render.d.ts +1 -0
- package/build/run-start-render.js +69 -0
- package/build/services/auth.d.ts +21 -0
- package/build/services/distributors.d.ts +45 -0
- package/build/services/domains.d.ts +8 -0
- package/build/services/navigation.d.ts +77 -0
- package/build/services/robots.d.ts +21 -0
- package/build/services/settings.d.ts +23 -0
- package/build/services/sites.d.ts +42 -0
- package/build/services/store.d.ts +6 -0
- package/build/start-render.d.ts +3 -0
- package/build/start-render.js +70 -0
- package/build/types/api.d.ts +130 -0
- package/build/types/global.d.ts +78 -0
- package/build/types/navigation.d.ts +28 -0
- package/build/types/pages.d.ts +128 -0
- package/build/types/sites.d.ts +43 -0
- package/build/types/templates.d.ts +8 -0
- package/build/utils/api.d.ts +23 -0
- package/build/utils/cache.d.ts +35 -0
- package/build/utils/create-build-data.d.ts +8 -0
- package/build/utils/domains.d.ts +5 -0
- package/build/utils/folders.d.ts +48 -0
- package/build/utils/health-checks.d.ts +7 -0
- package/build/utils/instance.d.ts +21 -0
- package/build/utils/messages.d.ts +2 -0
- package/build/utils/pages.d.ts +34 -0
- package/build/utils/searches.d.ts +14 -0
- package/build/utils/shared.d.ts +109 -0
- package/build/utils/sites.d.ts +36 -0
- package/build/utils/store.d.ts +63 -0
- package/build/utils/temp-utils.d.ts +10 -0
- package/{exporter/cx.config.d.ts → cx.config.d.ts} +1 -2
- package/{exporter/cx.config.js → cx.config.js} +5 -8
- package/package.json +21 -29
- package/src/adapters/gatsby/index.ts +219 -0
- package/src/adapters/gatsby/utils.ts +85 -0
- package/src/browser/README.md +3 -0
- package/src/browser/index.ts +46 -0
- package/src/index.ts +48 -0
- package/src/move-assets.ts +8 -0
- package/src/react/index.ts +5 -0
- package/src/run-start-render.ts +3 -0
- package/{exporter → src}/services/robots.ts +1 -5
- package/{exporter → src}/services/store.ts +6 -1
- package/src/start-render.ts +19 -0
- package/{exporter → src}/types/global.ts +4 -3
- package/src/utils/folders.ts +268 -0
- package/{exporter → src}/utils/instance.ts +2 -2
- package/{exporter → src}/utils/pages.ts +2 -9
- package/{exporter → src}/utils/searches.ts +5 -8
- package/{exporter → src}/utils/shared.ts +5 -2
- package/{exporter → src}/utils/sites.ts +1 -8
- package/{exporter → src}/utils/temp-utils.ts +35 -8
- package/ssg/README.md +1 -0
- package/ssg/astro/.gitkeep +0 -0
- package/ssg/gatsby/.eslintrc.json +51 -0
- package/ssg/gatsby/.prettierignore +6 -0
- package/ssg/gatsby/.prettierrc.json +3 -0
- package/{gatsby-browser.tsx → ssg/gatsby/gatsby-browser.tsx} +42 -44
- package/{gatsby-config.ts → ssg/gatsby/gatsby-config.ts} +1 -2
- package/{gatsby-node.ts → ssg/gatsby/gatsby-node.ts} +11 -8
- package/{gatsby-ssr.tsx → ssg/gatsby/gatsby-ssr.tsx} +1 -1
- package/ssg/gatsby/global.d.ts +1 -0
- package/ssg/gatsby/package.json +85 -0
- package/{src → ssg/gatsby/src}/components/Head.tsx +2 -2
- package/{src → ssg/gatsby/src}/components/template.tsx +2 -3
- package/{src → ssg/gatsby/src}/gatsby-node-utils.ts +6 -5
- package/{src → ssg/gatsby/src}/types.ts +5 -4
- package/ssg/gatsby/tsconfig.json +15 -0
- package/start-render.js +7 -0
- package/build/create-build-data.js +0 -60
- package/exporter/adapters/gatsby/index.ts +0 -159
- package/exporter/adapters/gatsby/utils.ts +0 -377
- package/exporter/create-build-data.ts +0 -22
- package/exporter/index.ts +0 -23
- package/exporter/utils/folders.ts +0 -318
- package/exporter/utils/integrations.ts +0 -36
- package/exporter/utils/runners.ts +0 -52
- package/index.js +0 -7
- /package/{exporter → src}/adapters/index.ts +0 -0
- /package/{exporter → src}/build-complete.ts +0 -0
- /package/{exporter → src}/reset-render.ts +0 -0
- /package/{exporter → src}/services/auth.ts +0 -0
- /package/{exporter → src}/services/distributors.ts +0 -0
- /package/{exporter → src}/services/domains.ts +0 -0
- /package/{exporter → src}/services/navigation.ts +0 -0
- /package/{exporter → src}/services/settings.ts +0 -0
- /package/{exporter → src}/services/sites.ts +0 -0
- /package/{exporter → src}/types/api.ts +0 -0
- /package/{exporter → src}/types/navigation.ts +0 -0
- /package/{exporter → src}/types/pages.ts +0 -0
- /package/{exporter → src}/types/sites.ts +0 -0
- /package/{exporter → src}/types/templates.ts +0 -0
- /package/{exporter → src}/utils/api.ts +0 -0
- /package/{exporter → src}/utils/cache.ts +0 -0
- /package/{exporter/utils/download-build-data.ts → src/utils/create-build-data.ts} +0 -0
- /package/{exporter → src}/utils/domains.ts +0 -0
- /package/{exporter → src}/utils/health-checks.ts +0 -0
- /package/{exporter → src}/utils/messages.ts +0 -0
- /package/{exporter → src}/utils/store.ts +0 -0
- /package/{src → ssg/gatsby/src}/README.md +0 -0
- /package/{src → ssg/gatsby/src}/html.tsx +0 -0
- /package/{src → ssg/gatsby/src}/utils.ts +0 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import type { Domains, Robots, Settings } from "./global";
|
|
2
|
+
import type { APIPageObject } from "./pages";
|
|
3
|
+
import type { Site } from "./sites";
|
|
4
|
+
import type { Core, Fields } from "@griddo/core";
|
|
5
|
+
/** EndSiteRender Body */
|
|
6
|
+
export type EndSiteRenderBody = {
|
|
7
|
+
/** Site hashes to publish. */
|
|
8
|
+
publishHashes: Array<string>;
|
|
9
|
+
/** Current site hash. */
|
|
10
|
+
siteHash: string | null;
|
|
11
|
+
/** Site hashes to unpublish. */
|
|
12
|
+
unpublishHashes: Array<string>;
|
|
13
|
+
};
|
|
14
|
+
/** Distributor Body */
|
|
15
|
+
export interface DistributorBody {
|
|
16
|
+
mode?: "auto" | "manual" | "navigation";
|
|
17
|
+
order?: string;
|
|
18
|
+
sources?: Array<Fields.Source<unknown>>;
|
|
19
|
+
quantity?: number;
|
|
20
|
+
filter?: Array<unknown>;
|
|
21
|
+
fullRelations?: boolean;
|
|
22
|
+
allLanguages?: boolean;
|
|
23
|
+
fixed?: Array<number>;
|
|
24
|
+
referenceId?: number;
|
|
25
|
+
}
|
|
26
|
+
/** Describes an item in a sitemap. */
|
|
27
|
+
interface SitemapItem {
|
|
28
|
+
/** The URL of the page. */
|
|
29
|
+
loc: string;
|
|
30
|
+
/** The date the page was last modified. */
|
|
31
|
+
lastmod: string;
|
|
32
|
+
/** The priority of the page. */
|
|
33
|
+
priority: number;
|
|
34
|
+
}
|
|
35
|
+
/** Describes a URL. */
|
|
36
|
+
interface URL {
|
|
37
|
+
/** The path of the URL. */
|
|
38
|
+
path: string;
|
|
39
|
+
/** The domain of the URL. */
|
|
40
|
+
domain: string;
|
|
41
|
+
/** The home of the URL. */
|
|
42
|
+
home: string;
|
|
43
|
+
}
|
|
44
|
+
/** Describes the items returned by a sitemap response. */
|
|
45
|
+
export type SitemapItems = Record<string, Array<SitemapItem>>;
|
|
46
|
+
/** Describes the response object returned by a Griddo distributor. */
|
|
47
|
+
export type DistributorResponse = Fields.QueriedData<unknown>;
|
|
48
|
+
/** Describes the response object returned by socials from Griddo. */
|
|
49
|
+
export type SocialsResponse = Record<Core.SocialName, string>;
|
|
50
|
+
/** Describes the response object returned by post search info post. */
|
|
51
|
+
export type PostSearchInfoResponse = {
|
|
52
|
+
code: number;
|
|
53
|
+
message: string;
|
|
54
|
+
};
|
|
55
|
+
/** Describes the response object returned by a sitemap. */
|
|
56
|
+
export interface SitemapAPIResponse {
|
|
57
|
+
/** Number of items */
|
|
58
|
+
totalItems: number;
|
|
59
|
+
/** Page id */
|
|
60
|
+
page: number;
|
|
61
|
+
/** Item response by API */
|
|
62
|
+
items: SitemapItems;
|
|
63
|
+
/** Url */
|
|
64
|
+
url: URL;
|
|
65
|
+
}
|
|
66
|
+
/** Descripbes Language responses from Griddo API. */
|
|
67
|
+
export interface LanguagesResponse {
|
|
68
|
+
/** Total of languages */
|
|
69
|
+
totalItems: number;
|
|
70
|
+
/** Array of languages objects */
|
|
71
|
+
items: Array<Core.SiteLanguage>;
|
|
72
|
+
}
|
|
73
|
+
/** Describes common props for api responses. */
|
|
74
|
+
export interface APIRequest {
|
|
75
|
+
/** The URL of the API endpoint. */
|
|
76
|
+
endpoint: string;
|
|
77
|
+
/** The parameters to be sent in the request body. */
|
|
78
|
+
body?: unknown;
|
|
79
|
+
/** Reference id to manage cache between renders. */
|
|
80
|
+
cacheKey?: string;
|
|
81
|
+
/** Number of connection attempts (in case it fails on the first attempt). */
|
|
82
|
+
attempt?: number;
|
|
83
|
+
/** Headers for the post api fetch */
|
|
84
|
+
headers?: Record<string, unknown>;
|
|
85
|
+
}
|
|
86
|
+
/** Type with the POST request properties. */
|
|
87
|
+
export interface PostAPI extends Omit<APIRequest, "headers"> {
|
|
88
|
+
headers?: {
|
|
89
|
+
lang?: number;
|
|
90
|
+
} & Record<string, unknown>;
|
|
91
|
+
}
|
|
92
|
+
/** Type with the GET request properties. */
|
|
93
|
+
export type GetAPI = APIRequest;
|
|
94
|
+
/** Type with the PUT request properties. */
|
|
95
|
+
export type PutAPI = APIRequest;
|
|
96
|
+
/** Response type for the start render API call */
|
|
97
|
+
export interface StartPageRenderResponse {
|
|
98
|
+
/** Site hashes to publish */
|
|
99
|
+
publishIds: Array<number>;
|
|
100
|
+
/** Current site hash */
|
|
101
|
+
siteHash: string | null;
|
|
102
|
+
/** Site hashes to unpublish */
|
|
103
|
+
unpublishHashes: Array<string>;
|
|
104
|
+
}
|
|
105
|
+
/** Response type for the end render API call */
|
|
106
|
+
export interface EndPageInfoResponse {
|
|
107
|
+
/** Response code */
|
|
108
|
+
code: number;
|
|
109
|
+
/** Response message */
|
|
110
|
+
message: string;
|
|
111
|
+
}
|
|
112
|
+
/** Describes a response type for GET all sites */
|
|
113
|
+
export type AllSitesReponse = Array<Site>;
|
|
114
|
+
/** Describes a response type for GET one page */
|
|
115
|
+
export type PageResponse = APIPageObject;
|
|
116
|
+
/** All types for the API response used in the api functions get, put, post */
|
|
117
|
+
export type APIResponses = Domains | Robots | Settings | AllSitesReponse | Site | LanguagesResponse | StartPageRenderResponse | SitemapAPIResponse | SocialsResponse | PageResponse | EndPageInfoResponse | DistributorResponse | PostSearchInfoResponse;
|
|
118
|
+
export interface ShowApiErrorOptions {
|
|
119
|
+
callInfo: {
|
|
120
|
+
endpoint?: string;
|
|
121
|
+
body?: unknown;
|
|
122
|
+
headers?: unknown;
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
export interface BuildMetaData {
|
|
126
|
+
buildProcessData: Record<string, EndSiteRenderBody>;
|
|
127
|
+
createdPages: Array<number>;
|
|
128
|
+
sitesToPublish: Array<Site>;
|
|
129
|
+
}
|
|
130
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { EndSiteRenderBody } from "./api";
|
|
2
|
+
import type { Core, Fields } from "@griddo/core";
|
|
3
|
+
import { Site } from "./sites";
|
|
4
|
+
interface Settings {
|
|
5
|
+
apiVersion?: string;
|
|
6
|
+
avoidCanonicalsOnSitemaps?: boolean;
|
|
7
|
+
avoidDebugMetas?: boolean;
|
|
8
|
+
avoidHrefLangsOnCanonicals?: boolean;
|
|
9
|
+
avoidHrefLangXDefault?: boolean;
|
|
10
|
+
avoidSelfReferenceCanonicals?: boolean;
|
|
11
|
+
cloudinaryName?: string;
|
|
12
|
+
forceMenuLinksLanguage?: boolean;
|
|
13
|
+
globalLogoBig?: string;
|
|
14
|
+
globalLogoMini?: string;
|
|
15
|
+
lastDBCheckVersion?: string;
|
|
16
|
+
schemasTimestamp?: string;
|
|
17
|
+
schemasVersion?: string;
|
|
18
|
+
showBasicMetaRobots?: boolean;
|
|
19
|
+
siteLogoBig?: string;
|
|
20
|
+
siteLogoMini?: string;
|
|
21
|
+
skipReviewOnPublish?: boolean;
|
|
22
|
+
useMetaTitle?: boolean;
|
|
23
|
+
useMetaKeywords?: boolean;
|
|
24
|
+
welcomeText1?: string;
|
|
25
|
+
welcomeText2?: string;
|
|
26
|
+
}
|
|
27
|
+
type Petition = Record<string, unknown>;
|
|
28
|
+
interface PostSearchInfoProps {
|
|
29
|
+
title?: string;
|
|
30
|
+
description: string | null | undefined;
|
|
31
|
+
image: string | null | undefined;
|
|
32
|
+
pageId?: number;
|
|
33
|
+
siteId: number;
|
|
34
|
+
content: string;
|
|
35
|
+
languageId?: number;
|
|
36
|
+
template?: string | null | number;
|
|
37
|
+
url?: string;
|
|
38
|
+
}
|
|
39
|
+
interface FetchDataProps {
|
|
40
|
+
page: Core.Page;
|
|
41
|
+
component: {
|
|
42
|
+
data?: Fields.Reference<unknown>;
|
|
43
|
+
};
|
|
44
|
+
/** Reference id to manage cache between renders. */
|
|
45
|
+
cacheKey: string;
|
|
46
|
+
}
|
|
47
|
+
type Domains = Array<{
|
|
48
|
+
id: number;
|
|
49
|
+
slug: string;
|
|
50
|
+
url: string;
|
|
51
|
+
}>;
|
|
52
|
+
/** Describes the type of build process data object. */
|
|
53
|
+
type BuildProcessData = Record<string, EndSiteRenderBody>;
|
|
54
|
+
type Robot = {
|
|
55
|
+
path: string;
|
|
56
|
+
content: string;
|
|
57
|
+
};
|
|
58
|
+
type Robots = Array<Robot>;
|
|
59
|
+
interface RenderInfo {
|
|
60
|
+
buildProcessData: BuildProcessData;
|
|
61
|
+
createdPages: Array<number>;
|
|
62
|
+
sitesToPublish: Array<Site>;
|
|
63
|
+
}
|
|
64
|
+
type LifeCyclesNames = "Prepare" | "Restore" | "Data" | "SSG" | "Relocation" | "Meta" | "Archive" | "Clean" | "__DEBUG__";
|
|
65
|
+
type CXDir = "__exports" | "__caches" | "__cx" | "__ssg" | "__components" | "__root";
|
|
66
|
+
interface CXConfig {
|
|
67
|
+
proDomain: string;
|
|
68
|
+
CXDir: {
|
|
69
|
+
EXPORTS: "__exports";
|
|
70
|
+
CACHE: "__caches";
|
|
71
|
+
CX: "__cx";
|
|
72
|
+
SSG: "__ssg";
|
|
73
|
+
COMPONENTS: "__components";
|
|
74
|
+
ROOT: "__root";
|
|
75
|
+
};
|
|
76
|
+
dirs: (domain?: string) => Record<CXDir, string>;
|
|
77
|
+
}
|
|
78
|
+
export { BuildProcessData, CXConfig, CXDir, Domains, FetchDataProps, LifeCyclesNames, Petition, PostSearchInfoProps, RenderInfo, Robot, Robots, Settings, };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Describes a Griddo Header */
|
|
2
|
+
export type Header = {
|
|
3
|
+
component: "Header";
|
|
4
|
+
id: number;
|
|
5
|
+
isDefault: boolean;
|
|
6
|
+
language: number;
|
|
7
|
+
navigationLanguages: Array<{
|
|
8
|
+
navigationId: number;
|
|
9
|
+
}>;
|
|
10
|
+
setAsDefault: boolean;
|
|
11
|
+
theme: null | string;
|
|
12
|
+
title: string;
|
|
13
|
+
type: "header";
|
|
14
|
+
};
|
|
15
|
+
/** Describes a Griddo Footer */
|
|
16
|
+
export type Footer = {
|
|
17
|
+
component: "Footer";
|
|
18
|
+
id: number;
|
|
19
|
+
isDefault: boolean;
|
|
20
|
+
language: number;
|
|
21
|
+
navigationLanguages: Array<{
|
|
22
|
+
navigationId: number;
|
|
23
|
+
}>;
|
|
24
|
+
setAsDefault: boolean;
|
|
25
|
+
theme: null | string;
|
|
26
|
+
title: string;
|
|
27
|
+
type: "header";
|
|
28
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { SocialsResponse } from "./api";
|
|
2
|
+
import type { Settings } from "./global";
|
|
3
|
+
import type { Site } from "./sites";
|
|
4
|
+
import type { Core, Fields } from "@griddo/core";
|
|
5
|
+
export type APIPageObject = Core.Page & {
|
|
6
|
+
id: number;
|
|
7
|
+
} & {
|
|
8
|
+
header: number | null;
|
|
9
|
+
footer: number | null;
|
|
10
|
+
};
|
|
11
|
+
export type CleanPage = Core.Page & {
|
|
12
|
+
isRoot: boolean;
|
|
13
|
+
defaultLang?: Core.SiteLanguage | undefined;
|
|
14
|
+
};
|
|
15
|
+
export type RenderPage = Core.Page & {
|
|
16
|
+
isRoot?: boolean;
|
|
17
|
+
multiPageElements: MultiPageElements;
|
|
18
|
+
defaultLang?: Core.SiteLanguage;
|
|
19
|
+
header: number;
|
|
20
|
+
footer: number;
|
|
21
|
+
id: number;
|
|
22
|
+
path: string;
|
|
23
|
+
component: "Page";
|
|
24
|
+
template_id: string;
|
|
25
|
+
mode: "list";
|
|
26
|
+
};
|
|
27
|
+
export type GriddoSinglePage = Core.Page & {
|
|
28
|
+
defaultLang?: Core.SiteLanguage;
|
|
29
|
+
};
|
|
30
|
+
export type GriddoListPage = Core.Page & {
|
|
31
|
+
page: APIPageObject;
|
|
32
|
+
pages: Array<Array<Fields.QueriedDataItem>>;
|
|
33
|
+
isRoot?: boolean;
|
|
34
|
+
defaultLang?: Core.SiteLanguage;
|
|
35
|
+
template: {
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
type: "template";
|
|
38
|
+
templateType: string;
|
|
39
|
+
activeSectionSlug: string;
|
|
40
|
+
activeSectionBase: string;
|
|
41
|
+
};
|
|
42
|
+
totalQueriedItems: Array<Fields.QueriedDataItem>;
|
|
43
|
+
};
|
|
44
|
+
export type GriddoMultiPage = Core.Page & {
|
|
45
|
+
header: number | null;
|
|
46
|
+
footer: number | null;
|
|
47
|
+
isRoot?: boolean;
|
|
48
|
+
multiPageElements: MultiPageElements;
|
|
49
|
+
defaultLang?: Core.SiteLanguage | undefined;
|
|
50
|
+
};
|
|
51
|
+
export interface AdditionalInfo {
|
|
52
|
+
baseUrl: string;
|
|
53
|
+
cloudinaryName?: string;
|
|
54
|
+
griddoVersion: string;
|
|
55
|
+
instance?: string;
|
|
56
|
+
publicBaseUrl: string;
|
|
57
|
+
siteLangs: Array<Core.SiteLanguage>;
|
|
58
|
+
siteMetadata: Site["siteMetadata"];
|
|
59
|
+
siteSlug: string;
|
|
60
|
+
socials: SocialsResponse;
|
|
61
|
+
siteOptions: Pick<Settings, "useMetaTitle" | "useMetaKeywords" | "showBasicMetaRobots" | "avoidHrefLangsOnCanonicals" | "avoidSelfReferenceCanonicals" | "avoidHrefLangXDefault" | "avoidDebugMetas">;
|
|
62
|
+
siteScript: string;
|
|
63
|
+
theme: string;
|
|
64
|
+
}
|
|
65
|
+
export interface PageAdditionalInfo extends AdditionalInfo {
|
|
66
|
+
navigations: {
|
|
67
|
+
header: Record<string, unknown> | null;
|
|
68
|
+
footer: Record<string, unknown> | null;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export type MultiPageElement = {
|
|
72
|
+
component: string;
|
|
73
|
+
title: string | Required<Fields.Heading>;
|
|
74
|
+
elements: Array<Record<string, unknown>>;
|
|
75
|
+
componentModules: Array<Record<string, unknown>>;
|
|
76
|
+
sectionSlug: string;
|
|
77
|
+
metaTitle: string;
|
|
78
|
+
metaDescription: string;
|
|
79
|
+
};
|
|
80
|
+
export type MultiPageElements = Array<MultiPageElement>;
|
|
81
|
+
/**
|
|
82
|
+
* Gatsby page object format.
|
|
83
|
+
*/
|
|
84
|
+
export type GriddoPageObject = {
|
|
85
|
+
matchPath?: string;
|
|
86
|
+
path: string;
|
|
87
|
+
/** Page size in bytes */
|
|
88
|
+
size?: number;
|
|
89
|
+
context: {
|
|
90
|
+
cloudinaryName?: string;
|
|
91
|
+
footer: Record<string, unknown> | null;
|
|
92
|
+
fullPath: Core.Page["fullPath"];
|
|
93
|
+
griddoVersion: string;
|
|
94
|
+
renderDate: string;
|
|
95
|
+
header: Record<string, unknown> | null;
|
|
96
|
+
id?: number;
|
|
97
|
+
languageId: number;
|
|
98
|
+
locale?: string;
|
|
99
|
+
openGraph: {
|
|
100
|
+
description?: string;
|
|
101
|
+
image?: string | null;
|
|
102
|
+
title?: string;
|
|
103
|
+
twitterImage?: string | null;
|
|
104
|
+
type: "website";
|
|
105
|
+
};
|
|
106
|
+
pageMetadata: {
|
|
107
|
+
canonical?: string | undefined;
|
|
108
|
+
description?: string;
|
|
109
|
+
follow?: "follow" | "nofollow";
|
|
110
|
+
index: "index" | "noindex";
|
|
111
|
+
locale?: string;
|
|
112
|
+
metaKeywords?: string;
|
|
113
|
+
metasAdvanced?: string;
|
|
114
|
+
pageLanguages?: Core.Page["pageLanguages"];
|
|
115
|
+
title?: string;
|
|
116
|
+
translate?: "notranslate" | "";
|
|
117
|
+
url?: string;
|
|
118
|
+
};
|
|
119
|
+
siteMetadata: Site["siteMetadata"];
|
|
120
|
+
theme: string;
|
|
121
|
+
title: string;
|
|
122
|
+
siteLangs: Array<Core.SiteLanguage>;
|
|
123
|
+
siteOptions: AdditionalInfo["siteOptions"];
|
|
124
|
+
siteScript: string;
|
|
125
|
+
socials: SocialsResponse;
|
|
126
|
+
page: GriddoSinglePage | GriddoListPage | GriddoMultiPage;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { SocialsResponse } from "./api";
|
|
2
|
+
import type { Footer, Header } from "./navigation";
|
|
3
|
+
import type { Core } from "@griddo/core";
|
|
4
|
+
/**
|
|
5
|
+
* Describes a Griddo site object from API.
|
|
6
|
+
* This takes some type props from Core.Site.
|
|
7
|
+
*/
|
|
8
|
+
export interface Site extends Required<Pick<Core.Site, "bigAvatar" | "favicon" | "home" | "id" | "isPublished" | "timezone" | "thumbnail" | "theme" | "socials" | "slug" | "smallAvatar" | "modified" | "name" | "siteMetadata">> {
|
|
9
|
+
author: string;
|
|
10
|
+
deleted: number;
|
|
11
|
+
domains: Array<Record<string, string>>;
|
|
12
|
+
footers: Array<Footer>;
|
|
13
|
+
hash: string | null;
|
|
14
|
+
headers: Array<Header>;
|
|
15
|
+
languages: Array<Core.SiteLanguage>;
|
|
16
|
+
languageSites: Array<number>;
|
|
17
|
+
navigationModules: {
|
|
18
|
+
header?: string;
|
|
19
|
+
footer?: string;
|
|
20
|
+
} | null;
|
|
21
|
+
pages: Array<number>;
|
|
22
|
+
changedPages: Array<number>;
|
|
23
|
+
published: string;
|
|
24
|
+
rendering: boolean;
|
|
25
|
+
renderingHours: number;
|
|
26
|
+
shouldBeUpdated: boolean;
|
|
27
|
+
siteScript: string;
|
|
28
|
+
smallAvatar: string;
|
|
29
|
+
updated: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface SiteData {
|
|
32
|
+
siteInfo: Site;
|
|
33
|
+
validPagesIds: Array<number>;
|
|
34
|
+
siteHash: string | null;
|
|
35
|
+
unpublishHashes: Array<string>;
|
|
36
|
+
siteLangs: Array<Core.SiteLanguage>;
|
|
37
|
+
defaultLang: Core.SiteLanguage | undefined;
|
|
38
|
+
headers: Array<Header>;
|
|
39
|
+
footers: Array<Footer>;
|
|
40
|
+
socials: SocialsResponse;
|
|
41
|
+
}
|
|
42
|
+
export type SiteHash = string | null;
|
|
43
|
+
export type HashSites = Record<string, number | string>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Core, Fields } from "@griddo/core";
|
|
2
|
+
/** Describes a template object from a Griddo Page */
|
|
3
|
+
export type Template = Core.Page["template"];
|
|
4
|
+
/** Describes a template with distributor data */
|
|
5
|
+
export type TemplateWithDistributor = Template & {
|
|
6
|
+
queriedItems?: Fields.QueriedData<unknown>;
|
|
7
|
+
itemsPerPage?: number;
|
|
8
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { APIResponses, GetAPI, PostAPI, PutAPI } from "../types/api";
|
|
2
|
+
/**
|
|
3
|
+
* Make a GET request to the Griddo API.
|
|
4
|
+
*
|
|
5
|
+
* @template T Response Type returned.
|
|
6
|
+
* @returns A promise that is resolved with the data from the API response.
|
|
7
|
+
*/
|
|
8
|
+
declare function getApi<T extends APIResponses>(props: GetAPI): Promise<T>;
|
|
9
|
+
/**
|
|
10
|
+
* Make a PUT request to the Griddo API.
|
|
11
|
+
*
|
|
12
|
+
* @template T Response Type returned.
|
|
13
|
+
* @returns A promise that is resolved with the data from the API response.
|
|
14
|
+
*/
|
|
15
|
+
declare function putApi<T extends APIResponses>(props: PutAPI): Promise<T>;
|
|
16
|
+
/**
|
|
17
|
+
* Make a POST request to the Griddo API.
|
|
18
|
+
*
|
|
19
|
+
* @template T Response Type returned.
|
|
20
|
+
* @returns A promise that is resolved with the data from the API response.
|
|
21
|
+
*/
|
|
22
|
+
declare function postApi<T extends APIResponses>(props: PostAPI): Promise<T>;
|
|
23
|
+
export { getApi as get, putApi as put, postApi as post };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Petition } from "../types/global";
|
|
2
|
+
import type { SiteHash } from "../types/sites";
|
|
3
|
+
/**
|
|
4
|
+
* Creates an `apiCache` dir to store pages fetched from them API.
|
|
5
|
+
*/
|
|
6
|
+
declare function createAPICacheDir(): void;
|
|
7
|
+
/**
|
|
8
|
+
* Generate a filename with a hash using a string.
|
|
9
|
+
*
|
|
10
|
+
* @todo Merge with generateFilenameWithHash
|
|
11
|
+
* @param data A string to create a sha256 based on.
|
|
12
|
+
*/
|
|
13
|
+
declare function createSha256(data: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Save a file using a hash name.
|
|
16
|
+
*
|
|
17
|
+
* @param petition An object.
|
|
18
|
+
* @param content Content to be saved.
|
|
19
|
+
*/
|
|
20
|
+
declare function saveCache<T>(petition: Petition, content: T): void;
|
|
21
|
+
/**
|
|
22
|
+
* Search in the `apiCache` dir for a file using the petition as hash generator.
|
|
23
|
+
* Return the file content if found or null if not.
|
|
24
|
+
*
|
|
25
|
+
* @param petition An object
|
|
26
|
+
*/
|
|
27
|
+
declare function searchCacheData<T>(petition: Petition): T | null;
|
|
28
|
+
/**
|
|
29
|
+
* Update (write) the site hash file.
|
|
30
|
+
*
|
|
31
|
+
* @param siteId The id of the site.
|
|
32
|
+
* @param siteHash The has of the site.
|
|
33
|
+
*/
|
|
34
|
+
declare function updatedSiteHash(siteId: number, siteHash: SiteHash): string;
|
|
35
|
+
export { createSha256, updatedSiteHash, searchCacheData, saveCache, createAPICacheDir, };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Download all data: sites, pages etc.. from the instance private Griddo API.
|
|
3
|
+
* Then you can use the generator funcion `getBuildPages()` to get the pages and
|
|
4
|
+
* `getBuildMetadata()` to get build and sites metadata as objects. Both from
|
|
5
|
+
* exporter utils sites dir.
|
|
6
|
+
*/
|
|
7
|
+
declare function createBuildData(domain: string): Promise<void>;
|
|
8
|
+
export { createBuildData };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { MakeDirectoryOptions } from "fs-extra";
|
|
3
|
+
/**
|
|
4
|
+
* Remove an empty directory from the basePath recursively.
|
|
5
|
+
* If the directory has only .xml files it will handle as empty too (empty site)
|
|
6
|
+
*
|
|
7
|
+
* @param baseDir - The base directory.
|
|
8
|
+
*/
|
|
9
|
+
declare const clearEmptyDirs: (baseDir?: string) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Creates multiple directories.
|
|
12
|
+
*
|
|
13
|
+
* @param dirs - An array of directory paths.
|
|
14
|
+
* @param options - Same option as `fs.mkdirSync()`
|
|
15
|
+
*/
|
|
16
|
+
declare function createDirsSync(dirs: Array<string>, options?: MakeDirectoryOptions): void;
|
|
17
|
+
/**
|
|
18
|
+
* Copy multiple directories with backup option.
|
|
19
|
+
*
|
|
20
|
+
* @param src - Source directory.
|
|
21
|
+
* @param dst - Destination directory.
|
|
22
|
+
* @param dirs - Directories to copy.
|
|
23
|
+
* @param options.withBackup - Create a previous backup before copy.
|
|
24
|
+
*/
|
|
25
|
+
declare function copyDirsSync(src: string, dst: string, dirs: Array<string>, options?: {
|
|
26
|
+
withBackup: boolean;
|
|
27
|
+
}): void;
|
|
28
|
+
/**
|
|
29
|
+
* Move artifacts between CX valid directories.
|
|
30
|
+
*
|
|
31
|
+
* @param src - Source directory.
|
|
32
|
+
* @param dst - Destination directory.
|
|
33
|
+
* @param dirs - Directories to move.
|
|
34
|
+
* @param options - Options.
|
|
35
|
+
*/
|
|
36
|
+
declare function moveDirsSync(src: string, dst: string, dirs: Array<string>, options?: {
|
|
37
|
+
withBackup?: boolean;
|
|
38
|
+
override?: boolean;
|
|
39
|
+
}): void;
|
|
40
|
+
/**
|
|
41
|
+
* Remove directories from `basePath` directory.
|
|
42
|
+
*
|
|
43
|
+
* @param basePath - Base directory.
|
|
44
|
+
* @param dirs - Directory to remove.
|
|
45
|
+
*/
|
|
46
|
+
declare function removeDirsSync(basePath: string, dirs: Array<string>): void;
|
|
47
|
+
declare function removeVirtualPagesFromStore(): Promise<void>;
|
|
48
|
+
export { clearEmptyDirs, copyDirsSync, createDirsSync, moveDirsSync, removeDirsSync, removeVirtualPagesFromStore, };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check if the environment is secure to launch a render.
|
|
3
|
+
* If something fails then log an error message and exit from the process.
|
|
4
|
+
* Otherwise just return true.
|
|
5
|
+
*/
|
|
6
|
+
declare function checkRenderHealthOrExit(): boolean;
|
|
7
|
+
export { checkRenderHealthOrExit };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare const IS_COMPONENT_LIBRARY: boolean;
|
|
2
|
+
declare const PROJECT_ALIASES: {
|
|
3
|
+
"@components": string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Returns the instance or monorepo paths.
|
|
7
|
+
*
|
|
8
|
+
* @param customPath The path for the instance components
|
|
9
|
+
*/
|
|
10
|
+
declare function resolveComponentsPath(customPath?: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Return the instance or monorepo components {t|j}sconfig.json file.
|
|
13
|
+
*/
|
|
14
|
+
declare function getComponentsJSConfig(): string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Get the instance webpack aliases
|
|
17
|
+
*/
|
|
18
|
+
declare function getComponentsLibAliases(): {
|
|
19
|
+
"@components": string;
|
|
20
|
+
};
|
|
21
|
+
export { IS_COMPONENT_LIBRARY, PROJECT_ALIASES, getComponentsJSConfig, getComponentsLibAliases, resolveComponentsPath, };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { GriddoListPage, GriddoMultiPage, GriddoPageObject, GriddoSinglePage, MultiPageElements, PageAdditionalInfo } from "../types/pages";
|
|
2
|
+
import type { TemplateWithDistributor } from "../types/templates";
|
|
3
|
+
import type { Fields } from "@griddo/core";
|
|
4
|
+
/**
|
|
5
|
+
* Create a single Griddo page object.
|
|
6
|
+
*
|
|
7
|
+
* @param page A Griddo single page object.
|
|
8
|
+
* @param additionalInfo Additional page info.
|
|
9
|
+
*/
|
|
10
|
+
declare function createGriddoSinglePage(page: GriddoSinglePage, additionalInfo: PageAdditionalInfo): Promise<GriddoPageObject>;
|
|
11
|
+
/**
|
|
12
|
+
* Create multiples pages from one page as list paginated pages
|
|
13
|
+
*/
|
|
14
|
+
declare function createGriddoListPages({ page, pages, isRoot, defaultLang, template, totalQueriedItems, }: GriddoListPage, additionalInfo: PageAdditionalInfo): Promise<GriddoPageObject[]>;
|
|
15
|
+
/**
|
|
16
|
+
* Create multiples pages from a MultiPage module
|
|
17
|
+
*
|
|
18
|
+
* @param page A Griddo Multipage object.
|
|
19
|
+
* @param additionalInfo Additional page info.
|
|
20
|
+
*/
|
|
21
|
+
declare function createGriddoMultiPages(page: GriddoMultiPage, additionalInfo: PageAdditionalInfo): Promise<GriddoPageObject[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Get the multi pages elements.
|
|
24
|
+
*
|
|
25
|
+
* @param page The page to get the multipage parts.
|
|
26
|
+
*/
|
|
27
|
+
declare function getMultiPageElements(page: TemplateWithDistributor): Promise<MultiPageElements> | null;
|
|
28
|
+
/**
|
|
29
|
+
* Takes a template object and split the whole queriedItems into separated queriedItems to use in Griddo static list templates.
|
|
30
|
+
*
|
|
31
|
+
* @param listTemplate A template schema with the distributor data included.
|
|
32
|
+
*/
|
|
33
|
+
declare function getPaginatedPages(listTemplate: TemplateWithDistributor): Fields.SimpleContentType<Omit<unknown, "__contentTypeKind">>[][];
|
|
34
|
+
export { createGriddoListPages, createGriddoMultiPages, createGriddoSinglePage, getMultiPageElements, getPaginatedPages, };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PostSearchInfoResponse } from "../types/api";
|
|
2
|
+
import type { PostSearchInfoProps } from "../types/global";
|
|
3
|
+
/**
|
|
4
|
+
* Save in the BBDD the content of a page parsed without HTML tags.
|
|
5
|
+
*
|
|
6
|
+
* @param props Object with parts of the final page object to be saved in the BBDD.
|
|
7
|
+
*/
|
|
8
|
+
declare function postSearchInfo(props: PostSearchInfoProps): Promise<PostSearchInfoResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Function that search in the `/public` dir the content info of the pages and
|
|
11
|
+
* send it to the search table in the ddbb using the API.
|
|
12
|
+
*/
|
|
13
|
+
declare function uploadSearchContentToAPI(): Promise<void>;
|
|
14
|
+
export { postSearchInfo, uploadSearchContentToAPI };
|