@littlebox/strapi-suite 1.0.50 → 1.0.52
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/_chunks/{App-CUhT6I0p.js → App-C-h--Kv_.js} +565 -36
- package/dist/_chunks/{App-CVOV2lQP.mjs → App-C1HyspTk.mjs} +558 -29
- package/dist/_chunks/{SlugInput-Cy1-zfz_.js → SlugInput-3gkr6B0t.js} +3 -4
- package/dist/_chunks/{SlugInput-DDRjbmRt.mjs → SlugInput-CU9_b0dd.mjs} +1 -2
- package/dist/_chunks/{en-CGJcJfk1.js → en-CLNZnNeq.js} +30 -0
- package/dist/_chunks/{en-CRSiVe4w.mjs → en-F6RYx79c.mjs} +30 -0
- package/dist/_chunks/{index-B0aQw-t1.js → index-60sq8G6p.js} +667 -20
- package/dist/_chunks/{index-fPknNRw6.mjs → index-DQ3vX9So.mjs} +639 -9
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/admin/src/components/DocumentTranslateBox.d.ts +5 -0
- package/dist/admin/src/components/DocumentTranslateModal.d.ts +11 -0
- package/dist/admin/src/components/TranslationAiModal.d.ts +8 -0
- package/dist/admin/src/components/TranslationSettingsModal.d.ts +6 -0
- package/dist/admin/src/contexts/settings.d.ts +1 -0
- package/dist/admin/src/core/config.d.ts +1 -0
- package/dist/admin/src/core/gateways/aiGateway.d.ts +19 -0
- package/dist/admin/src/core/gateways/documentGateway.d.ts +15 -0
- package/dist/admin/src/core/gateways/translationGateway.d.ts +13 -0
- package/dist/admin/src/core/usecases/translateDocument.d.ts +33 -0
- package/dist/admin/src/core/usecases/translateWithAi.d.ts +17 -0
- package/dist/admin/src/core/utils/documentFields.d.ts +23 -0
- package/dist/server/index.js +386 -79
- package/dist/server/index.mjs +386 -79
- package/dist/server/src/config/index.d.ts +4 -0
- package/dist/server/src/controllers/index.d.ts +6 -0
- package/dist/server/src/controllers/modules/ai-translation.d.ts +7 -0
- package/dist/server/src/controllers/modules/translation.d.ts +1 -0
- package/dist/server/src/index.d.ts +22 -1
- package/dist/server/src/services/app/setting.d.ts +3 -1
- package/dist/server/src/services/index.d.ts +16 -1
- package/dist/server/src/services/modules/ai-translation.d.ts +35 -0
- package/package.json +1 -1
- package/dist/_chunks/convertToSlug-B-OmazDp.js +0 -83
- package/dist/_chunks/convertToSlug-Bht0pDyl.mjs +0 -84
package/dist/admin/index.js
CHANGED
package/dist/admin/index.mjs
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Output as OutputTranslateDocument } from '../core/usecases/translateDocument';
|
|
2
|
+
import { Output as OutputFetchLocales } from '../core/usecases/fetchLocales';
|
|
3
|
+
interface Props {
|
|
4
|
+
open: boolean;
|
|
5
|
+
locales: OutputFetchLocales[];
|
|
6
|
+
targetLocale?: OutputFetchLocales;
|
|
7
|
+
translate: (sourceLocale: string, overwrite: boolean) => Promise<OutputTranslateDocument>;
|
|
8
|
+
close: () => void;
|
|
9
|
+
}
|
|
10
|
+
declare const DocumentTranslateModal: ({ open, locales, targetLocale, translate, close }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default DocumentTranslateModal;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Output as OutputFetchLocales } from '../core/usecases/fetchLocales';
|
|
2
|
+
interface Props {
|
|
3
|
+
open: boolean;
|
|
4
|
+
locales: OutputFetchLocales[];
|
|
5
|
+
close: (refresh: boolean) => void;
|
|
6
|
+
}
|
|
7
|
+
declare const TranslationAiModal: ({ open, locales, close }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default TranslationAiModal;
|
|
@@ -4,6 +4,7 @@ type SettingsProviderProps = {
|
|
|
4
4
|
};
|
|
5
5
|
type SettingsContextData = {
|
|
6
6
|
provide(module: string): Record<string, any>;
|
|
7
|
+
refresh(): Promise<void>;
|
|
7
8
|
};
|
|
8
9
|
export declare function SettingsProvider({ children }: SettingsProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export declare const SettingsContext: import("react").Context<SettingsContextData>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import HttpClient from "../http/httpClient";
|
|
2
|
+
export default interface AiGateway {
|
|
3
|
+
translateStrings(input: TranslateStringsInput): Promise<TranslateStringsOutput>;
|
|
4
|
+
}
|
|
5
|
+
export declare class AiGatewayHttp implements AiGateway {
|
|
6
|
+
httpClient: HttpClient;
|
|
7
|
+
constructor();
|
|
8
|
+
translateStrings(input: TranslateStringsInput): Promise<TranslateStringsOutput>;
|
|
9
|
+
}
|
|
10
|
+
export type TranslateStringsInput = {
|
|
11
|
+
sourceLocale: string;
|
|
12
|
+
targetLocale: string;
|
|
13
|
+
strings: Record<string, string>;
|
|
14
|
+
};
|
|
15
|
+
export type TranslateStringsOutput = {
|
|
16
|
+
translations: Record<string, string>;
|
|
17
|
+
failed: number;
|
|
18
|
+
errors: string[];
|
|
19
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import HttpClient from "../http/httpClient";
|
|
2
|
+
export default interface DocumentGateway {
|
|
3
|
+
fetch(input: FetchInput): Promise<any>;
|
|
4
|
+
}
|
|
5
|
+
export declare class DocumentGatewayHttp implements DocumentGateway {
|
|
6
|
+
httpClient: HttpClient;
|
|
7
|
+
constructor();
|
|
8
|
+
fetch({ collectionType, model, documentId, params }: FetchInput): Promise<any>;
|
|
9
|
+
}
|
|
10
|
+
export type FetchInput = {
|
|
11
|
+
collectionType: string;
|
|
12
|
+
model: string;
|
|
13
|
+
documentId?: string;
|
|
14
|
+
params: Record<string, any>;
|
|
15
|
+
};
|
|
@@ -12,6 +12,7 @@ export default interface TranslationGateway {
|
|
|
12
12
|
translation: string;
|
|
13
13
|
locale: string;
|
|
14
14
|
}[]): Promise<void>;
|
|
15
|
+
aiTranslate(params: AiTranslateInput): Promise<AiTranslateOutput>;
|
|
15
16
|
}
|
|
16
17
|
export declare class TranslationGatewayHttp implements TranslationGateway {
|
|
17
18
|
httpClient: HttpClient;
|
|
@@ -28,7 +29,19 @@ export declare class TranslationGatewayHttp implements TranslationGateway {
|
|
|
28
29
|
translation: string;
|
|
29
30
|
locale: string;
|
|
30
31
|
}[]): Promise<void>;
|
|
32
|
+
aiTranslate(params: AiTranslateInput): Promise<AiTranslateOutput>;
|
|
31
33
|
}
|
|
34
|
+
export type AiTranslateInput = {
|
|
35
|
+
sourceLocale: string;
|
|
36
|
+
targetLocales: string[];
|
|
37
|
+
overwrite: boolean;
|
|
38
|
+
};
|
|
39
|
+
export type AiTranslateOutput = {
|
|
40
|
+
translated: number;
|
|
41
|
+
skipped: number;
|
|
42
|
+
failed: number;
|
|
43
|
+
errors: string[];
|
|
44
|
+
};
|
|
32
45
|
type FetchOutput = {
|
|
33
46
|
id: number;
|
|
34
47
|
documentId: string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import DocumentGateway from '../gateways/documentGateway';
|
|
2
|
+
import AiGateway from '../gateways/aiGateway';
|
|
3
|
+
export default class TranslateDocument {
|
|
4
|
+
documentGateway: DocumentGateway;
|
|
5
|
+
aiGateway: AiGateway;
|
|
6
|
+
constructor();
|
|
7
|
+
execute(input: Input): Promise<Output>;
|
|
8
|
+
}
|
|
9
|
+
export type Input = {
|
|
10
|
+
collectionType: string;
|
|
11
|
+
model: string;
|
|
12
|
+
documentId?: string;
|
|
13
|
+
sourceLocale: string;
|
|
14
|
+
targetLocale: string;
|
|
15
|
+
status?: string;
|
|
16
|
+
attributes: Record<string, any>;
|
|
17
|
+
components: Record<string, any>;
|
|
18
|
+
values: any;
|
|
19
|
+
overwrite: boolean;
|
|
20
|
+
};
|
|
21
|
+
export type Result = {
|
|
22
|
+
path: string;
|
|
23
|
+
value: string;
|
|
24
|
+
kind: string;
|
|
25
|
+
};
|
|
26
|
+
export type Output = {
|
|
27
|
+
results: Result[];
|
|
28
|
+
translated: number;
|
|
29
|
+
skipped: number;
|
|
30
|
+
unmatched: number;
|
|
31
|
+
failed: number;
|
|
32
|
+
errors: string[];
|
|
33
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import TranslationGateway from '../gateways/translationGateway';
|
|
2
|
+
export default class TranslateWithAi {
|
|
3
|
+
translationGateway: TranslationGateway;
|
|
4
|
+
constructor();
|
|
5
|
+
execute(input: Input): Promise<Output>;
|
|
6
|
+
}
|
|
7
|
+
export type Input = {
|
|
8
|
+
sourceLocale: string;
|
|
9
|
+
targetLocales: string[];
|
|
10
|
+
overwrite: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type Output = {
|
|
13
|
+
translated: number;
|
|
14
|
+
skipped: number;
|
|
15
|
+
failed: number;
|
|
16
|
+
errors: string[];
|
|
17
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type FieldKind = 'text' | 'slug';
|
|
2
|
+
export interface TranslatableField {
|
|
3
|
+
path: string;
|
|
4
|
+
value: string;
|
|
5
|
+
current: string;
|
|
6
|
+
kind: FieldKind;
|
|
7
|
+
}
|
|
8
|
+
type Attributes = Record<string, any>;
|
|
9
|
+
type Components = Record<string, any>;
|
|
10
|
+
/**
|
|
11
|
+
* Walks the schema over the values of the document being edited and, for every
|
|
12
|
+
* translatable leaf, pairs it with the text found at the same path in the source
|
|
13
|
+
* document. The walk is driven by the target so that every path produced already
|
|
14
|
+
* exists in the open form, and dynamic zone entries are only paired when both
|
|
15
|
+
* sides hold the same component.
|
|
16
|
+
*/
|
|
17
|
+
export declare function collectTranslatableFields(attributes: Attributes, components: Components, target: any, source: any, basePath?: string): TranslatableField[];
|
|
18
|
+
/**
|
|
19
|
+
* Counts the translatable leaves of the source document on its own, so the
|
|
20
|
+
* caller can tell how many of them found no counterpart in the open document.
|
|
21
|
+
*/
|
|
22
|
+
export declare function countTranslatableFields(attributes: Attributes, components: Components, source: any): number;
|
|
23
|
+
export {};
|