@anywayseo/gatsby-plugin 2.5.0 → 2.6.1
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/gatsby-node.js +2 -2
- package/package.json +1 -1
- package/types/index.d.ts +2 -0
- package/utils/strapi-source/schema/components/content.d.ts +1 -1
- package/utils/strapi-source/schema/components/content.js +24 -1
- package/utils/strapi-source/strapi-client/index.d.ts +6 -1
- package/utils/strapi-source/strapi-client/index.js +17 -4
- package/utils/strapi-source/strapi-content/index.js +12 -0
package/gatsby-node.js
CHANGED
|
@@ -43,12 +43,12 @@ function createSchemaCustomization(args) {
|
|
|
43
43
|
function sourceNodes(args, options) {
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
45
|
const { reporter } = args;
|
|
46
|
-
const { strapiApiUrl, strapiAccessToken, pageSize, skipFileDownloads = false } = options;
|
|
46
|
+
const { strapiApiUrl, strapiAccessToken, pageSize, skipFileDownloads = false, retryNumber, retryDelay } = options;
|
|
47
47
|
if (source === 'local') {
|
|
48
48
|
reporter.warn('Local source mode enabled. Skipping Strapi source nodes.');
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
51
|
-
const strapiClient = new strapi_source_1.StrapiClient(strapiApiUrl, strapiAccessToken);
|
|
51
|
+
const strapiClient = new strapi_source_1.StrapiClient(reporter, strapiApiUrl, strapiAccessToken, retryNumber, retryDelay);
|
|
52
52
|
yield (0, strapi_source_1.sourceStrapiContentNode)(args, strapiClient, { pageSize, skipFileDownloads });
|
|
53
53
|
yield (0, strapi_source_1.sourceStrapiNavigationNode)(args, strapiClient);
|
|
54
54
|
yield (0, strapi_source_1.sourceStrapiLocalizationNode)(args, strapiClient);
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const content = "\n # === COMPONENT DEFINITIONS ===\n union ContentComponent =\n STRAPI__COMPONENT_CONTENT_FAQ\n | STRAPI__COMPONENT_CONTENT_FEATURES\n | STRAPI__COMPONENT_CONTENT_GAME_CARDS\n | STRAPI__COMPONENT_CONTENT_GAME_CARD_TABS\n | STRAPI__COMPONENT_CONTENT_GAME_DEMO\n | STRAPI__COMPONENT_CONTENT_GAME_INFO\n | STRAPI__COMPONENT_CONTENT_HOW_TO\n | STRAPI__COMPONENT_CONTENT_LIST\n | STRAPI__COMPONENT_CONTENT_MEDIA\n | STRAPI__COMPONENT_CONTENT_PROS_CONS\n | STRAPI__COMPONENT_CONTENT_RICH_TEXT\n | STRAPI__COMPONENT_CONTENT_TABLE\n | STRAPI__COMPONENT_CONTENT_TIP\n\n\n # === FAQ ===\n type STRAPI__COMPONENT_CONTENT_FAQ @dontInfer {\n items: [FaqItem!]\n }\n\n # === FEATURES ===\n type STRAPI__COMPONENT_CONTENT_FEATURES @dontInfer {\n items: [FeaturesItem!]\n }\n\n # === GAME CARDS ===\n type STRAPI__COMPONENT_CONTENT_GAME_CARDS @dontInfer {\n items: [GameCard!]\n order: String!\n randomSeed: Int\n cardHeight: String\n }\n\n # === GAME CARD TABS ===\n type STRAPI__COMPONENT_CONTENT_GAME_CARD_TABS @dontInfer {\n items: [GameCardTab!]\n }\n\n # === GAME_DEMO ===\n type STRAPI__COMPONENT_CONTENT_GAME_DEMO @dontInfer {\n name: String!\n src: String!\n href: String\n previewImage: Image!\n }\n\n # === GAME_INFO ===\n type STRAPI__COMPONENT_CONTENT_GAME_INFO @dontInfer {\n general: GameInfoGeneral\n features: GameInfoFeatures\n currency: CurrencyList\n }\n\n # === HOW_TO ===\n type STRAPI__COMPONENT_CONTENT_HOW_TO @dontInfer {\n steps: [HowToStep!]\n }\n\n # === LIST ===\n type STRAPI__COMPONENT_CONTENT_LIST @dontInfer {\n bullet: String\n content: JsonValue\n }\n\n # === MEDIA ===\n type STRAPI__COMPONENT_CONTENT_MEDIA @dontInfer {\n file: Image\n }\n\n # === PROS_CONS ===\n type STRAPI__COMPONENT_CONTENT_PROS_CONS @dontInfer {\n pros: [ProsConsItem!]\n cons: [ProsConsItem!]\n }\n\n # === RICH_TEXT ===\n type STRAPI__COMPONENT_CONTENT_RICH_TEXT @dontInfer {\n content: RichTextContent\n }\n\n # === TABLE ===\n type STRAPI__COMPONENT_CONTENT_TABLE @dontInfer {\n columnNumber: Int!\n content: JsonValue\n caption: String\n striped: Boolean\n bordered: Boolean\n scrollable: Boolean\n }\n\n # === TIP ===\n type STRAPI__COMPONENT_CONTENT_TIP @dontInfer {\n tip: String!\n author: Author\n }\n ";
|
|
1
|
+
export declare const content = "\n # === COMPONENT DEFINITIONS ===\n union ContentComponent =\n STRAPI__COMPONENT_CONTENT_CONTACTS_PAGE\n | STRAPI__COMPONENT_CONTENT_COOKIE_POLICY_PAGE \n | STRAPI__COMPONENT_CONTENT_FAQ\n | STRAPI__COMPONENT_CONTENT_FEATURES\n | STRAPI__COMPONENT_CONTENT_GAME_CARDS\n | STRAPI__COMPONENT_CONTENT_GAME_CARD_TABS\n | STRAPI__COMPONENT_CONTENT_GAME_DEMO\n | STRAPI__COMPONENT_CONTENT_GAME_INFO\n | STRAPI__COMPONENT_CONTENT_HOW_TO\n | STRAPI__COMPONENT_CONTENT_LIST\n | STRAPI__COMPONENT_CONTENT_MEDIA\n | STRAPI__COMPONENT_CONTENT_PRIVACY_POLICY_PAGE\n | STRAPI__COMPONENT_CONTENT_PROS_CONS\n | STRAPI__COMPONENT_CONTENT_RICH_TEXT\n | STRAPI__COMPONENT_CONTENT_TABLE\n | STRAPI__COMPONENT_CONTENT_TERMS_CONDITIONS_PAGE\n | STRAPI__COMPONENT_CONTENT_TIP\n\n # === CONTACTS ===\n type STRAPI__COMPONENT_CONTENT_CONTACTS_PAGE @dontInfer {\n id: ID\n }\n\n # === COOKIE_POLICY ===\n type STRAPI__COMPONENT_CONTENT_COOKIE_POLICY_PAGE @dontInfer {\n id: ID\n }\n\n # === FAQ ===\n type STRAPI__COMPONENT_CONTENT_FAQ @dontInfer {\n items: [FaqItem!]\n }\n\n # === FEATURES ===\n type STRAPI__COMPONENT_CONTENT_FEATURES @dontInfer {\n items: [FeaturesItem!]\n }\n\n # === GAME CARDS ===\n type STRAPI__COMPONENT_CONTENT_GAME_CARDS @dontInfer {\n items: [GameCard!]\n order: String!\n randomSeed: Int\n cardHeight: String\n }\n\n # === GAME CARD TABS ===\n type STRAPI__COMPONENT_CONTENT_GAME_CARD_TABS @dontInfer {\n items: [GameCardTab!]\n }\n\n # === GAME_DEMO ===\n type STRAPI__COMPONENT_CONTENT_GAME_DEMO @dontInfer {\n name: String!\n src: String!\n href: String\n previewImage: Image!\n }\n\n # === GAME_INFO ===\n type STRAPI__COMPONENT_CONTENT_GAME_INFO @dontInfer {\n general: GameInfoGeneral\n features: GameInfoFeatures\n currency: CurrencyList\n }\n\n # === HOW_TO ===\n type STRAPI__COMPONENT_CONTENT_HOW_TO @dontInfer {\n steps: [HowToStep!]\n }\n\n # === LIST ===\n type STRAPI__COMPONENT_CONTENT_LIST @dontInfer {\n bullet: String\n content: JsonValue\n }\n\n # === MEDIA ===\n type STRAPI__COMPONENT_CONTENT_MEDIA @dontInfer {\n file: Image\n }\n\n # === PRIVACY_POLICY ===\n type STRAPI__COMPONENT_CONTENT_PRIVACY_POLICY_PAGE @dontInfer {\n contactsSlug: String\n }\n\n # === PROS_CONS ===\n type STRAPI__COMPONENT_CONTENT_PROS_CONS @dontInfer {\n pros: [ProsConsItem!]\n cons: [ProsConsItem!]\n }\n\n # === RICH_TEXT ===\n type STRAPI__COMPONENT_CONTENT_RICH_TEXT @dontInfer {\n content: RichTextContent\n }\n\n # === TABLE ===\n type STRAPI__COMPONENT_CONTENT_TABLE @dontInfer {\n columnNumber: Int!\n content: JsonValue\n caption: String\n striped: Boolean\n bordered: Boolean\n scrollable: Boolean\n }\n\n # === TERMS_CONDITIONS ===\n type STRAPI__COMPONENT_CONTENT_TERMS_CONDITIONS_PAGE @dontInfer {\n privacyPolicySlug: String\n }\n\n # === TIP ===\n type STRAPI__COMPONENT_CONTENT_TIP @dontInfer {\n tip: String!\n author: Author\n }\n ";
|
|
@@ -4,7 +4,9 @@ exports.content = void 0;
|
|
|
4
4
|
exports.content = `
|
|
5
5
|
# === COMPONENT DEFINITIONS ===
|
|
6
6
|
union ContentComponent =
|
|
7
|
-
|
|
7
|
+
STRAPI__COMPONENT_CONTENT_CONTACTS_PAGE
|
|
8
|
+
| STRAPI__COMPONENT_CONTENT_COOKIE_POLICY_PAGE
|
|
9
|
+
| STRAPI__COMPONENT_CONTENT_FAQ
|
|
8
10
|
| STRAPI__COMPONENT_CONTENT_FEATURES
|
|
9
11
|
| STRAPI__COMPONENT_CONTENT_GAME_CARDS
|
|
10
12
|
| STRAPI__COMPONENT_CONTENT_GAME_CARD_TABS
|
|
@@ -13,11 +15,22 @@ exports.content = `
|
|
|
13
15
|
| STRAPI__COMPONENT_CONTENT_HOW_TO
|
|
14
16
|
| STRAPI__COMPONENT_CONTENT_LIST
|
|
15
17
|
| STRAPI__COMPONENT_CONTENT_MEDIA
|
|
18
|
+
| STRAPI__COMPONENT_CONTENT_PRIVACY_POLICY_PAGE
|
|
16
19
|
| STRAPI__COMPONENT_CONTENT_PROS_CONS
|
|
17
20
|
| STRAPI__COMPONENT_CONTENT_RICH_TEXT
|
|
18
21
|
| STRAPI__COMPONENT_CONTENT_TABLE
|
|
22
|
+
| STRAPI__COMPONENT_CONTENT_TERMS_CONDITIONS_PAGE
|
|
19
23
|
| STRAPI__COMPONENT_CONTENT_TIP
|
|
20
24
|
|
|
25
|
+
# === CONTACTS ===
|
|
26
|
+
type STRAPI__COMPONENT_CONTENT_CONTACTS_PAGE @dontInfer {
|
|
27
|
+
id: ID
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
# === COOKIE_POLICY ===
|
|
31
|
+
type STRAPI__COMPONENT_CONTENT_COOKIE_POLICY_PAGE @dontInfer {
|
|
32
|
+
id: ID
|
|
33
|
+
}
|
|
21
34
|
|
|
22
35
|
# === FAQ ===
|
|
23
36
|
type STRAPI__COMPONENT_CONTENT_FAQ @dontInfer {
|
|
@@ -73,6 +86,11 @@ exports.content = `
|
|
|
73
86
|
file: Image
|
|
74
87
|
}
|
|
75
88
|
|
|
89
|
+
# === PRIVACY_POLICY ===
|
|
90
|
+
type STRAPI__COMPONENT_CONTENT_PRIVACY_POLICY_PAGE @dontInfer {
|
|
91
|
+
contactsSlug: String
|
|
92
|
+
}
|
|
93
|
+
|
|
76
94
|
# === PROS_CONS ===
|
|
77
95
|
type STRAPI__COMPONENT_CONTENT_PROS_CONS @dontInfer {
|
|
78
96
|
pros: [ProsConsItem!]
|
|
@@ -94,6 +112,11 @@ exports.content = `
|
|
|
94
112
|
scrollable: Boolean
|
|
95
113
|
}
|
|
96
114
|
|
|
115
|
+
# === TERMS_CONDITIONS ===
|
|
116
|
+
type STRAPI__COMPONENT_CONTENT_TERMS_CONDITIONS_PAGE @dontInfer {
|
|
117
|
+
privacyPolicySlug: String
|
|
118
|
+
}
|
|
119
|
+
|
|
97
120
|
# === TIP ===
|
|
98
121
|
type STRAPI__COMPONENT_CONTENT_TIP @dontInfer {
|
|
99
122
|
tip: String!
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import type { Reporter } from 'gatsby';
|
|
1
2
|
export declare class StrapiClient {
|
|
3
|
+
private reporter;
|
|
2
4
|
private apiUrl;
|
|
3
5
|
private accessToken;
|
|
4
|
-
|
|
6
|
+
private retries;
|
|
7
|
+
private delay;
|
|
8
|
+
constructor(reporter: Reporter, apiUrl?: string, accessToken?: string, retries?: number, delay?: number);
|
|
9
|
+
private fetchWithRetry;
|
|
5
10
|
fetch<T = any>(path: string): Promise<T>;
|
|
6
11
|
getApiUrl(): string;
|
|
7
12
|
}
|
|
@@ -11,15 +11,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.StrapiClient = void 0;
|
|
13
13
|
class StrapiClient {
|
|
14
|
-
constructor(apiUrl, accessToken) {
|
|
14
|
+
constructor(reporter, apiUrl, accessToken, retries = 3, delay = 1000) {
|
|
15
15
|
if (!apiUrl || !accessToken) {
|
|
16
16
|
throw new Error('Missing STRAPI_API_URL or STRAPI_TOKEN in environment variables.');
|
|
17
17
|
}
|
|
18
|
+
this.reporter = reporter;
|
|
18
19
|
this.apiUrl = apiUrl;
|
|
19
20
|
this.accessToken = accessToken;
|
|
21
|
+
this.retries = retries;
|
|
22
|
+
this.delay = delay;
|
|
20
23
|
}
|
|
21
|
-
|
|
22
|
-
return __awaiter(this,
|
|
24
|
+
fetchWithRetry(path_1) {
|
|
25
|
+
return __awaiter(this, arguments, void 0, function* (path, retries = this.retries, delay = this.delay) {
|
|
23
26
|
try {
|
|
24
27
|
const result = yield fetch(`${this.apiUrl}/api/${path}`, {
|
|
25
28
|
headers: {
|
|
@@ -33,10 +36,20 @@ class StrapiClient {
|
|
|
33
36
|
return data;
|
|
34
37
|
}
|
|
35
38
|
catch (error) {
|
|
36
|
-
|
|
39
|
+
if (retries > 0) {
|
|
40
|
+
this.reporter.warn(`Fetch failed for ${path}. Retrying in ${delay}ms... (${retries} retries left)`);
|
|
41
|
+
yield new Promise((res) => setTimeout(res, delay));
|
|
42
|
+
return this.fetchWithRetry(path, retries - 1, delay * 2); // exponential backoff
|
|
43
|
+
}
|
|
44
|
+
throw new Error(`Error fetching ${path}: ${error}`);
|
|
37
45
|
}
|
|
38
46
|
});
|
|
39
47
|
}
|
|
48
|
+
fetch(path) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
return this.fetchWithRetry(path, this.retries, this.delay);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
40
53
|
getApiUrl() {
|
|
41
54
|
return this.apiUrl;
|
|
42
55
|
}
|
|
@@ -52,6 +52,12 @@ function sourceStrapiContentNode(args, strapiClient, config) {
|
|
|
52
52
|
},
|
|
53
53
|
content: {
|
|
54
54
|
on: {
|
|
55
|
+
'content.contacts-page': {
|
|
56
|
+
populate: '*',
|
|
57
|
+
},
|
|
58
|
+
'content.cookie-policy-page': {
|
|
59
|
+
populate: '*',
|
|
60
|
+
},
|
|
55
61
|
'content.faq': {
|
|
56
62
|
populate: '*',
|
|
57
63
|
},
|
|
@@ -109,6 +115,9 @@ function sourceStrapiContentNode(args, strapiClient, config) {
|
|
|
109
115
|
'content.media': {
|
|
110
116
|
populate: '*',
|
|
111
117
|
},
|
|
118
|
+
'content.privacy-policy-page': {
|
|
119
|
+
populate: '*',
|
|
120
|
+
},
|
|
112
121
|
'content.pros-cons': {
|
|
113
122
|
populate: '*',
|
|
114
123
|
},
|
|
@@ -118,6 +127,9 @@ function sourceStrapiContentNode(args, strapiClient, config) {
|
|
|
118
127
|
'content.table': {
|
|
119
128
|
populate: '*',
|
|
120
129
|
},
|
|
130
|
+
'content.terms-conditions-page': {
|
|
131
|
+
populate: '*',
|
|
132
|
+
},
|
|
121
133
|
'content.tip': {
|
|
122
134
|
populate: '*',
|
|
123
135
|
},
|