@prismicio/types-internal 3.2.0-alpha.0 → 3.2.0-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.
@@ -62,15 +62,18 @@ function traverseRepeatableContent({ path, key, apiId, model, content, }) {
62
62
  const itemPath = path.concat([
63
63
  { key: index.toString(), type: "Widget" },
64
64
  ]);
65
- const overriddenModel = model;
66
- if ((overriddenModel === null || overriddenModel === void 0 ? void 0 : overriddenModel.config) && overriddenModel.type === "Link") {
67
- overriddenModel.config.repeat = false;
68
- }
65
+ // Content inside repeatable can't be repeatable.
66
+ const newModel = (model === null || model === void 0 ? void 0 : model.type) === "Link" && model.config
67
+ ? {
68
+ ...model,
69
+ config: { ...model.config, repeat: false },
70
+ }
71
+ : model;
69
72
  const transformedField = transform({
70
73
  path: itemPath,
71
74
  key: key,
72
75
  apiId: apiId,
73
- model: overriddenModel,
76
+ model: newModel,
74
77
  content: fieldContent,
75
78
  });
76
79
  // Can happen if the transform function returns undefined to filter out a field
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prismicio/types-internal",
3
- "version": "3.2.0-alpha.0",
3
+ "version": "3.2.0-alpha.2",
4
4
  "description": "Prismic types for Custom Types and Prismic Data",
5
5
  "keywords": [
6
6
  "typescript",
@@ -113,16 +113,20 @@ export function traverseRepeatableContent({
113
113
  { key: index.toString(), type: "Widget" },
114
114
  ])
115
115
 
116
- const overriddenModel = model
117
- if (overriddenModel?.config && overriddenModel.type === "Link") {
118
- overriddenModel.config.repeat = false
119
- }
116
+ // Content inside repeatable can't be repeatable.
117
+ const newModel =
118
+ model?.type === "Link" && model.config
119
+ ? {
120
+ ...model,
121
+ config: { ...model.config, repeat: false },
122
+ }
123
+ : model
120
124
 
121
125
  const transformedField = transform({
122
126
  path: itemPath,
123
127
  key: key,
124
128
  apiId: apiId,
125
- model: overriddenModel,
129
+ model: newModel,
126
130
  content: fieldContent,
127
131
  })
128
132