@griddo/cx 11.7.6-rc.1 → 11.7.6-rc.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.
Files changed (176) hide show
  1. package/README.md +13 -9
  2. package/build/adapters/gatsby/actions/clean.js.map +1 -1
  3. package/build/adapters/gatsby/actions/close.js.map +1 -1
  4. package/build/adapters/gatsby/actions/data.js +3 -3
  5. package/build/adapters/gatsby/actions/data.js.map +1 -1
  6. package/build/adapters/gatsby/actions/healthCheck.js.map +1 -1
  7. package/build/adapters/gatsby/actions/init.js +2 -2
  8. package/build/adapters/gatsby/actions/init.js.map +1 -1
  9. package/build/adapters/gatsby/actions/meta.js +2 -2
  10. package/build/adapters/gatsby/actions/meta.js.map +1 -1
  11. package/build/adapters/gatsby/actions/prepare.js.map +1 -1
  12. package/build/adapters/gatsby/actions/relocation.js +2 -2
  13. package/build/adapters/gatsby/actions/relocation.js.map +1 -1
  14. package/build/adapters/gatsby/actions/restore.js +4 -4
  15. package/build/adapters/gatsby/actions/restore.js.map +1 -1
  16. package/build/adapters/gatsby/actions/ssg.js.map +1 -1
  17. package/build/adapters/gatsby/actions/sync.js +10 -9
  18. package/build/adapters/gatsby/actions/sync.js.map +1 -1
  19. package/build/adapters/gatsby/index.js +10 -6
  20. package/build/adapters/gatsby/index.js.map +1 -1
  21. package/build/adapters/gatsby/shared/context.js +8 -2
  22. package/build/adapters/gatsby/shared/context.js.map +1 -1
  23. package/build/adapters/gatsby/shared/diff-assets.js +101 -0
  24. package/build/adapters/gatsby/shared/diff-assets.js.map +1 -0
  25. package/build/adapters/gatsby/shared/extract-assets.js +11 -11
  26. package/build/adapters/gatsby/shared/extract-assets.js.map +1 -1
  27. package/build/adapters/gatsby/shared/gatsby-build.js.map +1 -1
  28. package/build/adapters/gatsby/shared/sync-render.js +162 -158
  29. package/build/adapters/gatsby/shared/sync-render.js.map +1 -1
  30. package/build/commands/end-render.js +44 -19
  31. package/build/commands/end-render.js.map +1 -1
  32. package/build/commands/prepare-assets-directory.js +4 -4
  33. package/build/commands/prepare-assets-directory.js.map +1 -1
  34. package/build/commands/prepare-domains-render.js +14 -19
  35. package/build/commands/prepare-domains-render.js.map +1 -1
  36. package/build/commands/reset-render.js +4 -4
  37. package/build/commands/reset-render.js.map +1 -1
  38. package/build/commands/start-render.js +20 -10
  39. package/build/commands/start-render.js.map +1 -1
  40. package/build/commands/upload-search-content.js +8 -17
  41. package/build/commands/upload-search-content.js.map +1 -1
  42. package/build/constants/endpoints.js.map +1 -1
  43. package/build/constants/envs.js +2 -7
  44. package/build/constants/envs.js.map +1 -1
  45. package/build/constants/errors.js +7 -9
  46. package/build/constants/errors.js.map +1 -1
  47. package/build/services/auth.js +1 -0
  48. package/build/services/auth.js.map +1 -1
  49. package/build/services/db-class.js +49 -0
  50. package/build/services/db-class.js.map +1 -0
  51. package/build/services/db.js.map +1 -1
  52. package/build/services/navigation.js +3 -0
  53. package/build/services/navigation.js.map +1 -1
  54. package/build/services/reference-fields.js.map +1 -1
  55. package/build/services/robots.js +4 -2
  56. package/build/services/robots.js.map +1 -1
  57. package/build/services/sites.js.map +1 -1
  58. package/build/services/store.js +2 -2
  59. package/build/services/store.js.map +1 -1
  60. package/build/types/render.js.map +1 -1
  61. package/build/utils/api.js.map +1 -1
  62. package/build/utils/artifacts.js +11 -11
  63. package/build/utils/artifacts.js.map +1 -1
  64. package/build/utils/brush.js +2 -2
  65. package/build/utils/brush.js.map +1 -1
  66. package/build/utils/cache.js +6 -6
  67. package/build/utils/cache.js.map +1 -1
  68. package/build/utils/check-health.js.map +1 -1
  69. package/build/utils/core-utils.js +35 -3
  70. package/build/utils/core-utils.js.map +1 -1
  71. package/build/utils/domains.js.map +1 -1
  72. package/build/utils/errors.js.map +1 -1
  73. package/build/utils/folders.js +30 -7
  74. package/build/utils/folders.js.map +1 -1
  75. package/build/utils/images.js.map +1 -1
  76. package/build/utils/instance.js.map +1 -1
  77. package/build/utils/loggin.js +9 -3
  78. package/build/utils/loggin.js.map +1 -1
  79. package/build/utils/pages.js.map +1 -1
  80. package/build/utils/render.js +1 -1
  81. package/build/utils/render.js.map +1 -1
  82. package/build/utils/sites.js +20 -19
  83. package/build/utils/sites.js.map +1 -1
  84. package/build/utils/store.js +8 -8
  85. package/build/utils/store.js.map +1 -1
  86. package/exporter/adapters/gatsby/actions/data.ts +3 -3
  87. package/exporter/adapters/gatsby/actions/init.ts +2 -2
  88. package/exporter/adapters/gatsby/actions/meta.ts +2 -2
  89. package/exporter/adapters/gatsby/actions/relocation.ts +2 -2
  90. package/exporter/adapters/gatsby/actions/restore.ts +4 -4
  91. package/exporter/adapters/gatsby/actions/sync.ts +10 -9
  92. package/exporter/adapters/gatsby/index.ts +13 -8
  93. package/exporter/adapters/gatsby/shared/diff-assets.ts +113 -0
  94. package/exporter/adapters/gatsby/shared/extract-assets.ts +11 -11
  95. package/exporter/adapters/gatsby/shared/sync-render.ts +195 -212
  96. package/exporter/build.sh +2 -3
  97. package/exporter/commands/end-render.ts +54 -25
  98. package/exporter/commands/prepare-assets-directory.ts +4 -4
  99. package/exporter/commands/prepare-domains-render.ts +15 -20
  100. package/exporter/commands/reset-render.ts +4 -4
  101. package/exporter/commands/start-render.ts +19 -11
  102. package/exporter/commands/upload-search-content.ts +9 -20
  103. package/exporter/constants/envs.ts +0 -6
  104. package/exporter/constants/errors.ts +12 -4
  105. package/exporter/services/db-class.ts +54 -0
  106. package/exporter/services/robots.ts +2 -2
  107. package/exporter/services/store.ts +2 -2
  108. package/exporter/types/global.ts +0 -1
  109. package/exporter/utils/artifacts.ts +11 -11
  110. package/exporter/utils/cache.ts +6 -6
  111. package/exporter/utils/core-utils.ts +46 -4
  112. package/exporter/utils/folders.ts +30 -7
  113. package/exporter/utils/loggin.ts +9 -3
  114. package/exporter/utils/render.ts +3 -1
  115. package/exporter/utils/sites.ts +18 -17
  116. package/exporter/utils/store.ts +8 -8
  117. package/package.json +10 -11
  118. package/src/gatsby-node-utils.ts +2 -2
  119. package/tsconfig.json +3 -2
  120. package/build/exporter/adapters/gatsby/actions/clean.d.ts +0 -3
  121. package/build/exporter/adapters/gatsby/actions/close.d.ts +0 -3
  122. package/build/exporter/adapters/gatsby/actions/data.d.ts +0 -2
  123. package/build/exporter/adapters/gatsby/actions/healthCheck.d.ts +0 -2
  124. package/build/exporter/adapters/gatsby/actions/init.d.ts +0 -2
  125. package/build/exporter/adapters/gatsby/actions/meta.d.ts +0 -2
  126. package/build/exporter/adapters/gatsby/actions/prepare.d.ts +0 -2
  127. package/build/exporter/adapters/gatsby/actions/relocation.d.ts +0 -2
  128. package/build/exporter/adapters/gatsby/actions/restore.d.ts +0 -3
  129. package/build/exporter/adapters/gatsby/actions/ssg.d.ts +0 -3
  130. package/build/exporter/adapters/gatsby/actions/sync.d.ts +0 -3
  131. package/build/exporter/adapters/gatsby/index.d.ts +0 -9
  132. package/build/exporter/adapters/gatsby/shared/context.d.ts +0 -38
  133. package/build/exporter/adapters/gatsby/shared/extract-assets.d.ts +0 -7
  134. package/build/exporter/adapters/gatsby/shared/gatsby-build.d.ts +0 -7
  135. package/build/exporter/adapters/gatsby/shared/sync-render.d.ts +0 -36
  136. package/build/exporter/adapters/gatsby/shared/types.d.ts +0 -34
  137. package/build/exporter/commands/end-render.d.ts +0 -2
  138. package/build/exporter/commands/prepare-assets-directory.d.ts +0 -2
  139. package/build/exporter/commands/prepare-domains-render.d.ts +0 -2
  140. package/build/exporter/commands/reset-render.d.ts +0 -2
  141. package/build/exporter/commands/start-render.d.ts +0 -2
  142. package/build/exporter/commands/upload-search-content.d.ts +0 -2
  143. package/build/exporter/constants/endpoints.d.ts +0 -19
  144. package/build/exporter/constants/envs.d.ts +0 -31
  145. package/build/exporter/constants/errors.d.ts +0 -24
  146. package/build/exporter/services/auth.d.ts +0 -10
  147. package/build/exporter/services/db.d.ts +0 -4
  148. package/build/exporter/services/navigation.d.ts +0 -50
  149. package/build/exporter/services/reference-fields.d.ts +0 -20
  150. package/build/exporter/services/robots.d.ts +0 -13
  151. package/build/exporter/services/sites.d.ts +0 -32
  152. package/build/exporter/services/store.d.ts +0 -15
  153. package/build/exporter/types/api.d.ts +0 -141
  154. package/build/exporter/types/global.d.ts +0 -84
  155. package/build/exporter/types/navigation.d.ts +0 -28
  156. package/build/exporter/types/pages.d.ts +0 -144
  157. package/build/exporter/types/render.d.ts +0 -50
  158. package/build/exporter/types/sites.d.ts +0 -56
  159. package/build/exporter/types/templates.d.ts +0 -8
  160. package/build/exporter/utils/api.d.ts +0 -23
  161. package/build/exporter/utils/artifacts.d.ts +0 -6
  162. package/build/exporter/utils/brush.d.ts +0 -18
  163. package/build/exporter/utils/cache.d.ts +0 -30
  164. package/build/exporter/utils/check-health.d.ts +0 -7
  165. package/build/exporter/utils/core-utils.d.ts +0 -77
  166. package/build/exporter/utils/domains.d.ts +0 -13
  167. package/build/exporter/utils/errors.d.ts +0 -15
  168. package/build/exporter/utils/folders.d.ts +0 -66
  169. package/build/exporter/utils/images.d.ts +0 -16
  170. package/build/exporter/utils/instance.d.ts +0 -21
  171. package/build/exporter/utils/loggin.d.ts +0 -37
  172. package/build/exporter/utils/pages.d.ts +0 -34
  173. package/build/exporter/utils/render.d.ts +0 -49
  174. package/build/exporter/utils/sites.d.ts +0 -31
  175. package/build/exporter/utils/store.d.ts +0 -53
  176. package/start-render.js +0 -5
