@prismicio/types-internal 3.16.2-alpha.0 → 3.16.2-alpha.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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.traverseSlices = exports.slicesContentWithDefaultValues = exports.SlicesContent = exports.SlicesLegacy = exports.isSlicesContent = exports.SlicesContentType = void 0;
3
+ exports.traverseSlicesWithModel = exports.traverseSlices = exports.slicesContentWithDefaultValues = exports.SlicesContent = exports.SlicesLegacy = exports.isSlicesContent = exports.SlicesContentType = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const fp_ts_1 = require("fp-ts");
6
6
  const function_1 = require("fp-ts/lib/function");
@@ -8,6 +8,8 @@ const t = (0, tslib_1.__importStar)(require("io-ts"));
8
8
  const customtypes_1 = require("../../../customtypes");
9
9
  const utils_1 = require("../../utils");
10
10
  const utils_2 = require("../../utils");
11
+ const GroupContent_1 = require("../GroupContent");
12
+ const nestable_1 = require("../nestable");
11
13
  const CompositeSliceContent_1 = require("./Slice/CompositeSliceContent");
12
14
  const SharedSliceContent_1 = require("./Slice/SharedSliceContent");
13
15
  const SimpleSliceContent_1 = require("./Slice/SimpleSliceContent");
@@ -185,3 +187,278 @@ function traverseSlices({ path, key, model, content, }) {
185
187
  };
186
188
  }
187
189
  exports.traverseSlices = traverseSlices;
