@sanity/assist 1.2.15-lang.5 → 1.2.15-lang.7
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/README.md +2 -0
- package/dist/index.cjs.mjs +1 -0
- package/dist/index.d.ts +16 -12
- package/dist/index.esm.js +141 -339
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +140 -337
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/assistLayout/AssistLayout.tsx +0 -3
- package/src/index.ts +3 -0
- package/src/node_modules/.vitest/results.json +1 -1
- package/src/plugin.tsx +0 -5
- package/src/schemas/serialize/serializeSchema.test.ts +171 -0
- package/src/schemas/serialize/serializeSchema.ts +44 -1
- package/src/translate/FieldTranslationProvider.tsx +54 -28
- package/src/translate/paths.test.ts +8 -7
- package/src/translate/paths.ts +18 -5
- package/src/translate/translateActions.tsx +1 -6
- package/src/translate/types.ts +1 -0
- package/src/types.ts +8 -10
- package/src/assistLayout/AlphaMigration.tsx +0 -310
- package/src/legacy-types.ts +0 -72
package/README.md
CHANGED
|
@@ -380,6 +380,8 @@ The rules can be extracted into an AI Context document and reused in other instr
|
|
|
380
380
|
|
|
381
381
|
AI assist offers full document translations, which is ideal for pairing with [@sanity/document-internationalization](https://github.com/sanity-io/document-internationalization).
|
|
382
382
|
|
|
383
|
+
Translations are done deeply; visiting nested objects, arrays and even Portable text annotations.
|
|
384
|
+
|
|
383
385
|
### What AI Assist full document translations solves
|
|
384
386
|
|
|
385
387
|
Given a document written in one language, AI assist can translate the document in place to a language specified by a language field in the document.
|
package/dist/index.cjs.mjs
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -21,10 +21,6 @@ export declare interface AssistOptions {
|
|
|
21
21
|
|
|
22
22
|
declare interface AssistPluginConfig {
|
|
23
23
|
translate?: TranslationConfig
|
|
24
|
-
/**
|
|
25
|
-
* Set this to false to disable model migration from the alpha version of this plugin
|
|
26
|
-
*/
|
|
27
|
-
alphaMigration?: boolean
|
|
28
24
|
/**
|
|
29
25
|
* @internal
|
|
30
26
|
*/
|
|
@@ -33,13 +29,21 @@ declare interface AssistPluginConfig {
|
|
|
33
29
|
|
|
34
30
|
export declare const contextDocumentTypeName: 'assist.instruction.context'
|
|
35
31
|
|
|
36
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Default implementation for plugin config `translate.field.translationOutputs`
|
|
34
|
+
*
|
|
35
|
+
* @see FieldTranslationConfig#translationOutputs
|
|
36
|
+
*/
|
|
37
|
+
export declare const defaultLanguageOutputs: TranslationOutputsFunction
|
|
38
|
+
|
|
39
|
+
export declare interface DocumentMember {
|
|
37
40
|
schemaType: SchemaType
|
|
38
41
|
path: Path
|
|
39
42
|
name: string
|
|
43
|
+
value: unknown
|
|
40
44
|
}
|
|
41
45
|
|
|
42
|
-
declare interface DocumentTranslationConfig {
|
|
46
|
+
export declare interface DocumentTranslationConfig {
|
|
43
47
|
/**
|
|
44
48
|
* Path to language field in documents. Can be a hidden field.
|
|
45
49
|
* For instance: 'config.language'
|
|
@@ -61,7 +65,7 @@ declare interface DocumentTranslationConfig {
|
|
|
61
65
|
documentTypes?: string[]
|
|
62
66
|
}
|
|
63
67
|
|
|
64
|
-
declare interface FieldTranslationConfig {
|
|
68
|
+
export declare interface FieldTranslationConfig {
|
|
65
69
|
/**
|
|
66
70
|
* `documentTypes` should be an array of strings where each entry must match a name from your document schemas.
|
|
67
71
|
*
|
|
@@ -152,19 +156,19 @@ declare interface FieldTranslationConfig {
|
|
|
152
156
|
translationOutputs?: TranslationOutputsFunction
|
|
153
157
|
}
|
|
154
158
|
|
|
155
|
-
declare interface Language {
|
|
159
|
+
export declare interface Language {
|
|
156
160
|
id: string
|
|
157
161
|
title?: string
|
|
158
162
|
}
|
|
159
163
|
|
|
160
|
-
declare type LanguageCallback = (
|
|
164
|
+
export declare type LanguageCallback = (
|
|
161
165
|
client: SanityClient,
|
|
162
166
|
selectedLanguageParams: Record<string, unknown>,
|
|
163
167
|
) => Promise<Language[]>
|
|
164
168
|
|
|
165
169
|
export declare function SchemaTypeTool(): JSX_2.Element
|
|
166
170
|
|
|
167
|
-
declare interface TranslationConfig {
|
|
171
|
+
export declare interface TranslationConfig {
|
|
168
172
|
/**
|
|
169
173
|
* Config for document types with fields in multiple languages in the same document.
|
|
170
174
|
*/
|
|
@@ -175,13 +179,13 @@ declare interface TranslationConfig {
|
|
|
175
179
|
document?: DocumentTranslationConfig
|
|
176
180
|
}
|
|
177
181
|
|
|
178
|
-
declare interface TranslationOutput {
|
|
182
|
+
export declare interface TranslationOutput {
|
|
179
183
|
/** Language id */
|
|
180
184
|
id: string
|
|
181
185
|
outputPath: Path
|
|
182
186
|
}
|
|
183
187
|
|
|
184
|
-
declare type TranslationOutputsFunction = (
|
|
188
|
+
export declare type TranslationOutputsFunction = (
|
|
185
189
|
documentMember: DocumentMember,
|
|
186
190
|
enclosingType: SchemaType,
|
|
187
191
|
translateFromLanguageId: string,
|