strapi-plugin-blogseo 1.1.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/LICENSE +21 -0
- package/README.md +81 -0
- package/dist/admin/Settings-BJbpMBlx.mjs +149 -0
- package/dist/admin/Settings-C3-8r0LW.js +149 -0
- package/dist/admin/en-CEwYiwKv.mjs +8 -0
- package/dist/admin/en-DXs_qePG.js +8 -0
- package/dist/admin/index.js +68 -0
- package/dist/admin/index.mjs +68 -0
- package/dist/admin/src/components/Initializer.d.ts +5 -0
- package/dist/admin/src/components/PluginIcon.d.ts +2 -0
- package/dist/admin/src/index.d.ts +3 -0
- package/dist/admin/src/pages/Settings.d.ts +2 -0
- package/dist/admin/src/pluginId.d.ts +1 -0
- package/dist/admin/src/utils/getTranslation.d.ts +2 -0
- package/dist/server/index.js +206 -0
- package/dist/server/index.mjs +206 -0
- package/dist/server/src/bootstrap.d.ts +5 -0
- package/dist/server/src/config/index.d.ts +7 -0
- package/dist/server/src/content-types/index.d.ts +2 -0
- package/dist/server/src/controllers/blogseo.d.ts +11 -0
- package/dist/server/src/controllers/index.d.ts +12 -0
- package/dist/server/src/destroy.d.ts +5 -0
- package/dist/server/src/index.d.ts +98 -0
- package/dist/server/src/middlewares/index.d.ts +2 -0
- package/dist/server/src/policies/index.d.ts +2 -0
- package/dist/server/src/register.d.ts +5 -0
- package/dist/server/src/routes/admin/index.d.ts +12 -0
- package/dist/server/src/routes/content-api/index.d.ts +12 -0
- package/dist/server/src/routes/index.d.ts +25 -0
- package/dist/server/src/services/blogseo.d.ts +43 -0
- package/dist/server/src/services/index.d.ts +43 -0
- package/dist/server/src/utils/getService.d.ts +3 -0
- package/package.json +89 -0
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const bootstrap = ({ strapi }) => {
|
|
4
|
+
};
|
|
5
|
+
const destroy = ({ strapi }) => {
|
|
6
|
+
};
|
|
7
|
+
const register = ({ strapi }) => {
|
|
8
|
+
};
|
|
9
|
+
const config = {
|
|
10
|
+
default: {
|
|
11
|
+
blogSeoApiUrl: "https://app.blogseo.io"
|
|
12
|
+
},
|
|
13
|
+
validator() {
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const contentTypes = {};
|
|
17
|
+
const getBlogSeoService = (strapi) => strapi.plugin("blogseo").service("blogseo");
|
|
18
|
+
const controller = ({ strapi }) => ({
|
|
19
|
+
async status(ctx) {
|
|
20
|
+
ctx.body = await getBlogSeoService(strapi).getStatus();
|
|
21
|
+
},
|
|
22
|
+
contentTypes(ctx) {
|
|
23
|
+
ctx.body = { contentTypes: getBlogSeoService(strapi).listCollectionContentTypes() };
|
|
24
|
+
},
|
|
25
|
+
schema(ctx) {
|
|
26
|
+
ctx.body = { contentTypes: getBlogSeoService(strapi).listContentTypeSchemas() };
|
|
27
|
+
},
|
|
28
|
+
async connect(ctx) {
|
|
29
|
+
const { apiKey, pluralApiId } = ctx.request.body ?? {};
|
|
30
|
+
if (!apiKey || typeof apiKey !== "string")
|
|
31
|
+
return ctx.badRequest("A BlogSEO connection key is required.");
|
|
32
|
+
if (!pluralApiId || typeof pluralApiId !== "string")
|
|
33
|
+
return ctx.badRequest("Select a content type to publish into.");
|
|
34
|
+
const configured = strapi.config.get("server.url");
|
|
35
|
+
const serverUrl = configured && /^https?:\/\//.test(configured) ? configured : ctx.request.origin;
|
|
36
|
+
try {
|
|
37
|
+
ctx.body = await getBlogSeoService(strapi).connect({
|
|
38
|
+
apiKey: apiKey.trim(),
|
|
39
|
+
pluralApiId,
|
|
40
|
+
serverUrl
|
|
41
|
+
});
|
|
42
|
+
} catch (error) {
|
|
43
|
+
return ctx.badRequest(error instanceof Error ? error.message : "Failed to connect to BlogSEO");
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
async disconnect(ctx) {
|
|
47
|
+
ctx.body = await getBlogSeoService(strapi).disconnect();
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
const controllers = {
|
|
51
|
+
blogseo: controller
|
|
52
|
+
};
|
|
53
|
+
const middlewares = {};
|
|
54
|
+
const policies = {};
|
|
55
|
+
const contentAPIRoutes = () => ({
|
|
56
|
+
type: "content-api",
|
|
57
|
+
routes: [
|
|
58
|
+
{ method: "GET", path: "/schema", handler: "blogseo.schema", config: { policies: [] } }
|
|
59
|
+
]
|
|
60
|
+
});
|
|
61
|
+
const adminAPIRoutes = () => ({
|
|
62
|
+
type: "admin",
|
|
63
|
+
routes: [
|
|
64
|
+
{ method: "GET", path: "/status", handler: "blogseo.status", config: { policies: [] } },
|
|
65
|
+
{
|
|
66
|
+
method: "GET",
|
|
67
|
+
path: "/content-types",
|
|
68
|
+
handler: "blogseo.contentTypes",
|
|
69
|
+
config: { policies: [] }
|
|
70
|
+
},
|
|
71
|
+
{ method: "POST", path: "/connect", handler: "blogseo.connect", config: { policies: [] } },
|
|
72
|
+
{ method: "POST", path: "/disconnect", handler: "blogseo.disconnect", config: { policies: [] } }
|
|
73
|
+
]
|
|
74
|
+
});
|
|
75
|
+
const routes = {
|
|
76
|
+
"content-api": contentAPIRoutes,
|
|
77
|
+
admin: adminAPIRoutes
|
|
78
|
+
};
|
|
79
|
+
const PLUGIN_ID = "blogseo";
|
|
80
|
+
const STRAPI_TOKEN_NAME = "BlogSEO";
|
|
81
|
+
const DEFAULT_BLOGSEO_API_URL = "https://app.blogseo.io";
|
|
82
|
+
const service = ({ strapi }) => {
|
|
83
|
+
const store = () => strapi.store({ type: "plugin", name: PLUGIN_ID });
|
|
84
|
+
const getState = async () => await store().get({ key: "connection" }) ?? { connected: false };
|
|
85
|
+
const setState = (value) => store().set({ key: "connection", value });
|
|
86
|
+
const apiTokens = () => strapi.service("admin::api-token");
|
|
87
|
+
const blogSeoApiUrl = () => strapi.config.get(`plugin::${PLUGIN_ID}.blogSeoApiUrl`, DEFAULT_BLOGSEO_API_URL);
|
|
88
|
+
return {
|
|
89
|
+
async getStatus() {
|
|
90
|
+
const state = await getState();
|
|
91
|
+
return {
|
|
92
|
+
connected: !!state.connected,
|
|
93
|
+
siteUrl: state.siteUrl ?? null,
|
|
94
|
+
pluralApiId: state.pluralApiId ?? null
|
|
95
|
+
};
|
|
96
|
+
},
|
|
97
|
+
listCollectionContentTypes() {
|
|
98
|
+
return Object.entries(strapi.contentTypes).filter(([uid, schema]) => uid.startsWith("api::") && schema.kind === "collectionType").map(([uid, schema]) => ({
|
|
99
|
+
uid,
|
|
100
|
+
displayName: schema.info?.displayName ?? schema.info?.singularName ?? uid,
|
|
101
|
+
pluralApiId: schema.info?.pluralName ?? ""
|
|
102
|
+
}));
|
|
103
|
+
},
|
|
104
|
+
listContentTypeSchemas() {
|
|
105
|
+
const systemAttributeNames = /* @__PURE__ */ new Set([
|
|
106
|
+
"id",
|
|
107
|
+
"documentId",
|
|
108
|
+
"createdAt",
|
|
109
|
+
"updatedAt",
|
|
110
|
+
"publishedAt",
|
|
111
|
+
"createdBy",
|
|
112
|
+
"updatedBy",
|
|
113
|
+
"locale",
|
|
114
|
+
"localizations",
|
|
115
|
+
"strapi_stage",
|
|
116
|
+
"strapi_assignee"
|
|
117
|
+
]);
|
|
118
|
+
return Object.entries(strapi.contentTypes).filter(([uid, schema]) => uid.startsWith("api::") && schema.kind === "collectionType").map(([uid, schema]) => ({
|
|
119
|
+
uid,
|
|
120
|
+
apiID: schema.info?.singularName ?? uid.split(".").pop() ?? uid,
|
|
121
|
+
schema: {
|
|
122
|
+
displayName: schema.info?.displayName ?? schema.info?.singularName ?? uid,
|
|
123
|
+
singularName: schema.info?.singularName ?? "",
|
|
124
|
+
pluralName: schema.info?.pluralName ?? "",
|
|
125
|
+
kind: schema.kind,
|
|
126
|
+
draftAndPublish: schema.options?.draftAndPublish ?? false,
|
|
127
|
+
pluginOptions: schema.pluginOptions ?? {},
|
|
128
|
+
attributes: Object.fromEntries(
|
|
129
|
+
Object.entries(schema.attributes ?? {}).filter(
|
|
130
|
+
([name, attribute]) => !systemAttributeNames.has(name) && !attribute.private
|
|
131
|
+
)
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
}));
|
|
135
|
+
},
|
|
136
|
+
async connect({
|
|
137
|
+
apiKey,
|
|
138
|
+
pluralApiId,
|
|
139
|
+
serverUrl
|
|
140
|
+
}) {
|
|
141
|
+
const previous = await getState();
|
|
142
|
+
if (previous.strapiTokenId) await apiTokens().revoke(previous.strapiTokenId).catch(() => null);
|
|
143
|
+
const leftover = await apiTokens().getByName(STRAPI_TOKEN_NAME);
|
|
144
|
+
if (leftover) await apiTokens().revoke(leftover.id).catch(() => null);
|
|
145
|
+
const created = await apiTokens().create({
|
|
146
|
+
name: STRAPI_TOKEN_NAME,
|
|
147
|
+
description: "Token used by BlogSEO to publish articles into this Strapi instance.",
|
|
148
|
+
type: "full-access",
|
|
149
|
+
lifespan: null
|
|
150
|
+
});
|
|
151
|
+
const postRegister = () => fetch(`${blogSeoApiUrl()}/api/integrations/strapi-plugin/register`, {
|
|
152
|
+
method: "POST",
|
|
153
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` },
|
|
154
|
+
body: JSON.stringify({
|
|
155
|
+
strapiUrl: serverUrl,
|
|
156
|
+
strapiApiToken: created.accessKey,
|
|
157
|
+
pluralApiId,
|
|
158
|
+
strapiVersion: strapi.config.get("info.strapi")
|
|
159
|
+
})
|
|
160
|
+
});
|
|
161
|
+
let response;
|
|
162
|
+
try {
|
|
163
|
+
response = await postRegister().catch(postRegister);
|
|
164
|
+
} catch {
|
|
165
|
+
await apiTokens().revoke(created.id).catch(() => null);
|
|
166
|
+
throw new Error("Could not reach BlogSEO. Check this server's outbound network access.");
|
|
167
|
+
}
|
|
168
|
+
const json = await response.json().catch(() => ({}));
|
|
169
|
+
if (!response.ok) {
|
|
170
|
+
await apiTokens().revoke(created.id).catch(() => null);
|
|
171
|
+
throw new Error(json.error ?? "BlogSEO rejected the connection. Double-check your connection key.");
|
|
172
|
+
}
|
|
173
|
+
const nextState = {
|
|
174
|
+
connected: true,
|
|
175
|
+
apiKey,
|
|
176
|
+
siteUrl: json.resolvedSiteUrl ?? serverUrl,
|
|
177
|
+
pluralApiId,
|
|
178
|
+
strapiTokenId: created.id
|
|
179
|
+
};
|
|
180
|
+
await setState(nextState);
|
|
181
|
+
return { connected: true, siteUrl: nextState.siteUrl };
|
|
182
|
+
},
|
|
183
|
+
async disconnect() {
|
|
184
|
+
const state = await getState();
|
|
185
|
+
if (state.strapiTokenId) await apiTokens().revoke(state.strapiTokenId).catch(() => null);
|
|
186
|
+
await setState({ connected: false });
|
|
187
|
+
return { connected: false };
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
const services = {
|
|
192
|
+
blogseo: service
|
|
193
|
+
};
|
|
194
|
+
const index = {
|
|
195
|
+
register,
|
|
196
|
+
bootstrap,
|
|
197
|
+
destroy,
|
|
198
|
+
config,
|
|
199
|
+
controllers,
|
|
200
|
+
routes,
|
|
201
|
+
services,
|
|
202
|
+
contentTypes,
|
|
203
|
+
policies,
|
|
204
|
+
middlewares
|
|
205
|
+
};
|
|
206
|
+
exports.default = index;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
const bootstrap = ({ strapi }) => {
|
|
2
|
+
};
|
|
3
|
+
const destroy = ({ strapi }) => {
|
|
4
|
+
};
|
|
5
|
+
const register = ({ strapi }) => {
|
|
6
|
+
};
|
|
7
|
+
const config = {
|
|
8
|
+
default: {
|
|
9
|
+
blogSeoApiUrl: "https://app.blogseo.io"
|
|
10
|
+
},
|
|
11
|
+
validator() {
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const contentTypes = {};
|
|
15
|
+
const getBlogSeoService = (strapi) => strapi.plugin("blogseo").service("blogseo");
|
|
16
|
+
const controller = ({ strapi }) => ({
|
|
17
|
+
async status(ctx) {
|
|
18
|
+
ctx.body = await getBlogSeoService(strapi).getStatus();
|
|
19
|
+
},
|
|
20
|
+
contentTypes(ctx) {
|
|
21
|
+
ctx.body = { contentTypes: getBlogSeoService(strapi).listCollectionContentTypes() };
|
|
22
|
+
},
|
|
23
|
+
schema(ctx) {
|
|
24
|
+
ctx.body = { contentTypes: getBlogSeoService(strapi).listContentTypeSchemas() };
|
|
25
|
+
},
|
|
26
|
+
async connect(ctx) {
|
|
27
|
+
const { apiKey, pluralApiId } = ctx.request.body ?? {};
|
|
28
|
+
if (!apiKey || typeof apiKey !== "string")
|
|
29
|
+
return ctx.badRequest("A BlogSEO connection key is required.");
|
|
30
|
+
if (!pluralApiId || typeof pluralApiId !== "string")
|
|
31
|
+
return ctx.badRequest("Select a content type to publish into.");
|
|
32
|
+
const configured = strapi.config.get("server.url");
|
|
33
|
+
const serverUrl = configured && /^https?:\/\//.test(configured) ? configured : ctx.request.origin;
|
|
34
|
+
try {
|
|
35
|
+
ctx.body = await getBlogSeoService(strapi).connect({
|
|
36
|
+
apiKey: apiKey.trim(),
|
|
37
|
+
pluralApiId,
|
|
38
|
+
serverUrl
|
|
39
|
+
});
|
|
40
|
+
} catch (error) {
|
|
41
|
+
return ctx.badRequest(error instanceof Error ? error.message : "Failed to connect to BlogSEO");
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
async disconnect(ctx) {
|
|
45
|
+
ctx.body = await getBlogSeoService(strapi).disconnect();
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
const controllers = {
|
|
49
|
+
blogseo: controller
|
|
50
|
+
};
|
|
51
|
+
const middlewares = {};
|
|
52
|
+
const policies = {};
|
|
53
|
+
const contentAPIRoutes = () => ({
|
|
54
|
+
type: "content-api",
|
|
55
|
+
routes: [
|
|
56
|
+
{ method: "GET", path: "/schema", handler: "blogseo.schema", config: { policies: [] } }
|
|
57
|
+
]
|
|
58
|
+
});
|
|
59
|
+
const adminAPIRoutes = () => ({
|
|
60
|
+
type: "admin",
|
|
61
|
+
routes: [
|
|
62
|
+
{ method: "GET", path: "/status", handler: "blogseo.status", config: { policies: [] } },
|
|
63
|
+
{
|
|
64
|
+
method: "GET",
|
|
65
|
+
path: "/content-types",
|
|
66
|
+
handler: "blogseo.contentTypes",
|
|
67
|
+
config: { policies: [] }
|
|
68
|
+
},
|
|
69
|
+
{ method: "POST", path: "/connect", handler: "blogseo.connect", config: { policies: [] } },
|
|
70
|
+
{ method: "POST", path: "/disconnect", handler: "blogseo.disconnect", config: { policies: [] } }
|
|
71
|
+
]
|
|
72
|
+
});
|
|
73
|
+
const routes = {
|
|
74
|
+
"content-api": contentAPIRoutes,
|
|
75
|
+
admin: adminAPIRoutes
|
|
76
|
+
};
|
|
77
|
+
const PLUGIN_ID = "blogseo";
|
|
78
|
+
const STRAPI_TOKEN_NAME = "BlogSEO";
|
|
79
|
+
const DEFAULT_BLOGSEO_API_URL = "https://app.blogseo.io";
|
|
80
|
+
const service = ({ strapi }) => {
|
|
81
|
+
const store = () => strapi.store({ type: "plugin", name: PLUGIN_ID });
|
|
82
|
+
const getState = async () => await store().get({ key: "connection" }) ?? { connected: false };
|
|
83
|
+
const setState = (value) => store().set({ key: "connection", value });
|
|
84
|
+
const apiTokens = () => strapi.service("admin::api-token");
|
|
85
|
+
const blogSeoApiUrl = () => strapi.config.get(`plugin::${PLUGIN_ID}.blogSeoApiUrl`, DEFAULT_BLOGSEO_API_URL);
|
|
86
|
+
return {
|
|
87
|
+
async getStatus() {
|
|
88
|
+
const state = await getState();
|
|
89
|
+
return {
|
|
90
|
+
connected: !!state.connected,
|
|
91
|
+
siteUrl: state.siteUrl ?? null,
|
|
92
|
+
pluralApiId: state.pluralApiId ?? null
|
|
93
|
+
};
|
|
94
|
+
},
|
|
95
|
+
listCollectionContentTypes() {
|
|
96
|
+
return Object.entries(strapi.contentTypes).filter(([uid, schema]) => uid.startsWith("api::") && schema.kind === "collectionType").map(([uid, schema]) => ({
|
|
97
|
+
uid,
|
|
98
|
+
displayName: schema.info?.displayName ?? schema.info?.singularName ?? uid,
|
|
99
|
+
pluralApiId: schema.info?.pluralName ?? ""
|
|
100
|
+
}));
|
|
101
|
+
},
|
|
102
|
+
listContentTypeSchemas() {
|
|
103
|
+
const systemAttributeNames = /* @__PURE__ */ new Set([
|
|
104
|
+
"id",
|
|
105
|
+
"documentId",
|
|
106
|
+
"createdAt",
|
|
107
|
+
"updatedAt",
|
|
108
|
+
"publishedAt",
|
|
109
|
+
"createdBy",
|
|
110
|
+
"updatedBy",
|
|
111
|
+
"locale",
|
|
112
|
+
"localizations",
|
|
113
|
+
"strapi_stage",
|
|
114
|
+
"strapi_assignee"
|
|
115
|
+
]);
|
|
116
|
+
return Object.entries(strapi.contentTypes).filter(([uid, schema]) => uid.startsWith("api::") && schema.kind === "collectionType").map(([uid, schema]) => ({
|
|
117
|
+
uid,
|
|
118
|
+
apiID: schema.info?.singularName ?? uid.split(".").pop() ?? uid,
|
|
119
|
+
schema: {
|
|
120
|
+
displayName: schema.info?.displayName ?? schema.info?.singularName ?? uid,
|
|
121
|
+
singularName: schema.info?.singularName ?? "",
|
|
122
|
+
pluralName: schema.info?.pluralName ?? "",
|
|
123
|
+
kind: schema.kind,
|
|
124
|
+
draftAndPublish: schema.options?.draftAndPublish ?? false,
|
|
125
|
+
pluginOptions: schema.pluginOptions ?? {},
|
|
126
|
+
attributes: Object.fromEntries(
|
|
127
|
+
Object.entries(schema.attributes ?? {}).filter(
|
|
128
|
+
([name, attribute]) => !systemAttributeNames.has(name) && !attribute.private
|
|
129
|
+
)
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
}));
|
|
133
|
+
},
|
|
134
|
+
async connect({
|
|
135
|
+
apiKey,
|
|
136
|
+
pluralApiId,
|
|
137
|
+
serverUrl
|
|
138
|
+
}) {
|
|
139
|
+
const previous = await getState();
|
|
140
|
+
if (previous.strapiTokenId) await apiTokens().revoke(previous.strapiTokenId).catch(() => null);
|
|
141
|
+
const leftover = await apiTokens().getByName(STRAPI_TOKEN_NAME);
|
|
142
|
+
if (leftover) await apiTokens().revoke(leftover.id).catch(() => null);
|
|
143
|
+
const created = await apiTokens().create({
|
|
144
|
+
name: STRAPI_TOKEN_NAME,
|
|
145
|
+
description: "Token used by BlogSEO to publish articles into this Strapi instance.",
|
|
146
|
+
type: "full-access",
|
|
147
|
+
lifespan: null
|
|
148
|
+
});
|
|
149
|
+
const postRegister = () => fetch(`${blogSeoApiUrl()}/api/integrations/strapi-plugin/register`, {
|
|
150
|
+
method: "POST",
|
|
151
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${apiKey}` },
|
|
152
|
+
body: JSON.stringify({
|
|
153
|
+
strapiUrl: serverUrl,
|
|
154
|
+
strapiApiToken: created.accessKey,
|
|
155
|
+
pluralApiId,
|
|
156
|
+
strapiVersion: strapi.config.get("info.strapi")
|
|
157
|
+
})
|
|
158
|
+
});
|
|
159
|
+
let response;
|
|
160
|
+
try {
|
|
161
|
+
response = await postRegister().catch(postRegister);
|
|
162
|
+
} catch {
|
|
163
|
+
await apiTokens().revoke(created.id).catch(() => null);
|
|
164
|
+
throw new Error("Could not reach BlogSEO. Check this server's outbound network access.");
|
|
165
|
+
}
|
|
166
|
+
const json = await response.json().catch(() => ({}));
|
|
167
|
+
if (!response.ok) {
|
|
168
|
+
await apiTokens().revoke(created.id).catch(() => null);
|
|
169
|
+
throw new Error(json.error ?? "BlogSEO rejected the connection. Double-check your connection key.");
|
|
170
|
+
}
|
|
171
|
+
const nextState = {
|
|
172
|
+
connected: true,
|
|
173
|
+
apiKey,
|
|
174
|
+
siteUrl: json.resolvedSiteUrl ?? serverUrl,
|
|
175
|
+
pluralApiId,
|
|
176
|
+
strapiTokenId: created.id
|
|
177
|
+
};
|
|
178
|
+
await setState(nextState);
|
|
179
|
+
return { connected: true, siteUrl: nextState.siteUrl };
|
|
180
|
+
},
|
|
181
|
+
async disconnect() {
|
|
182
|
+
const state = await getState();
|
|
183
|
+
if (state.strapiTokenId) await apiTokens().revoke(state.strapiTokenId).catch(() => null);
|
|
184
|
+
await setState({ connected: false });
|
|
185
|
+
return { connected: false };
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
const services = {
|
|
190
|
+
blogseo: service
|
|
191
|
+
};
|
|
192
|
+
const index = {
|
|
193
|
+
register,
|
|
194
|
+
bootstrap,
|
|
195
|
+
destroy,
|
|
196
|
+
config,
|
|
197
|
+
controllers,
|
|
198
|
+
routes,
|
|
199
|
+
services,
|
|
200
|
+
contentTypes,
|
|
201
|
+
policies,
|
|
202
|
+
middlewares
|
|
203
|
+
};
|
|
204
|
+
export {
|
|
205
|
+
index as default
|
|
206
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Core } from '@strapi/strapi';
|
|
2
|
+
declare const controller: ({ strapi }: {
|
|
3
|
+
strapi: Core.Strapi;
|
|
4
|
+
}) => {
|
|
5
|
+
status(ctx: any): Promise<void>;
|
|
6
|
+
contentTypes(ctx: any): void;
|
|
7
|
+
schema(ctx: any): void;
|
|
8
|
+
connect(ctx: any): Promise<any>;
|
|
9
|
+
disconnect(ctx: any): Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
export default controller;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
blogseo: ({ strapi }: {
|
|
3
|
+
strapi: import('@strapi/types/dist/core').Strapi;
|
|
4
|
+
}) => {
|
|
5
|
+
status(ctx: any): Promise<void>;
|
|
6
|
+
contentTypes(ctx: any): void;
|
|
7
|
+
schema(ctx: any): void;
|
|
8
|
+
connect(ctx: any): Promise<any>;
|
|
9
|
+
disconnect(ctx: any): Promise<void>;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
register: ({ strapi }: {
|
|
3
|
+
strapi: import('@strapi/types/dist/core').Strapi;
|
|
4
|
+
}) => void;
|
|
5
|
+
bootstrap: ({ strapi }: {
|
|
6
|
+
strapi: import('@strapi/types/dist/core').Strapi;
|
|
7
|
+
}) => void;
|
|
8
|
+
destroy: ({ strapi }: {
|
|
9
|
+
strapi: import('@strapi/types/dist/core').Strapi;
|
|
10
|
+
}) => void;
|
|
11
|
+
config: {
|
|
12
|
+
default: {
|
|
13
|
+
blogSeoApiUrl: string;
|
|
14
|
+
};
|
|
15
|
+
validator(): void;
|
|
16
|
+
};
|
|
17
|
+
controllers: {
|
|
18
|
+
blogseo: ({ strapi }: {
|
|
19
|
+
strapi: import('@strapi/types/dist/core').Strapi;
|
|
20
|
+
}) => {
|
|
21
|
+
status(ctx: any): Promise<void>;
|
|
22
|
+
contentTypes(ctx: any): void;
|
|
23
|
+
schema(ctx: any): void;
|
|
24
|
+
connect(ctx: any): Promise<any>;
|
|
25
|
+
disconnect(ctx: any): Promise<void>;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
routes: {
|
|
29
|
+
"content-api": () => {
|
|
30
|
+
type: string;
|
|
31
|
+
routes: {
|
|
32
|
+
method: string;
|
|
33
|
+
path: string;
|
|
34
|
+
handler: string;
|
|
35
|
+
config: {
|
|
36
|
+
policies: any[];
|
|
37
|
+
};
|
|
38
|
+
}[];
|
|
39
|
+
};
|
|
40
|
+
admin: () => {
|
|
41
|
+
type: string;
|
|
42
|
+
routes: {
|
|
43
|
+
method: string;
|
|
44
|
+
path: string;
|
|
45
|
+
handler: string;
|
|
46
|
+
config: {
|
|
47
|
+
policies: any[];
|
|
48
|
+
};
|
|
49
|
+
}[];
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
services: {
|
|
53
|
+
blogseo: ({ strapi }: {
|
|
54
|
+
strapi: import('@strapi/types/dist/core').Strapi;
|
|
55
|
+
}) => {
|
|
56
|
+
getStatus(): Promise<{
|
|
57
|
+
connected: boolean;
|
|
58
|
+
siteUrl: string;
|
|
59
|
+
pluralApiId: string;
|
|
60
|
+
}>;
|
|
61
|
+
listCollectionContentTypes(): {
|
|
62
|
+
uid: string;
|
|
63
|
+
displayName: any;
|
|
64
|
+
pluralApiId: any;
|
|
65
|
+
}[];
|
|
66
|
+
listContentTypeSchemas(): {
|
|
67
|
+
uid: string;
|
|
68
|
+
apiID: any;
|
|
69
|
+
schema: {
|
|
70
|
+
displayName: any;
|
|
71
|
+
singularName: any;
|
|
72
|
+
pluralName: any;
|
|
73
|
+
kind: any;
|
|
74
|
+
draftAndPublish: any;
|
|
75
|
+
pluginOptions: any;
|
|
76
|
+
attributes: {
|
|
77
|
+
[k: string]: unknown;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
}[];
|
|
81
|
+
connect({ apiKey, pluralApiId, serverUrl, }: {
|
|
82
|
+
apiKey: string;
|
|
83
|
+
pluralApiId: string;
|
|
84
|
+
serverUrl: string;
|
|
85
|
+
}): Promise<{
|
|
86
|
+
connected: boolean;
|
|
87
|
+
siteUrl: string;
|
|
88
|
+
}>;
|
|
89
|
+
disconnect(): Promise<{
|
|
90
|
+
connected: boolean;
|
|
91
|
+
}>;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
contentTypes: {};
|
|
95
|
+
policies: {};
|
|
96
|
+
middlewares: {};
|
|
97
|
+
};
|
|
98
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare const routes: {
|
|
2
|
+
"content-api": () => {
|
|
3
|
+
type: string;
|
|
4
|
+
routes: {
|
|
5
|
+
method: string;
|
|
6
|
+
path: string;
|
|
7
|
+
handler: string;
|
|
8
|
+
config: {
|
|
9
|
+
policies: any[];
|
|
10
|
+
};
|
|
11
|
+
}[];
|
|
12
|
+
};
|
|
13
|
+
admin: () => {
|
|
14
|
+
type: string;
|
|
15
|
+
routes: {
|
|
16
|
+
method: string;
|
|
17
|
+
path: string;
|
|
18
|
+
handler: string;
|
|
19
|
+
config: {
|
|
20
|
+
policies: any[];
|
|
21
|
+
};
|
|
22
|
+
}[];
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export default routes;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Core } from '@strapi/strapi';
|
|
2
|
+
declare const service: ({ strapi }: {
|
|
3
|
+
strapi: Core.Strapi;
|
|
4
|
+
}) => {
|
|
5
|
+
getStatus(): Promise<{
|
|
6
|
+
connected: boolean;
|
|
7
|
+
siteUrl: string;
|
|
8
|
+
pluralApiId: string;
|
|
9
|
+
}>;
|
|
10
|
+
listCollectionContentTypes(): {
|
|
11
|
+
uid: string;
|
|
12
|
+
displayName: any;
|
|
13
|
+
pluralApiId: any;
|
|
14
|
+
}[];
|
|
15
|
+
listContentTypeSchemas(): {
|
|
16
|
+
uid: string;
|
|
17
|
+
apiID: any;
|
|
18
|
+
schema: {
|
|
19
|
+
displayName: any;
|
|
20
|
+
singularName: any;
|
|
21
|
+
pluralName: any;
|
|
22
|
+
kind: any;
|
|
23
|
+
draftAndPublish: any;
|
|
24
|
+
pluginOptions: any;
|
|
25
|
+
attributes: {
|
|
26
|
+
[k: string]: unknown;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}[];
|
|
30
|
+
connect({ apiKey, pluralApiId, serverUrl, }: {
|
|
31
|
+
apiKey: string;
|
|
32
|
+
pluralApiId: string;
|
|
33
|
+
serverUrl: string;
|
|
34
|
+
}): Promise<{
|
|
35
|
+
connected: boolean;
|
|
36
|
+
siteUrl: string;
|
|
37
|
+
}>;
|
|
38
|
+
disconnect(): Promise<{
|
|
39
|
+
connected: boolean;
|
|
40
|
+
}>;
|
|
41
|
+
};
|
|
42
|
+
export type BlogSeoService = ReturnType<typeof service>;
|
|
43
|
+
export default service;
|