@parhelia/localization 0.4.13049 → 0.4.13170
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/LICENSE +1 -1
- package/dist/LocalizeItemCommand.d.ts.map +1 -1
- package/dist/LocalizeItemCommand.js +0 -1
- package/dist/LocalizeItemDialog.d.ts.map +1 -1
- package/dist/LocalizeItemDialog.js +3 -9
- package/dist/LocalizeItemUtils.d.ts +0 -1
- package/dist/LocalizeItemUtils.d.ts.map +1 -1
- package/dist/LocalizeItemUtils.js +24 -45
- package/dist/api/discovery.d.ts +3 -17
- package/dist/api/discovery.d.ts.map +1 -1
- package/dist/api/discovery.js +14 -35
- package/dist/hooks/useTranslationWizard.d.ts.map +1 -1
- package/dist/hooks/useTranslationWizard.js +2 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -6
- package/dist/services/translationService.d.ts +27 -43
- package/dist/services/translationService.d.ts.map +1 -1
- package/dist/services/translationService.js +32 -36
- package/dist/settings/TranslationServicesPanel.d.ts +4 -14
- package/dist/settings/TranslationServicesPanel.d.ts.map +1 -1
- package/dist/settings/TranslationServicesPanel.js +263 -186
- package/dist/setup/LocalizationSetupStep.d.ts.map +1 -1
- package/dist/setup/LocalizationSetupStep.js +33 -14
- package/dist/sidebar/TranslationSidebar.d.ts.map +1 -1
- package/dist/sidebar/TranslationSidebar.js +14 -35
- package/dist/steps/ItemSelectionTree.d.ts +2 -2
- package/dist/steps/ItemSelectionTree.d.ts.map +1 -1
- package/dist/steps/ItemSelectionTree.js +47 -132
- package/dist/steps/ProviderStep.d.ts.map +1 -1
- package/dist/steps/ProviderStep.js +42 -55
- package/dist/steps/ServiceLanguageSelectionStep.d.ts +1 -1
- package/dist/steps/ServiceLanguageSelectionStep.d.ts.map +1 -1
- package/dist/steps/ServiceLanguageSelectionStep.js +176 -127
- package/dist/steps/types.d.ts +3 -3
- package/dist/steps/types.d.ts.map +1 -1
- package/dist/translation-center/TranslationBatches.d.ts +0 -37
- package/dist/translation-center/TranslationBatches.d.ts.map +1 -1
- package/dist/translation-center/TranslationBatches.js +78 -214
- package/dist/types.d.ts +0 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -2
- package/dist/services/translationSettingsService.d.ts +0 -79
- package/dist/services/translationSettingsService.d.ts.map +0 -1
- package/dist/services/translationSettingsService.js +0 -68
- package/dist/settings/ExcludedContentTypeDialog.d.ts +0 -12
- package/dist/settings/ExcludedContentTypeDialog.d.ts.map +0 -1
- package/dist/settings/ExcludedContentTypeDialog.js +0 -29
- package/dist/settings/TranslationProviderDialog.d.ts +0 -18
- package/dist/settings/TranslationProviderDialog.d.ts.map +0 -1
- package/dist/settings/TranslationProviderDialog.js +0 -105
package/LICENSE
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalizeItemCommand.d.ts","sourceRoot":"","sources":["../src/LocalizeItemCommand.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,cAAc,EACd,WAAW,EACX,eAAe,EACf,QAAQ,EACT,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAEL,uBAAuB,EACxB,MAAM,eAAe,CAAC;AAQvB,MAAM,MAAM,uBAAuB,GAAG,WAAW,GAAG;IAClD,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GACpC,cAAc,CAAC,uBAAuB,CAAC,CAAC;AAC1C,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAEnE,wBAAsB,sBAAsB,CAAC,EAC3C,WAAW,EACX,UAAmC,EACnC,KAAK,GACN,EAAE;IACD,WAAW,EAAE,eAAe,CAAC;IAC7B,UAAU,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IAC3C,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,2CAiCA;AAED,eAAO,MAAM,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"LocalizeItemCommand.d.ts","sourceRoot":"","sources":["../src/LocalizeItemCommand.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,cAAc,EACd,WAAW,EACX,eAAe,EACf,QAAQ,EACT,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAEL,uBAAuB,EACxB,MAAM,eAAe,CAAC;AAQvB,MAAM,MAAM,uBAAuB,GAAG,WAAW,GAAG;IAClD,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GACpC,cAAc,CAAC,uBAAuB,CAAC,CAAC;AAC1C,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAEnE,wBAAsB,sBAAsB,CAAC,EAC3C,WAAW,EACX,UAAmC,EACnC,KAAK,GACN,EAAE;IACD,WAAW,EAAE,eAAe,CAAC;IAC7B,UAAU,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IAC3C,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,2CAiCA;AAED,eAAO,MAAM,mBAAmB,EAAE,mBAkCjC,CAAC"}
|
|
@@ -33,7 +33,6 @@ export async function openLocalizeItemDialog({ editContext, openDialog = editCon
|
|
|
33
33
|
}
|
|
34
34
|
export const localizeItemCommand = {
|
|
35
35
|
id: "localizeItem",
|
|
36
|
-
right: "parhelia.translate",
|
|
37
36
|
label: "Translate",
|
|
38
37
|
icon: _jsx(GlobeIcon, { strokeWidth: 1 }),
|
|
39
38
|
disabled: (context) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalizeItemDialog.d.ts","sourceRoot":"","sources":["../src/LocalizeItemDialog.tsx"],"names":[],"mappings":"AA8BA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EAExB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"LocalizeItemDialog.d.ts","sourceRoot":"","sources":["../src/LocalizeItemDialog.tsx"],"names":[],"mappings":"AA8BA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EAExB,MAAM,eAAe,CAAC;AAmEvB,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,uBAAuB,GAAG,WAAW,CAAC,uBAAuB,CAAC,+BA6hBtE"}
|
|
@@ -3,7 +3,6 @@ import { Dialog, DialogContent, StyledDialogTitle, Button, cn, AlertDialog, Aler
|
|
|
3
3
|
import { useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
4
4
|
import { AlertTriangle as LucideAlertTriangle, ArrowRight as LucideArrowRight, Globe as LucideGlobe, } from "lucide-react";
|
|
5
5
|
import { useTranslationWizard } from "./hooks/useTranslationWizard";
|
|
6
|
-
import { translationDescriptorKey } from "./services/translationService";
|
|
7
6
|
import { performDefaultTranslation, } from "./LocalizeItemUtils";
|
|
8
7
|
const AlertTriangleIcon = LucideAlertTriangle;
|
|
9
8
|
const GlobeIcon = LucideGlobe;
|
|
@@ -87,7 +86,7 @@ export function LocalizeItemDialog(props) {
|
|
|
87
86
|
useEffect(() => {
|
|
88
87
|
beforeNextCallbackRef.current = beforeNextCallback;
|
|
89
88
|
}, [beforeNextCallback]);
|
|
90
|
-
// Switch step helper that clears callbacks
|
|
89
|
+
// Switch step helper that clears callbacks (similar to page wizard)
|
|
91
90
|
const switchStep = useCallback((index) => {
|
|
92
91
|
beforeNextCallbackRef.current = null; // Clear callback when switching steps
|
|
93
92
|
setBeforeNextCallback(null);
|
|
@@ -137,7 +136,7 @@ export function LocalizeItemDialog(props) {
|
|
|
137
136
|
itemCount += 1;
|
|
138
137
|
if (!entry.includeSubitems)
|
|
139
138
|
continue;
|
|
140
|
-
const c = subitemCounts[
|
|
139
|
+
const c = subitemCounts[entry.descriptor.id];
|
|
141
140
|
if (c === undefined || c === "loading") {
|
|
142
141
|
isStreaming = true;
|
|
143
142
|
}
|
|
@@ -244,15 +243,10 @@ export function LocalizeItemDialog(props) {
|
|
|
244
243
|
targetLanguages: [...newData.targetLanguages].sort(),
|
|
245
244
|
includeSubitems: newData.includeSubitems,
|
|
246
245
|
discoveredItemIds: (newData.discoveredItems || [])
|
|
247
|
-
.map((item) =>
|
|
246
|
+
.map((item) => item?.descriptor?.id || item?.id)
|
|
248
247
|
.filter(Boolean)
|
|
249
248
|
.sort(),
|
|
250
249
|
itemsCount: newData.items?.length || 0,
|
|
251
|
-
selectionTreeItems: newData.selectionTreeItems?.map((entry) => [
|
|
252
|
-
translationDescriptorKey(entry.descriptor),
|
|
253
|
-
entry.descriptor.language,
|
|
254
|
-
entry.includeSubitems,
|
|
255
|
-
]),
|
|
256
250
|
serviceCustomData: serviceCustomDataKey,
|
|
257
251
|
metadata: metadataKey,
|
|
258
252
|
// batchName must be part of the key — otherwise the ProviderStep's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalizeItemUtils.d.ts","sourceRoot":"","sources":["../src/LocalizeItemUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LocalizeItemUtils.d.ts","sourceRoot":"","sources":["../src/LocalizeItemUtils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAsDjD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAIF,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,qBAAqB,EACjC,WAAW,EAAE,eAAe,GAC3B,OAAO,CAAC,iBAAiB,CAAC,CAkI5B;AAGD,eAAO,MAAM,mBAAmB,kBACf,MAAM,EAAE,qBACJ,iBAAiB,EAAE,aAC3B,MAAM,QACX,QAAQ,uBACO,MAAM,+BAkC5B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { requestBatchTranslation,
|
|
1
|
+
import { requestBatchTranslation, } from "./services/translationService";
|
|
2
2
|
import { discoverItemsTree, flattenSelectableItemsFromBackendTrees, } from "./api/discovery";
|
|
3
3
|
/**
|
|
4
4
|
* Resolve the final list of item IDs to translate, expanding subitems for
|
|
@@ -12,61 +12,40 @@ import { discoverItemsTree, flattenSelectableItemsFromBackendTrees, } from "./ap
|
|
|
12
12
|
async function resolveItemIdsToTranslate(wizardData, sessionId) {
|
|
13
13
|
if (wizardData.selectionTreeItems &&
|
|
14
14
|
wizardData.selectionTreeItems.length > 0) {
|
|
15
|
-
const
|
|
16
|
-
const rootsToExpand =
|
|
15
|
+
const directIds = [];
|
|
16
|
+
const rootsToExpand = [];
|
|
17
17
|
for (const entry of wizardData.selectionTreeItems) {
|
|
18
18
|
if (entry.includeSubitems) {
|
|
19
|
-
|
|
20
|
-
const key = JSON.stringify([item.store, entry.descriptor.language]);
|
|
21
|
-
const group = rootsToExpand.get(key) ?? {
|
|
22
|
-
store: item.store,
|
|
23
|
-
language: entry.descriptor.language,
|
|
24
|
-
rootItemIds: [],
|
|
25
|
-
};
|
|
26
|
-
group.rootItemIds.push(item.itemId);
|
|
27
|
-
rootsToExpand.set(key, group);
|
|
19
|
+
rootsToExpand.push(entry.descriptor.id);
|
|
28
20
|
}
|
|
29
21
|
else {
|
|
30
|
-
|
|
22
|
+
directIds.push(entry.descriptor.id);
|
|
31
23
|
}
|
|
32
24
|
}
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
itemId: n.id,
|
|
39
|
-
})));
|
|
25
|
+
const expandedIds = [];
|
|
26
|
+
if (rootsToExpand.length > 0) {
|
|
27
|
+
const language = wizardData.selectionTreeItems[0]?.descriptor.language;
|
|
28
|
+
const tree = await discoverItemsTree({ rootItemIds: rootsToExpand, language }, sessionId);
|
|
29
|
+
expandedIds.push(...flattenSelectableItemsFromBackendTrees(tree.trees).map((n) => n.id));
|
|
40
30
|
}
|
|
41
|
-
return Array.from(new
|
|
42
|
-
translationItemKey(item),
|
|
43
|
-
item,
|
|
44
|
-
])).values());
|
|
31
|
+
return Array.from(new Set([...directIds, ...expandedIds]));
|
|
45
32
|
}
|
|
46
33
|
const fallback = wizardData.discoveredItems && wizardData.discoveredItems.length > 0
|
|
47
34
|
? wizardData.discoveredItems
|
|
48
35
|
: wizardData.items;
|
|
49
|
-
return
|
|
50
|
-
const coordinate = translationItem(item.descriptor);
|
|
51
|
-
return [translationItemKey(coordinate), coordinate];
|
|
52
|
-
})).values());
|
|
36
|
+
return fallback.map((item) => item.descriptor.id);
|
|
53
37
|
}
|
|
54
38
|
// Unified translation function that handles both single and batch translations
|
|
55
39
|
// Now always uses batch logic for traceability in recentTranslation view
|
|
56
40
|
export async function performDefaultTranslation(wizardData, editContext) {
|
|
57
41
|
// Build language mappings (source -> target) from the wizard data
|
|
58
|
-
// The source language is consistent for each target language across all items
|
|
59
|
-
// The source the user chose in the dialog wins; the status endpoint's
|
|
60
|
-
// per-target suggestion is only the fallback for callers without one.
|
|
42
|
+
// The source language is consistent for each target language across all items
|
|
61
43
|
const languageMappings = [];
|
|
62
44
|
for (const language of wizardData.targetLanguages) {
|
|
63
45
|
const languageInfo = wizardData.languageData.get(language);
|
|
64
46
|
const sourceLanguage = wizardData.sourceLanguage ||
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
languageInfo?.translationStatus?.sourceLanguage;
|
|
68
|
-
if (!sourceLanguage)
|
|
69
|
-
throw new Error("Select a source language before translating.");
|
|
47
|
+
languageInfo?.translationStatus?.sourceLanguage ||
|
|
48
|
+
"en";
|
|
70
49
|
// Skip if target language equals source language
|
|
71
50
|
if (language === sourceLanguage)
|
|
72
51
|
continue;
|
|
@@ -76,9 +55,9 @@ export async function performDefaultTranslation(wizardData, editContext) {
|
|
|
76
55
|
});
|
|
77
56
|
}
|
|
78
57
|
// Resolve item IDs, expanding subitems per-item-flag where applicable.
|
|
79
|
-
const
|
|
58
|
+
const itemIds = await resolveItemIdsToTranslate(wizardData, editContext.sessionId);
|
|
80
59
|
// Validate that we have translation requests to process
|
|
81
|
-
if (languageMappings.length === 0 ||
|
|
60
|
+
if (languageMappings.length === 0 || itemIds.length === 0) {
|
|
82
61
|
const error = new Error("No translations needed. All selected target languages match the source languages of the items.");
|
|
83
62
|
error.name = "NoTranslationsNeededError";
|
|
84
63
|
throw error;
|
|
@@ -105,8 +84,11 @@ export async function performDefaultTranslation(wizardData, editContext) {
|
|
|
105
84
|
if (trimmedName) {
|
|
106
85
|
metadataObj.name = trimmedName;
|
|
107
86
|
}
|
|
108
|
-
//
|
|
109
|
-
|
|
87
|
+
// Per-target suggestions can differ; the batch only records a single source.
|
|
88
|
+
const sourceLanguages = new Set(languageMappings.map((mapping) => mapping.sourceLanguage));
|
|
89
|
+
if (sourceLanguages.size === 1) {
|
|
90
|
+
metadataObj.sourceLanguage = languageMappings[0].sourceLanguage;
|
|
91
|
+
}
|
|
110
92
|
// Merge service-specific custom data (e.g., custom prompts for AI providers)
|
|
111
93
|
if (wizardData.serviceCustomData && wizardData.serviceCustomData.size > 0) {
|
|
112
94
|
const serviceData = wizardData.serviceCustomData.get(wizardData.translationProvider);
|
|
@@ -131,7 +113,7 @@ export async function performDefaultTranslation(wizardData, editContext) {
|
|
|
131
113
|
provider: wizardData.translationProvider,
|
|
132
114
|
batchMetadata,
|
|
133
115
|
languageMappings,
|
|
134
|
-
|
|
116
|
+
itemIds,
|
|
135
117
|
});
|
|
136
118
|
if (batchResult.type === "error") {
|
|
137
119
|
console.error("Translation request failed:", batchResult);
|
|
@@ -151,7 +133,6 @@ export async function performDefaultTranslation(wizardData, editContext) {
|
|
|
151
133
|
throw error;
|
|
152
134
|
}
|
|
153
135
|
const started = batchResponse.started?.map((result) => ({
|
|
154
|
-
store: result.store,
|
|
155
136
|
itemId: result.itemId,
|
|
156
137
|
targetLanguage: result.targetLanguage,
|
|
157
138
|
jobId: result.jobId,
|
|
@@ -168,9 +149,7 @@ export const defaultTranslateAll = async (languageCodes, translationStatus, sess
|
|
|
168
149
|
items: [item],
|
|
169
150
|
targetLanguages: languageCodes,
|
|
170
151
|
languageData: new Map(languageCodes.map((lang) => {
|
|
171
|
-
const status = translationStatus?.find((x) => x.
|
|
172
|
-
x.itemId === item.descriptor.id &&
|
|
173
|
-
x.targetLanguage === lang);
|
|
152
|
+
const status = translationStatus?.find((x) => x.targetLanguage === lang);
|
|
174
153
|
return [
|
|
175
154
|
lang,
|
|
176
155
|
{
|
package/dist/api/discovery.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { type TranslationItem } from "../services/translationService";
|
|
2
1
|
export declare function suggestBatchName(req: {
|
|
3
|
-
|
|
4
|
-
language: string;
|
|
2
|
+
itemIds: string[];
|
|
5
3
|
targetLanguages: string[];
|
|
6
4
|
includeSubitems?: boolean;
|
|
7
5
|
}, sessionId?: string): Promise<string | null>;
|
|
8
6
|
export type DiscoveredItem = {
|
|
9
|
-
store: string;
|
|
10
7
|
id: string;
|
|
11
8
|
name: string;
|
|
12
9
|
path: string;
|
|
@@ -20,7 +17,6 @@ export type TreeNode = {
|
|
|
20
17
|
children?: TreeNode[];
|
|
21
18
|
};
|
|
22
19
|
export type BackendTreeNode = {
|
|
23
|
-
store: string;
|
|
24
20
|
id: string;
|
|
25
21
|
name: string;
|
|
26
22
|
path: string;
|
|
@@ -29,9 +25,8 @@ export type BackendTreeNode = {
|
|
|
29
25
|
children: BackendTreeNode[];
|
|
30
26
|
};
|
|
31
27
|
export type DiscoverItemsTreeRequest = {
|
|
32
|
-
store: string;
|
|
33
28
|
rootItemIds: string[];
|
|
34
|
-
language
|
|
29
|
+
language?: string;
|
|
35
30
|
};
|
|
36
31
|
export type DiscoverItemsTreeResponse = {
|
|
37
32
|
trees: BackendTreeNode[];
|
|
@@ -41,18 +36,10 @@ export type DiscoverItemsTreeResponse = {
|
|
|
41
36
|
export declare function discoverItemsTree(req: DiscoverItemsTreeRequest, sessionId?: string): Promise<DiscoverItemsTreeResponse>;
|
|
42
37
|
export declare function convertBackendTreeToTreeNodes(trees: BackendTreeNode[]): TreeNode[];
|
|
43
38
|
export declare function flattenSelectableItemsFromBackendTrees(trees: BackendTreeNode[]): DiscoveredItem[];
|
|
44
|
-
/**
|
|
45
|
-
* One line of the subitem-count stream. `refusal` (multi-cms cfsmall, A15; cfabove §5): the store refused to list the subtree
|
|
46
|
-
* past its bound — the server's last line names why, the count is what was walked before, and the translation itself would
|
|
47
|
-
* refuse with the same reason.
|
|
48
|
-
*/
|
|
49
39
|
export type SubitemCountUpdate = {
|
|
50
40
|
count: number;
|
|
51
41
|
complete: boolean;
|
|
52
|
-
refusal?: string;
|
|
53
42
|
};
|
|
54
|
-
/** The update a parsed stream line states, or undefined for a line without a count. */
|
|
55
|
-
export declare function subitemCountUpdateOf(line: unknown): SubitemCountUpdate | undefined;
|
|
56
43
|
/**
|
|
57
44
|
* Streams the running subitem count for a given root item from the
|
|
58
45
|
* backend. The endpoint returns newline-delimited JSON; each parsed line
|
|
@@ -63,9 +50,8 @@ export declare function subitemCountUpdateOf(line: unknown): SubitemCountUpdate
|
|
|
63
50
|
* subitems flag off again).
|
|
64
51
|
*/
|
|
65
52
|
export declare function streamSubitemCount(req: {
|
|
66
|
-
store: string;
|
|
67
53
|
itemId: string;
|
|
68
|
-
language
|
|
54
|
+
language?: string;
|
|
69
55
|
}, onProgress: (update: SubitemCountUpdate) => void, options?: {
|
|
70
56
|
sessionId?: string;
|
|
71
57
|
signal?: AbortSignal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/api/discovery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../src/api/discovery.ts"],"names":[],"mappings":"AAEA,wBAAsB,gBAAgB,CACpC,GAAG,EAAE;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,EACD,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAaxB;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;CACvB,CAAC;AAIF,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,wBAAwB,EAC7B,SAAS,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,yBAAyB,CAAC,CAYpC;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,eAAe,EAAE,GACvB,QAAQ,EAAE,CAgBZ;AAED,wBAAgB,sCAAsC,CACpD,KAAK,EAAE,eAAe,EAAE,GACvB,cAAc,EAAE,CAclB;AAED,MAAM,MAAM,kBAAkB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtE;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,EAC1C,UAAU,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,EAChD,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,GACrD,OAAO,CAAC,MAAM,CAAC,CAsEjB"}
|
package/dist/api/discovery.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { post
|
|
2
|
-
import { translationItemKey, } from "../services/translationService";
|
|
1
|
+
import { post } from "@parhelia/core";
|
|
3
2
|
export async function suggestBatchName(req, sessionId) {
|
|
4
3
|
const { data, type } = await post("/parhelia/translation/suggestBatchName", {
|
|
5
|
-
|
|
6
|
-
Language: req.language,
|
|
4
|
+
ItemIds: req.itemIds,
|
|
7
5
|
TargetLanguages: req.targetLanguages,
|
|
8
6
|
IncludeSubitems: !!req.includeSubitems,
|
|
9
7
|
}, sessionId);
|
|
@@ -14,7 +12,6 @@ export async function suggestBatchName(req, sessionId) {
|
|
|
14
12
|
}
|
|
15
13
|
export async function discoverItemsTree(req, sessionId) {
|
|
16
14
|
const { data, type, details } = await post("/parhelia/translation/discoveritemstree", {
|
|
17
|
-
Store: req.store,
|
|
18
15
|
RootItemIds: req.rootItemIds,
|
|
19
16
|
Language: req.language,
|
|
20
17
|
}, sessionId);
|
|
@@ -24,10 +21,9 @@ export async function discoverItemsTree(req, sessionId) {
|
|
|
24
21
|
}
|
|
25
22
|
export function convertBackendTreeToTreeNodes(trees) {
|
|
26
23
|
const convert = (n) => ({
|
|
27
|
-
key:
|
|
24
|
+
key: n.id,
|
|
28
25
|
label: n.name,
|
|
29
26
|
data: {
|
|
30
|
-
store: n.store,
|
|
31
27
|
id: n.id,
|
|
32
28
|
name: n.name,
|
|
33
29
|
path: n.path,
|
|
@@ -44,7 +40,6 @@ export function flattenSelectableItemsFromBackendTrees(trees) {
|
|
|
44
40
|
const out = [];
|
|
45
41
|
const walk = (n) => {
|
|
46
42
|
out.push({
|
|
47
|
-
store: n.store,
|
|
48
43
|
id: n.id,
|
|
49
44
|
name: n.name,
|
|
50
45
|
path: n.path,
|
|
@@ -56,18 +51,6 @@ export function flattenSelectableItemsFromBackendTrees(trees) {
|
|
|
56
51
|
trees.forEach(walk);
|
|
57
52
|
return out;
|
|
58
53
|
}
|
|
59
|
-
/** The update a parsed stream line states, or undefined for a line without a count. */
|
|
60
|
-
export function subitemCountUpdateOf(line) {
|
|
61
|
-
if (!line || typeof line !== "object")
|
|
62
|
-
return undefined;
|
|
63
|
-
const parsed = line;
|
|
64
|
-
if (typeof parsed.count !== "number")
|
|
65
|
-
return undefined;
|
|
66
|
-
const update = { count: parsed.count, complete: !!parsed.complete };
|
|
67
|
-
if (typeof parsed.refusal === "string" && parsed.refusal.trim())
|
|
68
|
-
update.refusal = parsed.refusal;
|
|
69
|
-
return update;
|
|
70
|
-
}
|
|
71
54
|
/**
|
|
72
55
|
* Streams the running subitem count for a given root item from the
|
|
73
56
|
* backend. The endpoint returns newline-delimited JSON; each parsed line
|
|
@@ -83,16 +66,12 @@ export async function streamSubitemCount(req, onProgress, options) {
|
|
|
83
66
|
url += "?sessionId=" + options.sessionId;
|
|
84
67
|
const response = await fetch(url, {
|
|
85
68
|
method: "POST",
|
|
86
|
-
body: JSON.stringify({
|
|
87
|
-
Store: req.store,
|
|
88
|
-
ItemId: req.itemId,
|
|
89
|
-
Language: req.language,
|
|
90
|
-
}),
|
|
69
|
+
body: JSON.stringify({ ItemId: req.itemId, Language: req.language }),
|
|
91
70
|
credentials: "include",
|
|
92
|
-
headers:
|
|
71
|
+
headers: {
|
|
93
72
|
"Content-Type": "application/json",
|
|
94
73
|
Accept: "application/x-ndjson",
|
|
95
|
-
}
|
|
74
|
+
},
|
|
96
75
|
signal: options?.signal,
|
|
97
76
|
});
|
|
98
77
|
if (!response.ok || !response.body) {
|
|
@@ -115,10 +94,10 @@ export async function streamSubitemCount(req, onProgress, options) {
|
|
|
115
94
|
if (!line)
|
|
116
95
|
continue;
|
|
117
96
|
try {
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
120
|
-
lastCount =
|
|
121
|
-
onProgress(
|
|
97
|
+
const parsed = JSON.parse(line);
|
|
98
|
+
if (typeof parsed.count === "number") {
|
|
99
|
+
lastCount = parsed.count;
|
|
100
|
+
onProgress({ count: parsed.count, complete: !!parsed.complete });
|
|
122
101
|
}
|
|
123
102
|
}
|
|
124
103
|
catch {
|
|
@@ -130,10 +109,10 @@ export async function streamSubitemCount(req, onProgress, options) {
|
|
|
130
109
|
const tail = buffer.trim();
|
|
131
110
|
if (tail) {
|
|
132
111
|
try {
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
135
|
-
lastCount =
|
|
136
|
-
onProgress(
|
|
112
|
+
const parsed = JSON.parse(tail);
|
|
113
|
+
if (typeof parsed.count === "number") {
|
|
114
|
+
lastCount = parsed.count;
|
|
115
|
+
onProgress({ count: parsed.count, complete: !!parsed.complete });
|
|
137
116
|
}
|
|
138
117
|
}
|
|
139
118
|
catch {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTranslationWizard.d.ts","sourceRoot":"","sources":["../../src/hooks/useTranslationWizard.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAUhF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,uBAAuB;;;
|
|
1
|
+
{"version":3,"file":"useTranslationWizard.d.ts","sourceRoot":"","sources":["../../src/hooks/useTranslationWizard.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAUhF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,uBAAuB;;;EAuGlE"}
|
|
@@ -16,7 +16,6 @@ export function useTranslationWizard(props) {
|
|
|
16
16
|
});
|
|
17
17
|
// Load initial data
|
|
18
18
|
useEffect(() => {
|
|
19
|
-
let cancelled = false;
|
|
20
19
|
const loadInitialData = async () => {
|
|
21
20
|
const itemDescriptors = props.items.map((x) => x.descriptor);
|
|
22
21
|
// Load translation providers
|
|
@@ -36,7 +35,7 @@ export function useTranslationWizard(props) {
|
|
|
36
35
|
}));
|
|
37
36
|
// Load translation status for each item
|
|
38
37
|
const translationStatuses = await Promise.all(itemDescriptors.map(async (item) => {
|
|
39
|
-
const result = await getTranslationStatus(item);
|
|
38
|
+
const result = await getTranslationStatus(item.id);
|
|
40
39
|
return result.data || [];
|
|
41
40
|
}));
|
|
42
41
|
const languageMap = new Map();
|
|
@@ -51,19 +50,15 @@ export function useTranslationWizard(props) {
|
|
|
51
50
|
if (language.versions > 0 && itemDescriptors[itemIndex]) {
|
|
52
51
|
languageData.items.push(itemDescriptors[itemIndex]);
|
|
53
52
|
}
|
|
54
|
-
const status = translationStatuses[itemIndex]?.find((s) => s.
|
|
55
|
-
s.targetLanguage === language.languageCode);
|
|
53
|
+
const status = translationStatuses[itemIndex]?.find((s) => s.targetLanguage === language.languageCode);
|
|
56
54
|
if (status && !languageData.translationStatus) {
|
|
57
55
|
languageData.translationStatus = status;
|
|
58
56
|
}
|
|
59
57
|
languageMap.set(language.languageCode, languageData);
|
|
60
58
|
});
|
|
61
59
|
});
|
|
62
|
-
if (cancelled)
|
|
63
|
-
return;
|
|
64
60
|
setWizardData((prevData) => ({
|
|
65
61
|
...prevData,
|
|
66
|
-
items: props.items,
|
|
67
62
|
translationProviders: providers,
|
|
68
63
|
translationProvider: defaultProvider,
|
|
69
64
|
languageData: languageMap,
|
|
@@ -71,9 +66,6 @@ export function useTranslationWizard(props) {
|
|
|
71
66
|
}
|
|
72
67
|
};
|
|
73
68
|
loadInitialData();
|
|
74
|
-
return () => {
|
|
75
|
-
cancelled = true;
|
|
76
|
-
};
|
|
77
69
|
}, [props.items]);
|
|
78
70
|
// Save translation provider to localStorage when it changes
|
|
79
71
|
useEffect(() => {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AAoBpF,OAAO,EACL,mBAAmB,EAGpB,MAAM,gBAAgB,CAAC;AAWxB,QAAA,MAAM,wCAAwC;;;;;;;;;;;;;;CAwB7C,CAAC;AAEF,QAAA,MAAM,4CAA4C;;;;;;;;CAkBjD,CAAC;AAoDF,OAAO,EACL,wCAAwC,EACxC,4CAA4C,GAC7C,CAAC;AACF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,YAAY,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,YAAY,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEhF,MAAM,MAAM,yBAAyB,GAAG;IACtC;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,mBAAmB,EAClC,OAAO,CAAC,EAAE,yBAAyB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AAoBpF,OAAO,EACL,mBAAmB,EAGpB,MAAM,gBAAgB,CAAC;AAWxB,QAAA,MAAM,wCAAwC;;;;;;;;;;;;;;CAwB7C,CAAC;AAEF,QAAA,MAAM,4CAA4C;;;;;;;;CAkBjD,CAAC;AAoDF,OAAO,EACL,wCAAwC,EACxC,4CAA4C,GAC7C,CAAC;AACF,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,YAAY,EACV,mBAAmB,EACnB,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,YAAY,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEhF,MAAM,MAAM,yBAAyB,GAAG;IACtC;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,mBAAmB,EAClC,OAAO,CAAC,EAAE,yBAAyB,uBAoIpC"}
|
package/dist/index.js
CHANGED
|
@@ -204,7 +204,7 @@ export function configureLocalization(configuration, options) {
|
|
|
204
204
|
const translationServicesPanel = {
|
|
205
205
|
id: "translation-services",
|
|
206
206
|
title: "Translation Services",
|
|
207
|
-
subtitle: "
|
|
207
|
+
subtitle: "Configure translation services (OpenAI, Azure, DeepL, etc.)",
|
|
208
208
|
icon: _jsx(LanguagesIcon, { strokeWidth: 1 }),
|
|
209
209
|
content: _jsx(TranslationServicesPanel, {}),
|
|
210
210
|
requiresAdministrator: true,
|
|
@@ -222,16 +222,14 @@ export function configureLocalization(configuration, options) {
|
|
|
222
222
|
}
|
|
223
223
|
else {
|
|
224
224
|
const groups = configuration.settings.groups;
|
|
225
|
-
|
|
226
|
-
const systemIndex = groups.findIndex((g) => g.title === "System");
|
|
227
|
-
const insertIndex = systemIndex >= 0 ? systemIndex : groups.findIndex((g) => g.title === "About");
|
|
225
|
+
const aboutIndex = groups.findIndex((g) => g.title === "About");
|
|
228
226
|
const localizationGroup = {
|
|
229
227
|
title: "Localization",
|
|
230
228
|
icon: _jsx(LanguagesIcon, { strokeWidth: 1 }),
|
|
231
229
|
panels: [translationServicesPanel],
|
|
232
230
|
};
|
|
233
|
-
if (
|
|
234
|
-
groups.splice(
|
|
231
|
+
if (aboutIndex >= 0) {
|
|
232
|
+
groups.splice(aboutIndex, 0, localizationGroup);
|
|
235
233
|
}
|
|
236
234
|
else {
|
|
237
235
|
groups.push(localizationGroup);
|
|
@@ -6,27 +6,7 @@ export type TranslationApiResponse<T> = {
|
|
|
6
6
|
error?: string;
|
|
7
7
|
message?: string;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
10
|
-
store: string;
|
|
11
|
-
itemId: string;
|
|
12
|
-
};
|
|
13
|
-
export declare function translationDescriptorKey(descriptor: {
|
|
14
|
-
database?: string;
|
|
15
|
-
id: string;
|
|
16
|
-
}): string;
|
|
17
|
-
export declare function translationItemKey(item: {
|
|
18
|
-
store?: string | null;
|
|
19
|
-
itemId: string;
|
|
20
|
-
}): string;
|
|
21
|
-
export declare function translationItem(descriptor: {
|
|
22
|
-
database?: string;
|
|
23
|
-
id: string;
|
|
24
|
-
}): TranslationItem;
|
|
25
|
-
export declare function getTranslationStatus(item: {
|
|
26
|
-
database?: string;
|
|
27
|
-
id: string;
|
|
28
|
-
language: string;
|
|
29
|
-
}): Promise<import("@parhelia/core").ExecutionResult<TranslationStatus[]>>;
|
|
9
|
+
export declare function getTranslationStatus(itemId: string): Promise<import("@parhelia/core").ExecutionResult<TranslationStatus[]>>;
|
|
30
10
|
export declare function getTranslationProviders(): Promise<import("@parhelia/core").ExecutionResult<TranslationProviderInfo[]>>;
|
|
31
11
|
export type AvailableTranslationService = {
|
|
32
12
|
serviceName: string;
|
|
@@ -34,10 +14,33 @@ export type AvailableTranslationService = {
|
|
|
34
14
|
isConfigured: boolean;
|
|
35
15
|
supportedLanguages?: string[];
|
|
36
16
|
settingsItemId?: string;
|
|
17
|
+
templateId: string;
|
|
18
|
+
templateName: string;
|
|
37
19
|
};
|
|
38
20
|
export declare function getAvailableTranslationServices(): Promise<import("@parhelia/core").ExecutionResult<TranslationApiResponse<AvailableTranslationService[]>>>;
|
|
21
|
+
export declare function createProviderSettings(serviceName: string, templateId: string, language?: string, structureSettings?: TranslationStructureSettings): Promise<import("@parhelia/core").ExecutionResult<TranslationApiResponse<{
|
|
22
|
+
itemId: string;
|
|
23
|
+
itemPath: string;
|
|
24
|
+
}>>>;
|
|
25
|
+
export type TranslationStructureSettings = {
|
|
26
|
+
translationFolderPath: string;
|
|
27
|
+
translationFolderTemplateId: string;
|
|
28
|
+
translationProvidersPath: string;
|
|
29
|
+
translationProvidersTemplateId: string;
|
|
30
|
+
};
|
|
31
|
+
export type TranslationStructureItemInfo = {
|
|
32
|
+
exists: boolean;
|
|
33
|
+
itemId?: string;
|
|
34
|
+
path?: string;
|
|
35
|
+
templateId?: string;
|
|
36
|
+
};
|
|
37
|
+
export type TranslationStructureResponse = {
|
|
38
|
+
translationFolder: TranslationStructureItemInfo;
|
|
39
|
+
translationProvidersFolder: TranslationStructureItemInfo;
|
|
40
|
+
};
|
|
41
|
+
export declare function getTranslationStructure(settings: TranslationStructureSettings): Promise<import("@parhelia/core").ExecutionResult<TranslationApiResponse<TranslationStructureResponse>>>;
|
|
42
|
+
export declare function ensureTranslationStructure(settings: TranslationStructureSettings): Promise<import("@parhelia/core").ExecutionResult<TranslationApiResponse<TranslationStructureResponse>>>;
|
|
39
43
|
export type TranslationJobRecord = {
|
|
40
|
-
store?: string | null;
|
|
41
44
|
id?: string;
|
|
42
45
|
sequenceId?: number;
|
|
43
46
|
itemId: string;
|
|
@@ -82,8 +85,6 @@ export type TranslationBatchInfo = {
|
|
|
82
85
|
startedAtUtc?: string;
|
|
83
86
|
completedAtUtc?: string;
|
|
84
87
|
initiatedByUser?: string;
|
|
85
|
-
/** The initiator's account id; the name where names are ids (the classic CM). */
|
|
86
|
-
initiatedBySubjectId?: string;
|
|
87
88
|
initiatorSessionId?: string;
|
|
88
89
|
provider?: string;
|
|
89
90
|
status?: string;
|
|
@@ -105,8 +106,6 @@ export type TranslationBatchInfo = {
|
|
|
105
106
|
};
|
|
106
107
|
export declare function getBatchInfo(batchId: string): Promise<import("@parhelia/core").ExecutionResult<TranslationBatchInfo>>;
|
|
107
108
|
export type ListBatchesFilters = {
|
|
108
|
-
store?: string;
|
|
109
|
-
language?: string;
|
|
110
109
|
fromUtc?: string;
|
|
111
110
|
status?: string;
|
|
112
111
|
user?: string;
|
|
@@ -124,16 +123,6 @@ export type AbortTranslationResponse = {
|
|
|
124
123
|
};
|
|
125
124
|
export declare function abortJob(id: string): Promise<import("@parhelia/core").ExecutionResult<AbortTranslationResponse>>;
|
|
126
125
|
export declare function abortBatch(id: string): Promise<import("@parhelia/core").ExecutionResult<AbortTranslationResponse>>;
|
|
127
|
-
export type DeleteTranslationBatchResponse = {
|
|
128
|
-
success: boolean;
|
|
129
|
-
batchId: string;
|
|
130
|
-
deletedJobs: number;
|
|
131
|
-
};
|
|
132
|
-
/**
|
|
133
|
-
* Deletes a batch that has stopped, with its jobs. A running batch is refused
|
|
134
|
-
* (409): abort it first. Translations already written to content stay.
|
|
135
|
-
*/
|
|
136
|
-
export declare function deleteBatch(id: string): Promise<import("@parhelia/core").ExecutionResult<DeleteTranslationBatchResponse>>;
|
|
137
126
|
export declare function subscribeToBatch(batchId: string, sessionId: string): Promise<import("@parhelia/core").ExecutionResult<{
|
|
138
127
|
success: boolean;
|
|
139
128
|
message: string;
|
|
@@ -147,13 +136,11 @@ export type LanguageMapping = {
|
|
|
147
136
|
targetLanguage: string;
|
|
148
137
|
};
|
|
149
138
|
export type BatchTranslationResult = {
|
|
150
|
-
store: string;
|
|
151
139
|
itemId: string;
|
|
152
140
|
targetLanguage: string;
|
|
153
141
|
jobId: string;
|
|
154
142
|
};
|
|
155
143
|
export type BatchTranslationError = {
|
|
156
|
-
store: string;
|
|
157
144
|
itemId: string;
|
|
158
145
|
targetLanguage: string;
|
|
159
146
|
error: string;
|
|
@@ -163,15 +150,14 @@ export type BatchTranslationResponse = {
|
|
|
163
150
|
started: BatchTranslationResult[];
|
|
164
151
|
skipped: BatchTranslationError[];
|
|
165
152
|
};
|
|
166
|
-
export declare function requestBatchTranslation({ sessionId, provider, batchMetadata, languageMappings,
|
|
153
|
+
export declare function requestBatchTranslation({ sessionId, provider, batchMetadata, languageMappings, itemIds, }: {
|
|
167
154
|
sessionId: string;
|
|
168
155
|
provider: string;
|
|
169
156
|
batchMetadata?: string;
|
|
170
157
|
languageMappings: LanguageMapping[];
|
|
171
|
-
|
|
158
|
+
itemIds: string[];
|
|
172
159
|
}): Promise<import("@parhelia/core").ExecutionResult<BatchTranslationResponse>>;
|
|
173
160
|
export type RetryBatchTranslationJobRequest = {
|
|
174
|
-
store: string;
|
|
175
161
|
sourceTranslationId?: string;
|
|
176
162
|
itemId: string;
|
|
177
163
|
sourceLanguage: string;
|
|
@@ -179,7 +165,6 @@ export type RetryBatchTranslationJobRequest = {
|
|
|
179
165
|
metadata?: string | null;
|
|
180
166
|
};
|
|
181
167
|
export type RetryBatchTranslationStartedJob = {
|
|
182
|
-
store: string;
|
|
183
168
|
sourceTranslationId?: string;
|
|
184
169
|
itemId: string;
|
|
185
170
|
sourceLanguage: string;
|
|
@@ -188,7 +173,6 @@ export type RetryBatchTranslationStartedJob = {
|
|
|
188
173
|
jobId: string;
|
|
189
174
|
};
|
|
190
175
|
export type RetryBatchTranslationSkippedJob = {
|
|
191
|
-
store: string;
|
|
192
176
|
sourceTranslationId?: string;
|
|
193
177
|
itemId: string;
|
|
194
178
|
sourceLanguage: string;
|