@translationstudio/translationstudio-strapi-extension 2.0.0 → 2.0.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.
- package/dist/server/index.js +27 -1
- package/dist/server/index.mjs +27 -1
- package/dist/server/src/controllers/controller.d.ts +1 -0
- package/dist/server/src/controllers/index.d.ts +1 -0
- package/dist/server/src/index.d.ts +2 -0
- package/dist/server/src/services/index.d.ts +1 -0
- package/dist/server/src/services/service.d.ts +1 -0
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -99,7 +99,7 @@ const controller = ({ strapi: strapi2 }) => ({
|
|
|
99
99
|
const payload = typeof ctx.request.body === "string" ? JSON.parse(ctx.request.body) : ctx.request.body;
|
|
100
100
|
const result = await strapi2.plugin(APP_NAME$1).service("service").exportData(payload);
|
|
101
101
|
ctx.status = 200;
|
|
102
|
-
ctx.body = [
|
|
102
|
+
ctx.body = [result];
|
|
103
103
|
} catch (ex) {
|
|
104
104
|
ctx.status = 500;
|
|
105
105
|
ctx.body = { error: ex.message ?? "Generic error" };
|
|
@@ -165,6 +165,19 @@ const controller = ({ strapi: strapi2 }) => ({
|
|
|
165
165
|
async getEmail(ctx) {
|
|
166
166
|
const result = await strapi2.plugin(APP_NAME$1).service("service").getEmail(ctx);
|
|
167
167
|
ctx.body = result;
|
|
168
|
+
},
|
|
169
|
+
async getEntryData(ctx) {
|
|
170
|
+
const { uid, locale } = ctx.request.body;
|
|
171
|
+
if (!uid) {
|
|
172
|
+
return ctx.badRequest("Missing uid parameter");
|
|
173
|
+
}
|
|
174
|
+
try {
|
|
175
|
+
const [contentTypeID, entryID] = uid.split("#");
|
|
176
|
+
const entry = await strapi2.plugin(APP_NAME$1).service("service").getEntryData(contentTypeID, entryID, locale);
|
|
177
|
+
return entry;
|
|
178
|
+
} catch (error) {
|
|
179
|
+
return ctx.badRequest("Failed to get entry data", { error: error.message });
|
|
180
|
+
}
|
|
168
181
|
}
|
|
169
182
|
});
|
|
170
183
|
const controllers = {
|
|
@@ -280,6 +293,15 @@ const routes = [
|
|
|
280
293
|
config: {
|
|
281
294
|
policies: []
|
|
282
295
|
}
|
|
296
|
+
},
|
|
297
|
+
/* get entry title */
|
|
298
|
+
{
|
|
299
|
+
method: "POST",
|
|
300
|
+
path: "/entrydata",
|
|
301
|
+
handler: "controller.getEntryData",
|
|
302
|
+
config: {
|
|
303
|
+
policies: []
|
|
304
|
+
}
|
|
283
305
|
}
|
|
284
306
|
];
|
|
285
307
|
function getComponentSchemata(schema) {
|
|
@@ -1223,6 +1245,10 @@ const service = ({ strapi: strapi2 }) => {
|
|
|
1223
1245
|
},
|
|
1224
1246
|
async ping() {
|
|
1225
1247
|
return;
|
|
1248
|
+
},
|
|
1249
|
+
async getEntryData(contentTypeID, entryID, locale) {
|
|
1250
|
+
const entry = await getEntry(contentTypeID, entryID, locale);
|
|
1251
|
+
return entry;
|
|
1226
1252
|
}
|
|
1227
1253
|
};
|
|
1228
1254
|
};
|
package/dist/server/index.mjs
CHANGED
|
@@ -80,7 +80,7 @@ const controller = ({ strapi: strapi2 }) => ({
|
|
|
80
80
|
const payload = typeof ctx.request.body === "string" ? JSON.parse(ctx.request.body) : ctx.request.body;
|
|
81
81
|
const result = await strapi2.plugin(APP_NAME$1).service("service").exportData(payload);
|
|
82
82
|
ctx.status = 200;
|
|
83
|
-
ctx.body = [
|
|
83
|
+
ctx.body = [result];
|
|
84
84
|
} catch (ex) {
|
|
85
85
|
ctx.status = 500;
|
|
86
86
|
ctx.body = { error: ex.message ?? "Generic error" };
|
|
@@ -146,6 +146,19 @@ const controller = ({ strapi: strapi2 }) => ({
|
|
|
146
146
|
async getEmail(ctx) {
|
|
147
147
|
const result = await strapi2.plugin(APP_NAME$1).service("service").getEmail(ctx);
|
|
148
148
|
ctx.body = result;
|
|
149
|
+
},
|
|
150
|
+
async getEntryData(ctx) {
|
|
151
|
+
const { uid, locale } = ctx.request.body;
|
|
152
|
+
if (!uid) {
|
|
153
|
+
return ctx.badRequest("Missing uid parameter");
|
|
154
|
+
}
|
|
155
|
+
try {
|
|
156
|
+
const [contentTypeID, entryID] = uid.split("#");
|
|
157
|
+
const entry = await strapi2.plugin(APP_NAME$1).service("service").getEntryData(contentTypeID, entryID, locale);
|
|
158
|
+
return entry;
|
|
159
|
+
} catch (error) {
|
|
160
|
+
return ctx.badRequest("Failed to get entry data", { error: error.message });
|
|
161
|
+
}
|
|
149
162
|
}
|
|
150
163
|
});
|
|
151
164
|
const controllers = {
|
|
@@ -261,6 +274,15 @@ const routes = [
|
|
|
261
274
|
config: {
|
|
262
275
|
policies: []
|
|
263
276
|
}
|
|
277
|
+
},
|
|
278
|
+
/* get entry title */
|
|
279
|
+
{
|
|
280
|
+
method: "POST",
|
|
281
|
+
path: "/entrydata",
|
|
282
|
+
handler: "controller.getEntryData",
|
|
283
|
+
config: {
|
|
284
|
+
policies: []
|
|
285
|
+
}
|
|
264
286
|
}
|
|
265
287
|
];
|
|
266
288
|
function getComponentSchemata(schema) {
|
|
@@ -1204,6 +1226,10 @@ const service = ({ strapi: strapi2 }) => {
|
|
|
1204
1226
|
},
|
|
1205
1227
|
async ping() {
|
|
1206
1228
|
return;
|
|
1229
|
+
},
|
|
1230
|
+
async getEntryData(contentTypeID, entryID, locale) {
|
|
1231
|
+
const entry = await getEntry(contentTypeID, entryID, locale);
|
|
1232
|
+
return entry;
|
|
1207
1233
|
}
|
|
1208
1234
|
};
|
|
1209
1235
|
};
|
|
@@ -30,6 +30,7 @@ declare const _default: {
|
|
|
30
30
|
ping(ctx: any): Promise<void>;
|
|
31
31
|
getLanguages(ctx: any): Promise<void>;
|
|
32
32
|
getEmail(ctx: any): Promise<void>;
|
|
33
|
+
getEntryData(ctx: any): Promise<any>;
|
|
33
34
|
};
|
|
34
35
|
};
|
|
35
36
|
routes: ({
|
|
@@ -80,6 +81,7 @@ declare const _default: {
|
|
|
80
81
|
}>;
|
|
81
82
|
getLanguages(): Promise<import("../../Types").LocaleMap>;
|
|
82
83
|
ping(): Promise<void>;
|
|
84
|
+
getEntryData(contentTypeID: string, entryID: string, locale: string): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
|
|
83
85
|
};
|
|
84
86
|
};
|
|
85
87
|
contentTypes: {};
|
|
@@ -29,6 +29,7 @@ declare const _default: {
|
|
|
29
29
|
}>;
|
|
30
30
|
getLanguages(): Promise<import("../../../Types").LocaleMap>;
|
|
31
31
|
ping(): Promise<void>;
|
|
32
|
+
getEntryData(contentTypeID: string, entryID: string, locale: string): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
|
|
32
33
|
};
|
|
33
34
|
};
|
|
34
35
|
export default _default;
|
|
@@ -30,5 +30,6 @@ declare const service: ({ strapi }: {
|
|
|
30
30
|
}>;
|
|
31
31
|
getLanguages(): Promise<LocaleMap>;
|
|
32
32
|
ping(): Promise<void>;
|
|
33
|
+
getEntryData(contentTypeID: string, entryID: string, locale: string): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
|
|
33
34
|
};
|
|
34
35
|
export default service;
|