gt-sanity 2.1.2 → 2.1.4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gt-sanity",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "General Translation integration with Sanity",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"jsonpath-plus": "^10.3.0",
|
|
55
55
|
"jsonpointer": "^5.0.1",
|
|
56
56
|
"lodash.merge": "^4.6.2",
|
|
57
|
-
"generaltranslation": "9.0.
|
|
57
|
+
"generaltranslation": "9.0.3"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@portabletext/types": "^2.0.15",
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { Merger } from './types';
|
|
4
4
|
import { SanityDocument } from 'sanity';
|
|
5
5
|
import { extractWithPath, arrayToJSONMatchPath } from '@sanity/mutator';
|
|
6
|
+
import { libraryDefaultLocale } from 'generaltranslation/internal';
|
|
6
7
|
|
|
7
8
|
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
8
9
|
typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
@@ -91,7 +92,7 @@ const fieldLevelMerge = (
|
|
|
91
92
|
//should be fetched according to the revision and id of the translated obj above
|
|
92
93
|
baseDoc: SanityDocument,
|
|
93
94
|
localeId: string,
|
|
94
|
-
baseLang: string =
|
|
95
|
+
baseLang: string = libraryDefaultLocale
|
|
95
96
|
): Record<string, unknown> => {
|
|
96
97
|
const merged: Record<string, unknown> = {};
|
|
97
98
|
const metaKeys = ['_rev', '_id', '_type'];
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
PortableTextTypeComponent,
|
|
13
13
|
toHTML,
|
|
14
14
|
} from '@portabletext/to-html';
|
|
15
|
+
import { libraryDefaultLocale } from 'generaltranslation/internal';
|
|
15
16
|
|
|
16
17
|
const META_FIELDS = ['_key', '_type', '_id', '_weak'];
|
|
17
18
|
|
|
@@ -217,7 +218,7 @@ export const BaseDocumentSerializer = (schemas: Schema) => {
|
|
|
217
218
|
const serializeDocument = (
|
|
218
219
|
doc: SanityDocument,
|
|
219
220
|
translationLevel: TranslationLevel = 'document',
|
|
220
|
-
baseLang =
|
|
221
|
+
baseLang: string = libraryDefaultLocale,
|
|
221
222
|
stopTypes = defaultStopTypes,
|
|
222
223
|
serializers = customSerializers
|
|
223
224
|
) => {
|