@contentful/field-editor-reference 6.13.0 → 6.13.2
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.
|
@@ -242,10 +242,6 @@ async function fetchExternalResource({ urn, fetch, options, spaceId, environment
|
|
|
242
242
|
spaceId,
|
|
243
243
|
environmentId
|
|
244
244
|
], ({ cmaClient })=>{
|
|
245
|
-
console.log('>> fetch resource types', {
|
|
246
|
-
spaceId,
|
|
247
|
-
environmentId
|
|
248
|
-
});
|
|
249
245
|
return (0, _contentfulmanagement.fetchAll)(({ query })=>cmaClient.resourceType.getForEnvironment({
|
|
250
246
|
spaceId,
|
|
251
247
|
environmentId,
|
|
@@ -253,8 +249,6 @@ async function fetchExternalResource({ urn, fetch, options, spaceId, environment
|
|
|
253
249
|
}), {});
|
|
254
250
|
})
|
|
255
251
|
]);
|
|
256
|
-
console.log('>> resource', resource);
|
|
257
|
-
console.log('>> resourceTypes', resourceTypes);
|
|
258
252
|
const resourceTypeEntity = resourceTypes.find((rt)=>rt.sys.id === resourceType);
|
|
259
253
|
if (!resourceTypeEntity) {
|
|
260
254
|
throw new UnsupportedError('Unsupported resource type');
|
|
@@ -308,7 +302,7 @@ const [InternalServiceProvider, useFetch, useEntityLoader, useCurrentIds] = (0,
|
|
|
308
302
|
cmaClient
|
|
309
303
|
]);
|
|
310
304
|
const isReleaseRequestError = (0, _react.useCallback)(function isReleaseRequestError(error, spaceId, environmentId) {
|
|
311
|
-
return !!releaseId && (!spaceId || spaceId === currentSpaceId) && (!environmentId || environmentId === currentEnvironmentId) && error instanceof Error && '
|
|
305
|
+
return !!releaseId && (!spaceId || spaceId === currentSpaceId) && (!environmentId || environmentId === currentEnvironmentId) && error instanceof Error && error.message.includes('The resource could not be found');
|
|
312
306
|
}, [
|
|
313
307
|
releaseId,
|
|
314
308
|
currentSpaceId,
|
|
@@ -327,12 +321,13 @@ const [InternalServiceProvider, useFetch, useEntityLoader, useCurrentIds] = (0,
|
|
|
327
321
|
return fetch(queryKey, async ({ cmaClient })=>{
|
|
328
322
|
if (entityType === 'Entry') {
|
|
329
323
|
try {
|
|
330
|
-
|
|
324
|
+
const entity = await cmaClient.entry.get({
|
|
331
325
|
entryId: entityId,
|
|
332
326
|
spaceId,
|
|
333
327
|
environmentId,
|
|
334
328
|
releaseId
|
|
335
329
|
});
|
|
330
|
+
return entity;
|
|
336
331
|
} catch (error) {
|
|
337
332
|
if (isReleaseRequestError(error, spaceId, environmentId)) {
|
|
338
333
|
const currentEntry = await cmaClient.entry.get({
|
|
@@ -355,15 +350,16 @@ const [InternalServiceProvider, useFetch, useEntityLoader, useCurrentIds] = (0,
|
|
|
355
350
|
}
|
|
356
351
|
if (entityType === 'Asset') {
|
|
357
352
|
try {
|
|
358
|
-
|
|
353
|
+
const entity = await cmaClient.asset.get({
|
|
359
354
|
assetId: entityId,
|
|
360
355
|
spaceId,
|
|
361
356
|
environmentId,
|
|
362
357
|
releaseId
|
|
363
358
|
});
|
|
359
|
+
return entity;
|
|
364
360
|
} catch (error) {
|
|
365
361
|
if (isReleaseRequestError(error, spaceId, environmentId)) {
|
|
366
|
-
const currentAsset = cmaClient.asset.get({
|
|
362
|
+
const currentAsset = await cmaClient.asset.get({
|
|
367
363
|
assetId: entityId,
|
|
368
364
|
spaceId,
|
|
369
365
|
environmentId,
|
|
@@ -154,10 +154,6 @@ async function fetchExternalResource({ urn, fetch, options, spaceId, environment
|
|
|
154
154
|
spaceId,
|
|
155
155
|
environmentId
|
|
156
156
|
], ({ cmaClient })=>{
|
|
157
|
-
console.log('>> fetch resource types', {
|
|
158
|
-
spaceId,
|
|
159
|
-
environmentId
|
|
160
|
-
});
|
|
161
157
|
return fetchAll(({ query })=>cmaClient.resourceType.getForEnvironment({
|
|
162
158
|
spaceId,
|
|
163
159
|
environmentId,
|
|
@@ -165,8 +161,6 @@ async function fetchExternalResource({ urn, fetch, options, spaceId, environment
|
|
|
165
161
|
}), {});
|
|
166
162
|
})
|
|
167
163
|
]);
|
|
168
|
-
console.log('>> resource', resource);
|
|
169
|
-
console.log('>> resourceTypes', resourceTypes);
|
|
170
164
|
const resourceTypeEntity = resourceTypes.find((rt)=>rt.sys.id === resourceType);
|
|
171
165
|
if (!resourceTypeEntity) {
|
|
172
166
|
throw new UnsupportedError('Unsupported resource type');
|
|
@@ -220,7 +214,7 @@ const [InternalServiceProvider, useFetch, useEntityLoader, useCurrentIds] = cons
|
|
|
220
214
|
cmaClient
|
|
221
215
|
]);
|
|
222
216
|
const isReleaseRequestError = useCallback(function isReleaseRequestError(error, spaceId, environmentId) {
|
|
223
|
-
return !!releaseId && (!spaceId || spaceId === currentSpaceId) && (!environmentId || environmentId === currentEnvironmentId) && error instanceof Error && '
|
|
217
|
+
return !!releaseId && (!spaceId || spaceId === currentSpaceId) && (!environmentId || environmentId === currentEnvironmentId) && error instanceof Error && error.message.includes('The resource could not be found');
|
|
224
218
|
}, [
|
|
225
219
|
releaseId,
|
|
226
220
|
currentSpaceId,
|
|
@@ -239,12 +233,13 @@ const [InternalServiceProvider, useFetch, useEntityLoader, useCurrentIds] = cons
|
|
|
239
233
|
return fetch(queryKey, async ({ cmaClient })=>{
|
|
240
234
|
if (entityType === 'Entry') {
|
|
241
235
|
try {
|
|
242
|
-
|
|
236
|
+
const entity = await cmaClient.entry.get({
|
|
243
237
|
entryId: entityId,
|
|
244
238
|
spaceId,
|
|
245
239
|
environmentId,
|
|
246
240
|
releaseId
|
|
247
241
|
});
|
|
242
|
+
return entity;
|
|
248
243
|
} catch (error) {
|
|
249
244
|
if (isReleaseRequestError(error, spaceId, environmentId)) {
|
|
250
245
|
const currentEntry = await cmaClient.entry.get({
|
|
@@ -267,15 +262,16 @@ const [InternalServiceProvider, useFetch, useEntityLoader, useCurrentIds] = cons
|
|
|
267
262
|
}
|
|
268
263
|
if (entityType === 'Asset') {
|
|
269
264
|
try {
|
|
270
|
-
|
|
265
|
+
const entity = await cmaClient.asset.get({
|
|
271
266
|
assetId: entityId,
|
|
272
267
|
spaceId,
|
|
273
268
|
environmentId,
|
|
274
269
|
releaseId
|
|
275
270
|
});
|
|
271
|
+
return entity;
|
|
276
272
|
} catch (error) {
|
|
277
273
|
if (isReleaseRequestError(error, spaceId, environmentId)) {
|
|
278
|
-
const currentAsset = cmaClient.asset.get({
|
|
274
|
+
const currentAsset = await cmaClient.asset.get({
|
|
279
275
|
assetId: entityId,
|
|
280
276
|
spaceId,
|
|
281
277
|
environmentId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-reference",
|
|
3
|
-
"version": "6.13.
|
|
3
|
+
"version": "6.13.2",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@contentful/f36-components": "^5.4.1",
|
|
40
40
|
"@contentful/f36-icons": "^5.4.1",
|
|
41
41
|
"@contentful/f36-tokens": "^5.1.0",
|
|
42
|
-
"@contentful/field-editor-shared": "^2.13.
|
|
42
|
+
"@contentful/field-editor-shared": "^2.13.2",
|
|
43
43
|
"@contentful/mimetype": "^2.2.29",
|
|
44
44
|
"@dnd-kit/core": "^6.0.8",
|
|
45
45
|
"@dnd-kit/modifiers": "^7.0.0",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"registry": "https://npm.pkg.github.com/"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "5268c1cf0458b21d33e68126d27f8c14a2c5785d"
|
|
71
71
|
}
|