@webbio/strapi-plugin-page-builder 0.11.16-platform → 0.11.17-platform

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/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webbio/strapi-plugin-page-builder",
3
- "version": "0.11.16-platform",
3
+ "version": "0.11.17-platform",
4
4
  "description": "This is the description of the plugin.",
5
5
  "scripts": {
6
6
  "develop": "tsc -p tsconfig.server.json -w",
@@ -5,28 +5,10 @@ const constants_1 = require("../../shared/utils/constants");
5
5
  exports.default = {
6
6
  async generateSitemap(domain) {
7
7
  try {
8
- const entities = await strapi.query(constants_1.PAGE_UID).findMany({
9
- select: ['path', 'updatedAt'],
10
- filters: {
11
- $and: [
12
- {
13
- platform: {
14
- domain
15
- }
16
- },
17
- {
18
- path: {
19
- $notNull: true
20
- }
21
- },
22
- {
23
- publishedAt: {
24
- $notNull: true
25
- }
26
- }
27
- ]
28
- }
29
- });
8
+ const entities = await this.fetchPages(domain);
9
+ if (entities.length === 0) {
10
+ throw new Error('Cannot generate a sitemap with 0 pages');
11
+ }
30
12
  const sitemapStream = new sitemap_1.SitemapStream();
31
13
  for (const entity of entities) {
32
14
  const { path, updatedAt } = entity;
@@ -47,5 +29,50 @@ exports.default = {
47
29
  console.error(error);
48
30
  throw new Error(`Error generating sitemap for domain ${domain}`);
49
31
  }
32
+ },
33
+ async fetchPages(domain) {
34
+ const entities = await strapi.query(constants_1.PAGE_UID).findMany({
35
+ select: ['path', 'updatedAt'],
36
+ where: {
37
+ $and: [
38
+ {
39
+ platform: {
40
+ domain: {
41
+ $eq: domain
42
+ }
43
+ }
44
+ },
45
+ {
46
+ path: {
47
+ $notNull: true
48
+ }
49
+ },
50
+ {
51
+ publishedAt: {
52
+ $notNull: true
53
+ }
54
+ },
55
+ {
56
+ $or: [
57
+ {
58
+ seo: {
59
+ metaRobots: {
60
+ $notContainsi: 'noindex'
61
+ }
62
+ }
63
+ },
64
+ {
65
+ seo: {
66
+ metaRobots: {
67
+ $null: true
68
+ }
69
+ }
70
+ }
71
+ ]
72
+ }
73
+ ]
74
+ }
75
+ });
76
+ return entities;
50
77
  }
51
78
  };