gt-sanity 2.0.13 → 2.0.15

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.
@@ -1,30 +1,30 @@
1
- import type { DeserializerRule } from '@portabletext/block-tools';
2
- import { DocumentActionComponent } from 'sanity';
3
- import { documentInternationalization } from '@sanity/document-internationalization';
4
- import { PluginConfig as DocumentInternationalizationConfig } from '@sanity/document-internationalization';
5
- import { DocumentInternationalizationMenu } from '@sanity/document-internationalization';
6
- import { GT } from 'generaltranslation';
7
- import { Language } from '@sanity/document-internationalization';
8
- import { Metadata } from '@sanity/document-internationalization';
9
- import { ObjectField } from 'sanity';
10
- import { Plugin as Plugin_2 } from 'sanity';
11
- import { PortableTextHtmlComponents } from '@portabletext/to-html';
12
- import { PortableTextTypeComponent } from '@portabletext/to-html';
13
- import { default as React_2 } from 'react';
14
- import { SanityClient } from 'sanity';
15
- import { SanityDocument } from 'sanity';
16
- import { Schema } from 'sanity';
17
- import { TranslationReference } from '@sanity/document-internationalization';
18
- import { TypedObject } from 'sanity';
19
- import { useDeleteTranslationAction } from '@sanity/document-internationalization';
20
- import { useDocumentInternationalizationContext } from '@sanity/document-internationalization';
21
- import { useDuplicateWithTranslationsAction } from '@sanity/document-internationalization';
1
+ import type { DeserializerRule } from "@portabletext/block-tools";
2
+ import { DocumentActionComponent } from "sanity";
3
+ import { documentInternationalization } from "@sanity/document-internationalization";
4
+ import { PluginConfig as DocumentInternationalizationConfig } from "@sanity/document-internationalization";
5
+ import { DocumentInternationalizationMenu } from "@sanity/document-internationalization";
6
+ import { GT } from "generaltranslation";
7
+ import { Language } from "@sanity/document-internationalization";
8
+ import { Metadata } from "@sanity/document-internationalization";
9
+ import { ObjectField } from "sanity";
10
+ import { Plugin as Plugin_2 } from "sanity";
11
+ import { PortableTextHtmlComponents } from "@portabletext/to-html";
12
+ import { PortableTextTypeComponent } from "@portabletext/to-html";
13
+ import { default as React_2 } from "react";
14
+ import { SanityClient } from "sanity";
15
+ import { SanityDocument } from "sanity";
16
+ import { Schema } from "sanity";
17
+ import { TranslationReference } from "@sanity/document-internationalization";
18
+ import { TypedObject } from "sanity";
19
+ import { useDeleteTranslationAction } from "@sanity/document-internationalization";
20
+ import { useDocumentInternationalizationContext } from "@sanity/document-internationalization";
21
+ import { useDuplicateWithTranslationsAction } from "@sanity/document-internationalization";
22
22
 
