@translationstudio/translationstudio-strapi-extension 1.0.0 → 1.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.
Files changed (54) hide show
  1. package/README.md +35 -32
  2. package/dist/Types.d.ts +146 -0
  3. package/dist/_chunks/App-Bw7t0TMJ.mjs +277 -0
  4. package/dist/_chunks/App-CUOeu4IU.js +277 -0
  5. package/dist/_chunks/en-B4KWt_jN.js +4 -0
  6. package/dist/_chunks/en-Byx4XI2L.mjs +4 -0
  7. package/dist/admin/index.js +323 -0
  8. package/dist/admin/index.mjs +324 -0
  9. package/dist/admin/src/components/Initializer.d.ts +5 -0
  10. package/dist/admin/src/components/PluginIcon.d.ts +2 -0
  11. package/dist/admin/src/components/TranslationMenu.d.ts +2 -0
  12. package/dist/admin/src/index.d.ts +11 -0
  13. package/dist/admin/src/pages/App.d.ts +2 -0
  14. package/dist/admin/src/pages/SettingsPage.d.ts +2 -0
  15. package/dist/admin/src/pluginId.d.ts +1 -0
  16. package/dist/admin/src/utils/getTranslation.d.ts +2 -0
  17. package/dist/server/index.js +1038 -0
  18. package/dist/server/index.mjs +1039 -0
  19. package/dist/server/src/bootstrap.d.ts +5 -0
  20. package/dist/server/src/config/index.d.ts +5 -0
  21. package/dist/server/src/content-types/index.d.ts +2 -0
  22. package/dist/server/src/controllers/controller.d.ts +19 -0
  23. package/dist/server/src/controllers/index.d.ts +20 -0
  24. package/dist/server/src/destroy.d.ts +5 -0
  25. package/dist/server/src/index.d.ts +85 -0
  26. package/dist/server/src/middlewares/index.d.ts +2 -0
  27. package/dist/server/src/policies/index.d.ts +2 -0
  28. package/dist/server/src/register.d.ts +5 -0
  29. package/dist/server/src/routes/index.d.ts +18 -0
  30. package/dist/server/src/services/functions/exportData/extractRichtextContent.d.ts +2 -0
  31. package/dist/server/src/services/functions/exportData/getContentType.d.ts +2 -0
  32. package/dist/server/src/services/functions/exportData/getEntry.d.ts +2 -0
  33. package/dist/server/src/services/functions/exportData/isFieldLocalizable.d.ts +2 -0
  34. package/dist/server/src/services/functions/exportData/jsonToHtml.d.ts +2 -0
  35. package/dist/server/src/services/functions/exportData/parsePayload.d.ts +7 -0
  36. package/dist/server/src/services/functions/exportData/processComponent.d.ts +3 -0
  37. package/dist/server/src/services/functions/exportData/processEntryFields.d.ts +2 -0
  38. package/dist/server/src/services/functions/exportData/transformResponse.d.ts +2 -0
  39. package/dist/server/src/services/functions/importData/extract.d.ts +6 -0
  40. package/dist/server/src/services/functions/importData/handleError.d.ts +1 -0
  41. package/dist/server/src/services/functions/importData/htmlToJson.d.ts +2 -0
  42. package/dist/server/src/services/functions/importData/organizeFields.d.ts +2 -0
  43. package/dist/server/src/services/functions/importData/parseImportPayload.d.ts +6 -0
  44. package/dist/server/src/services/functions/importData/parseInlineElements.d.ts +2 -0
  45. package/dist/server/src/services/functions/importData/parseNewValuesIntoStructure.d.ts +1 -0
  46. package/dist/server/src/services/functions/importData/prepareImportData.d.ts +2 -0
  47. package/dist/server/src/services/functions/importData/processComponentFields.d.ts +2 -0
  48. package/dist/server/src/services/functions/importData/processDynamicZones.d.ts +2 -0
  49. package/dist/server/src/services/functions/importData/processRegularFields.d.ts +2 -0
  50. package/dist/server/src/services/functions/importData/transformFieldsToData.d.ts +2 -0
  51. package/dist/server/src/services/functions/importData/updateEntry.d.ts +2 -0
  52. package/dist/server/src/services/index.d.ts +31 -0
  53. package/dist/server/src/services/service.d.ts +31 -0
  54. package/package.json +4 -2
