gt-sanity 4.0.18 → 4.0.19
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/index.js +6 -45
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/adapter/__tests__/api.test.ts +57 -51
- package/src/adapter/api.ts +9 -66
- package/src/configuration/utils/requireSourceDocument.ts +1 -1
- package/src/index.ts +2 -4
- package/src/structure/localizedStructure.ts +1 -1
- package/src/adapter/getTranslation.ts +0 -20
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GT, getLocaleProperties } from "generaltranslation";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { createDiagnosticMessage } from "generaltranslation/diagnostics";
|
|
3
|
+
import { createGtApiAdapter, defaultBaseUrl, libraryDefaultLocale, decode, encode } from "generaltranslation/internal";
|
|
4
4
|
import { useClient as useClient$1, useSchema, Preview, definePlugin } from "sanity";
|
|
5
5
|
import { useIntentLink, Link, route } from "sanity/router";
|
|
6
6
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
@@ -31,8 +31,7 @@ import { documentInternationalization } from "@sanity/document-internationalizat
|
|
|
31
31
|
import { DocumentInternationalizationMenu, documentInternationalization as documentInternationalization2, useDeleteTranslationAction, useDocumentInternationalizationContext, useDuplicateWithTranslationsAction } from "@sanity/document-internationalization";
|
|
32
32
|
const {
|
|
33
33
|
configure: configureSharedApi,
|
|
34
|
-
getClient,
|
|
35
|
-
getClientConfig: _getClientConfig,
|
|
34
|
+
getClient: _getClient,
|
|
36
35
|
...sharedApi
|
|
37
36
|
} = createGtApiAdapter({ baseUrl: defaultBaseUrl });
|
|
38
37
|
function configureApiClient(config) {
|
|
@@ -41,46 +40,8 @@ function configureApiClient(config) {
|
|
|
41
40
|
const api = {
|
|
42
41
|
...sharedApi,
|
|
43
42
|
async querySourceFile(query) {
|
|
44
|
-
const { fileId, ...queryParams } = query
|
|
45
|
-
|
|
46
|
-
path: { fileId },
|
|
47
|
-
query: queryParams,
|
|
48
|
-
client: getClient()
|
|
49
|
-
})
|
|
50
|
-
);
|
|
51
|
-
return {
|
|
52
|
-
...result,
|
|
53
|
-
translations: result.translations.map((translation) => ({
|
|
54
|
-
...translation,
|
|
55
|
-
locale: sharedApi.resolveAliasLocale(translation.locale)
|
|
56
|
-
})),
|
|
57
|
-
sourceFile: {
|
|
58
|
-
...result.sourceFile,
|
|
59
|
-
sourceLocale: sharedApi.resolveAliasLocale(
|
|
60
|
-
result.sourceFile.sourceLocale
|
|
61
|
-
),
|
|
62
|
-
locales: result.sourceFile.locales.map(
|
|
63
|
-
(locale) => sharedApi.resolveAliasLocale(locale)
|
|
64
|
-
)
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
},
|
|
68
|
-
async downloadFile(query) {
|
|
69
|
-
const { fileId, locale, ...queryParams } = query, response = unwrapApiResult(
|
|
70
|
-
await downloadFile({
|
|
71
|
-
path: { fileId },
|
|
72
|
-
query: {
|
|
73
|
-
...queryParams,
|
|
74
|
-
locale: locale ? sharedApi.resolveCanonicalLocale(locale) : void 0
|
|
75
|
-
},
|
|
76
|
-
client: getClient()
|
|
77
|
-
})
|
|
78
|
-
);
|
|
79
|
-
return decode(response.data);
|
|
80
|
-
},
|
|
81
|
-
async downloadFileBatch(files) {
|
|
82
|
-
const { pending: _pending, ...result } = await sharedApi.downloadFileBatch(files);
|
|
83
|
-
return result;
|
|
43
|
+
const { fileId, ...queryParams } = query;
|
|
44
|
+
return sharedApi.querySourceFile({ fileId }, queryParams);
|
|
84
45
|
}
|
|
85
46
|
}, SECRETS_NAMESPACE = "generaltranslation.secrets", SANITY_API_VERSION = "2025-09-15", gt = new GT(), DEFAULT_TRANSLATION_PREFERENCES = {
|
|
86
47
|
autoRefresh: !0,
|
|
@@ -2785,7 +2746,7 @@ const useTranslations = () => {
|
|
|
2785
2746
|
] }) })
|
|
2786
2747
|
}
|
|
2787
2748
|
) : null;
|
|
2788
|
-
var version = "4.0.
|
|
2749
|
+
var version = "4.0.19";
|
|
2789
2750
|
function buildDebugInfo({
|
|
2790
2751
|
secrets,
|
|
2791
2752
|
preferences,
|