190
+ function buildVariationFields(sharedSlice, variation) {
191
+ var _a, _b;
192
+ return {
193
+ type: "SharedSlice",
194
+ sliceName: sharedSlice.id,
195
+ variationId: variation.id,
196
+ fields: {
197
+ primary: (_a = variation.primary) !== null && _a !== void 0 ? _a : {},
198
+ items: (_b = variation.items) !== null && _b !== void 0 ? _b : {},
199
+ },
200
+ };
201
+ }
202
+ function traverseSharedSliceContentWithModel({ path, sliceKey, sliceName, model, content, }) {
203
+ return (transformWidget, transformSlice) => {
204
+ var _a, _b;
205
+ if (!content) {
206
+ return undefined;
207
+ }
208
+ const primary = Object.entries((_a = model.fields.primary) !== null && _a !== void 0 ? _a : {}).reduce((acc, [fieldKey, fieldModel]) => {
209
+ var _a;
210
+ const fieldContent = content.widget.primary[fieldKey];
211
+ const fieldPath = path.concat([
212
+ { key: "primary", type: "primary" },
213
+ { key: fieldKey, type: "Widget" },
214
+ ]);
215
+ let transformedField;
216
+ if (fieldModel.type === "Group") {
217
+ const groupContent = (0, GroupContent_1.isGroupContent)(fieldContent)
218
+ ? fieldContent
219
+ : undefined;
220
+ transformedField = (0, GroupContent_1.traverseGroupContentWithModel)({
221
+ path: fieldPath,
222
+ key: fieldKey,
223
+ model: fieldModel,
224
+ content: groupContent,
225
+ })(transformWidget);
226
+ }
227
+ else if (fieldModel.type === "Link" &&
228
+ ((_a = fieldModel.config) === null || _a === void 0 ? void 0 : _a.repeat) === true) {
229
+ const repeatableContent = (0, nestable_1.isRepeatableContent)(fieldContent)
230
+ ? fieldContent
231
+ : undefined;
232
+ transformedField = (0, nestable_1.traverseRepeatableContentWithModel)({
233
+ path: fieldPath,
234
+ key: fieldKey,
235
+ model: fieldModel,
236
+ content: repeatableContent,
237
+ })(transformWidget);
238
+ }
239
+ else if (fieldModel.type === "Table") {
240
+ const tableContent = (0, nestable_1.isTableContent)(fieldContent)
241
+ ? fieldContent
242
+ : undefined;
243
+ transformedField = (0, nestable_1.traverseTableContentWithModel)({
244
+ path: fieldPath,
245
+ key: fieldKey,
246
+ model: fieldModel,
247
+ content: tableContent,
248
+ })(transformWidget);
249
+ }
250
+ else {
251
+ const nestableContent = (0, nestable_1.isNestableContent)(fieldContent)
252
+ ? fieldContent
253
+ : undefined;
254
+ transformedField = transformWidget({
255
+ path: fieldPath,
256
+ key: fieldKey,
257
+ apiId: fieldKey,
258
+ model: fieldModel,
259
+ content: nestableContent,
260
+ });
261
+ }
262
+ if (!transformedField)
263
+ return acc;
264
+ return {
265
+ ...acc,
266
+ [fieldKey]: transformedField,
267
+ };
268
+ }, {});
269
+ const items = (0, GroupContent_1.traverseGroupItemsContentWithModel)({
270
+ path: path.concat([{ key: "items", type: "items" }]),
271
+ model: (_b = model.fields.items) !== null && _b !== void 0 ? _b : {},
272
+ content: content.widget.items,
273
+ })(transformWidget);
274
+ return transformSlice({
275
+ key: sliceKey,
276
+ apiId: sliceName,
277
+ path,
278
+ model,
279
+ content: {
280
+ ...content,
281
+ widget: {
282
+ __TYPE__: "SharedSliceContent",
283
+ variation: content.widget.variation,
284
+ primary,
285
+ items,
286
+ },
287
+ },
288
+ });
289
+ };
290
+ }
291
+ function traverseCompositeSliceContentWithModel({ path, sliceKey, sliceName, model, content, }) {
292
+ return (transformWidget, transformSlice) => {
293
+ var _a, _b, _c, _d;
294
+ if (!content || !(0, SliceItem_1.isCompositeSliceItemContent)(content)) {
295
+ return undefined;
296
+ }
297
+ const nonRepeatModel = model.type === "SharedSlice"
298
+ ? (_a = model.fields.primary) !== null && _a !== void 0 ? _a : {}
299
+ : (_b = model["non-repeat"]) !== null && _b !== void 0 ? _b : {};
300
+ const repeatModel = model.type === "SharedSlice"
301
+ ? (_c = model.fields.items) !== null && _c !== void 0 ? _c : {}
302
+ : (_d = model.repeat) !== null && _d !== void 0 ? _d : {};
303
+ const nonRepeat = Object.entries(nonRepeatModel).reduce((acc, [fieldKey, fieldModel]) => {
304
+ const fieldContent = content.widget.nonRepeat[fieldKey];
305
+ const fieldPath = path.concat([
306
+ { key: "non-repeat", type: "primary" },
307
+ { key: fieldKey, type: "Widget" },
308
+ ]);
309
+ const nestableContent = (0, nestable_1.isNestableContent)(fieldContent)
310
+ ? fieldContent
311
+ : undefined;
312
+ const transformedField = transformWidget({
313
+ path: fieldPath,
314
+ key: fieldKey,
315
+ apiId: sliceName,
316
+ model: fieldModel,
317
+ content: nestableContent,
318
+ });
319
+ if (!transformedField || !(0, nestable_1.isNestableContent)(transformedField))
320
+ return acc;
321
+ return {
322
+ ...acc,
323
+ [fieldKey]: transformedField,
324
+ };
325
+ }, {});
326
+ const repeat = (0, GroupContent_1.traverseGroupItemsContentWithModel)({
327
+ path: path.concat([{ key: "repeat", type: "items" }]),
328
+ model: repeatModel,
329
+ content: content.widget.repeat,
330
+ })(transformWidget);
331
+ return transformSlice({
332
+ key: sliceKey,
333
+ apiId: sliceName,
334
+ path,
335
+ model: model.type === "SharedSlice" ? model : model,
336
+ content: {
337
+ ...content,
338
+ widget: {
339
+ __TYPE__: content.widget.__TYPE__,
340
+ nonRepeat,
341
+ repeat,
342
+ },
343
+ },
344
+ });
345
+ };
346
+ }
347
+ function traverseSlicesWithModel({ path, key, model, content, }) {
348
+ return ({ transformWidget, transformSlice }) => {
349
+ var _a, _b, _c;
350
+ const choices = (_b = (_a = model.config) === null || _a === void 0 ? void 0 : _a.choices) !== null && _b !== void 0 ? _b : {};
351
+ const value = ((_c = content === null || content === void 0 ? void 0 : content.value) !== null && _c !== void 0 ? _c : []).reduce((acc, sliceContent) => {
352
+ const sliceName = sliceContent.name;
353
+ const sliceModel = choices[sliceName];
354
+ if (!sliceModel) {
355
+ return acc;
356
+ }
357
+ const slicePath = path.concat({
358
+ key: sliceContent.key,
359
+ type: (0, customtypes_1.isStaticSharedSlice)(sliceModel)
360
+ ? "SharedSlice"
361
+ : (0, customtypes_1.isCompositeSlice)(sliceModel)
362
+ ? "Slice"
363
+ : "LegacySlice",
364
+ });
365
+ let convertedSlice;
366
+ if ((0, customtypes_1.isStaticSharedSlice)(sliceModel)) {
367
+ if ((0, SliceItem_1.isSharedSliceItemContent)(sliceContent)) {
368
+ const variation = sliceModel.variations.find((v) => v.id === sliceContent.widget.variation);
369
+ if (variation) {
370
+ const variationFields = buildVariationFields(sliceModel, variation);
371
+ convertedSlice = traverseSharedSliceContentWithModel({
372
+ path: slicePath,
373
+ sliceKey: sliceContent.key,
374
+ sliceName,
375
+ model: variationFields,
376
+ content: sliceContent,
377
+ })(transformWidget, transformSlice);
378
+ }
379
+ }
380
+ else if ((0, SliceItem_1.isCompositeSliceItemContent)(sliceContent)) {
381
+ const defaultVariation = sliceModel.variations[0];
382
+ if (defaultVariation) {
383
+ const variationFields = buildVariationFields(sliceModel, defaultVariation);
384
+ convertedSlice = traverseCompositeSliceContentWithModel({
385
+ path: slicePath,
386
+ sliceKey: sliceContent.key,
387
+ sliceName,
388
+ model: variationFields,
389
+ content: sliceContent,
390
+ })(transformWidget, transformSlice);
391
+ }
392
+ }
393
+ }
394
+ else if ((0, customtypes_1.isCompositeSlice)(sliceModel)) {
395
+ if ((0, SliceItem_1.isCompositeSliceItemContent)(sliceContent)) {
396
+ convertedSlice = traverseCompositeSliceContentWithModel({
397
+ path: slicePath,
398
+ sliceKey: sliceContent.key,
399
+ sliceName,
400
+ model: sliceModel,
401
+ content: sliceContent,
402
+ })(transformWidget, transformSlice);
403
+ }
404
+ }
405
+ else if ((0, customtypes_1.isLegacySlice)(sliceModel)) {
406
+ if ((0, SliceItem_1.isSimpleSliceItemContent)(sliceContent)) {
407
+ let convertedWidget;
408
+ if ((0, GroupContent_1.isGroupContent)(sliceContent.widget)) {
409
+ const groupModel = (sliceModel === null || sliceModel === void 0 ? void 0 : sliceModel.type) === "Group" ? sliceModel : undefined;
410
+ if (groupModel) {
411
+ convertedWidget = (0, GroupContent_1.traverseGroupContentWithModel)({
412
+ path: slicePath,
413
+ key: sliceContent.key,
414
+ model: groupModel,
415
+ content: sliceContent.widget,
416
+ })(transformWidget);
417
+ }
418
+ }
419
+ else if ((0, nestable_1.isNestableContent)(sliceContent.widget)) {
420
+ const nestableModel = (sliceModel === null || sliceModel === void 0 ? void 0 : sliceModel.type) !== "Group" ? sliceModel : undefined;
421
+ if (nestableModel) {
422
+ convertedWidget = transformWidget({
423
+ key: sliceContent.key,
424
+ apiId: sliceName,
425
+ path: slicePath,
426
+ model: nestableModel,
427
+ content: sliceContent.widget,
428
+ });
429
+ }
430
+ }
431
+ convertedSlice =
432
+ convertedWidget &&
433
+ transformSlice({
434
+ key: sliceContent.key,
435
+ apiId: sliceName,
436
+ path: slicePath,
437
+ model: sliceModel,
438
+ content: {
439
+ ...sliceContent,
440
+ widget: convertedWidget,
441
+ },
442
+ });
443
+ }
444
+ }
445
+ if (convertedSlice) {
446
+ acc.push(convertedSlice);
447
+ }
448
+ return acc;
449
+ }, []);
450
+ return transformWidget({
451
+ path,
452
+ key,
453
+ apiId: key,
454
+ model,
455
+ content: content
456
+ ? {
457
+ __TYPE__: content.__TYPE__,
458
+ value,
459
+ }
460
+ : undefined,
461
+ });
462
+ };
463
+ }
464
+ exports.traverseSlicesWithModel = traverseSlicesWithModel;
@@ -26,6 +26,20 @@ export declare type TraverseWidgetContentFn<ContentTransformMode extends "preser
26
26
  model?: D | undefined;