@@ -0,0 +1,5 @@
1
+ import type { Core } from '@strapi/strapi';
2
+ declare const bootstrap: ({ strapi }: {
3
+ strapi: Core.Strapi;
4
+ }) => void;
5
+ export default bootstrap;
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ default: {};
3
+ validator(): void;
4
+ };
5
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: {};
2
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import type { Core } from '@strapi/strapi';
2
+ declare const controller: ({ strapi }: {
3
+ strapi: Core.Strapi;
4
+ }) => {
5
+ validateToken(ctx: any): Promise<boolean>;
6
+ getLicense(ctx: any): Promise<void>;
7
+ setLicense(ctx: any): Promise<void>;
8
+ getToken(ctx: any): Promise<void>;
9
+ generateToken(ctx: any): Promise<void>;
10
+ getLanguageOptions(ctx: any): Promise<void>;
11
+ requestTranslation(ctx: any): Promise<void>;
12
+ exportData(ctx: any): Promise<void>;
13
+ importData(ctx: any): Promise<void>;
14
+ ping(ctx: any): Promise<void>;
15
+ getLanguages(ctx: any): Promise<void>;
16
+ getEmail(ctx: any): Promise<void>;
17
+ getEntryData(ctx: any): Promise<any>;
18
+ };
19
+ export default controller;
@@ -0,0 +1,20 @@
1
+ declare const _default: {
2
+ controller: ({ strapi }: {
3
+ strapi: import("@strapi/types/dist/core").Strapi;
4
+ }) => {
5
+ validateToken(ctx: any): Promise<boolean>;
6
+ getLicense(ctx: any): Promise<void>;
7
+ setLicense(ctx: any): Promise<void>;
8
+ getToken(ctx: any): Promise<void>;
9
+ generateToken(ctx: any): Promise<void>;
10
+ getLanguageOptions(ctx: any): Promise<void>;
11
+ requestTranslation(ctx: any): Promise<void>;
12
+ exportData(ctx: any): Promise<void>;
13
+ importData(ctx: any): Promise<void>;
14
+ ping(ctx: any): Promise<void>;
15
+ getLanguages(ctx: any): Promise<void>;
16
+ getEmail(ctx: any): Promise<void>;
17
+ getEntryData(ctx: any): Promise<any>;
18
+ };
19
+ };
20
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import type { Core } from '@strapi/strapi';
2
+ declare const destroy: ({ strapi }: {
3
+ strapi: Core.Strapi;
4
+ }) => void;
5
+ export default destroy;
@@ -0,0 +1,85 @@
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
+ validator(): void;
14
+ };
15
+ controllers: {
16
+ controller: ({ strapi }: {
17
+ strapi: import("@strapi/types/dist/core").Strapi;
18
+ }) => {
19
+ validateToken(ctx: any): Promise<boolean>;
20
+ getLicense(ctx: any): Promise<void>;
21
+ setLicense(ctx: any): Promise<void>;
22
+ getToken(ctx: any): Promise<void>;
23
+ generateToken(ctx: any): Promise<void>;
24
+ getLanguageOptions(ctx: any): Promise<void>;
25
+ requestTranslation(ctx: any): Promise<void>;
26
+ exportData(ctx: any): Promise<void>;
27
+ importData(ctx: any): Promise<void>;
28
+ ping(ctx: any): Promise<void>;
29
+ getLanguages(ctx: any): Promise<void>;
30
+ getEmail(ctx: any): Promise<void>;
31
+ getEntryData(ctx: any): Promise<any>;
32
+ };
33
+ };
34
+ routes: ({
35
+ method: string;
36
+ path: string;
37
+ handler: string;
38
+ config: {
39
+ policies: any[];
40
+ auth?: undefined;
41
+ };
42
+ } | {
43
+ method: string;
44
+ path: string;
45
+ handler: string;
46
+ config: {
47
+ auth: boolean;
48
+ policies: any[];
49
+ };
50
+ })[];
51
+ services: {
52
+ service: ({ strapi }: {
53
+ strapi: import("@strapi/types/dist/core").Strapi;
54
+ }) => {
55
+ getLicense(): Promise<{
56
+ license: unknown;
57
+ }>;
58
+ setLicense(license: string): Promise<{
59
+ success: boolean;
60
+ }>;
61
+ getToken(): Promise<{
62
+ token: unknown;
63
+ }>;
64
+ generateToken(): Promise<{
65
+ token: any;
66
+ }>;
67
+ getLanguageOptions(): Promise<unknown>;
68
+ exportData(payload: import("../../Types").ExportPayload): Promise<any[]>;
69
+ importData(payload: import("../../Types").ImportPayload): Promise<{
70
+ success: boolean;
71
+ }>;
72
+ requestTranslation(payload: import("../../Types").TranslationRequest): Promise<boolean>;
73
+ getEmail(ctx: any): Promise<{
74
+ email: any;
75
+ }>;
76
+ getLanguages(): Promise<import("../../Types").LocaleMap>;
77
+ ping(): Promise<void>;
78
+ getEntryData(contentTypeID: any, entryID: any, locale: any): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
79
+ };
80
+ };
81
+ contentTypes: {};
82
+ policies: {};
83
+ middlewares: {};
84
+ };
85
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: {};
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: {};
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import type { Core } from '@strapi/strapi';
2
+ declare const register: ({ strapi }: {
3
+ strapi: Core.Strapi;
4
+ }) => void;
5
+ export default register;
@@ -0,0 +1,18 @@
1
+ declare const _default: ({
2
+ method: string;
3
+ path: string;
4
+ handler: string;
5
+ config: {
6
+ policies: any[];
7
+ auth?: undefined;
8
+ };
9
+ } | {
10
+ method: string;
11
+ path: string;
12
+ handler: string;
13
+ config: {
14
+ auth: boolean;
15
+ policies: any[];
16
+ };
17
+ })[];
18
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const extractRichtextContent: (content: any) => string[];
2
+ export default extractRichtextContent;
@@ -0,0 +1,2 @@
1
+ declare const getContentType: (contentTypeID: string) => Promise<import("@strapi/types/dist/struct").ContentTypeSchema>;
2
+ export default getContentType;
@@ -0,0 +1,2 @@
1
+ declare const getEntry: (contentTypeID: string, entryID: string | undefined, locale: string) => Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
2
+ export default getEntry;
@@ -0,0 +1,2 @@
1
+ declare const isFieldLocalizable: (fieldSchema: any, parentSchema: any) => boolean;
2
+ export default isFieldLocalizable;
@@ -0,0 +1,2 @@
1
+ declare function jsonToHtml(jsonData: any): string;
2
+ export default jsonToHtml;
@@ -0,0 +1,7 @@
1
+ import { ExportPayload } from "../../../../../Types";
2
+ declare const parsePayload: (payload: ExportPayload) => {
3
+ contentTypeID: string;
4
+ entryID: string;
5
+ locale: string;
6
+ };
7
+ export default parsePayload;
@@ -0,0 +1,3 @@
1
+ import { TranslationstudioTranslatable } from "../../../../../Types";
2
+ declare const processComponent: (fieldName: string, componentName: string, value: any, schemaName: string, componentId?: number) => Promise<TranslationstudioTranslatable[]>;
3
+ export default processComponent;
@@ -0,0 +1,2 @@
1
+ declare const processEntryFields: (entry: any, schema: any, locale: string) => Promise<any[]>;
2
+ export default processEntryFields;
@@ -0,0 +1,2 @@
1
+ declare const transformResponse: (data: any[]) => any[];
2
+ export default transformResponse;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * extract contentTypeID and entryID from elementuid
3
+ * @param elementuid
4
+ * @returns
5
+ */
6
+ export declare function extractContentAndEntryIds(elementuid: string): [string, string | undefined];
@@ -0,0 +1 @@
1
+ export declare function handleError(message: string, error: any): void;
@@ -0,0 +1,2 @@
1
+ declare function htmlToJson(htmlData: string): any[];
2
+ export default htmlToJson;
@@ -0,0 +1,2 @@
1
+ import { OrganizedFields, TranslationstudioTranslatable } from "../../../../../Types";
2
+ export declare function organizeFields(fields: TranslationstudioTranslatable[]): OrganizedFields;
@@ -0,0 +1,6 @@
1
+ import { ImportPayload } from "../../../../../Types";
2
+ declare const parseImportPayload: (payload: ImportPayload) => {
3
+ contentTypeID: string;
4
+ entryID: string;
5
+ };
6
+ export default parseImportPayload;
@@ -0,0 +1,2 @@
1
+ declare function parseInlineElements(text: string): any[];
2
+ export default parseInlineElements;
@@ -0,0 +1 @@
1
+ export declare function parseNewValuesIntoStructure(originalStructure: any, newValues: string[]): any;
@@ -0,0 +1,2 @@
1
+ import { TranslationstudioTranslatable } from "../../../../../Types";
2
+ export declare function prepareImportData(translatables: TranslationstudioTranslatable[], existingEntry: any, targetSchema: any): Record<string, any>;
@@ -0,0 +1,2 @@
1
+ import { TranslationstudioTranslatable } from "../../../../../Types";
2
+ export declare function processComponentFields(componentFieldsMap: Map<string, TranslationstudioTranslatable[]>, acc: Record<string, any>, existingEntry: any, targetSchema: any): Record<string, any>;
@@ -0,0 +1,2 @@
1
+ import { TranslationstudioTranslatable } from "../../../../../Types";
2
+ export declare function processDynamicZones(dynamicZoneFields: Map<number, TranslationstudioTranslatable[]>, acc: Record<string, any>, existingEntry: any): Record<string, any>;
@@ -0,0 +1,2 @@
1
+ import { TranslationstudioTranslatable } from "../../../../../Types";
2
+ export declare function processRegularFields(regularFields: TranslationstudioTranslatable[], acc: Record<string, any>): Record<string, any>;
@@ -0,0 +1,2 @@
1
+ import { TranslationstudioTranslatable } from "../../../../../Types";
2
+ export declare function transformFieldsToData(fields: TranslationstudioTranslatable[]): Record<string, any>;
@@ -0,0 +1,2 @@
1
+ export declare function updateEntry(contentTypeID: string, entryID: string, sourceLocale: string, targetLocale: string, data: Record<string, any>, attributes: Record<string, any>): Promise<void>;
2
+ export declare function processDataRecursively(data: any): any;
@@ -0,0 +1,31 @@
1
+ declare const _default: {
2
+ service: ({ strapi }: {
3
+ strapi: import("@strapi/types/dist/core").Strapi;
4
+ }) => {
5
+ getLicense(): Promise<{
6
+ license: unknown;
7
+ }>;
8
+ setLicense(license: string): Promise<{
9
+ success: boolean;
10
+ }>;
11
+ getToken(): Promise<{
12
+ token: unknown;
13
+ }>;
14
+ generateToken(): Promise<{
15
+ token: any;
16
+ }>;
17
+ getLanguageOptions(): Promise<unknown>;
18
+ exportData(payload: import("../../../Types").ExportPayload): Promise<any[]>;
19
+ importData(payload: import("../../../Types").ImportPayload): Promise<{
20
+ success: boolean;
21
+ }>;
22
+ requestTranslation(payload: import("../../../Types").TranslationRequest): Promise<boolean>;
23
+ getEmail(ctx: any): Promise<{
24
+ email: any;
25
+ }>;
26
+ getLanguages(): Promise<import("../../../Types").LocaleMap>;
27
+ ping(): Promise<void>;
28
+ getEntryData(contentTypeID: any, entryID: any, locale: any): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
29
+ };
30
+ };
31
+ export default _default;
@@ -0,0 +1,31 @@
1
+ import type { Core } from "@strapi/strapi";
2
+ import type { ExportPayload, ImportPayload, LocaleMap, TranslationRequest } from "../../../Types";
3
+ declare const service: ({ strapi }: {
4
+ strapi: Core.Strapi;
5
+ }) => {
6
+ getLicense(): Promise<{
7
+ license: unknown;
8
+ }>;
9
+ setLicense(license: string): Promise<{
10
+ success: boolean;
11
+ }>;
12
+ getToken(): Promise<{
13
+ token: unknown;
14
+ }>;
15
+ generateToken(): Promise<{
16
+ token: any;
17
+ }>;
18
+ getLanguageOptions(): Promise<unknown>;
19
+ exportData(payload: ExportPayload): Promise<any[]>;
20
+ importData(payload: ImportPayload): Promise<{
21
+ success: boolean;
22
+ }>;
23
+ requestTranslation(payload: TranslationRequest): Promise<boolean>;
24
+ getEmail(ctx: any): Promise<{
25
+ email: any;
26
+ }>;
27
+ getLanguages(): Promise<LocaleMap>;
28
+ ping(): Promise<void>;
29
+ getEntryData(contentTypeID: any, entryID: any, locale: any): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
30
+ };
31
+ export default service;
package/package.json CHANGED
@@ -3,7 +3,8 @@
3
3
  "description": "translationstudio extension for strapi",
4
4
  "license": "GPL-2.0-only",
5
5
  "author": "Duncan Leininger <duncan.leininger@idmedia.com>",
6
- "version": "1.0.0",
6
+ "homepage": "https://translationstudio.tech",
7
+ "version": "1.0.2",
7
8
  "keywords": [
8
9
  "translationstudio",
9
10
  "strapi",
@@ -40,7 +41,8 @@
40
41
  "watch:link": "strapi-plugin watch:link",
41
42
  "verify": "strapi-plugin verify",
42
43
  "test:ts:front": "run -T tsc -p admin/tsconfig.json",
43
- "test:ts:back": "run -T tsc -p server/tsconfig.json"
44
+ "test:ts:back": "run -T tsc -p server/tsconfig.json",
45
+ "publish": "npm publish --access public"
44
46
  },
45
47
  "dependencies": {
46
48
  "@strapi/design-system": "^2.0.0-rc.14",