@translationstudio/translationstudio-strapi-extension 1.1.3 → 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.
@@ -67,20 +67,21 @@ declare const _default: {
67
67
  token: unknown;
68
68
  }>;
69
69
  generateToken(): Promise<{
70
- token: any;
70
+ token: string;
71
71
  }>;
72
72
  getLanguageOptions(): Promise<unknown>;
73
- exportData(payload: import("../../Types").ExportPayload): Promise<any[]>;
74
- importData(payload: import("../../Types").ImportPayload): Promise<{
75
- success: boolean;
73
+ exportData(payload: import("../../Types").ExportPayload): Promise<{
74
+ fields: any[];
75
+ keep: any;
76
76
  }>;
77
+ importData(payload: import("../../Types").ImportPayload): Promise<boolean>;
77
78
  requestTranslation(payload: import("../../Types").TranslationRequest): Promise<boolean>;
78
79
  getEmail(ctx: any): Promise<{
79
80
  email: any;
80
81
  }>;
81
82
  getLanguages(): Promise<import("../../Types").LocaleMap>;
82
83
  ping(): Promise<void>;
83
- getEntryData(contentTypeID: any, entryID: any, locale: any): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
84
+ getEntryData(contentTypeID: string, entryID: string, locale: string): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
84
85
  };
85
86
  };
86
87
  contentTypes: {};
@@ -1,2 +1,30 @@
1
- declare const getContentType: (contentTypeID: string) => Promise<import("@strapi/types/dist/struct").ContentTypeSchema>;
2
- export default getContentType;
1
+ export interface IStrapiSchemaField {
2
+ "type": string;
3
+ "components"?: string[];
4
+ "pluginOptions"?: {
5
+ "i18n"?: {
6
+ "localized": boolean;
7
+ };
8
+ };
9
+ }
10
+ export interface IStrapiSchemaEntryAttributes {
11
+ [fieldName: string]: IStrapiSchemaField;
12
+ }
13
+ export interface IStrapiSchemaEntry {
14
+ "kind": string;
15
+ "collectionName": string;
16
+ "pluginOptions": {
17
+ "i18n"?: {
18
+ "localized": boolean;
19
+ };
20
+ };
21
+ "attributes": IStrapiSchemaEntryAttributes;
22
+ }
23
+ export interface IStrapiComponentSchemaMap {
24
+ [name: string]: IStrapiSchemaEntry;
25
+ }
26
+ export interface IStrapiSchema {
27
+ "entry": IStrapiSchemaEntry;
28
+ "components": IStrapiComponentSchemaMap;
29
+ }
30
+ export default function getContentType(contentTypeID: string): IStrapiSchema | null;
@@ -1,2 +1,4 @@
1
- declare const getEntry: (contentTypeID: string, entryID: string | undefined, locale: string) => Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
1
+ declare const requireTargetEntry: (contentTypeID: string, entryID: string | undefined, locale: string, logError?: boolean) => Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
2
+ declare const getEntry: (contentTypeID: string, entryID: string | undefined, locale: string, logError?: boolean) => Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
3
+ export { requireTargetEntry };
2
4
  export default getEntry;
@@ -1,3 +1,3 @@
1
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;
2
+ import { IStrapiComponentSchemaMap, IStrapiSchemaEntry } from "./getContentType";
3
+ export default function processComponent(fieldName: string, value: any, componentSchema: IStrapiSchemaEntry, schemata: IStrapiComponentSchemaMap): Promise<TranslationstudioTranslatable[]>;
@@ -1,2 +1,8 @@
1
- declare const processEntryFields: (entry: any, schema: any, locale: string) => Promise<any[]>;
1
+ import { IStrapiSchema, IStrapiSchemaEntry } from './getContentType';
2
+ export interface ExportedDocumentFields {
3
+ fields: any[];
4
+ keep: any;
5
+ }
6
+ export declare function IsLocalisableSchema(schema: IStrapiSchemaEntry): boolean;
7
+ declare const processEntryFields: (entry: any, schemaData: IStrapiSchema, _locale: string) => Promise<ExportedDocumentFields>;
2
8
  export default processEntryFields;
@@ -1,2 +1,8 @@
1
- declare const transformResponse: (data: any[]) => any[];
1
+ declare const transformResponse: (data: {
2
+ fields: any[];
3
+ keep: any;
4
+ }) => {
5
+ fields: any[];
6
+ keep: any;
7
+ };
2
8
  export default transformResponse;
@@ -1,2 +1,3 @@
1
- import { TranslationstudioTranslatable } from "../../../../../Types";
2
- export declare function prepareImportData(translatables: TranslationstudioTranslatable[], existingEntry: any, targetSchema: any): Record<string, any>;
1
+ import { TranslatedDocumentReplaceFields, TranslationstudioTranslatable } from "../../../../../Types";
2
+ import { IStrapiSchema } from "../exportData/getContentType";
3
+ export declare function prepareImportData(translatables: TranslationstudioTranslatable[], keepData: TranslatedDocumentReplaceFields, existingEntry: any, targetSchema: IStrapiSchema): Record<string, any> | null;
@@ -1,2 +1,3 @@
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, schema?: any): any;
1
+ import { IStrapiSchema } from '../exportData/getContentType';
2
+ export declare function appendMissingFields(data: Record<string, any>, sourceEntry: any, targetSchema: IStrapiSchema, targetEntry: any): void;
3
+ export declare function updateEntry(contentTypeID: string, entryID: string, targetLocale: string, data: Record<string, any>): Promise<void>;
@@ -15,20 +15,21 @@ declare const _default: {
15
15
  token: unknown;
16
16
  }>;