@@ -92,6 +92,9 @@ async function resolveDomainRenderMode(options: { domain: string; shouldBeRender
92
92
  return { renderMode: RENDER_MODE.IDLE, reason: "" };
93
93
  }
94
94
 
95
+ console.log(
96
+ "[ DEBUG ] (INCREMENTAL) porque no se cumplen: missingExports (FROM_SCRATCH), wasRenderWithError (FROM_SCRATCH), isNewDeploy (FROM_SCRATCH) o !shouldBeRendered (IDLE)",
97
+ );
95
98
  return { renderMode: RENDER_MODE.INCREMENTAL, reason: "" };
96
99
  }
97
100
 
@@ -145,7 +148,6 @@ async function getRenderPathsFromDB(options?: { domain?: string; dbFilePath?: st
145
148
  __exports: path.join(paths.exportsDir, domain || ""),
146
149
  __ssg: paths.ssg,
147
150
  __exports_dist: path.join(paths.exportsDir, domain || "", "dist"),
148
- __cx_dist: path.join(paths.cx, "dist"),
149
151
  };
150
152
  }
151
153
 
@@ -3,7 +3,7 @@ import type { Site, SiteData } from "../types/sites";
3
3
  import fsp from "node:fs/promises";
4
4
  import path from "node:path";
