@contentful/experiences-core 1.11.0-prerelease-20240723T1849-cedcf84.0 → 1.11.0-prerelease-20240726T1510-9e11672.0
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/entity/EntityStore.d.ts +1 -1
- package/dist/index.js +138 -143
- package/dist/index.js.map +1 -1
- package/dist/registries/breakpointsRegistry.d.ts +1 -1
- package/package.json +3 -3
|
@@ -19,9 +19,9 @@ declare class EntityStore extends EntityStoreBase {
|
|
|
19
19
|
get schemaVersion(): "2023-09-28" | undefined;
|
|
20
20
|
get breakpoints(): {
|
|
21
21
|
id: string;
|
|
22
|
-
displayName: string;
|
|
23
22
|
query: string;
|
|
24
23
|
previewSize: string;
|
|
24
|
+
displayName: string;
|
|
25
25
|
displayIcon?: "desktop" | "tablet" | "mobile" | undefined;
|
|
26
26
|
}[];
|
|
27
27
|
get dataSource(): Record<string, {
|
package/dist/index.js
CHANGED
|
@@ -1041,13 +1041,6 @@ z.union([
|
|
|
1041
1041
|
z.literal('2023-06-27'),
|
|
1042
1042
|
]);
|
|
1043
1043
|
|
|
1044
|
-
const PrimitiveValueSchema = z.union([
|
|
1045
|
-
z.string(),
|
|
1046
|
-
z.boolean(),
|
|
1047
|
-
z.number(),
|
|
1048
|
-
z.record(z.any(), z.any()),
|
|
1049
|
-
z.undefined(),
|
|
1050
|
-
]);
|
|
1051
1044
|
const DefinitionPropertyTypeSchema = z.enum([
|
|
1052
1045
|
'Text',
|
|
1053
1046
|
'RichText',
|
|
@@ -1064,122 +1057,13 @@ const DefinitionPropertyTypeSchema = z.enum([
|
|
|
1064
1057
|
const DefinitionPropertyKeySchema = z
|
|
1065
1058
|
.string()
|
|
1066
1059
|
.regex(/^[a-zA-Z0-9-_]{1,32}$/, { message: 'Property needs to match: /^[a-zA-Z0-9-_]{1,32}$/' });
|
|
1067
|
-
z.
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
description: z.string().optional(),
|
|
1075
|
-
group: z.string().optional(),
|
|
1076
|
-
defaultValue: PrimitiveValueSchema.optional(),
|
|
1077
|
-
})
|
|
1078
|
-
.superRefine((val, ctx) => {
|
|
1079
|
-
switch (val.type) {
|
|
1080
|
-
case 'Array':
|
|
1081
|
-
if (typeof val.defaultValue !== 'undefined') {
|
|
1082
|
-
ctx.addIssue({
|
|
1083
|
-
code: z.ZodIssueCode.custom,
|
|
1084
|
-
message: `defaultValue is not supported for "Array" type for ${ctx.path.join('.')}`,
|
|
1085
|
-
fatal: false,
|
|
1086
|
-
});
|
|
1087
|
-
}
|
|
1088
|
-
break;
|
|
1089
|
-
case 'Boolean':
|
|
1090
|
-
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'boolean') {
|
|
1091
|
-
ctx.addIssue({
|
|
1092
|
-
code: z.ZodIssueCode.custom,
|
|
1093
|
-
message: `defaultValue must be a boolean when type is "Boolean" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1094
|
-
fatal: false,
|
|
1095
|
-
});
|
|
1096
|
-
}
|
|
1097
|
-
break;
|
|
1098
|
-
case 'Date':
|
|
1099
|
-
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {
|
|
1100
|
-
ctx.addIssue({
|
|
1101
|
-
code: z.ZodIssueCode.custom,
|
|
1102
|
-
message: `defaultValue must be a string when type is "Date" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1103
|
-
fatal: false,
|
|
1104
|
-
});
|
|
1105
|
-
}
|
|
1106
|
-
break;
|
|
1107
|
-
case 'Hyperlink':
|
|
1108
|
-
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {
|
|
1109
|
-
ctx.addIssue({
|
|
1110
|
-
code: z.ZodIssueCode.custom,
|
|
1111
|
-
message: `defaultValue must be a string when type is "Hyperlink" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1112
|
-
fatal: false,
|
|
1113
|
-
});
|
|
1114
|
-
}
|
|
1115
|
-
break;
|
|
1116
|
-
case 'Link':
|
|
1117
|
-
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {
|
|
1118
|
-
ctx.addIssue({
|
|
1119
|
-
code: z.ZodIssueCode.custom,
|
|
1120
|
-
message: `defaultValue is not supported for "Link" type for ${ctx.path.join('.')}`,
|
|
1121
|
-
fatal: false,
|
|
1122
|
-
});
|
|
1123
|
-
}
|
|
1124
|
-
break;
|
|
1125
|
-
case 'Location':
|
|
1126
|
-
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {
|
|
1127
|
-
ctx.addIssue({
|
|
1128
|
-
code: z.ZodIssueCode.custom,
|
|
1129
|
-
message: `defaultValue must be an object when type is "Location" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1130
|
-
fatal: false,
|
|
1131
|
-
});
|
|
1132
|
-
}
|
|
1133
|
-
break;
|
|
1134
|
-
case 'Media':
|
|
1135
|
-
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {
|
|
1136
|
-
ctx.addIssue({
|
|
1137
|
-
code: z.ZodIssueCode.custom,
|
|
1138
|
-
message: `defaultValue must be a string when type is "Media" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1139
|
-
fatal: false,
|
|
1140
|
-
});
|
|
1141
|
-
}
|
|
1142
|
-
break;
|
|
1143
|
-
case 'Number':
|
|
1144
|
-
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'number') {
|
|
1145
|
-
ctx.addIssue({
|
|
1146
|
-
code: z.ZodIssueCode.custom,
|
|
1147
|
-
message: `defaultValue must be a number when type is "Number" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1148
|
-
fatal: false,
|
|
1149
|
-
});
|
|
1150
|
-
}
|
|
1151
|
-
break;
|
|
1152
|
-
case 'Object':
|
|
1153
|
-
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {
|
|
1154
|
-
ctx.addIssue({
|
|
1155
|
-
code: z.ZodIssueCode.custom,
|
|
1156
|
-
message: `defaultValue must be an object when type is "Object" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1157
|
-
fatal: false,
|
|
1158
|
-
});
|
|
1159
|
-
}
|
|
1160
|
-
break;
|
|
1161
|
-
case 'RichText':
|
|
1162
|
-
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {
|
|
1163
|
-
ctx.addIssue({
|
|
1164
|
-
code: z.ZodIssueCode.custom,
|
|
1165
|
-
message: `defaultValue must be an object when type is "RichText" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1166
|
-
fatal: false,
|
|
1167
|
-
});
|
|
1168
|
-
}
|
|
1169
|
-
break;
|
|
1170
|
-
case 'Text':
|
|
1171
|
-
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {
|
|
1172
|
-
ctx.addIssue({
|
|
1173
|
-
code: z.ZodIssueCode.custom,
|
|
1174
|
-
message: `defaultValue must be a string when type is "Text" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1175
|
-
fatal: false,
|
|
1176
|
-
});
|
|
1177
|
-
}
|
|
1178
|
-
break;
|
|
1179
|
-
}
|
|
1180
|
-
})),
|
|
1181
|
-
});
|
|
1182
|
-
|
|
1060
|
+
const PrimitiveValueSchema = z.union([
|
|
1061
|
+
z.string(),
|
|
1062
|
+
z.boolean(),
|
|
1063
|
+
z.number(),
|
|
1064
|
+
z.record(z.any(), z.any()),
|
|
1065
|
+
z.undefined(),
|
|
1066
|
+
]);
|
|
1183
1067
|
const uuidKeySchema = z
|
|
1184
1068
|
.string()
|
|
1185
1069
|
.regex(/^[a-zA-Z0-9-_]{1,21}$/, { message: 'Does not match /^[a-zA-Z0-9-_]{1,21}$/' });
|
|
@@ -1259,27 +1143,29 @@ const BaseComponentTreeNodeSchema = z.object({
|
|
|
1259
1143
|
const ComponentTreeNodeSchema = BaseComponentTreeNodeSchema.extend({
|
|
1260
1144
|
children: z.lazy(() => ComponentTreeNodeSchema.array()),
|
|
1261
1145
|
});
|
|
1262
|
-
const
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
displayName: z.string().optional(),
|
|
1278
|
-
}))
|
|
1279
|
-
.optional(),
|
|
1280
|
-
})
|
|
1146
|
+
const ComponentVariableSchema = z.object({
|
|
1147
|
+
displayName: z.string().optional(),
|
|
1148
|
+
type: DefinitionPropertyTypeSchema,
|
|
1149
|
+
description: z.string().optional(),
|
|
1150
|
+
group: z.string().optional(),
|
|
1151
|
+
defaultValue: PrimitiveValueSchema.or(ComponentPropertyValueSchema).optional(),
|
|
1152
|
+
validations: z
|
|
1153
|
+
.object({
|
|
1154
|
+
required: z.boolean().optional(),
|
|
1155
|
+
format: z.literal('URL').optional(),
|
|
1156
|
+
in: z
|
|
1157
|
+
.array(z.object({
|
|
1158
|
+
value: z.union([z.string(), z.number()]),
|
|
1159
|
+
displayName: z.string().optional(),
|
|
1160
|
+
}))
|
|
1281
1161
|
.optional(),
|
|
1282
|
-
})
|
|
1162
|
+
})
|
|
1163
|
+
.optional(),
|
|
1164
|
+
});
|
|
1165
|
+
const ComponentVariablesSchema = z.record(z.string().regex(/^[a-zA-Z0-9-_]{1,54}$/), // Here the key is <variableName>_<nanoidId> so we need to allow for a longer length
|
|
1166
|
+
ComponentVariableSchema);
|
|
1167
|
+
const ComponentSettingsSchema = z.object({
|
|
1168
|
+
variableDefinitions: ComponentVariablesSchema,
|
|
1283
1169
|
});
|
|
1284
1170
|
const UsedComponentsSchema = z.array(z.object({
|
|
1285
1171
|
sys: z.object({
|
|
@@ -1358,6 +1244,115 @@ z
|
|
|
1358
1244
|
})
|
|
1359
1245
|
.superRefine(componentSettingsRefinement);
|
|
1360
1246
|
|
|
1247
|
+
z.object({
|
|
1248
|
+
id: DefinitionPropertyKeySchema,
|
|
1249
|
+
variables: z.record(DefinitionPropertyKeySchema, ComponentVariableSchema.extend({
|
|
1250
|
+
defaultValue: PrimitiveValueSchema.optional(),
|
|
1251
|
+
}).superRefine((val, ctx) => {
|
|
1252
|
+
switch (val.type) {
|
|
1253
|
+
case 'Array':
|
|
1254
|
+
if (typeof val.defaultValue !== 'undefined') {
|
|
1255
|
+
ctx.addIssue({
|
|
1256
|
+
code: z.ZodIssueCode.custom,
|
|
1257
|
+
message: `defaultValue is not supported for "Array" type for ${ctx.path.join('.')}`,
|
|
1258
|
+
fatal: false,
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
break;
|
|
1262
|
+
case 'Boolean':
|
|
1263
|
+
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'boolean') {
|
|
1264
|
+
ctx.addIssue({
|
|
1265
|
+
code: z.ZodIssueCode.custom,
|
|
1266
|
+
message: `defaultValue must be a boolean when type is "Boolean" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1267
|
+
fatal: false,
|
|
1268
|
+
});
|
|
1269
|
+
}
|
|
1270
|
+
break;
|
|
1271
|
+
case 'Date':
|
|
1272
|
+
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {
|
|
1273
|
+
ctx.addIssue({
|
|
1274
|
+
code: z.ZodIssueCode.custom,
|
|
1275
|
+
message: `defaultValue must be a string when type is "Date" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1276
|
+
fatal: false,
|
|
1277
|
+
});
|
|
1278
|
+
}
|
|
1279
|
+
break;
|
|
1280
|
+
case 'Hyperlink':
|
|
1281
|
+
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {
|
|
1282
|
+
ctx.addIssue({
|
|
1283
|
+
code: z.ZodIssueCode.custom,
|
|
1284
|
+
message: `defaultValue must be a string when type is "Hyperlink" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1285
|
+
fatal: false,
|
|
1286
|
+
});
|
|
1287
|
+
}
|
|
1288
|
+
break;
|
|
1289
|
+
case 'Link':
|
|
1290
|
+
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {
|
|
1291
|
+
ctx.addIssue({
|
|
1292
|
+
code: z.ZodIssueCode.custom,
|
|
1293
|
+
message: `defaultValue is not supported for "Link" type for ${ctx.path.join('.')}`,
|
|
1294
|
+
fatal: false,
|
|
1295
|
+
});
|
|
1296
|
+
}
|
|
1297
|
+
break;
|
|
1298
|
+
case 'Location':
|
|
1299
|
+
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {
|
|
1300
|
+
ctx.addIssue({
|
|
1301
|
+
code: z.ZodIssueCode.custom,
|
|
1302
|
+
message: `defaultValue must be an object when type is "Location" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1303
|
+
fatal: false,
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
break;
|
|
1307
|
+
case 'Media':
|
|
1308
|
+
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {
|
|
1309
|
+
ctx.addIssue({
|
|
1310
|
+
code: z.ZodIssueCode.custom,
|
|
1311
|
+
message: `defaultValue must be a string when type is "Media" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1312
|
+
fatal: false,
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1315
|
+
break;
|
|
1316
|
+
case 'Number':
|
|
1317
|
+
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'number') {
|
|
1318
|
+
ctx.addIssue({
|
|
1319
|
+
code: z.ZodIssueCode.custom,
|
|
1320
|
+
message: `defaultValue must be a number when type is "Number" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1321
|
+
fatal: false,
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
break;
|
|
1325
|
+
case 'Object':
|
|
1326
|
+
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {
|
|
1327
|
+
ctx.addIssue({
|
|
1328
|
+
code: z.ZodIssueCode.custom,
|
|
1329
|
+
message: `defaultValue must be an object when type is "Object" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1330
|
+
fatal: false,
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
break;
|
|
1334
|
+
case 'RichText':
|
|
1335
|
+
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {
|
|
1336
|
+
ctx.addIssue({
|
|
1337
|
+
code: z.ZodIssueCode.custom,
|
|
1338
|
+
message: `defaultValue must be an object when type is "RichText" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1339
|
+
fatal: false,
|
|
1340
|
+
});
|
|
1341
|
+
}
|
|
1342
|
+
break;
|
|
1343
|
+
case 'Text':
|
|
1344
|
+
if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {
|
|
1345
|
+
ctx.addIssue({
|
|
1346
|
+
code: z.ZodIssueCode.custom,
|
|
1347
|
+
message: `defaultValue must be a string when type is "Text" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,
|
|
1348
|
+
fatal: false,
|
|
1349
|
+
});
|
|
1350
|
+
}
|
|
1351
|
+
break;
|
|
1352
|
+
}
|
|
1353
|
+
})),
|
|
1354
|
+
});
|
|
1355
|
+
|
|
1361
1356
|
var CodeNames;
|
|
1362
1357
|
(function (CodeNames) {
|
|
1363
1358
|
CodeNames["Type"] = "type";
|