@anywayseo/gatsby-plugin 1.1.0 → 2.0.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/gatsby-node.d.ts +4 -4
- package/gatsby-node.js +60 -80
- package/package.json +9 -2
- package/types/index.d.ts +8 -2
- package/utils/slug.d.ts +2 -0
- package/utils/slug.js +8 -0
- package/utils/strapi-source/index.d.ts +5 -0
- package/utils/strapi-source/index.js +13 -0
- package/utils/strapi-source/schema/components.d.ts +1 -0
- package/utils/strapi-source/schema/components.js +152 -0
- package/utils/strapi-source/schema/index.d.ts +1 -0
- package/utils/strapi-source/schema/index.js +10 -0
- package/utils/strapi-source/schema/localization.d.ts +1 -0
- package/utils/strapi-source/schema/localization.js +14 -0
- package/utils/strapi-source/schema/navigation.d.ts +1 -0
- package/utils/strapi-source/schema/navigation.js +25 -0
- package/utils/strapi-source/schema/page.d.ts +1 -0
- package/utils/strapi-source/schema/page.js +17 -0
- package/utils/strapi-source/schema/shared.d.ts +1 -0
- package/utils/strapi-source/schema/shared.js +22 -0
- package/utils/strapi-source/schema/site.d.ts +1 -0
- package/utils/strapi-source/schema/site.js +14 -0
- package/utils/{strapi-client.d.ts → strapi-source/strapi-client/index.d.ts} +2 -1
- package/utils/strapi-source/strapi-client/index.js +44 -0
- package/utils/strapi-source/strapi-content/clean-entity.d.ts +2 -0
- package/utils/strapi-source/strapi-content/clean-entity.js +93 -0
- package/utils/strapi-source/strapi-content/create-nodes.d.ts +3 -0
- package/utils/strapi-source/strapi-content/create-nodes.js +202 -0
- package/utils/strapi-source/strapi-content/delete-nodes.d.ts +3 -0
- package/utils/strapi-source/strapi-content/delete-nodes.js +76 -0
- package/utils/strapi-source/strapi-content/download-media.d.ts +15 -0
- package/utils/strapi-source/strapi-content/download-media.js +174 -0
- package/utils/strapi-source/strapi-content/fetch-entity.d.ts +4 -0
- package/utils/strapi-source/strapi-content/fetch-entity.js +35 -0
- package/utils/strapi-source/strapi-content/fetch-schemas.d.ts +3 -0
- package/utils/strapi-source/strapi-content/fetch-schemas.js +23 -0
- package/utils/strapi-source/strapi-content/get-cached-entities.d.ts +3 -0
- package/utils/strapi-source/strapi-content/get-cached-entities.js +27 -0
- package/utils/strapi-source/strapi-content/get-endpoints.d.ts +2 -0
- package/utils/strapi-source/strapi-content/get-endpoints.js +32 -0
- package/utils/strapi-source/strapi-content/get-entities.d.ts +2 -0
- package/utils/strapi-source/strapi-content/get-entities.js +17 -0
- package/utils/strapi-source/strapi-content/helpers.d.ts +9 -0
- package/utils/strapi-source/strapi-content/helpers.js +56 -0
- package/utils/strapi-source/strapi-content/index.d.ts +3 -0
- package/utils/strapi-source/strapi-content/index.js +113 -0
- package/utils/strapi-source/strapi-content/types.d.ts +43 -0
- package/utils/strapi-source/strapi-content/types.js +2 -0
- package/utils/strapi-source/strapi-content/utils.d.ts +5 -0
- package/utils/strapi-source/strapi-content/utils.js +30 -0
- package/utils/strapi-source/strapi-localization/index.d.ts +3 -0
- package/utils/strapi-source/strapi-localization/index.js +38 -0
- package/utils/strapi-source/strapi-localization/types.d.ts +9 -0
- package/utils/strapi-source/strapi-localization/types.js +2 -0
- package/utils/strapi-source/strapi-navigation/index.d.ts +3 -0
- package/utils/strapi-source/strapi-navigation/index.js +48 -0
- package/utils/strapi-source/strapi-navigation/types.d.ts +5 -0
- package/utils/strapi-source/strapi-navigation/types.js +2 -0
- package/utils/schema.d.ts +0 -1
- package/utils/schema.js +0 -194
- package/utils/strapi-client.js +0 -20
package/gatsby-node.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CreatePagesArgs, CreateSchemaCustomizationArgs, CreateWebpackConfigArgs, SourceNodesArgs } from 'gatsby';
|
|
2
2
|
import type { IPluginOptions } from './types';
|
|
3
|
-
export declare function onCreateWebpackConfig(
|
|
4
|
-
export declare function createSchemaCustomization(
|
|
5
|
-
export declare function sourceNodes(args: SourceNodesArgs,
|
|
6
|
-
export declare function createPages(args: CreatePagesArgs,
|
|
3
|
+
export declare function onCreateWebpackConfig(args: CreateWebpackConfigArgs): void;
|
|
4
|
+
export declare function createSchemaCustomization(args: CreateSchemaCustomizationArgs, options: IPluginOptions): void;
|
|
5
|
+
export declare function sourceNodes(args: SourceNodesArgs, options: IPluginOptions): Promise<void>;
|
|
6
|
+
export declare function createPages(args: CreatePagesArgs, options: IPluginOptions): Promise<void>;
|
package/gatsby-node.js
CHANGED
|
@@ -14,9 +14,10 @@ exports.createSchemaCustomization = createSchemaCustomization;
|
|
|
14
14
|
exports.sourceNodes = sourceNodes;
|
|
15
15
|
exports.createPages = createPages;
|
|
16
16
|
const path_1 = require("path");
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
function onCreateWebpackConfig(
|
|
17
|
+
const slug_1 = require("./utils/slug");
|
|
18
|
+
const strapi_source_1 = require("./utils/strapi-source");
|
|
19
|
+
function onCreateWebpackConfig(args) {
|
|
20
|
+
const { actions, store } = args;
|
|
20
21
|
const root = store.getState().program.directory;
|
|
21
22
|
actions.setWebpackConfig({
|
|
22
23
|
resolve: {
|
|
@@ -24,77 +25,45 @@ function onCreateWebpackConfig({ actions, store }) {
|
|
|
24
25
|
},
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
|
-
function createSchemaCustomization(
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
function createSchemaCustomization(args, options) {
|
|
29
|
+
const { actions, reporter } = args;
|
|
30
|
+
const { source } = options;
|
|
31
|
+
if (source === 'local') {
|
|
32
|
+
reporter.warn('Local source mode enabled. Apply Strapi type definitions fallback.');
|
|
33
|
+
actions.createTypes(strapi_source_1.typeDefs);
|
|
30
34
|
}
|
|
31
35
|
}
|
|
32
|
-
function
|
|
33
|
-
return __awaiter(this,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const result = yield strapiClient.fetch('navigation');
|
|
37
|
-
if (!result.ok) {
|
|
38
|
-
throw new Error(`Failed to fetch navigation list: ${result.status} ${result.statusText}`);
|
|
39
|
-
}
|
|
40
|
-
const navigation = yield result.json();
|
|
41
|
-
const navigationList = Array.isArray(navigation) ? navigation : [];
|
|
42
|
-
reporter.info(`Found ${navigationList.length} navigation objects`);
|
|
43
|
-
const strapiNavigation = [];
|
|
44
|
-
for (const { slug, name } of navigationList) {
|
|
45
|
-
const result = yield strapiClient.fetch(`navigation/render/${slug}?type=TREE`);
|
|
46
|
-
if (!result.ok) {
|
|
47
|
-
reporter.warn(`Failed to fetch rendered navigation: ${slug} (${result.status})`);
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
const navigationItems = yield result.json();
|
|
51
|
-
if (!navigationItems.length) {
|
|
52
|
-
reporter.warn(`Missing navigation items in ${slug}`);
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
strapiNavigation.push({ name, slug, items: navigationItems });
|
|
56
|
-
}
|
|
57
|
-
const nodeContent = JSON.stringify(strapiNavigation);
|
|
58
|
-
const nodeMeta = {
|
|
59
|
-
id: createNodeId(`strapi-navigation-header`),
|
|
60
|
-
parent: null,
|
|
61
|
-
children: [],
|
|
62
|
-
internal: {
|
|
63
|
-
type: `StrapiNavigation`,
|
|
64
|
-
mediaType: `application/json`,
|
|
65
|
-
content: nodeContent,
|
|
66
|
-
contentDigest: createContentDigest(strapiNavigation),
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
actions.createNode(Object.assign(Object.assign({}, nodeMeta), { items: strapiNavigation }));
|
|
70
|
-
reporter.success('Navigation node created');
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
reporter.panicOnBuild('Error fetching navigation from Strapi:', error);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
function sourceNodes(args_1, _a) {
|
|
78
|
-
return __awaiter(this, arguments, void 0, function* (args, { source, strapiApiUrl, strapiAccessToken }) {
|
|
36
|
+
function sourceNodes(args, options) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const { reporter } = args;
|
|
39
|
+
const { source, strapiApiUrl, strapiAccessToken } = options;
|
|
79
40
|
if (source === 'local') {
|
|
80
|
-
|
|
41
|
+
reporter.warn('Local source mode enabled. Skipping Strapi source nodes.');
|
|
81
42
|
}
|
|
82
43
|
else {
|
|
83
|
-
const strapiClient = new
|
|
84
|
-
yield
|
|
44
|
+
const strapiClient = new strapi_source_1.StrapiClient(strapiApiUrl, strapiAccessToken);
|
|
45
|
+
yield (0, strapi_source_1.sourceStrapiContentNode)(args, strapiClient);
|
|
46
|
+
yield (0, strapi_source_1.sourceStrapiNavigationNode)(args, strapiClient);
|
|
47
|
+
yield (0, strapi_source_1.sourceStrapiLocalizationNode)(args, strapiClient);
|
|
85
48
|
}
|
|
86
49
|
});
|
|
87
50
|
}
|
|
88
51
|
function createStrapiPages(_a, root_1) {
|
|
89
52
|
return __awaiter(this, arguments, void 0, function* ({ actions, reporter, graphql }, root) {
|
|
90
|
-
var _b, _c;
|
|
53
|
+
var _b, _c, _d, _e;
|
|
91
54
|
reporter.info('Starting to create Strapi pages');
|
|
92
55
|
try {
|
|
93
56
|
const result = yield graphql(`
|
|
94
|
-
query
|
|
57
|
+
query GetStrapiPages {
|
|
58
|
+
strapiSite {
|
|
59
|
+
locale
|
|
60
|
+
}
|
|
95
61
|
allStrapiPage {
|
|
96
62
|
nodes {
|
|
63
|
+
id
|
|
64
|
+
title
|
|
97
65
|
slug
|
|
66
|
+
locale
|
|
98
67
|
}
|
|
99
68
|
}
|
|
100
69
|
}
|
|
@@ -102,29 +71,32 @@ function createStrapiPages(_a, root_1) {
|
|
|
102
71
|
if (result.errors) {
|
|
103
72
|
throw new Error(`There was an error loading your Strapi pages: ${result.errors}`);
|
|
104
73
|
}
|
|
105
|
-
const
|
|
74
|
+
const defaultLocale = (_c = (_b = result.data) === null || _b === void 0 ? void 0 : _b.strapiSite) === null || _c === void 0 ? void 0 : _c.locale;
|
|
75
|
+
const strapiPages = (_e = (_d = result.data) === null || _d === void 0 ? void 0 : _d.allStrapiPage) === null || _e === void 0 ? void 0 : _e.nodes;
|
|
106
76
|
if (!(strapiPages === null || strapiPages === void 0 ? void 0 : strapiPages.length)) {
|
|
107
77
|
reporter.warn('No Strapi pages found. Skipping Strapi page creation.');
|
|
108
78
|
return;
|
|
109
79
|
}
|
|
110
80
|
reporter.info(`Found ${strapiPages.length} Strapi pages`);
|
|
111
|
-
let
|
|
112
|
-
strapiPages.forEach(({ slug }) => {
|
|
113
|
-
if (slug) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
path: `/${slug === 'index' ? '' : slug}`,
|
|
121
|
-
component: strapiPageTemplate,
|
|
122
|
-
context: { slug },
|
|
123
|
-
});
|
|
124
|
-
count++;
|
|
81
|
+
let pageCount = 0;
|
|
82
|
+
strapiPages.forEach(({ id, slug, title, locale }) => {
|
|
83
|
+
if (slug === slug_1.DUMMY_PAGE_SLUG) {
|
|
84
|
+
reporter.info('Skipping page creation: dummy page detected.');
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (!title && !slug) {
|
|
88
|
+
reporter.info('Skipping page creation: empty page detected.');
|
|
89
|
+
return;
|
|
125
90
|
}
|
|
91
|
+
const strapiPageTemplate = (0, path_1.resolve)(root, `./src/templates/strapi-page.tsx`);
|
|
92
|
+
actions.createPage({
|
|
93
|
+
path: `/${locale === defaultLocale ? '' : locale + '/'}${(0, slug_1.normalizeSlug)(slug)}`,
|
|
94
|
+
component: strapiPageTemplate,
|
|
95
|
+
context: { id },
|
|
96
|
+
});
|
|
97
|
+
pageCount++;
|
|
126
98
|
});
|
|
127
|
-
reporter.success(`Created ${
|
|
99
|
+
reporter.success(`Created ${pageCount} Strapi pages`);
|
|
128
100
|
}
|
|
129
101
|
catch (error) {
|
|
130
102
|
reporter.panicOnBuild(`Error creating Strapi pages: ${error}`);
|
|
@@ -132,7 +104,7 @@ function createStrapiPages(_a, root_1) {
|
|
|
132
104
|
});
|
|
133
105
|
}
|
|
134
106
|
function createMdxPages(_a, root_1) {
|
|
135
|
-
return __awaiter(this, arguments, void 0, function* ({ actions, reporter, graphql }, root) {
|
|
107
|
+
return __awaiter(this, arguments, void 0, function* ({ actions, store, reporter, graphql }, root) {
|
|
136
108
|
var _b, _c;
|
|
137
109
|
reporter.info('Starting to create Mdx pages');
|
|
138
110
|
try {
|
|
@@ -160,15 +132,21 @@ function createMdxPages(_a, root_1) {
|
|
|
160
132
|
return;
|
|
161
133
|
}
|
|
162
134
|
reporter.info(`Found ${mdxPages.length} MDX pages`);
|
|
135
|
+
const existingPages = [...store.getState().pages.values()];
|
|
163
136
|
let count = 0;
|
|
164
137
|
mdxPages.forEach(({ frontmatter, internal }) => {
|
|
165
138
|
const slug = frontmatter === null || frontmatter === void 0 ? void 0 : frontmatter.slug;
|
|
166
139
|
const contentFilePath = internal.contentFilePath;
|
|
167
140
|
if (slug && contentFilePath) {
|
|
141
|
+
const hasRemoteVersion = existingPages.some(({ path }) => path.includes(slug));
|
|
142
|
+
if (hasRemoteVersion) {
|
|
143
|
+
reporter.warn(`Skipping local page, remote exists: ${slug}`);
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
168
146
|
const mdxPageTemplate = (0, path_1.resolve)(root, `./src/templates/mdx-page.jsx`);
|
|
169
147
|
const component = `${mdxPageTemplate}?__contentFilePath=${contentFilePath}`;
|
|
170
148
|
actions.createPage({
|
|
171
|
-
path: `/${
|
|
149
|
+
path: `/${(0, slug_1.normalizeSlug)(slug)}`,
|
|
172
150
|
component,
|
|
173
151
|
context: { slug },
|
|
174
152
|
});
|
|
@@ -197,11 +175,13 @@ function createRedirectPage(_a, root_1) {
|
|
|
197
175
|
}
|
|
198
176
|
});
|
|
199
177
|
}
|
|
200
|
-
function createPages(
|
|
201
|
-
return __awaiter(this,
|
|
202
|
-
const
|
|
178
|
+
function createPages(args, options) {
|
|
179
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
180
|
+
const { reporter, store } = args;
|
|
181
|
+
const { source } = options;
|
|
182
|
+
const root = store.getState().program.directory;
|
|
203
183
|
if (source === 'local') {
|
|
204
|
-
|
|
184
|
+
reporter.warn('Local source mode enabled. Skipping Strapi page creation.');
|
|
205
185
|
}
|
|
206
186
|
else {
|
|
207
187
|
yield createStrapiPages(args, root);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anywayseo/gatsby-plugin",
|
|
3
3
|
"description": "Shared config for Anywayseo sites",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"author": "zerg41",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"publishConfig": {
|
|
@@ -27,12 +27,19 @@
|
|
|
27
27
|
"bump:major": "npm version major",
|
|
28
28
|
"postversion": "git push --follow-tags && npm publish"
|
|
29
29
|
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"commonmark": "0.31.2",
|
|
32
|
+
"qs": "6.14.0"
|
|
33
|
+
},
|
|
30
34
|
"devDependencies": {
|
|
35
|
+
"@types/commonmark": "0.27.10",
|
|
31
36
|
"@types/node": "^20.0.0",
|
|
37
|
+
"@types/qs": "6.14.0",
|
|
32
38
|
"rimraf": "^6.0.1",
|
|
33
39
|
"typescript": "^5.0.0"
|
|
34
40
|
},
|
|
35
41
|
"peerDependencies": {
|
|
36
|
-
"gatsby": "^5.0.0"
|
|
42
|
+
"gatsby": "^5.0.0",
|
|
43
|
+
"gatsby-source-filesystem": "^5.0.0"
|
|
37
44
|
}
|
|
38
45
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -5,10 +5,16 @@ export interface IPluginOptions extends IPluginRefOptions {
|
|
|
5
5
|
strapiApiUrl?: string;
|
|
6
6
|
strapiAccessToken?: string;
|
|
7
7
|
}
|
|
8
|
-
export interface
|
|
8
|
+
export interface IGetStrapiPagesQuery {
|
|
9
|
+
strapiSite?: {
|
|
10
|
+
locale?: string;
|
|
11
|
+
};
|
|
9
12
|
allStrapiPage?: {
|
|
10
13
|
nodes: {
|
|
11
|
-
|
|
14
|
+
id: string;
|
|
15
|
+
title?: string | null;
|
|
16
|
+
slug?: string | null;
|
|
17
|
+
locale?: string | null;
|
|
12
18
|
}[];
|
|
13
19
|
};
|
|
14
20
|
}
|
package/utils/slug.d.ts
ADDED
package/utils/slug.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DUMMY_PAGE_SLUG = void 0;
|
|
4
|
+
exports.normalizeSlug = normalizeSlug;
|
|
5
|
+
exports.DUMMY_PAGE_SLUG = 'dummy';
|
|
6
|
+
function normalizeSlug(slug) {
|
|
7
|
+
return slug && slug !== 'index' ? slug : '';
|
|
8
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { typeDefs } from './schema';
|
|
2
|
+
export { StrapiClient } from './strapi-client';
|
|
3
|
+
export { sourceStrapiContentNode } from './strapi-content';
|
|
4
|
+
export { sourceStrapiNavigationNode } from './strapi-navigation';
|
|
5
|
+
export { sourceStrapiLocalizationNode } from './strapi-localization';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sourceStrapiLocalizationNode = exports.sourceStrapiNavigationNode = exports.sourceStrapiContentNode = exports.StrapiClient = exports.typeDefs = void 0;
|
|
4
|
+
var schema_1 = require("./schema");
|
|
5
|
+
Object.defineProperty(exports, "typeDefs", { enumerable: true, get: function () { return schema_1.typeDefs; } });
|
|
6
|
+
var strapi_client_1 = require("./strapi-client");
|
|
7
|
+
Object.defineProperty(exports, "StrapiClient", { enumerable: true, get: function () { return strapi_client_1.StrapiClient; } });
|
|
8
|
+
var strapi_content_1 = require("./strapi-content");
|
|
9
|
+
Object.defineProperty(exports, "sourceStrapiContentNode", { enumerable: true, get: function () { return strapi_content_1.sourceStrapiContentNode; } });
|
|
10
|
+
var strapi_navigation_1 = require("./strapi-navigation");
|
|
11
|
+
Object.defineProperty(exports, "sourceStrapiNavigationNode", { enumerable: true, get: function () { return strapi_navigation_1.sourceStrapiNavigationNode; } });
|
|
12
|
+
var strapi_localization_1 = require("./strapi-localization");
|
|
13
|
+
Object.defineProperty(exports, "sourceStrapiLocalizationNode", { enumerable: true, get: function () { return strapi_localization_1.sourceStrapiLocalizationNode; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const components = "\n # === COMPONENT DEFINITIONS ===\n union ContentComponent =\n STRAPI__COMPONENT_CONTENT_FAQ\n | STRAPI__COMPONENT_CONTENT_FEATURES\n | STRAPI__COMPONENT_CONTENT_PROS_CONS\n | STRAPI__COMPONENT_CONTENT_GAME_DEMO\n | STRAPI__COMPONENT_CONTENT_GAME_INFO\n | STRAPI__COMPONENT_CONTENT_HOW_TO\n | STRAPI__COMPONENT_CONTENT_TIP\n | STRAPI__COMPONENT_CONTENT_RICH_TEXT\n | STRAPI__COMPONENT_CONTENT_MEDIA\n | STRAPI__COMPONENT_CONTENT_LIST\n | STRAPI__COMPONENT_CONTENT_TABLE\n\n\n # === FAQ ===\n type STRAPI__COMPONENT_CONTENT_FAQ @dontInfer {\n items: [FaqItem!]\n }\n\n type FaqItem {\n question: String\n answer: String\n }\n\n\n # === FEATURES ===\n type STRAPI__COMPONENT_CONTENT_FEATURES @dontInfer {\n items: [ListItem!]\n }\n\n\n # === PROS_CONS ===\n type STRAPI__COMPONENT_CONTENT_PROS_CONS @dontInfer {\n pros: [ListItem!]\n cons: [ListItem!]\n }\n\n type ListItem {\n title: String\n description: String\n }\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\n # === GAME_INFO ===\n type STRAPI__COMPONENT_CONTENT_GAME_INFO @dontInfer {\n general: GameInfoGeneral\n features: GameInfoFeatures\n }\n\n type GameInfoGeneral @dontInfer {\n NAME: String\n DEVELOPER: String\n RELEASE_DATE: Date @dateformat\n THEME: String\n TYPE: String\n VOLATILITY: String\n RTP: String\n PAY_LINES: String\n ROWS_WITH_PINS: String\n REELS_NUMBER: String\n MIN_BET: String\n MAX_BET: String\n MAX_WIN: String\n COMPATIBILITY: String\n }\n\n type GameInfoFeatures @dontInfer {\n HAS_DEMO: Boolean\n HAS_AUTOPLAY: Boolean\n HAS_FREE_SPINS: Boolean\n HAS_FAST_SPIN: Boolean\n HAS_BONUS_PURCHASE: Boolean\n HAS_COLLECTION_SYMBOLS: Boolean\n HAS_PROGRESSIVE_JACKPOT: Boolean\n BONUS_FEATURES: String\n FUNCTIONS: String\n LANGUAGES: String\n }\n\n\n # === HOW_TO ===\n type STRAPI__COMPONENT_CONTENT_HOW_TO @dontInfer {\n steps: [HowToStep!]\n }\n\n type HowToStep {\n title: String!\n description: String\n thumbnail: Image\n }\n\n\n # === TIP ===\n type STRAPI__COMPONENT_CONTENT_TIP @dontInfer {\n tip: String\n author: Author\n }\n\n\n # === RICH_TEXT ===\n type STRAPI__COMPONENT_CONTENT_RICH_TEXT @dontInfer {\n content: RichTextContent\n }\n\n type RichTextContent {\n data: RichTextData\n }\n\n type RichTextData {\n content: String\n }\n\n\n # === MEDIA ===\n type STRAPI__COMPONENT_CONTENT_MEDIA @dontInfer {\n file: Image\n }\n\n # === LIST ===\n type STRAPI__COMPONENT_CONTENT_LIST @dontInfer {\n bullet: String\n content: JsonValue\n }\n\n # === TABLE ===\n type STRAPI__COMPONENT_CONTENT_TABLE @dontInfer {\n columnNumber: Int\n striped: Boolean\n bordered: Boolean\n scrollable: Boolean\n caption: String\n content: JsonValue\n }\n\n type JsonValue {\n strapi_json_value: JSON\n }\n ";
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.components = void 0;
|
|
4
|
+
exports.components = `
|
|
5
|
+
# === COMPONENT DEFINITIONS ===
|
|
6
|
+
union ContentComponent =
|
|
7
|
+
STRAPI__COMPONENT_CONTENT_FAQ
|
|
8
|
+
| STRAPI__COMPONENT_CONTENT_FEATURES
|
|
9
|
+
| STRAPI__COMPONENT_CONTENT_PROS_CONS
|
|
10
|
+
| STRAPI__COMPONENT_CONTENT_GAME_DEMO
|
|
11
|
+
| STRAPI__COMPONENT_CONTENT_GAME_INFO
|
|
12
|
+
| STRAPI__COMPONENT_CONTENT_HOW_TO
|
|
13
|
+
| STRAPI__COMPONENT_CONTENT_TIP
|
|
14
|
+
| STRAPI__COMPONENT_CONTENT_RICH_TEXT
|
|
15
|
+
| STRAPI__COMPONENT_CONTENT_MEDIA
|
|
16
|
+
| STRAPI__COMPONENT_CONTENT_LIST
|
|
17
|
+
| STRAPI__COMPONENT_CONTENT_TABLE
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# === FAQ ===
|
|
21
|
+
type STRAPI__COMPONENT_CONTENT_FAQ @dontInfer {
|
|
22
|
+
items: [FaqItem!]
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
type FaqItem {
|
|
26
|
+
question: String
|
|
27
|
+
answer: String
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# === FEATURES ===
|
|
32
|
+
type STRAPI__COMPONENT_CONTENT_FEATURES @dontInfer {
|
|
33
|
+
items: [ListItem!]
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# === PROS_CONS ===
|
|
38
|
+
type STRAPI__COMPONENT_CONTENT_PROS_CONS @dontInfer {
|
|
39
|
+
pros: [ListItem!]
|
|
40
|
+
cons: [ListItem!]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type ListItem {
|
|
44
|
+
title: String
|
|
45
|
+
description: String
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# === GAME_DEMO ===
|
|
50
|
+
type STRAPI__COMPONENT_CONTENT_GAME_DEMO @dontInfer {
|
|
51
|
+
name: String
|
|
52
|
+
src: String
|
|
53
|
+
href: String
|
|
54
|
+
previewImage: Image
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# === GAME_INFO ===
|
|
59
|
+
type STRAPI__COMPONENT_CONTENT_GAME_INFO @dontInfer {
|
|
60
|
+
general: GameInfoGeneral
|
|
61
|
+
features: GameInfoFeatures
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
type GameInfoGeneral @dontInfer {
|
|
65
|
+
NAME: String
|
|
66
|
+
DEVELOPER: String
|
|
67
|
+
RELEASE_DATE: Date @dateformat
|
|
68
|
+
THEME: String
|
|
69
|
+
TYPE: String
|
|
70
|
+
VOLATILITY: String
|
|
71
|
+
RTP: String
|
|
72
|
+
PAY_LINES: String
|
|
73
|
+
ROWS_WITH_PINS: String
|
|
74
|
+
REELS_NUMBER: String
|
|
75
|
+
MIN_BET: String
|
|
76
|
+
MAX_BET: String
|
|
77
|
+
MAX_WIN: String
|
|
78
|
+
COMPATIBILITY: String
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
type GameInfoFeatures @dontInfer {
|
|
82
|
+
HAS_DEMO: Boolean
|
|
83
|
+
HAS_AUTOPLAY: Boolean
|
|
84
|
+
HAS_FREE_SPINS: Boolean
|
|
85
|
+
HAS_FAST_SPIN: Boolean
|
|
86
|
+
HAS_BONUS_PURCHASE: Boolean
|
|
87
|
+
HAS_COLLECTION_SYMBOLS: Boolean
|
|
88
|
+
HAS_PROGRESSIVE_JACKPOT: Boolean
|
|
89
|
+
BONUS_FEATURES: String
|
|
90
|
+
FUNCTIONS: String
|
|
91
|
+
LANGUAGES: String
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
# === HOW_TO ===
|
|
96
|
+
type STRAPI__COMPONENT_CONTENT_HOW_TO @dontInfer {
|
|
97
|
+
steps: [HowToStep!]
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
type HowToStep {
|
|
101
|
+
title: String!
|
|
102
|
+
description: String
|
|
103
|
+
thumbnail: Image
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
# === TIP ===
|
|
108
|
+
type STRAPI__COMPONENT_CONTENT_TIP @dontInfer {
|
|
109
|
+
tip: String
|
|
110
|
+
author: Author
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
# === RICH_TEXT ===
|
|
115
|
+
type STRAPI__COMPONENT_CONTENT_RICH_TEXT @dontInfer {
|
|
116
|
+
content: RichTextContent
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
type RichTextContent {
|
|
120
|
+
data: RichTextData
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
type RichTextData {
|
|
124
|
+
content: String
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
# === MEDIA ===
|
|
129
|
+
type STRAPI__COMPONENT_CONTENT_MEDIA @dontInfer {
|
|
130
|
+
file: Image
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
# === LIST ===
|
|
134
|
+
type STRAPI__COMPONENT_CONTENT_LIST @dontInfer {
|
|
135
|
+
bullet: String
|
|
136
|
+
content: JsonValue
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
# === TABLE ===
|
|
140
|
+
type STRAPI__COMPONENT_CONTENT_TABLE @dontInfer {
|
|
141
|
+
columnNumber: Int
|
|
142
|
+
striped: Boolean
|
|
143
|
+
bordered: Boolean
|
|
144
|
+
scrollable: Boolean
|
|
145
|
+
caption: String
|
|
146
|
+
content: JsonValue
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
type JsonValue {
|
|
150
|
+
strapi_json_value: JSON
|
|
151
|
+
}
|
|
152
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const typeDefs: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.typeDefs = void 0;
|
|
4
|
+
const components_1 = require("./components");
|
|
5
|
+
const localization_1 = require("./localization");
|
|
6
|
+
const navigation_1 = require("./navigation");
|
|
7
|
+
const page_1 = require("./page");
|
|
8
|
+
const shared_1 = require("./shared");
|
|
9
|
+
const site_1 = require("./site");
|
|
10
|
+
exports.typeDefs = [shared_1.shared, site_1.site, navigation_1.navigation, localization_1.localization, page_1.page, components_1.components].join('\n');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const localization = "\n # === STRAPI LOCALIZATION DEFINITIONS ===\n type StrapiLocalization implements Node {\n locales: [Locale!]\n }\n \n type Locale {\n code: String!\n name: String!\n }\n ";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.localization = void 0;
|
|
4
|
+
exports.localization = `
|
|
5
|
+
# === STRAPI LOCALIZATION DEFINITIONS ===
|
|
6
|
+
type StrapiLocalization implements Node {
|
|
7
|
+
locales: [Locale!]
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type Locale {
|
|
11
|
+
code: String!
|
|
12
|
+
name: String!
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const navigation = "\n # === STRAPI NAVIGATION DEFINITIONS ===\n type StrapiNavigation implements Node {\n id: ID!\n items: [NavigationGroup!]\n }\n\n type NavigationGroup {\n name: String!\n slug: String!\n items: [NavigationItem!]\n }\n\n type NavigationItem {\n type: String!\n title: String!\n slug: String!\n path: String!\n menuAttached: Boolean!\n items: [NavigationItem!]\n }\n ";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.navigation = void 0;
|
|
4
|
+
exports.navigation = `
|
|
5
|
+
# === STRAPI NAVIGATION DEFINITIONS ===
|
|
6
|
+
type StrapiNavigation implements Node {
|
|
7
|
+
id: ID!
|
|
8
|
+
items: [NavigationGroup!]
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type NavigationGroup {
|
|
12
|
+
name: String!
|
|
13
|
+
slug: String!
|
|
14
|
+
items: [NavigationItem!]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type NavigationItem {
|
|
18
|
+
type: String!
|
|
19
|
+
title: String!
|
|
20
|
+
slug: String!
|
|
21
|
+
path: String!
|
|
22
|
+
menuAttached: Boolean!
|
|
23
|
+
items: [NavigationItem!]
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const page = "\n # === STRAPI PAGE DEFINITIONS ===\n type StrapiPage implements Node {\n id: ID!\n title: String\n slug: String\n seo: Seo\n author: Author\n createdAt: Date @dateformat\n updatedAt: Date @dateformat\n content: [ContentComponent]\n }\n\n";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.page = void 0;
|
|
4
|
+
exports.page = `
|
|
5
|
+
# === STRAPI PAGE DEFINITIONS ===
|
|
6
|
+
type StrapiPage implements Node {
|
|
7
|
+
id: ID!
|
|
8
|
+
title: String
|
|
9
|
+
slug: String
|
|
10
|
+
seo: Seo
|
|
11
|
+
author: Author
|
|
12
|
+
createdAt: Date @dateformat
|
|
13
|
+
updatedAt: Date @dateformat
|
|
14
|
+
content: [ContentComponent]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const shared = "\n # === SHARED DEFINITIONS ===\n type Image {\n localFile: File @link(from: \"localFile\")\n alternativeText: String\n }\n\n type Seo {\n metaTitle: String\n metaDescription: String\n }\n\n type Author {\n name: String\n role: String\n bio: String\n avatar: Image\n }\n ";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shared = void 0;
|
|
4
|
+
exports.shared = `
|
|
5
|
+
# === SHARED DEFINITIONS ===
|
|
6
|
+
type Image {
|
|
7
|
+
localFile: File @link(from: "localFile")
|
|
8
|
+
alternativeText: String
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type Seo {
|
|
12
|
+
metaTitle: String
|
|
13
|
+
metaDescription: String
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type Author {
|
|
17
|
+
name: String
|
|
18
|
+
role: String
|
|
19
|
+
bio: String
|
|
20
|
+
avatar: Image
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const site = "\n # === STRAPI SITE DEFINITIONS ===\n type StrapiSite implements Node {\n id: ID!\n name: String\n locale: String\n currency: String\n seo: Seo\n logo: Image\n }\n ";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.site = void 0;
|
|
4
|
+
exports.site = `
|
|
5
|
+
# === STRAPI SITE DEFINITIONS ===
|
|
6
|
+
type StrapiSite implements Node {
|
|
7
|
+
id: ID!
|
|
8
|
+
name: String
|
|
9
|
+
locale: String
|
|
10
|
+
currency: String
|
|
11
|
+
seo: Seo
|
|
12
|
+
logo: Image
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.StrapiClient = void 0;
|
|
13
|
+
class StrapiClient {
|
|
14
|
+
constructor(apiUrl, accessToken) {
|
|
15
|
+
if (!apiUrl || !accessToken) {
|
|
16
|
+
throw new Error('Missing STRAPI_API_URL or STRAPI_TOKEN in environment variables.');
|
|
17
|
+
}
|
|
18
|
+
this.apiUrl = apiUrl;
|
|
19
|
+
this.accessToken = accessToken;
|
|
20
|
+
}
|
|
21
|
+
fetch(path) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
try {
|
|
24
|
+
const result = yield fetch(`${this.apiUrl}/api/${path}`, {
|
|
25
|
+
headers: {
|
|
26
|
+
Authorization: `Bearer ${this.accessToken}`,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
if (!result.ok) {
|
|
30
|
+
throw new Error(`Fetch Error with status ${result.status}: ${result.statusText}`);
|
|
31
|
+
}
|
|
32
|
+
const data = yield result.json();
|
|
33
|
+
return data;
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
throw new Error(`Error occurred while fetching ${path}: ${error}`);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
getApiUrl() {
|
|
41
|
+
return this.apiUrl;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.StrapiClient = StrapiClient;
|