@prismicio/types-internal 2.0.0-beta.0 → 2.0.0-beta.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.
- package/lib/common/WidgetKey.d.ts +1 -1
- package/lib/common/WidgetKey.js +1 -1
- package/lib/common/index.js +1 -1
- package/lib/content/Document.d.ts +20 -100
- package/lib/content/Document.js +1 -1
- package/lib/content/LegacyContentCtx.d.ts +2 -2
- package/lib/content/LegacyContentCtx.js +1 -1
- package/lib/content/fields/EmptyContent.d.ts +1 -1
- package/lib/content/fields/EmptyContent.js +1 -1
- package/lib/content/fields/GroupContent.d.ts +8 -28
- package/lib/content/fields/GroupContent.js +12 -5
- package/lib/content/fields/UIDContent.d.ts +1 -1
- package/lib/content/fields/UIDContent.js +1 -1
- package/lib/content/fields/WidgetContent.d.ts +18 -98
- package/lib/content/fields/WidgetContent.js +1 -1
- package/lib/content/fields/index.js +6 -6
- package/lib/content/fields/nestable/BooleanContent.d.ts +1 -1
- package/lib/content/fields/nestable/BooleanContent.js +1 -1
- package/lib/content/fields/nestable/EmbedContent.d.ts +2 -2
- package/lib/content/fields/nestable/EmbedContent.js +1 -1
- package/lib/content/fields/nestable/FieldContent/ColorContent.d.ts +1 -1
- package/lib/content/fields/nestable/FieldContent/ColorContent.js +2 -2
- package/lib/content/fields/nestable/FieldContent/DateContent.d.ts +1 -1
- package/lib/content/fields/nestable/FieldContent/DateContent.js +2 -2
- package/lib/content/fields/nestable/FieldContent/NumberContent.d.ts +1 -1
- package/lib/content/fields/nestable/FieldContent/NumberContent.js +2 -2
- package/lib/content/fields/nestable/FieldContent/RangeContent.d.ts +1 -1
- package/lib/content/fields/nestable/FieldContent/RangeContent.js +2 -2
- package/lib/content/fields/nestable/FieldContent/SelectContent.d.ts +1 -1
- package/lib/content/fields/nestable/FieldContent/SelectContent.js +2 -2
- package/lib/content/fields/nestable/FieldContent/TextContent.d.ts +1 -1
- package/lib/content/fields/nestable/FieldContent/TextContent.js +2 -2
- package/lib/content/fields/nestable/FieldContent/TimestampContent.d.ts +1 -1
- package/lib/content/fields/nestable/FieldContent/TimestampContent.js +2 -2
- package/lib/content/fields/nestable/FieldContent/index.d.ts +2 -2
- package/lib/content/fields/nestable/FieldContent/index.js +9 -9
- package/lib/content/fields/nestable/GeoPointContent.d.ts +1 -1
- package/lib/content/fields/nestable/GeoPointContent.js +1 -1
- package/lib/content/fields/nestable/ImageContent.d.ts +2 -2
- package/lib/content/fields/nestable/ImageContent.js +1 -1
- package/lib/content/fields/nestable/IntegrationFieldContent.d.ts +1 -1
- package/lib/content/fields/nestable/IntegrationFieldContent.js +1 -1
- package/lib/content/fields/nestable/LinkContent.d.ts +6 -6
- package/lib/content/fields/nestable/LinkContent.js +1 -1
- package/lib/content/fields/nestable/NestableContent.d.ts +4 -14
- package/lib/content/fields/nestable/NestableContent.js +1 -1
- package/lib/content/fields/nestable/RichTextContent/Blocks.d.ts +11 -31
- package/lib/content/fields/nestable/RichTextContent/Blocks.js +15 -11
- package/lib/content/fields/nestable/RichTextContent/index.d.ts +3 -13
- package/lib/content/fields/nestable/RichTextContent/index.js +3 -3
- package/lib/content/fields/nestable/SeparatorContent.d.ts +1 -1
- package/lib/content/fields/nestable/SeparatorContent.js +1 -1
- package/lib/content/fields/nestable/index.js +10 -10
- package/lib/content/fields/slices/Slice/CompositeSliceContent.d.ts +5 -25
- package/lib/content/fields/slices/Slice/CompositeSliceContent.js +1 -1
- package/lib/content/fields/slices/Slice/RepeatableContent.d.ts +2 -12
- package/lib/content/fields/slices/Slice/RepeatableContent.js +1 -1
- package/lib/content/fields/slices/Slice/SharedSliceContent.d.ts +5 -25
- package/lib/content/fields/slices/Slice/SharedSliceContent.js +1 -1
- package/lib/content/fields/slices/Slice/SimpleSliceContent.d.ts +279 -27
- package/lib/content/fields/slices/Slice/SimpleSliceContent.js +6 -2
- package/lib/content/fields/slices/Slice/index.d.ts +285 -73
- package/lib/content/fields/slices/Slice/index.js +4 -4
- package/lib/content/fields/slices/SliceItem.d.ts +13 -73
- package/lib/content/fields/slices/SliceItem.js +1 -1
- package/lib/content/fields/slices/SlicesContent.d.ts +14 -74
- package/lib/content/fields/slices/SlicesContent.js +1 -1
- package/lib/content/fields/slices/index.js +3 -3
- package/lib/content/index.js +3 -3
- package/lib/content/utils.d.ts +2 -2
- package/lib/content/utils.js +2 -1
- package/lib/customtypes/CustomType.d.ts +14 -2
- package/lib/customtypes/CustomType.js +7 -2
- package/lib/customtypes/Section.d.ts +2 -2
- package/lib/customtypes/Section.js +1 -1
- package/lib/customtypes/diff/Changes.d.ts +4 -4
- package/lib/customtypes/diff/SharedSlice.d.ts +671 -3
- package/lib/customtypes/diff/Variation.d.ts +657 -3
- package/lib/customtypes/diff/index.js +3 -3
- package/lib/customtypes/index.js +4 -4
- package/lib/customtypes/widgets/Group.d.ts +2 -2
- package/lib/customtypes/widgets/Group.js +1 -1
- package/lib/customtypes/widgets/UID.d.ts +2 -2
- package/lib/customtypes/widgets/UID.js +1 -1
- package/lib/customtypes/widgets/Widget.d.ts +3 -3
- package/lib/customtypes/widgets/Widget.js +1 -1
- package/lib/customtypes/widgets/index.js +6 -6
- package/lib/customtypes/widgets/nestable/BooleanField.d.ts +2 -2
- package/lib/customtypes/widgets/nestable/BooleanField.js +1 -1
- package/lib/customtypes/widgets/nestable/Color.d.ts +2 -2
- package/lib/customtypes/widgets/nestable/Color.js +1 -1
- package/lib/customtypes/widgets/nestable/Date.d.ts +2 -2
- package/lib/customtypes/widgets/nestable/Date.js +1 -1
- package/lib/customtypes/widgets/nestable/Embed.d.ts +2 -2
- package/lib/customtypes/widgets/nestable/Embed.js +1 -1
- package/lib/customtypes/widgets/nestable/GeoPoint.d.ts +2 -2
- package/lib/customtypes/widgets/nestable/GeoPoint.js +1 -1
- package/lib/customtypes/widgets/nestable/Image.d.ts +3 -3
- package/lib/customtypes/widgets/nestable/Image.js +2 -2
- package/lib/customtypes/widgets/nestable/IntegrationField.d.ts +2 -2
- package/lib/customtypes/widgets/nestable/IntegrationField.js +1 -1
- package/lib/customtypes/widgets/nestable/Link.d.ts +2 -2
- package/lib/customtypes/widgets/nestable/Link.js +1 -1
- package/lib/customtypes/widgets/nestable/NestableWidget.d.ts +2 -2
- package/lib/customtypes/widgets/nestable/NestableWidget.js +1 -1
- package/lib/customtypes/widgets/nestable/Number.d.ts +2 -2
- package/lib/customtypes/widgets/nestable/Number.js +1 -1
- package/lib/customtypes/widgets/nestable/Range.d.ts +2 -2
- package/lib/customtypes/widgets/nestable/Range.js +1 -1
- package/lib/customtypes/widgets/nestable/RichText.d.ts +3 -3
- package/lib/customtypes/widgets/nestable/RichText.js +2 -2
- package/lib/customtypes/widgets/nestable/Select.d.ts +2 -2
- package/lib/customtypes/widgets/nestable/Select.js +1 -1
- package/lib/customtypes/widgets/nestable/Separator.d.ts +2 -2
- package/lib/customtypes/widgets/nestable/Separator.js +1 -1
- package/lib/customtypes/widgets/nestable/Text.d.ts +2 -2
- package/lib/customtypes/widgets/nestable/Text.js +1 -1
- package/lib/customtypes/widgets/nestable/Timestamp.d.ts +2 -2
- package/lib/customtypes/widgets/nestable/Timestamp.js +1 -1
- package/lib/customtypes/widgets/nestable/index.js +16 -16
- package/lib/customtypes/widgets/shared/ImageConstraint.d.ts +1 -1
- package/lib/customtypes/widgets/shared/ImageConstraint.js +1 -1
- package/lib/customtypes/widgets/slices/CompositeSlice.d.ts +2 -2
- package/lib/customtypes/widgets/slices/CompositeSlice.js +1 -1
- package/lib/customtypes/widgets/slices/LegacySlice.d.ts +1 -1
- package/lib/customtypes/widgets/slices/LegacySlice.js +1 -1
- package/lib/customtypes/widgets/slices/SharedSlice.d.ts +2 -2
- package/lib/customtypes/widgets/slices/SharedSlice.js +1 -1
- package/lib/customtypes/widgets/slices/SharedSliceRef.d.ts +1 -1
- package/lib/customtypes/widgets/slices/SharedSliceRef.js +1 -1
- package/lib/customtypes/widgets/slices/Slice.d.ts +2 -2
- package/lib/customtypes/widgets/slices/Slices.d.ts +5 -5
- package/lib/customtypes/widgets/slices/Slices.js +1 -1
- package/lib/customtypes/widgets/slices/SlicesTypes.d.ts +1 -1
- package/lib/customtypes/widgets/slices/SlicesTypes.js +1 -1
- package/lib/customtypes/widgets/slices/index.js +7 -7
- package/lib/utils/index.js +2 -2
- package/lib/validators/DateFromString.js +1 -1
- package/lib/validators/DateFromStringOrNumber.js +1 -1
- package/lib/validators/DateFromTsMs.js +1 -1
- package/lib/validators/IntFromNumber.d.ts +2 -2
- package/lib/validators/IntFromNumber.js +1 -1
- package/lib/validators/IntFromPixels.d.ts +2 -2
- package/lib/validators/IntFromPixels.js +1 -1
- package/lib/validators/NonEmptyString.js +1 -1
- package/lib/validators/NonEmptyStringOrNull.js +1 -1
- package/lib/validators/NumberOrNull.js +1 -1
- package/lib/validators/StringFromBoolean.d.ts +2 -2
- package/lib/validators/StringFromBoolean.js +1 -1
- package/lib/validators/StringFromNumber.d.ts +2 -2
- package/lib/validators/StringFromNumber.js +1 -1
- package/lib/validators/StringOrNull.js +1 -1
- package/lib/validators/TrimmedString.d.ts +2 -2
- package/lib/validators/TrimmedString.js +1 -1
- package/lib/validators/function.js +1 -1
- package/lib/validators/index.js +12 -12
- package/package.json +1 -1
- package/src/content/fields/GroupContent.ts +9 -5
- package/src/content/fields/nestable/RichTextContent/Blocks.ts +31 -23
- package/src/content/fields/nestable/RichTextContent/index.ts +1 -3
- package/src/content/fields/slices/Slice/SimpleSliceContent.ts +4 -1
- package/src/customtypes/CustomType.ts +6 -0
package/lib/common/WidgetKey.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WidgetKey = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const t = tslib_1.__importStar(require("io-ts"));
|
|
5
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
6
|
const function_1 = require("../validators/function");
|
|
7
7
|
const widgetKeyRegex = new RegExp("^[^<>]+$");
|
|
8
8
|
exports.WidgetKey = (0, function_1.refineType)(t.string, "WidgetKey", (s) => s.length === 0 || widgetKeyRegex.test(s));
|
package/lib/common/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
2
|
import { WidgetKey } from "../common";
|
|
3
|
-
import { FieldOrSliceType,
|
|
3
|
+
import { FieldOrSliceType, WithTypes } from "./LegacyContentCtx";
|
|
4
4
|
export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.UnionC<[t.ExactC<t.TypeC<{
|
|
5
5
|
__TYPE__: t.LiteralC<"GroupContentType">;
|
|
6
6
|
value: t.ArrayC<t.ExactC<t.TypeC<{
|
|
@@ -224,8 +224,6 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
|
|
|
224
224
|
title?: string;
|
|
225
225
|
} | null | undefined;
|
|
226
226
|
}), ({
|
|
227
|
-
__TYPE__: "ImageLink";
|
|
228
|
-
} & {
|
|
229
227
|
id: string;
|
|
230
228
|
url: string;
|
|
231
229
|
height: string;
|
|
@@ -243,17 +241,9 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
|
|
|
243
241
|
size: string;
|
|
244
242
|
} & {
|
|
245
243
|
date?: string | null | undefined;
|
|
246
|
-
}
|
|
247
|
-
__TYPE__: "FileLink";
|
|
248
|
-
} & {
|
|
249
|
-
size?: string;
|
|
250
|
-
}) | ({
|
|
251
|
-
__TYPE__: "DocumentLink";
|
|
252
|
-
} & {
|
|
244
|
+
}) | {
|
|
253
245
|
id: string;
|
|
254
|
-
}
|
|
255
|
-
__TYPE__: "ExternalLink";
|
|
256
|
-
} & {
|
|
246
|
+
} | ({
|
|
257
247
|
url: string;
|
|
258
248
|
} & {
|
|
259
249
|
kind?: "web";
|
|
@@ -536,8 +526,6 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
|
|
|
536
526
|
title?: string;
|
|
537
527
|
} | null | undefined;
|
|
538
528
|
}), ({
|
|
539
|
-
__TYPE__: "ImageLink";
|
|
540
|
-
} & {
|
|
541
529
|
id: string;
|
|
542
530
|
url: string;
|
|
543
531
|
height: string;
|
|
@@ -555,17 +543,9 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
|
|
|
555
543
|
size: string;
|
|
556
544
|
} & {
|
|
557
545
|
date?: string | null | undefined;
|
|
558
|
-
}
|
|
559
|
-
__TYPE__: "FileLink";
|
|
560
|
-
} & {
|
|
561
|
-
size?: string;
|
|
562
|
-
}) | ({
|
|
563
|
-
__TYPE__: "DocumentLink";
|
|
564
|
-
} & {
|
|
546
|
+
}) | {
|
|
565
547
|
id: string;
|
|
566
|
-
}
|
|
567
|
-
__TYPE__: "ExternalLink";
|
|
568
|
-
} & {
|
|
548
|
+
} | ({
|
|
569
549
|
url: string;
|
|
570
550
|
} & {
|
|
571
551
|
kind?: "web";
|
|
@@ -857,8 +837,6 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
|
|
|
857
837
|
title?: string;
|
|
858
838
|
} | null | undefined;
|
|
859
839
|
}), ({
|
|
860
|
-
__TYPE__: "ImageLink";
|
|
861
|
-
} & {
|
|
862
840
|
id: string;
|
|
863
841
|
url: string;
|
|
864
842
|
height: string;
|
|
@@ -876,17 +854,9 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
|
|
|
876
854
|
size: string;
|
|
877
855
|
} & {
|
|
878
856
|
date?: string | null | undefined;
|
|
879
|
-
}
|
|
880
|
-
__TYPE__: "FileLink";
|
|
881
|
-
} & {
|
|
882
|
-
size?: string;
|
|
883
|
-
}) | ({
|
|
884
|
-
__TYPE__: "DocumentLink";
|
|
885
|
-
} & {
|
|
857
|
+
}) | {
|
|
886
858
|
id: string;
|
|
887
|
-
}
|
|
888
|
-
__TYPE__: "ExternalLink";
|
|
889
|
-
} & {
|
|
859
|
+
} | ({
|
|
890
860
|
url: string;
|
|
891
861
|
} & {
|
|
892
862
|
kind?: "web";
|
|
@@ -1170,8 +1140,6 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
|
|
|
1170
1140
|
title?: string;
|
|
1171
1141
|
} | null | undefined;
|
|
1172
1142
|
}), ({
|
|
1173
|
-
__TYPE__: "ImageLink";
|
|
1174
|
-
} & {
|
|
1175
1143
|
id: string;
|
|
1176
1144
|
url: string;
|
|
1177
1145
|
height: string;
|
|
@@ -1189,17 +1157,9 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
|
|
|
1189
1157
|
size: string;
|
|
1190
1158
|
} & {
|
|
1191
1159
|
date?: string | null | undefined;
|
|
1192
|
-
}
|
|
1193
|
-
__TYPE__: "FileLink";
|
|
1194
|
-
} & {
|
|
1195
|
-
size?: string;
|
|
1196
|
-
}) | ({
|
|
1197
|
-
__TYPE__: "DocumentLink";
|
|
1198
|
-
} & {
|
|
1160
|
+
}) | {
|
|
1199
1161
|
id: string;
|
|
1200
|
-
}
|
|
1201
|
-
__TYPE__: "ExternalLink";
|
|
1202
|
-
} & {
|
|
1162
|
+
} | ({
|
|
1203
1163
|
url: string;
|
|
1204
1164
|
} & {
|
|
1205
1165
|
kind?: "web";
|
|
@@ -1485,8 +1445,6 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
|
|
|
1485
1445
|
title?: string;
|
|
1486
1446
|
} | null | undefined;
|
|
1487
1447
|
}), ({
|
|
1488
|
-
__TYPE__: "ImageLink";
|
|
1489
|
-
} & {
|
|
1490
1448
|
id: string;
|
|
1491
1449
|
url: string;
|
|
1492
1450
|
height: string;
|
|
@@ -1504,17 +1462,9 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
|
|
|
1504
1462
|
size: string;
|
|
1505
1463
|
} & {
|
|
1506
1464
|
date?: string | null | undefined;
|
|
1507
|
-
}
|
|
1508
|
-
__TYPE__: "FileLink";
|
|
1509
|
-
} & {
|
|
1510
|
-
size?: string;
|
|
1511
|
-
}) | ({
|
|
1512
|
-
__TYPE__: "DocumentLink";
|
|
1513
|
-
} & {
|
|
1465
|
+
}) | {
|
|
1514
1466
|
id: string;
|
|
1515
|
-
}
|
|
1516
|
-
__TYPE__: "ExternalLink";
|
|
1517
|
-
} & {
|
|
1467
|
+
} | ({
|
|
1518
1468
|
url: string;
|
|
1519
1469
|
} & {
|
|
1520
1470
|
kind?: "web";
|
|
@@ -1798,8 +1748,6 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
|
|
|
1798
1748
|
title?: string;
|
|
1799
1749
|
} | null | undefined;
|
|
1800
1750
|
}), ({
|
|
1801
|
-
__TYPE__: "ImageLink";
|
|
1802
|
-
} & {
|
|
1803
1751
|
id: string;
|
|
1804
1752
|
url: string;
|
|
1805
1753
|
height: string;
|
|
@@ -1817,17 +1765,9 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
|
|
|
1817
1765
|
size: string;
|
|
1818
1766
|
} & {
|
|
1819
1767
|
date?: string | null | undefined;
|
|
1820
|
-
}
|
|
1821
|
-
__TYPE__: "FileLink";
|
|
1822
|
-
} & {
|
|
1823
|
-
size?: string;
|
|
1824
|
-
}) | ({
|
|
1825
|
-
__TYPE__: "DocumentLink";
|
|
1826
|
-
} & {
|
|
1768
|
+
}) | {
|
|
1827
1769
|
id: string;
|
|
1828
|
-
}
|
|
1829
|
-
__TYPE__: "ExternalLink";
|
|
1830
|
-
} & {
|
|
1770
|
+
} | ({
|
|
1831
1771
|
url: string;
|
|
1832
1772
|
} & {
|
|
1833
1773
|
kind?: "web";
|
|
@@ -2110,8 +2050,6 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
|
|
|
2110
2050
|
title?: string;
|
|
2111
2051
|
} | null | undefined;
|
|
2112
2052
|
}), ({
|
|
2113
|
-
__TYPE__: "ImageLink";
|
|
2114
|
-
} & {
|
|
2115
2053
|
id: string;
|
|
2116
2054
|
url: string;
|
|
2117
2055
|
height: string;
|
|
@@ -2129,17 +2067,9 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
|
|
|
2129
2067
|
size: string;
|
|
2130
2068
|
} & {
|
|
2131
2069
|
date?: string | null | undefined;
|
|
2132
|
-
}
|
|
2133
|
-
__TYPE__: "FileLink";
|
|
2134
|
-
} & {
|
|
2135
|
-
size?: string;
|
|
2136
|
-
}) | ({
|
|
2137
|
-
__TYPE__: "DocumentLink";
|
|
2138
|
-
} & {
|
|
2070
|
+
}) | {
|
|
2139
2071
|
id: string;
|
|
2140
|
-
}
|
|
2141
|
-
__TYPE__: "ExternalLink";
|
|
2142
|
-
} & {
|
|
2072
|
+
} | ({
|
|
2143
2073
|
url: string;
|
|
2144
2074
|
} & {
|
|
2145
2075
|
kind?: "web";
|
|
@@ -2424,8 +2354,6 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
|
|
|
2424
2354
|
title?: string;
|
|
2425
2355
|
} | null | undefined;
|
|
2426
2356
|
}), ({
|
|
2427
|
-
__TYPE__: "ImageLink";
|
|
2428
|
-
} & {
|
|
2429
2357
|
id: string;
|
|
2430
2358
|
url: string;
|
|
2431
2359
|
height: string;
|
|
@@ -2443,17 +2371,9 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
|
|
|
2443
2371
|
size: string;
|
|
2444
2372
|
} & {
|
|
2445
2373
|
date?: string | null | undefined;
|
|
2446
|
-
}
|
|
2447
|
-
__TYPE__: "FileLink";
|
|
2448
|
-
} & {
|
|
2449
|
-
size?: string;
|
|
2450
|
-
}) | ({
|
|
2451
|
-
__TYPE__: "DocumentLink";
|
|
2452
|
-
} & {
|
|
2374
|
+
}) | {
|
|
2453
2375
|
id: string;
|
|
2454
|
-
}
|
|
2455
|
-
__TYPE__: "ExternalLink";
|
|
2456
|
-
} & {
|
|
2376
|
+
} | ({
|
|
2457
2377
|
url: string;
|
|
2458
2378
|
} & {
|
|
2459
2379
|
kind?: "web";
|
|
@@ -2520,9 +2440,9 @@ export declare const Document: t.RecordC<t.Type<string, string, unknown>, t.Unio
|
|
|
2520
2440
|
}>>]>]>;
|
|
2521
2441
|
}>>;
|
|
2522
2442
|
}>]>>;
|
|
2523
|
-
export type Document = t.TypeOf<typeof Document>;
|
|
2443
|
+
export declare type Document = t.TypeOf<typeof Document>;
|
|
2524
2444
|
declare const legacyDocReader: t.RecordC<t.Type<string, string, unknown>, t.UnknownC>;
|
|
2525
|
-
type DocumentLegacy = t.TypeOf<typeof legacyDocReader>;
|
|
2445
|
+
declare type DocumentLegacy = t.TypeOf<typeof legacyDocReader>;
|
|
2526
2446
|
declare function extractMetadata(data: {
|
|
2527
2447
|
[p: string]: unknown;
|
|
2528
2448
|
}): {
|
|
@@ -2534,7 +2454,7 @@ declare function extractMetadata(data: {
|
|
|
2534
2454
|
declare function parseLegacyDocument(legacyDoc: unknown): Document | undefined;
|
|
2535
2455
|
declare function encodeToLegacyDocument(document: Document): DocumentLegacy;
|
|
2536
2456
|
export declare const DocumentLegacy: {
|
|
2537
|
-
_codec: (allTypes?:
|
|
2457
|
+
_codec: (allTypes?: Map<string, "Boolean" | "Color" | "Date" | "Embed" | "GeoPoint" | "Image" | "IntegrationFields" | "Link" | "Number" | "Range" | "StructuredText" | "Select" | "Separator" | "Text" | "Timestamp" | "Group" | "Slice" | "SharedSlice" | "Choice" | "Slices" | "UID"> | undefined) => t.Type<{
|
|
2538
2458
|
[x: string]: {
|
|
2539
2459
|
type: string;
|
|
2540
2460
|
__TYPE__: "EmptyContent";
|
package/lib/content/Document.js
CHANGED
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const fp_ts_1 = require("fp-ts");
|
|
6
6
|
const Either_1 = require("fp-ts/lib/Either");
|
|
7
7
|
const function_1 = require("fp-ts/lib/function");
|
|
8
|
-
const t = tslib_1.__importStar(require("io-ts"));
|
|
8
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
9
9
|
const common_1 = require("../common");
|
|
10
10
|
const fields_1 = require("./fields");
|
|
11
11
|
const LegacyContentCtx_1 = require("./LegacyContentCtx");
|
|
@@ -23,7 +23,7 @@ export declare const FieldOrSliceType: t.UnionC<[t.KeyofC<{
|
|
|
23
23
|
Slice: null;
|
|
24
24
|
SharedSlice: null;
|
|
25
25
|
}>]>;
|
|
26
|
-
export type FieldOrSliceType = t.TypeOf<typeof FieldOrSliceType>;
|
|
26
|
+
export declare type FieldOrSliceType = t.TypeOf<typeof FieldOrSliceType>;
|
|
27
27
|
export declare class LegacyContentCtx {
|
|
28
28
|
fieldKey: string;
|
|
29
29
|
prefixedKey: string;
|
|
@@ -35,7 +35,7 @@ export declare class LegacyContentCtx {
|
|
|
35
35
|
}
|
|
36
36
|
export declare function getFieldCtx(fieldKey: string, ctx: LegacyContentCtx, prefixes?: Array<string>): LegacyContentCtx;
|
|
37
37
|
export declare function defaultCtx(key: string, allTypes?: Map<string, FieldOrSliceType>): LegacyContentCtx;
|
|
38
|
-
export type WithTypes<T> = {
|
|
38
|
+
export declare type WithTypes<T> = {
|
|
39
39
|
types: Record<string, FieldOrSliceType>;
|
|
40
40
|
content: T;
|
|
41
41
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaultCtx = exports.getFieldCtx = exports.LegacyContentCtx = exports.FieldOrSliceType = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const t = tslib_1.__importStar(require("io-ts"));
|
|
5
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
6
|
const widgets_1 = require("../customtypes/widgets");
|
|
7
7
|
exports.FieldOrSliceType = t.union([widgets_1.FieldType, widgets_1.SlicesTypes]);
|
|
8
8
|
class LegacyContentCtx {
|
|
@@ -4,7 +4,7 @@ exports.EmptyContent = exports.EmptyLegacy = exports.isEmptyContent = exports.Em
|
|
|
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");
|
|
7
|
-
const t = tslib_1.__importStar(require("io-ts"));
|
|
7
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
9
|
exports.EmptyContentType = "EmptyContent";
|
|
10
10
|
const isEmptyContent = (u) => (0, utils_1.hasContentType)(u) && u.__TYPE__ === exports.EmptyContentType;
|
|
@@ -222,8 +222,6 @@ export declare const GroupItemContent: t.ExactC<t.TypeC<{
|
|
|
222
222
|
title?: string;
|
|
223
223
|
} | null | undefined;
|
|
224
224
|
}), ({
|
|
225
|
-
__TYPE__: "ImageLink";
|
|
226
|
-
} & {
|
|
227
225
|
id: string;
|
|
228
226
|
url: string;
|
|
229
227
|
height: string;
|
|
@@ -241,17 +239,9 @@ export declare const GroupItemContent: t.ExactC<t.TypeC<{
|
|
|
241
239
|
size: string;
|
|
242
240
|
} & {
|
|
243
241
|
date?: string | null | undefined;
|
|
244
|
-
}
|
|
245
|
-
__TYPE__: "FileLink";
|
|
246
|
-
} & {
|
|
247
|
-
size?: string;
|
|
248
|
-
}) | ({
|
|
249
|
-
__TYPE__: "DocumentLink";
|
|
250
|
-
} & {
|
|
242
|
+
}) | {
|
|
251
243
|
id: string;
|
|
252
|
-
}
|
|
253
|
-
__TYPE__: "ExternalLink";
|
|
254
|
-
} & {
|
|
244
|
+
} | ({
|
|
255
245
|
url: string;
|
|
256
246
|
} & {
|
|
257
247
|
kind?: "web";
|
|
@@ -315,9 +305,9 @@ export declare const GroupItemContent: t.ExactC<t.TypeC<{
|
|
|
315
305
|
__TYPE__: t.LiteralC<"SeparatorContent">;
|
|
316
306
|
}>>]>]>>;
|
|
317
307
|
}>>;
|
|
318
|
-
export type GroupItemContent = t.TypeOf<typeof GroupItemContent>;
|
|
308
|
+
export declare type GroupItemContent = t.TypeOf<typeof GroupItemContent>;
|
|
319
309
|
declare const itemLegacyReader: t.RecordC<t.StringC, t.UnknownC>;
|
|
320
|
-
type GroupItemLegacy = t.TypeOf<typeof itemLegacyReader>;
|
|
310
|
+
declare type GroupItemLegacy = t.TypeOf<typeof itemLegacyReader>;
|
|
321
311
|
export declare const GroupItemLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
322
312
|
__TYPE__: "GroupItemContent";
|
|
323
313
|
value: [string, {
|
|
@@ -590,7 +580,7 @@ export declare const GroupItemLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
|
590
580
|
}, WithTypes<{
|
|
591
581
|
[x: string]: unknown;
|
|
592
582
|
}>, unknown>;
|
|
593
|
-
type GroupLegacy = Array<GroupItemLegacy>;
|
|
583
|
+
declare type GroupLegacy = Array<GroupItemLegacy>;
|
|
594
584
|
export declare const GroupLegacy: (ctx: LegacyContentCtx) => t.Type<{
|
|
595
585
|
__TYPE__: "GroupContentType";
|
|
596
586
|
value: {
|
|
@@ -1361,8 +1351,6 @@ export declare const GroupContent: t.ExactC<t.TypeC<{
|
|
|
1361
1351
|
title?: string;
|
|
1362
1352
|
} | null | undefined;
|
|
1363
1353
|
}), ({
|
|
1364
|
-
__TYPE__: "ImageLink";
|
|
1365
|
-
} & {
|
|
1366
1354
|
id: string;
|
|
1367
1355
|
url: string;
|
|
1368
1356
|
height: string;
|
|
@@ -1380,17 +1368,9 @@ export declare const GroupContent: t.ExactC<t.TypeC<{
|
|
|
1380
1368
|
size: string;
|
|
1381
1369
|
} & {
|
|
1382
1370
|
date?: string | null | undefined;
|
|
1383
|
-
}
|
|
1384
|
-
__TYPE__: "FileLink";
|
|
1385
|
-
} & {
|
|
1386
|
-
size?: string;
|
|
1387
|
-
}) | ({
|
|
1388
|
-
__TYPE__: "DocumentLink";
|
|
1389
|
-
} & {
|
|
1371
|
+
}) | {
|
|
1390
1372
|
id: string;
|
|
1391
|
-
}
|
|
1392
|
-
__TYPE__: "ExternalLink";
|
|
1393
|
-
} & {
|
|
1373
|
+
} | ({
|
|
1394
1374
|
url: string;
|
|
1395
1375
|
} & {
|
|
1396
1376
|
kind?: "web";
|
|
@@ -1455,5 +1435,5 @@ export declare const GroupContent: t.ExactC<t.TypeC<{
|
|
|
1455
1435
|
}>>]>]>>;
|
|
1456
1436
|
}>>>;
|
|
1457
1437
|
}>>;
|
|
1458
|
-
export type GroupContent = t.TypeOf<typeof GroupContent>;
|
|
1438
|
+
export declare type GroupContent = t.TypeOf<typeof GroupContent>;
|
|
1459
1439
|
export {};
|
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const fp_ts_1 = require("fp-ts");
|
|
6
6
|
const Either_1 = require("fp-ts/lib/Either");
|
|
7
7
|
const function_1 = require("fp-ts/lib/function");
|
|
8
|
-
const t = tslib_1.__importStar(require("io-ts"));
|
|
8
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
9
9
|
const LegacyContentCtx_1 = require("../LegacyContentCtx");
|
|
10
10
|
const utils_1 = require("../utils");
|
|
11
11
|
const nestable_1 = require("./nestable");
|
|
@@ -48,16 +48,23 @@ const GroupItemLegacy = (ctx) => {
|
|
|
48
48
|
};
|
|
49
49
|
exports.GroupItemLegacy = GroupItemLegacy;
|
|
50
50
|
const GroupLegacy = (ctx) => {
|
|
51
|
-
const
|
|
51
|
+
const codecDecode = t.array(t.union([t.null, (0, exports.GroupItemLegacy)(ctx)]));
|
|
52
|
+
const codecEncode = t.array((0, exports.GroupItemLegacy)(ctx));
|
|
52
53
|
return new t.Type("GroupLegacy", exports.isGroupContent, (items) => {
|
|
53
|
-
return (0, function_1.pipe)(
|
|
54
|
+
return (0, function_1.pipe)(codecDecode.decode(items), fp_ts_1.either.map((parsedItems) => {
|
|
54
55
|
return {
|
|
55
|
-
value: parsedItems
|
|
56
|
+
value: parsedItems.map((i) => {
|
|
57
|
+
if (i === null) {
|
|
58
|
+
return { __TYPE__: exports.GroupItemContentType, value: [] };
|
|
59
|
+
}
|
|
60
|
+
else
|
|
61
|
+
return i;
|
|
62
|
+
}),
|
|
56
63
|
__TYPE__: exports.GroupContentType,
|
|
57
64
|
};
|
|
58
65
|
}));
|
|
59
66
|
}, (g) => {
|
|
60
|
-
const res =
|
|
67
|
+
const res = codecEncode.encode(g.value);
|
|
61
68
|
return {
|
|
62
69
|
content: res.map((block) => block.content),
|
|
63
70
|
types: res.reduce((acc, block) => {
|
|
@@ -4,7 +4,7 @@ exports.UIDContent = exports.UIDLegacy = exports.isUIDContent = exports.UIDConte
|
|
|
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");
|
|
7
|
-
const t = tslib_1.__importStar(require("io-ts"));
|
|
7
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
9
|
exports.UIDContentType = "UIDContent";
|
|
10
10
|
const isUIDContent = (u) => (0, utils_1.hasContentType)(u) && u.__TYPE__ === exports.UIDContentType;
|