5
5
 
6
- import { parse } from "js2xmlparser";
6
+ import { create } from "xmlbuilder2";
7
7
 
8
8
  import {
9
9
  GRIDDO_API_URL,
@@ -84,7 +84,7 @@ async function getSitesToRender(domain: string) {
84
84
  * @see https://griddoio.notion.site/Sites-d7bb0b7cb8d24894a5337e1139fc3d09#2019d3255bda4d219c7e19cf28d0c4fe
85
85
  */
86
86
  async function unpublishSites(sites: Array<Site>) {
87
- const { __cx } = await getRenderPathsFromDB();
87
+ const { __root } = await getRenderPathsFromDB();
88
88
 
89
89
  for (const site of sites) {
90
90
  // API
@@ -102,7 +102,7 @@ async function unpublishSites(sites: Array<Site>) {
102
102
  // STORE
103
103
  // Remove site directory from the Store
104
104
  // @todo: quitar. Como ya no hay persistenci de store, esto debería eliminarse de forma segura.
105
- await fsp.rm(path.join(__cx, "store", site.id.toString()), {
105
+ await fsp.rm(path.join(__root, "store", site.id.toString()), {
106
106
  force: true,
107
107
  recursive: true,
108
108
  });
@@ -150,7 +150,7 @@ async function getSiteData(siteID: number) {
150
150
  async function generateBuildReport(domain: string) {
151
151
  const authControl = await AuthService.login();
152
152
 
153
- const { __cx } = await getRenderPathsFromDB();
153
+ const { __root } = await getRenderPathsFromDB();
154
154
  const { buildReportFileName } = await getRenderMetadataFromDB();
155
155
  const { buildProcessData } = await getBuildMetadata(domain);
156
156
 
@@ -164,7 +164,7 @@ async function generateBuildReport(domain: string) {
164
164
  sites: buildSitesInfo,
165
165
  };
166
166
 
167
- const reportFilePath = path.join(__cx, "dist", buildReportFileName);
167
+ const reportFilePath = path.join(__root, "dist", buildReportFileName);
168
168
 
169
169
  await fsp.writeFile(reportFilePath, JSON.stringify(report));
170
170
 
@@ -175,9 +175,9 @@ async function generateBuildReport(domain: string) {
175
175
  * Generate sitemaps and save them into file system.
176
176
  */
177
177
  async function generateSitemaps(domain: string) {
178
- const { __cx } = await getRenderPathsFromDB();
178
+ const { __root } = await getRenderPathsFromDB();
179
179
  const { sitesToPublish } = await getBuildMetadata(domain);
180
- const distDir = path.join(__cx, "dist");
180
+ const distDir = path.join(__root, "dist");
181
181
  const templateSitemapPrefix = "sitemap-";
182
182
 
183
183
  const isGriddoSitemapFile = (file: string) =>
@@ -245,15 +245,16 @@ async function generateSitemaps(domain: string) {
245
245
  continue;
246
246
  }
247
247
 
248
- const siteMap = parse("urlset", {
249
- "@": {
248
+ const siteMap = create({ version: "1.0", encoding: "UTF-8" })
249
+ .ele("urlset", {
250
250
  xmlns: "http://www.sitemaps.org/schemas/sitemap/0.9",
251
251
  "xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
252
252
  "xsi:schemaLocation":
253
- "http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd",
254
- },
255
- url: sitemapPages,
256
- });
253
+ "http://www.sitemaps.org/schemas/sitemap/0.9 " +
254
+ "http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd",
255
+ })
256
+ .ele(sitemapPages.map((page) => ({ url: page })))
257
+ .end({ prettyPrint: true });
257
258
 
258
259
  const sitemapName = `/${templateSitemapPrefix}${templateId.toLowerCase()}.xml`;
259
260
  const exactPath = path.join(sitemapBasePath, sitemapName);
@@ -267,10 +268,10 @@ async function generateSitemaps(domain: string) {
267
268
  continue;
268
269
  }
269
270
 
270
- const siteMap = parse("sitemapindex", {
271
- "@": { xmlns: "http://www.sitemaps.org/schemas/sitemap/0.9" },
272
- sitemap: sitemaps.map((loc) => ({ loc })),
273
- });
271
+ const siteMap = create({ version: "1.0", encoding: "UTF-8" })
272
+ .ele("sitemapindex", { xmlns: "http://www.sitemaps.org/schemas/sitemap/0.9" })
273
+ .ele(sitemaps.map((loc) => ({ sitemap: { loc } })))
274
+ .end({ prettyPrint: true });
274
275
 
275
276
  const exactPath = path.join(sitemapBasePath, "sitemap.xml");
276
277
 
@@ -93,13 +93,13 @@ async function getPageInStoreDir(basePath: string) {
93
93
  * @param pages - An array of Griddo page objects to be saved.
94
94
  */
95
95
  async function saveSitePagesInStore(siteDirName: string, pages: Array<GriddoPageObject>) {
96
- const { __cx } = await getRenderPathsFromDB();
96
+ const { __root } = await getRenderPathsFromDB();
97
97
 
98
98
  try {
99
99
  for (const page of pages) {
100
100
  removeProperties(page, ["editorID", "parentEditorID"]);
101
101
  const filename = `${page.context.page.id}.json`;
102
- const filePath = path.join(__cx, "store", siteDirName, filename);
102
+ const filePath = path.join(__root, "store", siteDirName, filename);
103
103
  // En los listados estáticos y multipage los ids de las páginas son iguales
104
104
  await writeUniqueFileSync(filePath, JSON.stringify(page));
105
105
  }
@@ -120,11 +120,11 @@ async function saveSitePagesInStore(siteDirName: string, pages: Array<GriddoPage
120
120
  * @param pageIdsArray - A two-dimensional array where each inner array contains numbers representing page files to be removed.
121
121
  */
122
122
  async function removeSitePagesFromStore(siteDirName: string, pageIdsArray: Array<Array<number>>) {
123
- const { __cx } = await getRenderPathsFromDB();
123
+ const { __root } = await getRenderPathsFromDB();
124
124
 
125
125
  const processPageIdsArray = async (pageIds: Array<number>) => {
126
126
  for (const filename of pageIds) {
127
- const filePath = path.join(__cx, "store", siteDirName, `${filename}.json`);
127
+ const filePath = path.join(__root, "store", siteDirName, `${filename}.json`);
128
128
  try {
129
129
  if (await pathExists(filePath)) {
130
130
  await fsp.unlink(filePath);
@@ -148,8 +148,8 @@ async function removeSitePagesFromStore(siteDirName: string, pageIdsArray: Array
148
148
  * be marked as `sitesToUnpublish` so they must be removed manually.
149
149
  */
150
150
  async function removeOrphanSites(sitesToPublish: Array<Site>, domain: string) {
151
- const { __cx } = await getRenderPathsFromDB({ domain });
152
- const storePath = path.join(__cx, "store");
151
+ const { __root } = await getRenderPathsFromDB({ domain });
152
+ const storePath = path.join(__root, "store");
153
153
 
154
154
  if (!(await pathExists(storePath))) {
155
155
  return;
@@ -169,8 +169,8 @@ async function removeOrphanSites(sitesToPublish: Array<Site>, domain: string) {
169
169
  * Get pages that are not active anymore but are in the store.
170
170
  */
171
171
  async function getZombiePagesInStore(siteDir: string, activePages: Array<number>) {
172
- const { __cx } = await getRenderPathsFromDB();
173
- const storeDir = path.join(__cx, "store", siteDir);
172
+ const { __root } = await getRenderPathsFromDB();
173
+ const storeDir = path.join(__root, "store", siteDir);
174
174
  const sitePages = await fsp.readdir(storeDir);
175
175
 
176
176
  const zombiePages: Array<number> = [];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@griddo/cx",
3
3
  "description": "Griddo SSG based on Gatsby",
4
- "version": "11.7.6-rc.1",
4
+ "version": "11.7.6-rc.2",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Diego M. Béjar <diego.bejar@secuoyas.com>",
@@ -15,9 +15,6 @@
15
15
  "type": "git",
16
16
  "url": "https://github.com/griddo/griddo"
17
17
  },
18
- "bin": {
19
- "griddo-cx": "./start-render.js"
20
- },
21
18
  "scripts": {
22
19
  "// NPM": "",
23
20
  "prepare": "yarn run build",
@@ -25,7 +22,7 @@
25
22
  "build": "rm -rf build && sh ./exporter/build.sh",
26
23
  "build:debug": "rm -rf build && sh ./exporter/build.sh --debug",
27
24
  "// TESTS": "",
28
- "test": "NODE_OPTIONS='--import tsx' env-cmd node --test ./__tests__/*",
25
+ "test": "npm run test:create-render-fixtures && NODE_OPTIONS='--import tsx' env-cmd node --test ./__tests__/* && npm run test:remove-render-fixtures",
29
26
  "test:create-render-fixtures": "env-cmd tsx ./__tests__/utils/create-fixtures.ts",
30
27
  "test:remove-render-fixtures": "env-cmd tsx ./__tests__/utils/remove-fixtures.ts",
31
28
  "// INFRA SCRIPTS": "",
@@ -42,24 +39,26 @@
42
39
  "lint": "biome check --write",
43
40
  "format": "biome format --write",
44
41
  "flint": "npm run lint && npm run format",
45
- "ts-lint": "tsc --noEmit",
42
+ "ts-lint": "tsgo --noEmit",
46
43
  "watch:ts-lint": "tsc --noEmit --watch"
47
44
  },
48
45
  "dependencies": {
49
- "@svgr/webpack": "^5.0.0",
46
+ "@svgr/webpack": "5.5.0",
50
47
  "find-up-simple": "1.0.1",
51
48
  "gatsby": "5.15.0",
52
49
  "html-react-parser": "5.2.6",
53
- "js2xmlparser": "5.0.0",
54
50
  "p-limit": "3.1.0",
55
51
  "typescript": "5.9.2",
56
- "webpack": "5.76.1"
52
+ "webpack": "5.101.3",
53
+ "xmlbuilder2": "3.1.1"
57
54
  },
58
55
  "devDependencies": {
59
- "@biomejs/biome": "2.2.3",
56
+ "@biomejs/biome": "2.2.4",
60
57
  "@types/cheerio": "1.0.0",
61
58
  "@types/node": "20.19.2",
62
59
  "@types/webpack": "5.28.5",
60
+ "@types/xml2js": "0.4.14",
61
+ "@typescript/native-preview": "7.0.0-dev.20250912.1",
63
62
  "cheerio": "1.1.2"
64
63
  },
65
64
  "peerDependencies": {
@@ -89,5 +88,5 @@
89
88
  "publishConfig": {
90
89
  "access": "public"
91
90
  },
92
- "gitHead": "223e520fd758d21a2d55457978102bc1f1f35efb"
91
+ "gitHead": "8f531ba518504804c62cf35972d384d5ddc7eaf0"
93
92
  }
@@ -106,10 +106,10 @@ async function* getBuildPagesFromStore<PageType extends GriddoPageObject>(args?:
106
106
  dbFilePath?: string;
107
107
  }): AsyncGenerator<PageType> {
108
108
  const { basePath, withSizeProp, dbFilePath } = args || {};
109
- const { __cx } = await getRenderPathsFromDB({
109
+ const { __root } = await getRenderPathsFromDB({
110
110
  dbFilePath,
111
111
  });
112
- const pagesDirPath = basePath || path.join(__cx, "store");
112
+ const pagesDirPath = basePath || path.join(__root, "store");
113
113
 
114
114
  // Procesamos archivos JSON uno por uno sin cargar todos los paths en memoria
115
115
  for await (const filePath of walkStore(pagesDirPath)) {
package/tsconfig.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "esnext",
3
+ "target": "es2024",
4
4
  "lib": ["dom", "esnext"],
5
5
  "jsx": "react-jsx",
6
6
  "module": "NodeNext",
@@ -10,7 +10,8 @@
10
10
  "strict": true,
11
11
  "skipLibCheck": true,
12
12
  "resolveJsonModule": true,
13
- "typeRoots": []
13
+ "typeRoots": [],
14
+ "sourceMap": true
14
15
  },
15
16
  "include": [
16
17
  "./exporter/**/*.ts",
@@ -1,3 +0,0 @@
1
- import type { RenderContext } from "../shared/context";
2
- import type { SSG } from "../shared/types";
3
- export declare function cleanAction(context: RenderContext<SSG>): Promise<void>;
@@ -1,3 +0,0 @@
1
- import type { RenderContext } from "../shared/context";
2
- import type { SSG } from "../shared/types";
3
- export declare function closeAction(context: RenderContext<SSG>): Promise<void>;
@@ -1,2 +0,0 @@
1
- import type { RenderContext } from "../shared/context";
2
- export declare function dataAction(context: RenderContext): Promise<void>;
@@ -1,2 +0,0 @@
1
- import type { RenderContext } from "../shared/context";
2
- export declare function healthCheckAction(context: RenderContext): Promise<void>;
@@ -1,2 +0,0 @@
1
- import type { RenderContext } from "../shared/context";
2
- export declare function initAction(context: RenderContext): Promise<void>;
@@ -1,2 +0,0 @@
1
- import type { RenderContext } from "../shared/context";
2
- export declare function metaAction(context: RenderContext): Promise<void>;
@@ -1,2 +0,0 @@
1
- import type { RenderContext } from "../shared/context";
2
- export declare function prepareAction(context: RenderContext): Promise<void>;
@@ -1,2 +0,0 @@
1
- import type { RenderContext } from "../shared/context";
2
- export declare function relocationAction(context: RenderContext): Promise<void>;
@@ -1,3 +0,0 @@
1
- import type { RenderContext } from "../shared/context";
2
- import type { SSG } from "../shared/types";
3
- export declare function restoreAction(context: RenderContext<SSG>): Promise<void>;
@@ -1,3 +0,0 @@
1
- import type { RenderContext } from "../shared/context";
2
- import type { SSG } from "../shared/types";
3
- export declare function ssgAction(context: RenderContext<SSG>): Promise<void>;
@@ -1,3 +0,0 @@
1
- import type { RenderContext } from "../shared/context";
2
- import type { SSG } from "../shared/types";
3
- export declare function syncAction(context: RenderContext<SSG>): Promise<void>;
@@ -1,9 +0,0 @@
1
- /**
2
- * Executes a complete Gatsby render process for a given domain.
3
- *
4
- * The render process consists of multiple lifecycle steps that handle cleaning,
5
- * preparing, building and syncing the site. It can run in two modes:
6
- * - FROM_SCRATCH: Performs a complete rebuild of the site
7
- * - INCREMENTAL: Only rebuilds changed pages while preserving the rest
8
- */
9
- export declare function gatsbyRenderDomain(domain: string): Promise<void>;
@@ -1,38 +0,0 @@
1
- import type { Artifacts, PlaceholderPath } from "../../../types/global";
2
- import type { RenderMode } from "../../../types/render";
3
- interface RenderContextProps<T> {
4
- domain: string;
5
- renderMode: RenderMode;
6
- paths: Record<string, string>;
7
- ssg: T;
8
- renderMetadata: {
9
- proDomain: string;
10
- griddoVersion: string;
11
- buildReportFileName: string;
12
- };
13
- cxArtifacts: Artifacts;
14
- }
15
- /**
16
- * Encapsulates the state, configuration, and artifacts for a single SSG
17
- * render process.
18
- *
19
- * This class is instantiated at the beginning of a render and passed through
20
- * each lifecycle step, providing a centralized and consistent context for all
21
- * operations. It is agnostic to the specific SSG being used.
22
- */
23
- export declare class RenderContext<T = unknown> {
24
- readonly domain: string;
25
- readonly renderMode: RenderMode;
26
- readonly paths: Record<PlaceholderPath, string>;
27
- pagesToCreate: number[];
28
- pagesToDelete: number[];
29
- ssg: T;
30
- renderMetadata: {
31
- proDomain: string;
32
- griddoVersion: string;
33
- buildReportFileName: string;
34
- };
35
- cxArtifacts: Artifacts;
36
- constructor({ domain, renderMode, ssg, paths, renderMetadata, cxArtifacts, }: RenderContextProps<T>);
37
- }
38
- export {};
@@ -1,7 +0,0 @@
1
- /**
2
- * Update the Griddo's `/dist` dir with the contents from `public` dir only
3
- * with files of type: js, json and css.
4
- * TODO: Explicar que el static se copia a assets porque el js va en el subdominio de assets.
5
- */
6
- declare function extractAssetsFromDist(domain: string): Promise<void>;
7
- export { extractAssetsFromDist };
@@ -1,7 +0,0 @@
1
- /**
2
- * Spawn a new node process `yarn gatsby-build`
3
- * @note This proccess (`yarn gatsby-build`) can not access to the custom Griddo
4
- * `process.env` so it needs variables passed to it via the `env` prop.
5
- */
6
- declare function gatsbyBuild(assetPrefixWithDomain: string): Promise<void>;
7
- export { gatsbyBuild };
@@ -1,36 +0,0 @@
1
- type SyncRenderConfig = {
2
- src: string;
3
- dst: string;
4
- pagesToCreate: Array<number>;
5
- pagesToDelete: Array<number>;
6
- artifactsToCopyToExports: Array<string>;
7
- };
8
- declare class SyncRender {
9
- private bundleDir;
10
- private currentRenderDir;
11
- private pagesToCreate;
12
- private pagesToDelete;
13
- private assetArtifacts;
14
- private state;
15
- constructor(config: SyncRenderConfig);
16
- setPagesToDelete(): void;
17
- setPagesToAdd(): void;
18
- /**
19
- * Realiza la sincronización de los archivos HTML y JSON entre el directorio
20
- * actual de renderizado y el directorio de exportación.
21
- */
22
- sync(): void;
23
- /**
24
- * Busca archivos por extensión de forma recursiva en un directorio.
25
- * @param dir Directorio base.
26
- * @param extension Extensión a buscar (ej: ".ts", ".js").
27
- * @returns Lista de rutas absolutas de archivos encontrados.
28
- */
29
- private findFilesByExtension;
30
- private findAllPageDataJsons;
31
- private getPageComposePaths;
32
- private copyAppDataJsonFile;
33
- private copyDirs;
34
- private copySitemaps;
35
- }
36
- export { SyncRender };
@@ -1,34 +0,0 @@
1
- interface SSG {
2
- assetPrefix: string;
3
- ssgArtifacts: {
4
- disposables: string[];
5
- cacheables: string[];
6
- };
7
- }
8
- interface GatsbyPageData {
9
- path: string;
10
- result: {
11
- pageContext: {
12
- id: number;
13
- title: string;
14
- path: string;
15
- openGraph: any;
16
- pageMetadata: any;
17
- page: {
18
- site: number;
19
- id: number;
20
- fullPath: {
21
- compose: string;
22
- };
23
- language: number;
24
- title: string;
25
- fullUrl: string;
26
- templateId: string;
27
- template: {
28
- templateType: string;
29
- };
30
- };
31
- };
32
- };
33
- }
34
- export type { GatsbyPageData, SSG };
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,19 +0,0 @@
1
- declare const AI_EMBEDDINGS: string;
2
- declare const ALERT: string;
3
- declare const DOMAINS: string;
4
- declare const GET_ALL: string;
5
- declare const GET_PAGE: string;
6
- declare const LOGIN: string;
7
- declare const RESET_RENDER: string;
8
- declare const ROBOTS: string;
9
- declare const SEARCH: string;
10
- declare const SETTINGS: string;
11
- declare const BUILD_END: string[];
12
- declare const BUILD_START: string[];
13
- declare const GET_PAGES: string[];
14
- declare const GET_REFERENCE_FIELD_DATA: string[];
15
- declare const GET_SITEMAP: string[];
16
- declare const INFO: string[];
17
- declare const LANGUAGES: string[];
18
- declare const SOCIALS: string[];
19
- export { AI_EMBEDDINGS, ALERT, BUILD_END, BUILD_START, DOMAINS, GET_ALL, GET_PAGE, GET_PAGES, GET_REFERENCE_FIELD_DATA, GET_SITEMAP, INFO, LANGUAGES, LOGIN, RESET_RENDER, ROBOTS, SEARCH, SETTINGS, SOCIALS, };
@@ -1,31 +0,0 @@
1
- declare const GRIDDO_API_URL: string | undefined;
2
- declare const GRIDDO_PUBLIC_API_URL: string | undefined;
3
- declare const GRIDDO_BOT_USER: string | undefined;
4
- declare const GRIDDO_BOT_PASSWORD: string | undefined;
5
- declare const GRIDDO_API_CONCURRENCY_COUNT: number;
6
- declare const GRIDDO_RENDER_ALL_SITES: boolean;
7
- declare const GRIDDO_RENDER_SITE: number;
8
- declare const GRIDDO_RENDER_PAGES: number[];
9
- declare const GRIDDO_SKIP_BUILD_CHECKS: boolean;
10
- declare const GRIDDO_DEBUG_LOGS: boolean;
11
- declare const GRIDDO_BUILD_LOGS: boolean;
12
- declare const GRIDDO_RENDER_BREAKPOINTS_FEATURE: boolean;
13
- declare const GRIDDO_SSG_VERBOSE_LOGS: boolean;
14
- declare const GRIDDO_SEARCH_FEATURE: boolean;
15
- declare const GRIDDO_ASSET_PREFIX: string | undefined;
16
- declare const GRIDDO_REACT_APP_INSTANCE: string | undefined;
17
- declare const GRIDDO_AI_EMBEDDINGS: boolean;
18
- declare const GRIDDO_VERBOSE_LOGS: boolean;
19
- declare const GRIDDO_INIT_LIFECYCLE_MAX_ATTEMPTS: number;
20
- declare const GRIDDO_CLEAN_LIFECYCLE_MAX_ATTEMPTS: number;
21
- declare const GRIDDO_CLOSE_LIFECYCLE_MAX_ATTEMPTS: number;
22
- declare const GRIDDO_PREPARE_LIFECYCLE_MAX_ATTEMPTS: number;
23
- declare const GRIDDO_RESTORE_LIFECYCLE_MAX_ATTEMPTS: number;
24
- declare const GRIDDO_DATA_LIFECYCLE_MAX_ATTEMPTS: number;
25
- declare const GRIDDO_SSG_LIFECYCLE_MAX_ATTEMPTS: number;
26
- declare const GRIDDO_RELOCATION_LIFECYCLE_MAX_ATTEMPTS: number;
27
- declare const GRIDDO_META_LIFECYCLE_MAX_ATTEMPTS: number;
28
- declare const GRIDDO_ARCHIVE_LIFECYCLE_MAX_ATTEMPTS: number;
29
- declare const GRIDDO_FIXTURES_DOMAIN_NAMES: string | undefined;
30
- declare const GRIDDO_FIXTURES_SITE_NAMES: string | undefined;
31
- export { GRIDDO_AI_EMBEDDINGS, GRIDDO_API_CONCURRENCY_COUNT, GRIDDO_API_URL, GRIDDO_ARCHIVE_LIFECYCLE_MAX_ATTEMPTS, GRIDDO_ASSET_PREFIX, GRIDDO_BOT_PASSWORD, GRIDDO_BOT_USER, GRIDDO_BUILD_LOGS, GRIDDO_CLEAN_LIFECYCLE_MAX_ATTEMPTS, GRIDDO_CLOSE_LIFECYCLE_MAX_ATTEMPTS, GRIDDO_DATA_LIFECYCLE_MAX_ATTEMPTS, GRIDDO_DEBUG_LOGS, GRIDDO_FIXTURES_DOMAIN_NAMES, GRIDDO_FIXTURES_SITE_NAMES, GRIDDO_INIT_LIFECYCLE_MAX_ATTEMPTS, GRIDDO_META_LIFECYCLE_MAX_ATTEMPTS, GRIDDO_PREPARE_LIFECYCLE_MAX_ATTEMPTS, GRIDDO_PUBLIC_API_URL, GRIDDO_REACT_APP_INSTANCE, GRIDDO_RELOCATION_LIFECYCLE_MAX_ATTEMPTS, GRIDDO_RENDER_ALL_SITES, GRIDDO_RENDER_BREAKPOINTS_FEATURE, GRIDDO_RENDER_PAGES, GRIDDO_RENDER_SITE, GRIDDO_RESTORE_LIFECYCLE_MAX_ATTEMPTS, GRIDDO_SEARCH_FEATURE, GRIDDO_SKIP_BUILD_CHECKS, GRIDDO_SSG_LIFECYCLE_MAX_ATTEMPTS, GRIDDO_SSG_VERBOSE_LOGS, GRIDDO_VERBOSE_LOGS, };
@@ -1,24 +0,0 @@
1
- /**
2
- * Do you want to add a new error to the list?
3
- *
4
- * 1 - Add the new error type name to the `ErrorsType` union type.
5
- * 2 - Export a new ErrorData object (or a function that returns one) in this
6
- * file by completing the `error` (ErrosType) and `message` (string) properties
7
- * obligatorily.
8
- */
9
- import type { SpawnSyncReturns } from "node:child_process";
10
- import type { ErrorData } from "../utils/errors";
11
- type ErrorsType = "UploadSearchError" | "ArtifactError" | "ErrorInSSGBuildProcess" | "LifecycleExecutionError" | "LoginError" | "NoDomainsFoundError" | "NoJSConfigFileFound" | "ReadFromStoreError" | "ReferenceFieldSourcesNotFoundError" | "RenderUUIDError" | "WriteToStoreError" | "CheckHealthError";
12
- declare const ArtifactError: ErrorData;
13
- declare const ErrorInSSGBuildProcess: (command: SpawnSyncReturns<string>) => ErrorData;
14
- declare const LifecycleExecutionError: (attempts: number, name: string) => ErrorData;
15
- declare const LoginError: ErrorData;
16
- declare const NoDomainsFoundError: ErrorData;
17
- declare const NoJSConfigFileFound: ErrorData;
18
- declare const ReadFromStoreError: ErrorData;
19
- declare const ReferenceFieldSourcesNotFoundError: ErrorData;
20
- declare const RenderUUIDError: ErrorData;
21
- declare const WriteToStoreError: ErrorData;
22
- declare const UploadSearchError: ErrorData;
23
- declare const CheckHealthError: ErrorData;
24
- export { ArtifactError, ErrorInSSGBuildProcess, LifecycleExecutionError, LoginError, NoDomainsFoundError, NoJSConfigFileFound, ReadFromStoreError, ReferenceFieldSourcesNotFoundError, RenderUUIDError, UploadSearchError, WriteToStoreError, CheckHealthError, type ErrorsType, };
@@ -1,10 +0,0 @@
1
- import type { AuthHeaders } from "../types/api";
2
- /**
3
- * Service for authentication in the Griddo Private API
4
- */
5
- declare class AuthService {
6
- headers: AuthHeaders | undefined;
7
- login(): Promise<AuthHeaders>;
8
- }
9
- declare const authService: AuthService;
10
- export { authService as AuthService };
@@ -1,4 +0,0 @@
1
- import type { RenderDB } from "../types/render";
2
- declare function readDB(customDBPath?: string): Promise<RenderDB>;
3
- declare function writeDB(renderDB: RenderDB, customDBPath?: string): Promise<void>;
4
- export { readDB, writeDB };
@@ -1,50 +0,0 @@
1
- import type { Footer, Header } from "../types/navigation";
2
- import type { APIPageObject } from "../types/pages";
3
- declare class NavigationService {
4
- private _defaultHeaders;
5
- private _defaultFooters;
6
- private _navigations;
7
- constructor();
8
- set navigations(navigations: {
9
- headers: Array<Header>;
10
- footers: Array<Footer>;
11
- });
12
- get navigations(): {
13
- headers: Array<Header>;
14
- footers: Array<Footer>;
15
- };
16
- getDefaultFooters(): Record<number, Footer>;
17
- getDefaultHeaders(): Record<number, Header>;
18
- getRightLanguage(list: Array<{
19
- language: number;
20
- navigationLanguages: Array<{
21
- navigationId: number;
22
- }>;
23
- id: number;
24
- }>, id: number, language: number): {
25
- language: number;
26
- navigationLanguages: Array<{
27
- navigationId: number;
28
- }>;
29
- id: number;
30
- } | null;
31
- getPageHeader(id: number, language: number): {
32
- language: number;
33
- navigationLanguages: Array<{
34
- navigationId: number;
35
- }>;
36
- id: number;
37
- } | null;
38
- getPageFooter(id: number, language: number): {
39
- language: number;
40
- navigationLanguages: Array<{
41
- navigationId: number;
42
- }>;
43
- id: number;
44
- } | null;
45
- getPageNavigations(page: APIPageObject): {
46
- header: Header;
47
- footer: Footer;
48
- };
49
- }
50
- export { NavigationService };
@@ -1,20 +0,0 @@
1
- import type { APIPageObject } from "../types/pages";
2
- /**
3
- * Compose the queriedItems prop from a ReferenceField data of a page.
4
- *
5
- * @param props
6
- * @param props.page The APIPage object
7
- * @param props.cacheKey A cache key to manage cached files or using fetch
8
- */
9
- declare function getReferenceFieldData({ page, cacheKey, }: {
10
- page: APIPageObject;
11
- /** Reference id to manage cache between renders. */
12
- cacheKey: string;
13
- }): Promise<{
14
- [key: string]: any;
15
- type: "template" | "formTemplate";
16
- templateType: string;
17
- activeSectionSlug: string;
18
- activeSectionBase: string;
19
- }>;
20
- export { getReferenceFieldData };