27
27
  content: C;
28
28
  }) => ([ContentTransformMode] extends ["preserve"] ? C : WidgetContent) | undefined;
29
+ export declare type TraverseWidgetContentWithModelFn<ContentTransformMode extends "preserve" | "widen" = "preserve"> = <C extends WidgetContent | undefined, D extends NestableWidget | StaticSlices | Group | UID>({ path, key, apiId, model, content, }: {
30
+ path: ContentPath;
31
+ key: string;
32
+ apiId: string;
33
+ model: D;
34
+ content: C;
35
+ }) => ([ContentTransformMode] extends ["preserve"] ? C : WidgetContent) | undefined;
36
+ export declare type TraverseSliceContentWithModelFn = <S extends SliceItemContent | SharedSliceItemContent | undefined, D extends VariationFields | CompositeSlice | Group | NestableWidget>({ path, key, apiId, model, content, }: {
37
+ path: ContentPath;
38
+ key: string;
39
+ apiId: string;
40
+ model: D;
41
+ content: S;
42
+ }) => S | SharedSliceItemContent | undefined;
29
43
  export declare type ContentPathEntry = {
30
44
  type: "CustomType" | "Widget" | "SharedSlice" | "Slice" | "LegacySlice" | "GroupItem" | "primary" | "items" | "RepeatableItem";
31
45
  key: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismicio/types-internal",
3
- "version": "3.16.2-alpha.0",
3
+ "version": "3.16.2-alpha.2",
4
4
  "description": "Prismic types for Custom Types and Prismic Data",
5
5
  "keywords": [
6
6
  "typescript",
@@ -14,20 +14,6 @@
14
14
  "author": "Prismic <contact@prismic.io> (https://prismic.io)",
15
15
  "main": "lib/index.js",
16
16
  "types": "lib/index.d.ts",
17
- "exports": {
18
- ".": {
19
- "types": "./lib/index.d.ts",
20
- "default": "./lib/index.js"
21
- },
22
- "./lib/customtypes": {
23
- "types": "./lib/customtypes/index.d.ts",
24
- "default": "./lib/customtypes/index.js"
25
- },
26
- "./lib/content": {
27
- "types": "./lib/content/index.d.ts",
28
- "default": "./lib/content/index.js"
29
- }
30
- },
31
17
  "files": [
32
18
  "lib",
33
19
  "src"
@@ -15,14 +15,21 @@ import {
15
15
  import {
16
16
  groupContentWithDefaultValues,
17
17
  isGroupContent,
18
+ isNestableContent,
19
+ isRepeatableContent,
18
20
  isSlicesContent,
21
+ isTableContent,
19
22
  migrateSliceItem,
20
23
  NestableContentDefaultValue,
21
24
  slicesContentWithDefaultValues,
22
25
  traverseGroupContent,
26
+ traverseGroupContentWithModel,
23
27
  traverseRepeatableContent,
28
+ traverseRepeatableContentWithModel,
24
29
  traverseSlices,
30
+ traverseSlicesWithModel,
25
31
  traverseTableContent,
32
+ traverseTableContentWithModel,
26
33
  WidgetContent,
27
34
  WidgetLegacy,
28
35
  } from "./fields"
@@ -35,7 +42,9 @@ import {
35
42
  import {
36
43
  ContentPath,
37
44
  TraverseSliceContentFn,
45
+ TraverseSliceContentWithModelFn,
38
46
  TraverseWidgetContentFn,
47
+ TraverseWidgetContentWithModelFn,
39
48
  } from "./utils"
40
49
 
41
50
  export const Document = t.record(WidgetKey, WidgetContent)
@@ -407,3 +416,124 @@ export function migrateDocument(
407
416
  transformSlice: migrateSliceItem,
408
417
  })
409
418
  }
419
+
420
+ export function traverseDocumentWithModel({
421
+ document,
422
+ customType,
423
+ }: {
424
+ document: Document
425
+ customType:
426
+ | StaticCustomType
427
+ | {
428
+ customTypeId: string
429
+ fields: Record<string, StaticWidget>
430
+ }
431
+ }) {
432
+ const model = StaticCustomType.is(customType)
433
+ ? simplifyCustomType(customType)
434
+ : customType
435
+
436
+ return ({
437
+ transformWidget,
438
+ transformSlice,
439
+ }: {
440
+ transformWidget: TraverseWidgetContentWithModelFn
441
+ transformSlice: TraverseSliceContentWithModelFn
442
+ }): Document => {
443
+ return Object.entries(model.fields).reduce<Document>(
444
+ (acc, [key, fieldModel]) => {
445
+ const content = document[key]
446
+
447
+ const path = ContentPath.make([
448
+ { key: model.customTypeId, type: "CustomType" },
449
+ { key, type: "Widget" },
450
+ ])
451
+
452
+ const transformedWidget = (() => {
453
+ switch (fieldModel.type) {
454
+ case "Choice":
455
+ case "Slices": {
456
+ const slicesContent = isSlicesContent(content)
457
+ ? content
458
+ : undefined
459
+ return traverseSlicesWithModel({
460
+ path,
461
+ key,
462
+ model: fieldModel,
463
+ content: slicesContent,
464
+ })({ transformWidget, transformSlice })
465
+ }
466
+ case "Group": {
467
+ const groupContent = isGroupContent(content) ? content : undefined
468
+ return traverseGroupContentWithModel({
469
+ path,
470
+ key,
471
+ model: fieldModel,
472
+ content: groupContent,
473
+ })(transformWidget)
474
+ }
475
+ case "Link": {
476
+ if (fieldModel.config?.repeat === true) {
477
+ const repeatableContent = isRepeatableContent(content)
478
+ ? content
479
+ : undefined
480
+ return traverseRepeatableContentWithModel({
481
+ path,
482
+ key,
483
+ model: fieldModel,
484
+ content: repeatableContent,
485
+ })(transformWidget)
486
+ }
487
+ const nestableContent = isNestableContent(content)
488
+ ? content
489
+ : undefined
490
+ return transformWidget({
491
+ path,
492
+ key,
493
+ apiId: key,
494
+ model: fieldModel,
495
+ content: nestableContent,
496
+ })
497
+ }
498
+ case "Table": {
499
+ const tableContent = isTableContent(content) ? content : undefined
500
+ return traverseTableContentWithModel({
501
+ path,
502
+ key,
503
+ model: fieldModel,
504
+ content: tableContent,
505
+ })(transformWidget)
506
+ }
507
+ case "UID": {
508
+ return transformWidget({
509
+ path,
510
+ key,
511
+ apiId: key,
512
+ model: fieldModel,
513
+ content,
514
+ })
515
+ }
516
+ default: {
517
+ const nestableContent = isNestableContent(content)
518
+ ? content
519
+ : undefined
520
+ return transformWidget({
521
+ path,
522
+ key,
523
+ apiId: key,
524
+ model: fieldModel,
525
+ content: nestableContent,
526
+ })
527
+ }
528
+ }
529
+ })()
530
+
531
+ return {
532
+ ...acc,
533
+ ...(transformedWidget ? { [key]: transformedWidget } : {}),
534
+ }
535
+ },
536
+ {},
537
+ )
538
+ }
539
+ }
@@ -6,6 +6,7 @@ import * as t from "io-ts"
6
6
  import {
7
7
  type Group,
8
8
  type NestableWidget,
9
+ type NestedGroup,
9
10
  GroupFieldType,
10
11
  } from "../../customtypes"
11
12
  import {
@@ -14,7 +15,12 @@ import {
14
15
  LegacyContentCtx,
15
16
  WithTypes,
16
17
  } from "../LegacyContentCtx"
17
- import { ContentPath, hasContentType, TraverseWidgetContentFn } from "../utils"
18
+ import {
19
+ ContentPath,
20
+ hasContentType,
21
+ TraverseWidgetContentFn,
22
+ TraverseWidgetContentWithModelFn,
23
+ } from "../utils"
18
24
  import {
19
25
  isNestableContent,
20
26
  isRepeatableContent,
@@ -22,7 +28,9 @@ import {
22
28
  NestableContent,
23
29
  NestableLegacy,
24
30
  traverseRepeatableContent,
31
+ traverseRepeatableContentWithModel,
25
32
  traverseTableContent,
33
+ traverseTableContentWithModel,
26
34
  } from "./nestable"
27
35
  import { repeatableContentWithDefaultNestableContentValues } from "./withDefaultValues"
28
36
 
@@ -327,3 +335,132 @@ export function traverseGroupItemsContent({
327
335
  })
328
336
  }
329
337
  }
338
+
339
+ export function traverseGroupContentWithModel({
340
+ path,
341
+ key,
342
+ model,
343
+ content,
344
+ }: {
345
+ path: ContentPath
346
+ key: string
347
+ model: Group
348
+ content: GroupContent | undefined
349
+ }): (transform: TraverseWidgetContentWithModelFn) => GroupContent | undefined {
350
+ return (transform) => {
351
+ const groupItems = traverseGroupItemsContentWithModel({
352
+ path,
353
+ model: model.config?.fields ?? {},
354
+ content: content?.value,
355
+ })(transform)
356
+
357
+ return transform({
358
+ path,
359
+ key,
360
+ apiId: key,
361
+ model,
362
+ content: content
363
+ ? {
364
+ __TYPE__: content.__TYPE__,
365
+ value: groupItems,
366
+ }
367
+ : undefined,
368
+ })
369
+ }
370
+ }
371
+
372
+ export function traverseGroupItemsContentWithModel({
373
+ path,
374
+ model,
375
+ content,
376
+ }: {
377
+ path: ContentPath
378
+ model: Record<string, NestableWidget | Group | NestedGroup>
379
+ content: Array<GroupItemContent> | undefined
380
+ }): (transform: TraverseWidgetContentWithModelFn) => Array<GroupItemContent> {
381
+ return (transform) => {
382
+ if (!content) return []
383
+
384
+ return content.map((groupItem) => {
385
+ const groupItemPath = path.concat([
386
+ { key: groupItem.key, type: "GroupItem" },
387
+ ])
388
+
389
+ const groupItemFields = Object.entries(model).reduce<
390
+ GroupItemContent["value"]
391
+ >((acc, [fieldKey, fieldModel]) => {
392
+ const fieldContent = groupItem.value.find(
393
+ ([key]) => key === fieldKey,
394
+ )?.[1]
395
+
396
+ const fieldPath = groupItemPath.concat([
397
+ { key: fieldKey, type: "Widget" },
398
+ ])
399
+
400
+ let transformedField: NestableContent | GroupContent | undefined
401
+ if (fieldModel.type === "Group") {
402
+ const groupContent = isGroupContent(fieldContent)
403
+ ? fieldContent
404
+ : undefined
405
+ transformedField = traverseGroupContentWithModel({
406
+ path: fieldPath,
407
+ key: fieldKey,
408
+ model: fieldModel,
409
+ content: groupContent,
410
+ })(transform)
411
+ } else if (
412
+ fieldModel.type === "Link" &&
413
+ fieldModel.config?.repeat === true
414
+ ) {
415
+ const repeatableContent = isRepeatableContent(fieldContent)
416
+ ? fieldContent
417
+ : undefined
418
+ transformedField = traverseRepeatableContentWithModel({
419
+ path: fieldPath,
420
+ key: fieldKey,
421
+ model: fieldModel,
422
+ content: repeatableContent,
423
+ })(transform)
424
+ } else if (fieldModel.type === "Table") {
425
+ const tableContent = isTableContent(fieldContent)
426
+ ? fieldContent
427
+ : undefined
428
+ transformedField = traverseTableContentWithModel({
429
+ path: fieldPath,
430
+ key: fieldKey,
431
+ model: fieldModel,
432
+ content: tableContent,
433
+ })(transform)
434
+ } else {
435
+ const nestableContent = isNestableContent(fieldContent)
436
+ ? fieldContent
437
+ : undefined
438
+ transformedField = transform({
439
+ path: fieldPath,
440
+ key: fieldKey,
441
+ apiId: fieldKey,
442
+ model: fieldModel,
443
+ content: nestableContent,
444
+ })
445
+ }
446
+
447
+ if (
448
+ !transformedField ||
449
+ !(
450
+ isNestableContent(transformedField) ||
451
+ isGroupContent(transformedField)
452
+ )
453
+ )
454
+ return acc
455
+
456
+ return acc.concat([[fieldKey, transformedField]])
457
+ }, [])
458
+
459
+ return {
460
+ __TYPE__: groupItem.__TYPE__,
461
+ key: groupItem.key,
462
+ value: groupItemFields,
463
+ }
464
+ })
465
+ }
466
+ }