23
23
  export declare interface Adapter {
24
24
  getLocales: (secrets: Secrets | null) => Promise<TranslationLocale[]>;
25
25
  getTranslationTask: (
26
26
  document: GTFile,
27
- secrets: Secrets | null
27
+ secrets: Secrets | null,
28
28
  ) => Promise<TranslationTask>;
29
29
  createTask: (
30
30
  documentInfo: GTFile,
@@ -32,19 +32,19 @@ export declare interface Adapter {
32
32
  localeIds: string[],
33
33
  secrets: Secrets | null,
34
34
  workflowUid?: string,
35
- callbackUrl?: string
35
+ callbackUrl?: string,
36
36
  ) => Promise<TranslationTask>;
37
37
  getTranslation: (
38
38
  document: GTFile,
39
39
  localeId: string,
40
- secrets: Secrets | null
40
+ secrets: Secrets | null,
41
41
  ) => Promise<any | null>;
42
42
  }
43
43
 
44
44
  export declare function attachGTData(
45
45
  html: string,
46
46
  data: Record<string, any>,
47
- type: 'markDef'
47
+ type: "markDef",
48
48
  ): string;
49
49
 
50
50
  export declare const BaseDocumentDeserializer: Deserializer;
@@ -57,7 +57,7 @@ export declare const BaseDocumentSerializer: (schemas: Schema) => {
57
57
  translationLevel?: TranslationLevel,
58
58
  baseLang?: string,
59
59
  stopTypes?: string[],
60
- serializers?: Partial<PortableTextHtmlComponents>
60
+ serializers?: Partial<PortableTextHtmlComponents>,
61
61
  ) => {
62
62
  name: string;
63
63
  content: string;
@@ -65,22 +65,22 @@ export declare const BaseDocumentSerializer: (schemas: Schema) => {
65
65
  fieldFilter: (
66
66
  obj: Record<string, any>,
67
67
  objFields: ObjectField[],
68
- stopTypes: string[]
68
+ stopTypes: string[],
69
69
  ) => TypedObject;
70
70
  languageObjectFieldFilter: (
71
71
  obj: Record<string, any>,
72
- baseLang: string
72
+ baseLang: string,
73
73
  ) => Record<string, any>;
74
74
  serializeArray: (
75
75
  fieldContent: Record<string, any>[],
76
76
  fieldName: string,
77
77
  stopTypes: string[],
78
- serializers: Record<string, any>
78
+ serializers: Record<string, any>,
79
79
  ) => string;
80
80
  serializeObject: (
81
81
  obj: TypedObject,
82
82
  stopTypes: string[],
83
- serializers: Record<string, any>
83
+ serializers: Record<string, any>,
84
84
  ) => string;
85
85
  };
86
86
 
@@ -94,18 +94,18 @@ declare interface Deserializer {
94
94
  deserializeDocument: (
95
95
  serializedDoc: string,
96
96
  deserializers?: Record<string, any>,
97
- blockDeserializers?: Array<any>
97
+ blockDeserializers?: Array<any>,
98
98
  ) => Record<string, any>;
99
99
  deserializeHTML: (
100
100
  html: string,
101
101
  deserializers: Record<string, any>,
102
- blockDeserializers: Array<any>
102
+ blockDeserializers: Array<any>,
103
103
  ) => Record<string, any> | any[];
104
104
  }
105
105
 
106
106
  export declare function detachGTData(html: string): {
107
107
  html: string;
108
- data?: Record<'markDef', Record<string, any>>;
108
+ data?: Record<"markDef", Record<string, any>>;
109
109
  };
110
110
 
111
111
  export { documentInternationalization };
@@ -116,7 +116,7 @@ export { DocumentInternationalizationMenu };
116
116
 
117
117
  export declare type ExportForTranslation = (
118
118
  documentInfo: GTFile,
119
- context: TranslationFunctionContext
119
+ context: TranslationFunctionContext,
120
120
  ) => Promise<GTSerializedDocument>;
121
121
 
122
122
  declare type FieldMatcher = {
@@ -129,7 +129,7 @@ declare type FieldMatcher = {
129
129
 
130
130
  export declare const findLatestDraft: (
131
131
  documentId: string,
132
- client: SanityClient
132
+ client: SanityClient,
133
133
  ) => Promise<SanityDocument>;
134
134
 
135
135
  declare const gt: GT;
@@ -156,7 +156,7 @@ export declare const gtPlugin: Plugin_2<GTPluginConfig>;
156
156
 
157
157
  export declare type GTPluginConfig = Omit<
158
158
  Parameters<typeof gt.setConfig>[0],
159
- 'locales'
159
+ "locales"
160
160
  > & {
161
161
  locales: string[];
162
162
  defaultLocale?: string;
@@ -175,7 +175,7 @@ export declare type GTPluginConfig = Omit<
175
175
  showDocumentInternationalization?: boolean;
176
176
  };
177
177
 
178
- declare type GTSerializedDocument = Omit<SerializedDocument, 'name'> & GTFile;
178
+ declare type GTSerializedDocument = Omit<SerializedDocument, "name"> & GTFile;
179
179
 
180
180
  declare type IgnoreFields = FieldMatcher;
181
181
 
@@ -185,7 +185,7 @@ export declare type ImportTranslation = (
185
185
  document: string,
186
186
  context: TranslationFunctionContext,
187
187
  mergeWithTargetLocale?: boolean,
188
- publish?: boolean
188
+ publish?: boolean,
189
189
  ) => Promise<void>;
190
190
 
191
191
  export { Language };
@@ -195,16 +195,16 @@ declare interface Merger {
195
195
  translatedFields: Record<string, any>,
196
196
  baseDoc: SanityDocument,
197
197
  localeId: string,
198
- baseLang: string
198
+ baseLang: string,
199
199
  ) => Record<string, any>;
200
200
  documentLevelMerge: (
201
201
  translatedFields: Record<string, any>,
202
- baseDoc: SanityDocument
202
+ baseDoc: SanityDocument,
203
203
  ) => Record<string, any>;
204
204
  reconcileArray: (origArray: any[], translatedArray: any[]) => any[];
205
205
  reconcileObject: (
206
206
  origObject: Record<string, any>,
207
- translatedObject: Record<string, any>
207
+ translatedObject: Record<string, any>,
208
208
  ) => Record<string, any>;
209
209
  }
210
210
 
@@ -239,7 +239,7 @@ export declare interface TranslationFunctionContext {
239
239
  schema: Schema;
240
240
  }
241
241
 
242
- declare type TranslationLevel = 'document' | 'field';
242
+ declare type TranslationLevel = "document" | "field";
243
243
 
244
244
  declare type TranslationLocale = {
245
245
  localeId: string;
@@ -250,7 +250,7 @@ declare type TranslationLocale = {
250
250
  export { TranslationReference };
251
251
 
252
252
  export declare const TranslationsTab: (
253
- props: TranslationTabProps
253
+ props: TranslationTabProps,
254
254
  ) => React_2.JSX.Element;
255
255
 
256
256
  export declare type TranslationsTabConfigOptions = {
package/dist/index.d.ts CHANGED
@@ -1,30 +1,30 @@
1
- import type { DeserializerRule } from '@portabletext/block-tools';
2
- import { DocumentActionComponent } from 'sanity';
3
- import { documentInternationalization } from '@sanity/document-internationalization';
4
- import { PluginConfig as DocumentInternationalizationConfig } from '@sanity/document-internationalization';
5
- import { DocumentInternationalizationMenu } from '@sanity/document-internationalization';
6
- import { GT } from 'generaltranslation';
7
- import { Language } from '@sanity/document-internationalization';
8
- import { Metadata } from '@sanity/document-internationalization';
9
- import { ObjectField } from 'sanity';
10
- import { Plugin as Plugin_2 } from 'sanity';
11
- import { PortableTextHtmlComponents } from '@portabletext/to-html';
12
- import { PortableTextTypeComponent } from '@portabletext/to-html';
13
- import { default as React_2 } from 'react';
14
- import { SanityClient } from 'sanity';
15
- import { SanityDocument } from 'sanity';
16
- import { Schema } from 'sanity';
17
- import { TranslationReference } from '@sanity/document-internationalization';
18
- import { TypedObject } from 'sanity';
19
- import { useDeleteTranslationAction } from '@sanity/document-internationalization';
20
- import { useDocumentInternationalizationContext } from '@sanity/document-internationalization';
21
- import { useDuplicateWithTranslationsAction } from '@sanity/document-internationalization';
1
+ import type { DeserializerRule } from "@portabletext/block-tools";
2
+ import { DocumentActionComponent } from "sanity";
3
+ import { documentInternationalization } from "@sanity/document-internationalization";
4
+ import { PluginConfig as DocumentInternationalizationConfig } from "@sanity/document-internationalization";
5
+ import { DocumentInternationalizationMenu } from "@sanity/document-internationalization";
6
+ import { GT } from "generaltranslation";
7
+ import { Language } from "@sanity/document-internationalization";
8
+ import { Metadata } from "@sanity/document-internationalization";
9
+ import { ObjectField } from "sanity";
10
+ import { Plugin as Plugin_2 } from "sanity";
11
+ import { PortableTextHtmlComponents } from "@portabletext/to-html";
12
+ import { PortableTextTypeComponent } from "@portabletext/to-html";
13
+ import { default as React_2 } from "react";
14
+ import { SanityClient } from "sanity";
15
+ import { SanityDocument } from "sanity";
16
+ import { Schema } from "sanity";
17
+ import { TranslationReference } from "@sanity/document-internationalization";
18
+ import { TypedObject } from "sanity";
19
+ import { useDeleteTranslationAction } from "@sanity/document-internationalization";
20
+ import { useDocumentInternationalizationContext } from "@sanity/document-internationalization";
21
+ import { useDuplicateWithTranslationsAction } from "@sanity/document-internationalization";
22
22
 
23
23
  export declare interface Adapter {
24
24
  getLocales: (secrets: Secrets | null) => Promise<TranslationLocale[]>;
25
25
  getTranslationTask: (
26
26
  document: GTFile,
27
- secrets: Secrets | null
27
+ secrets: Secrets | null,
28
28
  ) => Promise<TranslationTask>;
29
29
  createTask: (
30
30
  documentInfo: GTFile,
@@ -32,19 +32,19 @@ export declare interface Adapter {
32
32
  localeIds: string[],
33
33
  secrets: Secrets | null,
34
34
  workflowUid?: string,
35
- callbackUrl?: string
35
+ callbackUrl?: string,
36
36
  ) => Promise<TranslationTask>;
37
37
  getTranslation: (
38
38
  document: GTFile,
39
39
  localeId: string,
40
- secrets: Secrets | null
40
+ secrets: Secrets | null,
41
41
  ) => Promise<any | null>;
42
42
  }
43
43
 
44
44
  export declare function attachGTData(
45
45
  html: string,
46
46
  data: Record<string, any>,
47
- type: 'markDef'
47
+ type: "markDef",
48
48
  ): string;
49
49
 
50
50
  export declare const BaseDocumentDeserializer: Deserializer;
@@ -57,7 +57,7 @@ export declare const BaseDocumentSerializer: (schemas: Schema) => {
57
57
  translationLevel?: TranslationLevel,
58
58
  baseLang?: string,
59
59
  stopTypes?: string[],
60
- serializers?: Partial<PortableTextHtmlComponents>
60
+ serializers?: Partial<PortableTextHtmlComponents>,
61
61
  ) => {
62
62
  name: string;
63
63
  content: string;
@@ -65,22 +65,22 @@ export declare const BaseDocumentSerializer: (schemas: Schema) => {
65
65
  fieldFilter: (
66
66
  obj: Record<string, any>,
67
67
  objFields: ObjectField[],
68
- stopTypes: string[]
68
+ stopTypes: string[],
69
69
  ) => TypedObject;
70
70
  languageObjectFieldFilter: (
71
71
  obj: Record<string, any>,
72
- baseLang: string
72
+ baseLang: string,
73
73
  ) => Record<string, any>;
74
74
  serializeArray: (
75
75
  fieldContent: Record<string, any>[],
76
76
  fieldName: string,
77
77
  stopTypes: string[],
78
- serializers: Record<string, any>
78
+ serializers: Record<string, any>,
79
79
  ) => string;
80
80
  serializeObject: (
81
81
  obj: TypedObject,
82
82
  stopTypes: string[],
83
- serializers: Record<string, any>
83
+ serializers: Record<string, any>,
84
84
  ) => string;
85
85
  };
86
86
 
@@ -94,18 +94,18 @@ declare interface Deserializer {
94
94
  deserializeDocument: (
95
95
  serializedDoc: string,
96
96
  deserializers?: Record<string, any>,
97
- blockDeserializers?: Array<any>
97
+ blockDeserializers?: Array<any>,
98
98
  ) => Record<string, any>;
99
99
  deserializeHTML: (
100
100
  html: string,
101
101
  deserializers: Record<string, any>,
102
- blockDeserializers: Array<any>
102
+ blockDeserializers: Array<any>,
103
103
  ) => Record<string, any> | any[];
104
104
  }
105
105
 
106
106
  export declare function detachGTData(html: string): {
107
107
  html: string;
108
- data?: Record<'markDef', Record<string, any>>;
108
+ data?: Record<"markDef", Record<string, any>>;
109
109
  };
110
110
 
111
111
  export { documentInternationalization };
@@ -116,7 +116,7 @@ export { DocumentInternationalizationMenu };
116
116
 
117
117
  export declare type ExportForTranslation = (
118
118
  documentInfo: GTFile,
119
- context: TranslationFunctionContext
119
+ context: TranslationFunctionContext,
120
120
  ) => Promise<GTSerializedDocument>;
121
121
 
122
122
  declare type FieldMatcher = {
@@ -129,7 +129,7 @@ declare type FieldMatcher = {
129
129
 
130
130
  export declare const findLatestDraft: (
131
131
  documentId: string,
132
- client: SanityClient
132
+ client: SanityClient,
133
133
  ) => Promise<SanityDocument>;
134
134
 
135
135
  declare const gt: GT;
@@ -156,7 +156,7 @@ export declare const gtPlugin: Plugin_2<GTPluginConfig>;
156
156
 
157
157
  export declare type GTPluginConfig = Omit<
158
158
  Parameters<typeof gt.setConfig>[0],
159
- 'locales'
159
+ "locales"
160
160
  > & {
161
161
  locales: string[];
162
162
  defaultLocale?: string;
@@ -175,7 +175,7 @@ export declare type GTPluginConfig = Omit<
175
175
  showDocumentInternationalization?: boolean;
176
176
  };
177
177
 
178
- declare type GTSerializedDocument = Omit<SerializedDocument, 'name'> & GTFile;
178
+ declare type GTSerializedDocument = Omit<SerializedDocument, "name"> & GTFile;
179
179
 
180
180
  declare type IgnoreFields = FieldMatcher;
181
181
 
@@ -185,7 +185,7 @@ export declare type ImportTranslation = (
185
185
  document: string,
186
186
  context: TranslationFunctionContext,
187
187
  mergeWithTargetLocale?: boolean,
188
- publish?: boolean
188
+ publish?: boolean,
189
189
  ) => Promise<void>;
190
190
 
191
191
  export { Language };
@@ -195,16 +195,16 @@ declare interface Merger {
195
195
  translatedFields: Record<string, any>,
196
196
  baseDoc: SanityDocument,
197
197
  localeId: string,
198
- baseLang: string
198
+ baseLang: string,
199
199
  ) => Record<string, any>;
200
200
  documentLevelMerge: (
201
201
  translatedFields: Record<string, any>,
202
- baseDoc: SanityDocument
202
+ baseDoc: SanityDocument,
203
203
  ) => Record<string, any>;
204
204
  reconcileArray: (origArray: any[], translatedArray: any[]) => any[];
205
205
  reconcileObject: (
206
206
  origObject: Record<string, any>,
207
- translatedObject: Record<string, any>
207
+ translatedObject: Record<string, any>,
208
208
  ) => Record<string, any>;
209
209
  }
210
210
 
@@ -239,7 +239,7 @@ export declare interface TranslationFunctionContext {
239
239
  schema: Schema;
240
240
  }
241
241
 
242
- declare type TranslationLevel = 'document' | 'field';
242
+ declare type TranslationLevel = "document" | "field";
243
243
 
244
244
  declare type TranslationLocale = {
245
245
  localeId: string;
@@ -250,7 +250,7 @@ declare type TranslationLocale = {
250
250
  export { TranslationReference };
251
251
 
252
252
  export declare const TranslationsTab: (
253
- props: TranslationTabProps
253
+ props: TranslationTabProps,
254
254
  ) => React_2.JSX.Element;
255
255
 
256
256
  export declare type TranslationsTabConfigOptions = {