@translationstudio/translationstudio-strapi-extension 2.0.0 → 2.0.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.
@@ -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
  };
@@ -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
  };
@@ -16,5 +16,6 @@ declare const controller: ({ strapi }: {
16
16
  ping(ctx: any): Promise<void>;
17
17
  getLanguages(ctx: any): Promise<void>;
18
18
  getEmail(ctx: any): Promise<void>;
19
+ getEntryData(ctx: any): Promise<any>;
19
20
  };
20
21
  export default controller;
@@ -16,6 +16,7 @@ declare const _default: {
16
16
  ping(ctx: any): Promise<void>;
17
17
  getLanguages(ctx: any): Promise<void>;
18
18
  getEmail(ctx: any): Promise<void>;
19
+ getEntryData(ctx: any): Promise<any>;
19
20
  };
20
21
  };
21
22
  export default _default;
@@ -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;
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  }
11
11
  ],
12
12
  "homepage": "https://translationstudio.tech",
13
- "version": "2.0.0",
13
+ "version": "2.0.1",
14
14
  "keywords": [
15
15
  "translationstudio",
16
16
  "strapi",