@contentful/field-editor-shared 2.17.1 → 2.17.2-canary.25
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/cjs/hooks/useContentTypes.js +94 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/queryClient.js +6 -2
- package/dist/cjs/queryKeys.js +94 -0
- package/dist/esm/hooks/useContentTypes.js +73 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/queryClient.js +6 -2
- package/dist/esm/queryKeys.js +64 -0
- package/dist/types/hooks/useContentTypes.d.ts +24 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/queryClient.d.ts +3 -1
- package/dist/types/queryKeys.d.ts +76 -0
- package/package.json +2 -2
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
fetchContentType: function() {
|
|
13
|
+
return fetchContentType;
|
|
14
|
+
},
|
|
15
|
+
useContentType: function() {
|
|
16
|
+
return useContentType;
|
|
17
|
+
},
|
|
18
|
+
useContentTypes: function() {
|
|
19
|
+
return useContentTypes;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const _react = require("react");
|
|
23
|
+
const _queryClient = require("../queryClient");
|
|
24
|
+
const _queryKeys = require("../queryKeys");
|
|
25
|
+
function useContentType(sdk, contentTypeId, options) {
|
|
26
|
+
const spaceId = sdk.ids.space;
|
|
27
|
+
const environmentId = sdk.ids.environmentAlias ?? sdk.ids.environment;
|
|
28
|
+
return (0, _queryClient.useQuery)((0, _queryKeys.createGetContentTypeKey)(spaceId, environmentId, contentTypeId), ()=>sdk.cma.contentType.get({
|
|
29
|
+
contentTypeId
|
|
30
|
+
}), {
|
|
31
|
+
staleTime: Infinity,
|
|
32
|
+
...options
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
async function fetchContentType(sdk, contentTypeId) {
|
|
36
|
+
return sdk.cma.contentType.get({
|
|
37
|
+
contentTypeId
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function useContentTypes(source) {
|
|
41
|
+
const cma = 'cma' in source ? source.cma : source;
|
|
42
|
+
const navigator = 'navigator' in source ? source.navigator : undefined;
|
|
43
|
+
const queryClient = (0, _queryClient.useQueryClient)();
|
|
44
|
+
const spaceId = 'ids' in source ? source.ids.space : '';
|
|
45
|
+
const environmentId = 'ids' in source ? source.ids.environmentAlias ?? source.ids.environment : '';
|
|
46
|
+
const queryParams = (0, _react.useMemo)(()=>({
|
|
47
|
+
limit: 1000
|
|
48
|
+
}), []);
|
|
49
|
+
const { data: contentTypes = [] } = (0, _queryClient.useQuery)((0, _queryKeys.createGetManyContentTypesKey)(spaceId, environmentId, queryParams), async ()=>{
|
|
50
|
+
const allContentTypes = [];
|
|
51
|
+
const limit = 1000;
|
|
52
|
+
let skip = 0;
|
|
53
|
+
let total = 0;
|
|
54
|
+
do {
|
|
55
|
+
const response = await cma.contentType.getMany({
|
|
56
|
+
query: {
|
|
57
|
+
limit,
|
|
58
|
+
skip
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
allContentTypes.push(...response.items);
|
|
62
|
+
total = response.total;
|
|
63
|
+
skip += response.items.length;
|
|
64
|
+
}while (skip < total)
|
|
65
|
+
return allContentTypes;
|
|
66
|
+
}, {
|
|
67
|
+
staleTime: Infinity,
|
|
68
|
+
refetchOnMount: false
|
|
69
|
+
});
|
|
70
|
+
(0, _react.useEffect)(()=>{
|
|
71
|
+
if (!navigator?.onSlideInNavigation) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const unsubscribe = navigator.onSlideInNavigation(({ oldSlideLevel, newSlideLevel })=>{
|
|
75
|
+
if (oldSlideLevel > newSlideLevel) {
|
|
76
|
+
void queryClient.invalidateQueries((0, _queryKeys.createGetManyContentTypesKey)(spaceId, environmentId, queryParams));
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return unsubscribe;
|
|
80
|
+
}, [
|
|
81
|
+
navigator,
|
|
82
|
+
queryClient,
|
|
83
|
+
spaceId,
|
|
84
|
+
environmentId,
|
|
85
|
+
queryParams
|
|
86
|
+
]);
|
|
87
|
+
const invalidate = ()=>{
|
|
88
|
+
return queryClient.invalidateQueries((0, _queryKeys.createGetManyContentTypesKey)(spaceId, environmentId, queryParams));
|
|
89
|
+
};
|
|
90
|
+
return {
|
|
91
|
+
contentTypes,
|
|
92
|
+
invalidate
|
|
93
|
+
};
|
|
94
|
+
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -117,12 +117,14 @@ _export_star(require("./types"), exports);
|
|
|
117
117
|
_export_star(require("./hooks/useActiveLocales"), exports);
|
|
118
118
|
_export_star(require("./hooks/useReleaseStatus"), exports);
|
|
119
119
|
_export_star(require("./hooks/useLocalePublishStatus"), exports);
|
|
120
|
+
_export_star(require("./hooks/useContentTypes"), exports);
|
|
120
121
|
_export_star(require("./LocalePublishingEntityStatusBadge"), exports);
|
|
121
122
|
_export_star(require("./ReleaseEntityStatusBadge"), exports);
|
|
122
123
|
_export_star(require("./utils/determineReleaseAction"), exports);
|
|
123
124
|
_export_star(require("./utils/getEntityReleaseStatus"), exports);
|
|
124
125
|
_export_star(require("./utils/getReleaseStatusBadgeConfig"), exports);
|
|
125
126
|
const _queryClient = require("./queryClient");
|
|
127
|
+
_export_star(require("./queryKeys"), exports);
|
|
126
128
|
function _export_star(from, to) {
|
|
127
129
|
Object.keys(from).forEach(function(k) {
|
|
128
130
|
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
package/dist/cjs/queryClient.js
CHANGED
|
@@ -115,8 +115,12 @@ function useQuery(queryKey, queryFn, options) {
|
|
|
115
115
|
context: clientContext
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
|
-
function SharedQueryClientProvider({ children }) {
|
|
119
|
-
const
|
|
118
|
+
function SharedQueryClientProvider({ children, client: providedClient }) {
|
|
119
|
+
const internalClient = useQueryClient();
|
|
120
|
+
const client = _react.useMemo(()=>providedClient ?? internalClient, [
|
|
121
|
+
providedClient,
|
|
122
|
+
internalClient
|
|
123
|
+
]);
|
|
120
124
|
return /*#__PURE__*/ _react.createElement(clientContext.Provider, {
|
|
121
125
|
value: client
|
|
122
126
|
}, children);
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
createGetAssetKey: function() {
|
|
13
|
+
return createGetAssetKey;
|
|
14
|
+
},
|
|
15
|
+
createGetContentTypeKey: function() {
|
|
16
|
+
return createGetContentTypeKey;
|
|
17
|
+
},
|
|
18
|
+
createGetEntryKey: function() {
|
|
19
|
+
return createGetEntryKey;
|
|
20
|
+
},
|
|
21
|
+
createGetManyContentTypesKey: function() {
|
|
22
|
+
return createGetManyContentTypesKey;
|
|
23
|
+
},
|
|
24
|
+
createGetManyLocalesKey: function() {
|
|
25
|
+
return createGetManyLocalesKey;
|
|
26
|
+
},
|
|
27
|
+
createGetSpaceKey: function() {
|
|
28
|
+
return createGetSpaceKey;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const createGetEntryKey = (spaceId, environmentId, entryId)=>{
|
|
32
|
+
return [
|
|
33
|
+
'spaces',
|
|
34
|
+
spaceId,
|
|
35
|
+
'environments',
|
|
36
|
+
environmentId,
|
|
37
|
+
'entries',
|
|
38
|
+
'get',
|
|
39
|
+
entryId
|
|
40
|
+
];
|
|
41
|
+
};
|
|
42
|
+
const createGetAssetKey = (spaceId, environmentId, assetId)=>{
|
|
43
|
+
return [
|
|
44
|
+
'spaces',
|
|
45
|
+
spaceId,
|
|
46
|
+
'environments',
|
|
47
|
+
environmentId,
|
|
48
|
+
'assets',
|
|
49
|
+
'get',
|
|
50
|
+
assetId
|
|
51
|
+
];
|
|
52
|
+
};
|
|
53
|
+
const createGetSpaceKey = (spaceId)=>{
|
|
54
|
+
return [
|
|
55
|
+
'spaces',
|
|
56
|
+
'get',
|
|
57
|
+
spaceId
|
|
58
|
+
];
|
|
59
|
+
};
|
|
60
|
+
const createGetManyLocalesKey = (spaceId, environmentId, params = {})=>{
|
|
61
|
+
return [
|
|
62
|
+
'spaces',
|
|
63
|
+
spaceId,
|
|
64
|
+
'environments',
|
|
65
|
+
environmentId,
|
|
66
|
+
'locales',
|
|
67
|
+
params
|
|
68
|
+
];
|
|
69
|
+
};
|
|
70
|
+
const createGetContentTypeKey = (spaceId, environmentId, contentTypeId)=>{
|
|
71
|
+
return [
|
|
72
|
+
'spaces',
|
|
73
|
+
spaceId,
|
|
74
|
+
'environments',
|
|
75
|
+
environmentId,
|
|
76
|
+
'content_types',
|
|
77
|
+
'get',
|
|
78
|
+
contentTypeId
|
|
79
|
+
];
|
|
80
|
+
};
|
|
81
|
+
const createGetManyContentTypesKey = (spaceId, environmentId, params = {})=>{
|
|
82
|
+
const prefix = [
|
|
83
|
+
'spaces',
|
|
84
|
+
spaceId,
|
|
85
|
+
'environments',
|
|
86
|
+
environmentId,
|
|
87
|
+
'content_types',
|
|
88
|
+
'getMany'
|
|
89
|
+
];
|
|
90
|
+
return Object.keys(params).length === 0 ? prefix : [
|
|
91
|
+
...prefix,
|
|
92
|
+
params
|
|
93
|
+
];
|
|
94
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { useEffect, useMemo } from 'react';
|
|
2
|
+
import { useQuery, useQueryClient } from '../queryClient';
|
|
3
|
+
import { createGetContentTypeKey, createGetManyContentTypesKey } from '../queryKeys';
|
|
4
|
+
export function useContentType(sdk, contentTypeId, options) {
|
|
5
|
+
const spaceId = sdk.ids.space;
|
|
6
|
+
const environmentId = sdk.ids.environmentAlias ?? sdk.ids.environment;
|
|
7
|
+
return useQuery(createGetContentTypeKey(spaceId, environmentId, contentTypeId), ()=>sdk.cma.contentType.get({
|
|
8
|
+
contentTypeId
|
|
9
|
+
}), {
|
|
10
|
+
staleTime: Infinity,
|
|
11
|
+
...options
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export async function fetchContentType(sdk, contentTypeId) {
|
|
15
|
+
return sdk.cma.contentType.get({
|
|
16
|
+
contentTypeId
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export function useContentTypes(source) {
|
|
20
|
+
const cma = 'cma' in source ? source.cma : source;
|
|
21
|
+
const navigator = 'navigator' in source ? source.navigator : undefined;
|
|
22
|
+
const queryClient = useQueryClient();
|
|
23
|
+
const spaceId = 'ids' in source ? source.ids.space : '';
|
|
24
|
+
const environmentId = 'ids' in source ? source.ids.environmentAlias ?? source.ids.environment : '';
|
|
25
|
+
const queryParams = useMemo(()=>({
|
|
26
|
+
limit: 1000
|
|
27
|
+
}), []);
|
|
28
|
+
const { data: contentTypes = [] } = useQuery(createGetManyContentTypesKey(spaceId, environmentId, queryParams), async ()=>{
|
|
29
|
+
const allContentTypes = [];
|
|
30
|
+
const limit = 1000;
|
|
31
|
+
let skip = 0;
|
|
32
|
+
let total = 0;
|
|
33
|
+
do {
|
|
34
|
+
const response = await cma.contentType.getMany({
|
|
35
|
+
query: {
|
|
36
|
+
limit,
|
|
37
|
+
skip
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
allContentTypes.push(...response.items);
|
|
41
|
+
total = response.total;
|
|
42
|
+
skip += response.items.length;
|
|
43
|
+
}while (skip < total)
|
|
44
|
+
return allContentTypes;
|
|
45
|
+
}, {
|
|
46
|
+
staleTime: Infinity,
|
|
47
|
+
refetchOnMount: false
|
|
48
|
+
});
|
|
49
|
+
useEffect(()=>{
|
|
50
|
+
if (!navigator?.onSlideInNavigation) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const unsubscribe = navigator.onSlideInNavigation(({ oldSlideLevel, newSlideLevel })=>{
|
|
54
|
+
if (oldSlideLevel > newSlideLevel) {
|
|
55
|
+
void queryClient.invalidateQueries(createGetManyContentTypesKey(spaceId, environmentId, queryParams));
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return unsubscribe;
|
|
59
|
+
}, [
|
|
60
|
+
navigator,
|
|
61
|
+
queryClient,
|
|
62
|
+
spaceId,
|
|
63
|
+
environmentId,
|
|
64
|
+
queryParams
|
|
65
|
+
]);
|
|
66
|
+
const invalidate = ()=>{
|
|
67
|
+
return queryClient.invalidateQueries(createGetManyContentTypesKey(spaceId, environmentId, queryParams));
|
|
68
|
+
};
|
|
69
|
+
return {
|
|
70
|
+
contentTypes,
|
|
71
|
+
invalidate
|
|
72
|
+
};
|
|
73
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -12,9 +12,11 @@ export * from './types';
|
|
|
12
12
|
export * from './hooks/useActiveLocales';
|
|
13
13
|
export * from './hooks/useReleaseStatus';
|
|
14
14
|
export * from './hooks/useLocalePublishStatus';
|
|
15
|
+
export * from './hooks/useContentTypes';
|
|
15
16
|
export * from './LocalePublishingEntityStatusBadge';
|
|
16
17
|
export * from './ReleaseEntityStatusBadge';
|
|
17
18
|
export * from './utils/determineReleaseAction';
|
|
18
19
|
export * from './utils/getEntityReleaseStatus';
|
|
19
20
|
export * from './utils/getReleaseStatusBadgeConfig';
|
|
20
21
|
export { SharedQueryClientProvider, useQueryClient, useQuery } from './queryClient';
|
|
22
|
+
export * from './queryKeys';
|
package/dist/esm/queryClient.js
CHANGED
|
@@ -53,8 +53,12 @@ export function useQuery(queryKey, queryFn, options) {
|
|
|
53
53
|
context: clientContext
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
export function SharedQueryClientProvider({ children }) {
|
|
57
|
-
const
|
|
56
|
+
export function SharedQueryClientProvider({ children, client: providedClient }) {
|
|
57
|
+
const internalClient = useQueryClient();
|
|
58
|
+
const client = React.useMemo(()=>providedClient ?? internalClient, [
|
|
59
|
+
providedClient,
|
|
60
|
+
internalClient
|
|
61
|
+
]);
|
|
58
62
|
return /*#__PURE__*/ React.createElement(clientContext.Provider, {
|
|
59
63
|
value: client
|
|
60
64
|
}, children);
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export const createGetEntryKey = (spaceId, environmentId, entryId)=>{
|
|
2
|
+
return [
|
|
3
|
+
'spaces',
|
|
4
|
+
spaceId,
|
|
5
|
+
'environments',
|
|
6
|
+
environmentId,
|
|
7
|
+
'entries',
|
|
8
|
+
'get',
|
|
9
|
+
entryId
|
|
10
|
+
];
|
|
11
|
+
};
|
|
12
|
+
export const createGetAssetKey = (spaceId, environmentId, assetId)=>{
|
|
13
|
+
return [
|
|
14
|
+
'spaces',
|
|
15
|
+
spaceId,
|
|
16
|
+
'environments',
|
|
17
|
+
environmentId,
|
|
18
|
+
'assets',
|
|
19
|
+
'get',
|
|
20
|
+
assetId
|
|
21
|
+
];
|
|
22
|
+
};
|
|
23
|
+
export const createGetSpaceKey = (spaceId)=>{
|
|
24
|
+
return [
|
|
25
|
+
'spaces',
|
|
26
|
+
'get',
|
|
27
|
+
spaceId
|
|
28
|
+
];
|
|
29
|
+
};
|
|
30
|
+
export const createGetManyLocalesKey = (spaceId, environmentId, params = {})=>{
|
|
31
|
+
return [
|
|
32
|
+
'spaces',
|
|
33
|
+
spaceId,
|
|
34
|
+
'environments',
|
|
35
|
+
environmentId,
|
|
36
|
+
'locales',
|
|
37
|
+
params
|
|
38
|
+
];
|
|
39
|
+
};
|
|
40
|
+
export const createGetContentTypeKey = (spaceId, environmentId, contentTypeId)=>{
|
|
41
|
+
return [
|
|
42
|
+
'spaces',
|
|
43
|
+
spaceId,
|
|
44
|
+
'environments',
|
|
45
|
+
environmentId,
|
|
46
|
+
'content_types',
|
|
47
|
+
'get',
|
|
48
|
+
contentTypeId
|
|
49
|
+
];
|
|
50
|
+
};
|
|
51
|
+
export const createGetManyContentTypesKey = (spaceId, environmentId, params = {})=>{
|
|
52
|
+
const prefix = [
|
|
53
|
+
'spaces',
|
|
54
|
+
spaceId,
|
|
55
|
+
'environments',
|
|
56
|
+
environmentId,
|
|
57
|
+
'content_types',
|
|
58
|
+
'getMany'
|
|
59
|
+
];
|
|
60
|
+
return Object.keys(params).length === 0 ? prefix : [
|
|
61
|
+
...prefix,
|
|
62
|
+
params
|
|
63
|
+
];
|
|
64
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ContentType, FieldAppSDK } from '@contentful/app-sdk';
|
|
2
|
+
type SDKWithCMA = Pick<FieldAppSDK, 'cma'>;
|
|
3
|
+
type SDKWithCMAAndNavigator = Pick<FieldAppSDK, 'cma' | 'navigator'>;
|
|
4
|
+
type SDKWithIdsAndCMA = Pick<FieldAppSDK, 'cma' | 'ids'>;
|
|
5
|
+
type CMAClient = SDKWithCMA['cma'];
|
|
6
|
+
/**
|
|
7
|
+
* Hook to fetch a single content type by ID.
|
|
8
|
+
* Uses proper query key for cache sharing with user_interface.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useContentType(sdk: Pick<FieldAppSDK, 'cma' | 'ids'>, contentTypeId: string, options?: {
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
}): import("@tanstack/react-query").UseQueryResult<ContentType, unknown>;
|
|
13
|
+
/**
|
|
14
|
+
* Simple helper to fetch a single content type by ID.
|
|
15
|
+
* For use in async functions or one-off fetches.
|
|
16
|
+
* For repeated fetches with caching, use the useContentType hook instead.
|
|
17
|
+
*/
|
|
18
|
+
export declare function fetchContentType(sdk: Pick<FieldAppSDK, 'cma'>, contentTypeId: string): Promise<ContentType>;
|
|
19
|
+
export type UseContentTypesResult = {
|
|
20
|
+
contentTypes: ContentType[];
|
|
21
|
+
invalidate: () => void;
|
|
22
|
+
};
|
|
23
|
+
export declare function useContentTypes(source: SDKWithCMAAndNavigator | SDKWithCMA | SDKWithIdsAndCMA | CMAClient): UseContentTypesResult;
|
|
24
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -14,9 +14,11 @@ export * from './types';
|
|
|
14
14
|
export * from './hooks/useActiveLocales';
|
|
15
15
|
export * from './hooks/useReleaseStatus';
|
|
16
16
|
export * from './hooks/useLocalePublishStatus';
|
|
17
|
+
export * from './hooks/useContentTypes';
|
|
17
18
|
export * from './LocalePublishingEntityStatusBadge';
|
|
18
19
|
export * from './ReleaseEntityStatusBadge';
|
|
19
20
|
export * from './utils/determineReleaseAction';
|
|
20
21
|
export * from './utils/getEntityReleaseStatus';
|
|
21
22
|
export * from './utils/getReleaseStatusBadgeConfig';
|
|
22
23
|
export { SharedQueryClientProvider, useQueryClient, useQuery } from './queryClient';
|
|
24
|
+
export * from './queryKeys';
|
|
@@ -6,4 +6,6 @@ export declare function useQuery<TQueryFnData = unknown, TError = unknown, TData
|
|
|
6
6
|
* Provides access to a query client either by sharing an existing client or
|
|
7
7
|
* creating a new one.
|
|
8
8
|
*/
|
|
9
|
-
export declare function SharedQueryClientProvider({ children }: React.PropsWithChildren<{
|
|
9
|
+
export declare function SharedQueryClientProvider({ children, client: providedClient, }: React.PropsWithChildren<{
|
|
10
|
+
client?: QueryClient;
|
|
11
|
+
}>): React.JSX.Element;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query key factories matching user_interface repository structure.
|
|
3
|
+
*
|
|
4
|
+
* IMPORTANT: These must stay in sync with user_interface to enable cache sharing.
|
|
5
|
+
* When updating, check the corresponding file in user_interface repository.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Creates a query key for fetching a single entry.
|
|
9
|
+
* Matches the structure used in user_interface for cache sharing.
|
|
10
|
+
*
|
|
11
|
+
* Source: https://github.com/contentful/user_interface/blob/main/src/javascripts/core/react-query/cma/entry/useGetEntry.ts
|
|
12
|
+
*
|
|
13
|
+
* @param spaceId - The space ID
|
|
14
|
+
* @param environmentId - The environment ID
|
|
15
|
+
* @param entryId - The entry ID to fetch
|
|
16
|
+
* @returns Query key array for React Query
|
|
17
|
+
*/
|
|
18
|
+
export declare const createGetEntryKey: (spaceId: string, environmentId: string, entryId: string) => string[];
|
|
19
|
+
/**
|
|
20
|
+
* Creates a query key for fetching a single asset.
|
|
21
|
+
* Matches the structure used in user_interface for cache sharing.
|
|
22
|
+
*
|
|
23
|
+
* Source: https://github.com/contentful/user_interface/blob/main/src/javascripts/core/react-query/cma/asset/useGetAsset.ts
|
|
24
|
+
*
|
|
25
|
+
* @param spaceId - The space ID
|
|
26
|
+
* @param environmentId - The environment ID
|
|
27
|
+
* @param assetId - The asset ID to fetch
|
|
28
|
+
* @returns Query key array for React Query
|
|
29
|
+
*/
|
|
30
|
+
export declare const createGetAssetKey: (spaceId: string, environmentId: string, assetId: string) => string[];
|
|
31
|
+
/**
|
|
32
|
+
* Creates a query key for fetching a single space.
|
|
33
|
+
* Matches the structure used in user_interface for cache sharing.
|
|
34
|
+
*
|
|
35
|
+
* Source: https://github.com/contentful/user_interface/blob/main/src/javascripts/core/react-query/cma/space/useGetSpace.ts
|
|
36
|
+
*
|
|
37
|
+
* @param spaceId - The space ID to fetch
|
|
38
|
+
* @returns Query key array for React Query
|
|
39
|
+
*/
|
|
40
|
+
export declare const createGetSpaceKey: (spaceId: string) => string[];
|
|
41
|
+
/**
|
|
42
|
+
* Creates a query key for fetching multiple locales.
|
|
43
|
+
* Matches the structure used in user_interface for cache sharing.
|
|
44
|
+
*
|
|
45
|
+
* Source: https://github.com/contentful/user_interface/blob/main/src/javascripts/core/react-query/cma/locale/useGetManyLocales.ts
|
|
46
|
+
*
|
|
47
|
+
* @param spaceId - The space ID
|
|
48
|
+
* @param environmentId - The environment ID
|
|
49
|
+
* @param params - Optional query parameters
|
|
50
|
+
* @returns Query key array for React Query
|
|
51
|
+
*/
|
|
52
|
+
export declare const createGetManyLocalesKey: (spaceId: string, environmentId: string, params?: Record<string, unknown>) => (string | Record<string, unknown>)[];
|
|
53
|
+
/**
|
|
54
|
+
* Creates a query key for fetching a single content type.
|
|
55
|
+
* Matches the structure used in user_interface for cache sharing.
|
|
56
|
+
*
|
|
57
|
+
* Source: https://github.com/contentful/user_interface/blob/main/src/javascripts/core/react-query/cma/contentType/useGetContentType.ts
|
|
58
|
+
*
|
|
59
|
+
* @param spaceId - The space ID
|
|
60
|
+
* @param environmentId - The environment ID
|
|
61
|
+
* @param contentTypeId - The content type ID to fetch
|
|
62
|
+
* @returns Query key array for React Query
|
|
63
|
+
*/
|
|
64
|
+
export declare const createGetContentTypeKey: (spaceId: string, environmentId: string, contentTypeId: string) => string[];
|
|
65
|
+
/**
|
|
66
|
+
* Creates a query key for fetching multiple content types.
|
|
67
|
+
* Matches the structure used in user_interface for cache sharing.
|
|
68
|
+
*
|
|
69
|
+
* Source: https://github.com/contentful/user_interface/blob/main/src/javascripts/core/react-query/cma/contentType/useGetManyContentTypes.ts
|
|
70
|
+
*
|
|
71
|
+
* @param spaceId - The space ID
|
|
72
|
+
* @param environmentId - The environment ID
|
|
73
|
+
* @param params - Optional query parameters (e.g., { limit: 1000 })
|
|
74
|
+
* @returns Query key array for React Query
|
|
75
|
+
*/
|
|
76
|
+
export declare const createGetManyContentTypesKey: (spaceId: string, environmentId: string, params?: Record<string, unknown>) => (string | Record<string, unknown>)[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-shared",
|
|
3
|
-
"version": "2.17.
|
|
3
|
+
"version": "2.17.2-canary.25+a4f2df74",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"registry": "https://npm.pkg.github.com/"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "a4f2df742d1cb10986f9c465824fd5b88d092d8a"
|
|
71
71
|
}
|