17
17
  generateToken(): Promise<{
18
- token: any;
18
+ token: string;
19
19
  }>;
20
20
  getLanguageOptions(): Promise<unknown>;
21
- exportData(payload: import("../../../Types").ExportPayload): Promise<any[]>;
22
- importData(payload: import("../../../Types").ImportPayload): Promise<{
23
- success: boolean;
21
+ exportData(payload: import("../../../Types").ExportPayload): Promise<{
22
+ fields: any[];
23
+ keep: any;
24
24
  }>;
25
+ importData(payload: import("../../../Types").ImportPayload): Promise<boolean>;
25
26
  requestTranslation(payload: import("../../../Types").TranslationRequest): Promise<boolean>;
26
27
  getEmail(ctx: any): Promise<{
27
28
  email: any;
28
29
  }>;
29
30
  getLanguages(): Promise<import("../../../Types").LocaleMap>;
30
31
  ping(): Promise<void>;
31
- getEntryData(contentTypeID: any, entryID: any, locale: any): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
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;
@@ -16,19 +16,20 @@ declare const service: ({ strapi }: {
16
16
  token: unknown;
17
17
  }>;
18
18
  generateToken(): Promise<{
19
- token: any;
19
+ token: string;
20
20
  }>;
21
21
  getLanguageOptions(): Promise<unknown>;
22
- exportData(payload: ExportPayload): Promise<any[]>;
23
- importData(payload: ImportPayload): Promise<{
24
- success: boolean;
22
+ exportData(payload: ExportPayload): Promise<{
23
+ fields: any[];
24
+ keep: any;
25
25
  }>;
26
+ importData(payload: ImportPayload): Promise<boolean>;
26
27
  requestTranslation(payload: TranslationRequest): Promise<boolean>;
27
28
  getEmail(ctx: any): Promise<{
28
29
  email: any;
29
30
  }>;
30
31
  getLanguages(): Promise<LocaleMap>;
31
32
  ping(): Promise<void>;
32
- getEntryData(contentTypeID: any, entryID: any, locale: any): Promise<import("@strapi/types/dist/modules/documents").AnyDocument>;
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
@@ -3,8 +3,14 @@
3
3
  "description": "translationstudio extension for strapi",
4
4
  "license": "GPL-2.0-only",
5
5
  "author": "Duncan Leininger <duncan.leininger@idmedia.com>",
6
+ "contributors": [
7
+ {
8
+ "name": "Phillip Austerfield",
9
+ "email": "phillip.austerfield@idmedia.com"
10
+ }
11
+ ],
6
12
  "homepage": "https://translationstudio.tech",
7
- "version": "1.1.3",
13
+ "version": "2.0.1",
8
14
  "keywords": [
9
15
  "translationstudio",
10
16
  "strapi",
@@ -46,15 +52,21 @@
46
52
  "dependencies": {
47
53
  "@strapi/design-system": "^2.0.0-rc.14",
48
54
  "@strapi/icons": "^2.0.0-rc.14",
49
- "react-intl": "^7.1.10"
55
+ "react-intl": "^7.1.10",
56
+ "translationstudio-strapi-extension": "file:.yalc/translationstudio-strapi-extension"
50
57
  },
51
58
  "devDependencies": {
59
+ "@babel/preset-typescript": "^7.27.1",
60
+ "@jest/globals": "^30.0.0-beta.3",
52
61
  "@strapi/sdk-plugin": "^5.3.2",
53
62
  "@strapi/strapi": "^5.12.4",
54
63
  "@strapi/typescript-utils": "^5.5.0",
64
+ "@types/jest": "^29.5.14",
55
65
  "@types/react": "^18.3.1",
56
66
  "@types/react-dom": "^18.3.1",
67
+ "jest": "^29.7.0",
57
68
  "prettier": "^3.4.2",
69
+ "ts-jest": "^29.3.4",
58
70
  "typescript": "^5.7.2"
59
71
  },
60
72
  "peerDependencies": {
@@ -1,2 +0,0 @@
1
- import { OrganizedFields, TranslationstudioTranslatable } from "../../../../../Types";
2
- export declare function organizeFields(fields: TranslationstudioTranslatable[]): OrganizedFields;
@@ -1,2 +0,0 @@
1
- import { TranslationstudioTranslatable } from "../../../../../Types";
2
- export declare function processDynamicZones(dynamicZoneFields: Map<number, TranslationstudioTranslatable[]>, acc: Record<string, any>, existingEntry: any): Record<string, any>;
@@ -1,2 +0,0 @@
1
- import { TranslationstudioTranslatable } from "../../../../../Types";
2
- export declare function processRegularFields(regularFields: TranslationstudioTranslatable[], acc: Record<string, any>): Record<string, any>;