@prismicio/types-internal 2.0.0-alpha.2 → 2.0.0-alpha.4

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.
Files changed (141) hide show
  1. package/lib/content/LegacyContentCtx.js +1 -1
  2. package/lib/content/fields/WidgetContent.d.ts +1 -1
  3. package/lib/customtypes/widgets/Group.d.ts +164 -3
  4. package/lib/customtypes/widgets/Group.js +4 -5
  5. package/lib/customtypes/widgets/UID.d.ts +8 -3
  6. package/lib/customtypes/widgets/UID.js +4 -5
  7. package/lib/customtypes/widgets/Widget.d.ts +2 -2
  8. package/lib/customtypes/widgets/Widget.js +5 -5
  9. package/lib/customtypes/widgets/nestable/Link.d.ts +0 -1
  10. package/lib/customtypes/widgets/nestable/Link.js +0 -1
  11. package/lib/customtypes/widgets/nestable/RichText.d.ts +1 -1
  12. package/lib/customtypes/widgets/nestable/Text.d.ts +0 -1
  13. package/lib/customtypes/widgets/nestable/Text.js +0 -1
  14. package/lib/customtypes/widgets/slices/CompositeSlice.d.ts +6 -3
  15. package/lib/customtypes/widgets/slices/CompositeSlice.js +4 -5
  16. package/lib/customtypes/widgets/slices/LegacySlice.d.ts +2 -3
  17. package/lib/customtypes/widgets/slices/LegacySlice.js +3 -3
  18. package/lib/customtypes/widgets/slices/SharedSliceRef.d.ts +2 -3
  19. package/lib/customtypes/widgets/slices/SharedSliceRef.js +2 -2
  20. package/lib/customtypes/widgets/slices/Slice.d.ts +3 -3
  21. package/lib/customtypes/widgets/slices/Slices.d.ts +1 -1
  22. package/lib/customtypes/widgets/slices/Slices.js +5 -5
  23. package/lib/customtypes/widgets/slices/index.d.ts +3 -3
  24. package/lib/customtypes/widgets/slices/index.js +3 -3
  25. package/package.json +1 -1
  26. package/src/content/LegacyContentCtx.ts +2 -2
  27. package/src/content/fields/WidgetContent.ts +1 -1
  28. package/src/customtypes/widgets/Group.ts +4 -6
  29. package/src/customtypes/widgets/UID.ts +4 -6
  30. package/src/customtypes/widgets/Widget.ts +5 -5
  31. package/src/customtypes/widgets/nestable/Link.ts +0 -2
  32. package/src/customtypes/widgets/nestable/RichText.ts +1 -1
  33. package/src/customtypes/widgets/nestable/Text.ts +0 -2
  34. package/src/customtypes/widgets/slices/CompositeSlice.ts +4 -6
  35. package/src/customtypes/widgets/slices/LegacySlice.ts +3 -5
  36. package/src/customtypes/widgets/slices/SharedSliceRef.ts +2 -4
  37. package/src/customtypes/widgets/slices/Slice.ts +3 -3
  38. package/src/customtypes/widgets/slices/Slices.ts +3 -3
  39. package/src/customtypes/widgets/slices/index.ts +3 -3
  40. package/lib/content/CustomType.d.ts +0 -2972
  41. package/lib/content/CustomType.js +0 -15
  42. package/lib/content/fields/nestable/FieldContent.d.ts +0 -32
  43. package/lib/content/fields/nestable/FieldContent.js +0 -37
  44. package/lib/content/fields/nestable/Image.d.ts +0 -103
  45. package/lib/content/fields/nestable/Image.js +0 -13
  46. package/lib/content/fields/nestable/RichTextContent.d.ts +0 -376
  47. package/lib/content/fields/nestable/RichTextContent.js +0 -16
  48. package/lib/content/fields/slices/CompositeSliceContent.d.ts +0 -677
  49. package/lib/content/fields/slices/CompositeSliceContent.js +0 -14
  50. package/lib/content/fields/slices/RepeatableContent.d.ts +0 -338
  51. package/lib/content/fields/slices/RepeatableContent.js +0 -16
  52. package/lib/content/fields/slices/SharedSliceContent.d.ts +0 -678
  53. package/lib/content/fields/slices/SharedSliceContent.js +0 -15
  54. package/lib/content/fields/slices/SimpleSliceContent.d.ts +0 -675
  55. package/lib/content/fields/slices/SimpleSliceContent.js +0 -8
  56. package/lib/customtypes/Comparators/Changes.d.ts +0 -17
  57. package/lib/customtypes/Comparators/Changes.js +0 -9
  58. package/lib/customtypes/Comparators/SharedSlice.d.ts +0 -679
  59. package/lib/customtypes/Comparators/SharedSlice.js +0 -55
  60. package/lib/customtypes/Comparators/Variation.d.ts +0 -662
  61. package/lib/customtypes/Comparators/Variation.js +0 -75
  62. package/lib/customtypes/Comparators/index.d.ts +0 -3
  63. package/lib/customtypes/Comparators/index.js +0 -6
  64. package/lib/customtypes/Format.d.ts +0 -4
  65. package/lib/customtypes/Format.js +0 -8
  66. package/lib/customtypes/comp/Changes.d.ts +0 -17
  67. package/lib/customtypes/comp/Changes.js +0 -9
  68. package/lib/customtypes/comp/SharedSlice.d.ts +0 -679
  69. package/lib/customtypes/comp/SharedSlice.js +0 -55
  70. package/lib/customtypes/comp/Variation.d.ts +0 -662
  71. package/lib/customtypes/comp/Variation.js +0 -76
  72. package/lib/customtypes/comp/index.d.ts +0 -3
  73. package/lib/customtypes/comp/index.js +0 -6
  74. package/lib/customtypes/utils/Comparator.d.ts +0 -1353
  75. package/lib/customtypes/utils/Comparator.js +0 -59
  76. package/lib/customtypes/utils/index.d.ts +0 -1
  77. package/lib/customtypes/utils/index.js +0 -4
  78. package/lib/customtypes/widgets/WidgetTypes.d.ts +0 -22
  79. package/lib/customtypes/widgets/WidgetTypes.js +0 -25
  80. package/lib/documents/DocumentData.d.ts +0 -6
  81. package/lib/documents/DocumentData.js +0 -15
  82. package/lib/documents/index.d.ts +0 -2
  83. package/lib/documents/index.js +0 -7
  84. package/lib/documents/widgets/EmptyContent.d.ts +0 -8
  85. package/lib/documents/widgets/EmptyContent.js +0 -9
  86. package/lib/documents/widgets/GroupContent.d.ts +0 -16
  87. package/lib/documents/widgets/GroupContent.js +0 -60
  88. package/lib/documents/widgets/SimpleWidgetContent.d.ts +0 -20
  89. package/lib/documents/widgets/SimpleWidgetContent.js +0 -75
  90. package/lib/documents/widgets/StaticWidgetContent.d.ts +0 -10
  91. package/lib/documents/widgets/StaticWidgetContent.js +0 -26
  92. package/lib/documents/widgets/UIDContent.d.ts +0 -7
  93. package/lib/documents/widgets/UIDContent.js +0 -10
  94. package/lib/documents/widgets/index.d.ts +0 -38
  95. package/lib/documents/widgets/index.js +0 -40
  96. package/lib/documents/widgets/nestable/BooleanContent.d.ts +0 -8
  97. package/lib/documents/widgets/nestable/BooleanContent.js +0 -11
  98. package/lib/documents/widgets/nestable/EmbedContent.d.ts +0 -42
  99. package/lib/documents/widgets/nestable/EmbedContent.js +0 -35
  100. package/lib/documents/widgets/nestable/FieldContent.d.ts +0 -13
  101. package/lib/documents/widgets/nestable/FieldContent.js +0 -37
  102. package/lib/documents/widgets/nestable/GeoPointContent.d.ts +0 -17
  103. package/lib/documents/widgets/nestable/GeoPointContent.js +0 -13
  104. package/lib/documents/widgets/nestable/ImageContent.d.ts +0 -127
  105. package/lib/documents/widgets/nestable/ImageContent.js +0 -41
  106. package/lib/documents/widgets/nestable/IntegrationFieldsContent.d.ts +0 -8
  107. package/lib/documents/widgets/nestable/IntegrationFieldsContent.js +0 -16
  108. package/lib/documents/widgets/nestable/Link/DocumentLink.d.ts +0 -12
  109. package/lib/documents/widgets/nestable/Link/DocumentLink.js +0 -13
  110. package/lib/documents/widgets/nestable/Link/ExternalLink.d.ts +0 -24
  111. package/lib/documents/widgets/nestable/Link/ExternalLink.js +0 -24
  112. package/lib/documents/widgets/nestable/Link/FileLink.d.ts +0 -22
  113. package/lib/documents/widgets/nestable/Link/FileLink.js +0 -25
  114. package/lib/documents/widgets/nestable/Link/ImageLink.d.ts +0 -28
  115. package/lib/documents/widgets/nestable/Link/ImageLink.js +0 -26
  116. package/lib/documents/widgets/nestable/Link/LinkContent.d.ts +0 -42
  117. package/lib/documents/widgets/nestable/Link/LinkContent.js +0 -17
  118. package/lib/documents/widgets/nestable/Link/index.d.ts +0 -90
  119. package/lib/documents/widgets/nestable/Link/index.js +0 -35
  120. package/lib/documents/widgets/nestable/SeparatorContent.d.ts +0 -11
  121. package/lib/documents/widgets/nestable/SeparatorContent.js +0 -15
  122. package/lib/documents/widgets/nestable/StructuredTextContent/Block.d.ts +0 -314
  123. package/lib/documents/widgets/nestable/StructuredTextContent/Block.js +0 -98
  124. package/lib/documents/widgets/nestable/StructuredTextContent/index.d.ts +0 -9
  125. package/lib/documents/widgets/nestable/StructuredTextContent/index.js +0 -14
  126. package/lib/documents/widgets/nestable/index.d.ts +0 -26
  127. package/lib/documents/widgets/nestable/index.js +0 -39
  128. package/lib/documents/widgets/slices/CompositeSliceContent.d.ts +0 -14
  129. package/lib/documents/widgets/slices/CompositeSliceContent.js +0 -52
  130. package/lib/documents/widgets/slices/SharedSliceContent.d.ts +0 -15
  131. package/lib/documents/widgets/slices/SharedSliceContent.js +0 -63
  132. package/lib/documents/widgets/slices/SimpleSliceContent.d.ts +0 -6
  133. package/lib/documents/widgets/slices/SimpleSliceContent.js +0 -6
  134. package/lib/documents/widgets/slices/SliceWidgetContent.d.ts +0 -8
  135. package/lib/documents/widgets/slices/SliceWidgetContent.js +0 -26
  136. package/lib/documents/widgets/slices/SlicesContent.d.ts +0 -17
  137. package/lib/documents/widgets/slices/SlicesContent.js +0 -52
  138. package/lib/documents/widgets/slices/index.d.ts +0 -5
  139. package/lib/documents/widgets/slices/index.js +0 -8
  140. package/lib/index.d.ts +0 -3
  141. package/lib/index.js +0 -7
@@ -1,314 +0,0 @@
1
- import * as t from "io-ts";
2
- export declare const Meta: t.ExactC<t.IntersectionC<[t.PartialC<{
3
- data: t.UnknownC;
4
- }>, t.TypeC<{
5
- start: t.NumberC;
6
- end: t.NumberC;
7
- type: t.UnionC<[t.KeyofC<{
8
- heading1: null;
9
- heading2: null;
10
- heading3: null;
11
- heading4: null;
12
- heading5: null;
13
- heading6: null;
14
- paragraph: null;
15
- strong: null;
16
- em: null;
17
- preformatted: null;
18
- hyperlink: null;
19
- image: null;
20
- embed: null;
21
- "list-item": null;
22
- "o-list-item": null;
23
- rtl: null;
24
- }>, t.LiteralC<"label">]>;
25
- }>]>>;
26
- export declare type Meta = t.TypeOf<typeof Meta>;
27
- export declare const Span: t.ExactC<t.IntersectionC<[t.PartialC<{
28
- data: t.UnknownC;
29
- }>, t.TypeC<{
30
- start: t.NumberC;
31
- end: t.NumberC;
32
- type: t.UnionC<[t.KeyofC<{
33
- heading1: null;
34
- heading2: null;
35
- heading3: null;
36
- heading4: null;
37
- heading5: null;
38
- heading6: null;
39
- paragraph: null;
40
- strong: null;
41
- em: null;
42
- preformatted: null;
43
- hyperlink: null;
44
- image: null;
45
- embed: null;
46
- "list-item": null;
47
- "o-list-item": null;
48
- rtl: null;
49
- }>, t.LiteralC<"label">]>;
50
- }>]>>;
51
- export declare type Span = Meta;
52
- export declare const ValidatedMetas: t.Type<({
53
- data?: unknown;
54
- } & {
55
- start: number;
56
- end: number;
57
- type: "label" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "image" | "embed" | "list-item" | "o-list-item" | "rtl";
58
- })[], ({
59
- data?: unknown;
60
- } & {
61
- start: number;
62
- end: number;
63
- type: "label" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "image" | "embed" | "list-item" | "o-list-item" | "rtl";
64
- })[], unknown>;
65
- export declare const ImageBlock: t.ExactC<t.IntersectionC<[t.TypeC<{
66
- type: t.LiteralC<"image">;
67
- data: t.IntersectionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
68
- origin: t.ExactC<t.TypeC<{
69
- id: t.StringC;
70
- url: t.StringC;
71
- width: t.NumberC;
72
- height: t.NumberC;
73
- }>>;
74
- width: t.NumberC;
75
- height: t.NumberC;
76
- edit: t.TypeC<{
77
- zoom: t.NumberC;
78
- crop: t.TypeC<{
79
- x: t.NumberC;
80
- y: t.NumberC;
81
- }>;
82
- background: t.StringC;
83
- }>;
84
- }>, t.PartialC<{
85
- url: t.StringC;
86
- credits: t.Type<string | null, string | null, unknown>;
87
- alt: t.Type<string | null, string | null, unknown>;
88
- provider: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
89
- }>]>>, t.PartialC<{
90
- linkTo: t.UnionC<[t.Type<{
91
- id: string;
92
- } | ({
93
- url: string;
94
- } & {
95
- kind?: "web";
96
- target?: string | null | undefined;
97
- preview?: {
98
- title?: string;
99
- } | null | undefined;
100
- }) | ({
101
- id: string;
102
- url: string;
103
- name: string;
104
- kind: string;
105
- } & {
106
- date?: string | null | undefined;
107
- size?: string;
108
- }) | ({
109
- id: string;
110
- url: string;
111
- height: string;
112
- width: string;
113
- size: string;
114
- name: string;
115
- kind: string;
116
- } & {
117
- date?: string | null | undefined;
118
- }), ({
119
- id: string;
120
- } & {
121
- __TYPE__: "DocumentLink";
122
- }) | ({
123
- url: string;
124
- } & {
125
- kind?: "web";
126
- target?: string | null | undefined;
127
- preview?: {
128
- title?: string;
129
- } | null | undefined;
130
- } & {
131
- __TYPE__: "ExternalLink";
132
- }) | {
133
- readonly size: string;
134
- readonly __TYPE__: "FileLink";
135
- readonly id: string;
136
- readonly url: string;
137
- readonly name: string;
138
- readonly kind: string;
139
- readonly date?: string | null | undefined;
140
- } | ({
141
- id: string;
142
- url: string;
143
- height: string;
144
- width: string;
145
- size: string;
146
- name: string;
147
- kind: string;
148
- } & {
149
- date?: string | null | undefined;
150
- } & {
151
- __TYPE__: "ImageLink";
152
- }), unknown>, t.NullC, t.UndefinedC]>;
153
- }>]>;
154
- }>, t.PartialC<{
155
- label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
156
- direction: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
157
- }>]>>;
158
- export declare type ImageBlock = t.TypeOf<typeof ImageBlock>;
159
- export declare function checkImageBlock(block: Block): block is ImageBlock;
160
- export declare const EmbedBlock: t.ExactC<t.IntersectionC<[t.TypeC<{
161
- type: t.LiteralC<"embed">;
162
- data: t.Type<import("../EmbedContent").EmbedContentO, unknown, unknown>;
163
- }>, t.PartialC<{
164
- label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
165
- direction: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
166
- }>]>>;
167
- export declare type EmbedBlock = t.TypeOf<typeof EmbedBlock>;
168
- export declare function checkEmbedBlock(block: Block): block is EmbedBlock;
169
- export declare const TextBlock: t.ExactC<t.IntersectionC<[t.TypeC<{
170
- type: t.Type<"paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "image" | "embed" | "list-item" | "o-list-item" | "rtl", "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "image" | "embed" | "list-item" | "o-list-item" | "rtl", unknown>;
171
- content: t.IntersectionC<[t.TypeC<{
172
- text: t.StringC;
173
- }>, t.PartialC<{
174
- spans: t.Type<({
175
- data?: unknown;
176
- } & {
177
- start: number;
178
- end: number;
179
- type: "label" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "image" | "embed" | "list-item" | "o-list-item" | "rtl";
180
- })[], ({
181
- data?: unknown;
182
- } & {
183
- start: number;
184
- end: number;
185
- type: "label" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "image" | "embed" | "list-item" | "o-list-item" | "rtl";
186
- })[], unknown>;
187
- }>]>;
188
- }>, t.PartialC<{
189
- label: t.StringC;
190
- direction: t.StringC;
191
- }>]>>;
192
- export declare type TextBlock = t.TypeOf<typeof TextBlock>;
193
- export declare const Block: t.UnionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
194
- type: t.LiteralC<"image">;
195
- data: t.IntersectionC<[t.ExactC<t.IntersectionC<[t.TypeC<{
196
- origin: t.ExactC<t.TypeC<{
197
- id: t.StringC;
198
- url: t.StringC;
199
- width: t.NumberC;
200
- height: t.NumberC;
201
- }>>;
202
- width: t.NumberC;
203
- height: t.NumberC;
204
- edit: t.TypeC<{
205
- zoom: t.NumberC;
206
- crop: t.TypeC<{
207
- x: t.NumberC;
208
- y: t.NumberC;
209
- }>;
210
- background: t.StringC;
211
- }>;
212
- }>, t.PartialC<{
213
- url: t.StringC;
214
- credits: t.Type<string | null, string | null, unknown>;
215
- alt: t.Type<string | null, string | null, unknown>;
216
- provider: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
217
- }>]>>, t.PartialC<{
218
- linkTo: t.UnionC<[t.Type<{
219
- id: string;
220
- } | ({
221
- url: string;
222
- } & {
223
- kind?: "web";
224
- target?: string | null | undefined;
225
- preview?: {
226
- title?: string;
227
- } | null | undefined;
228
- }) | ({
229
- id: string;
230
- url: string;
231
- name: string;
232
- kind: string;
233
- } & {
234
- date?: string | null | undefined;
235
- size?: string;
236
- }) | ({
237
- id: string;
238
- url: string;
239
- height: string;
240
- width: string;
241
- size: string;
242
- name: string;
243
- kind: string;
244
- } & {
245
- date?: string | null | undefined;
246
- }), ({
247
- id: string;
248
- } & {
249
- __TYPE__: "DocumentLink";
250
- }) | ({
251
- url: string;
252
- } & {
253
- kind?: "web";
254
- target?: string | null | undefined;
255
- preview?: {
256
- title?: string;
257
- } | null | undefined;
258
- } & {
259
- __TYPE__: "ExternalLink";
260
- }) | {
261
- readonly size: string;
262
- readonly __TYPE__: "FileLink";
263
- readonly id: string;
264
- readonly url: string;
265
- readonly name: string;
266
- readonly kind: string;
267
- readonly date?: string | null | undefined;
268
- } | ({
269
- id: string;
270
- url: string;
271
- height: string;
272
- width: string;
273
- size: string;
274
- name: string;
275
- kind: string;
276
- } & {
277
- date?: string | null | undefined;
278
- } & {
279
- __TYPE__: "ImageLink";
280
- }), unknown>, t.NullC, t.UndefinedC]>;
281
- }>]>;
282
- }>, t.PartialC<{
283
- label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
284
- direction: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
285
- }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
286
- type: t.LiteralC<"embed">;
287
- data: t.Type<import("../EmbedContent").EmbedContentO, unknown, unknown>;
288
- }>, t.PartialC<{
289
- label: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
290
- direction: t.UnionC<[t.Type<string, string, unknown>, t.NullC, t.UndefinedC]>;
291
- }>]>>, t.ExactC<t.IntersectionC<[t.TypeC<{
292
- type: t.Type<"paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "image" | "embed" | "list-item" | "o-list-item" | "rtl", "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "image" | "embed" | "list-item" | "o-list-item" | "rtl", unknown>;
293
- content: t.IntersectionC<[t.TypeC<{
294
- text: t.StringC;
295
- }>, t.PartialC<{
296
- spans: t.Type<({
297
- data?: unknown;
298
- } & {
299
- start: number;
300
- end: number;
301
- type: "label" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "image" | "embed" | "list-item" | "o-list-item" | "rtl";
302
- })[], ({
303
- data?: unknown;
304
- } & {
305
- start: number;
306
- end: number;
307
- type: "label" | "paragraph" | "heading1" | "heading2" | "heading3" | "heading4" | "heading5" | "heading6" | "strong" | "em" | "preformatted" | "hyperlink" | "image" | "embed" | "list-item" | "o-list-item" | "rtl";
308
- })[], unknown>;
309
- }>]>;
310
- }>, t.PartialC<{
311
- label: t.StringC;
312
- direction: t.StringC;
313
- }>]>>]>;
314
- export declare type Block = t.TypeOf<typeof Block>;
@@ -1,98 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Block = exports.TextBlock = exports.checkEmbedBlock = exports.EmbedBlock = exports.checkImageBlock = exports.ImageBlock = exports.ValidatedMetas = exports.Span = exports.Meta = void 0;
4
- const tslib_1 = require("tslib");
5
- const E = (0, tslib_1.__importStar)(require("fp-ts/lib/Either"));
6
- const t = (0, tslib_1.__importStar)(require("io-ts"));
7
- const nestable_1 = require("../../../../customtypes/widgets/nestable");
8
- const validators_1 = require("../../../../validators");
9
- const function_1 = require("../../../../validators/function");
10
- const EmbedContent_1 = require("../EmbedContent");
11
- const ImageContent_1 = require("../ImageContent");
12
- const Link_1 = require("../Link");
13
- exports.Meta = t.exact(t.intersection([
14
- t.partial({
15
- data: t.unknown,
16
- }),
17
- t.type({
18
- start: t.number,
19
- end: t.number,
20
- type: t.union([nestable_1.RichTextNodeTypeCodec, t.literal("label")]),
21
- }),
22
- ]));
23
- // export alias for code clarity
24
- exports.Span = exports.Meta;
25
- exports.ValidatedMetas = new t.Type("ValidatedMetas", (metas) => Array.isArray(metas) && metas.every(exports.Meta.is), (metas, c) => {
26
- if (Array.isArray(metas)) {
27
- const res = metas
28
- .reduce((acc, maybeMeta) => {
29
- const maybeDecodedMeta = exports.Meta.decode(maybeMeta);
30
- if (E.isRight(maybeDecodedMeta)) {
31
- const meta = maybeDecodedMeta.right;
32
- // if it's an hyperlink it should have data validated as link otherwise we don't care and keep the meta
33
- if ((meta.data &&
34
- meta.type === "hyperlink" &&
35
- E.isRight(Link_1.Link.validate(meta.data, c))) ||
36
- meta.type !== "hyperlink") {
37
- return [...acc, meta];
38
- }
39
- }
40
- return acc;
41
- }, [])
42
- .sort((m1, m2) => m1.start - m2.start);
43
- return t.success(res);
44
- }
45
- else
46
- return t.failure(metas, c);
47
- }, (m) => t.array(exports.Meta).encode(m));
48
- exports.ImageBlock = t.exact(t.intersection([
49
- t.type({
50
- type: t.literal(nestable_1.RichTextNodeType.image),
51
- data: t.intersection([
52
- ImageContent_1.ImageContentView,
53
- t.partial({
54
- linkTo: (0, function_1.nullable)(Link_1.Link),
55
- }),
56
- ]),
57
- }),
58
- t.partial({
59
- label: validators_1.StringOrNull,
60
- direction: validators_1.StringOrNull,
61
- }),
62
- ]));
63
- function checkImageBlock(block) {
64
- return block.type === nestable_1.RichTextNodeType.image;
65
- }
66
- exports.checkImageBlock = checkImageBlock;
67
- exports.EmbedBlock = t.exact(t.intersection([
68
- t.type({
69
- type: t.literal(nestable_1.RichTextNodeType.embed),
70
- data: EmbedContent_1.EmbedContent,
71
- }),
72
- t.partial({
73
- label: validators_1.StringOrNull,
74
- direction: validators_1.StringOrNull,
75
- }),
76
- ]));
77
- function checkEmbedBlock(block) {
78
- return block.type === nestable_1.RichTextNodeType.embed;
79
- }
80
- exports.checkEmbedBlock = checkEmbedBlock;
81
- exports.TextBlock = t.exact(t.intersection([
82
- t.type({
83
- type: (0, function_1.refineType)(nestable_1.RichTextNodeTypeCodec, `string which isn't ${nestable_1.RichTextNodeType.image} ${nestable_1.RichTextNodeType.embed}`, (s) => s !== nestable_1.RichTextNodeType.image && s !== nestable_1.RichTextNodeType.embed),
84
- content: t.intersection([
85
- t.type({
86
- text: t.string,
87
- }),
88
- t.partial({
89
- spans: exports.ValidatedMetas,
90
- }),
91
- ]),
92
- }),
93
- t.partial({
94
- label: t.string,
95
- direction: t.string,
96
- }),
97
- ]));
98
- exports.Block = t.union([exports.ImageBlock, exports.EmbedBlock, exports.TextBlock]);
@@ -1,9 +0,0 @@
1
- import * as t from "io-ts";
2
- import { Block } from "./Block";
3
- export declare const StructuredTextContentType = "StructuredTextContent";
4
- export declare type StructuredTextContent = {
5
- value: Block[];
6
- __TYPE__: typeof StructuredTextContentType;
7
- };
8
- export declare const StructuredTextContent: t.Type<StructuredTextContent, string, unknown>;
9
- export * as Blocks from "./Block";
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Blocks = exports.StructuredTextContent = exports.StructuredTextContentType = void 0;
4
- const tslib_1 = require("tslib");
5
- const Either_1 = require("fp-ts/Either");
6
- const t = (0, tslib_1.__importStar)(require("io-ts"));
7
- const Block_1 = require("./Block");
8
- exports.StructuredTextContentType = "StructuredTextContent";
9
- exports.StructuredTextContent = new t.Type(exports.StructuredTextContentType, (u) => { var _a; return ((_a = u) === null || _a === void 0 ? void 0 : _a.__TYPE__) === exports.StructuredTextContentType; }, (u, c) => Either_1.Chain.chain(t.array(Block_1.Block).validate(u, c), (u) => {
10
- return t.success({ value: u, __TYPE__: exports.StructuredTextContentType });
11
- }), () => {
12
- throw new Error("NotImplementedError: Not relevant method");
13
- });
14
- exports.Blocks = (0, tslib_1.__importStar)(require("./Block"));
@@ -1,26 +0,0 @@
1
- export { default as BooleanContent } from "./BooleanContent";
2
- export * from "./EmbedContent";
3
- export { default as FieldContent } from "./FieldContent";
4
- export { type GeoPointContentO, GeoPointContent } from "./GeoPointContent";
5
- export { type ImageContentO, ImageContent, ImageContentView, } from "./ImageContent";
6
- export { default as IntegrationFieldsContent } from "./IntegrationFieldsContent";
7
- export * as Links from "./Link";
8
- export * from "./SeparatorContent";
9
- export * from "./StructuredTextContent";
10
- export declare const NestableTypes: {
11
- readonly Links: {
12
- readonly DocumentLink: "DocumentLink";
13
- readonly FileLink: "FileLink";
14
- readonly ExternalLink: "ExternalLink";
15
- readonly ImageLink: "ImageLink";
16
- readonly LinkContent: "LinkContent";
17
- };
18
- readonly StructuredText: "StructuredTextContent";
19
- readonly Boolean: "BooleanContent";
20
- readonly Embed: "EmbedContent";
21
- readonly Field: "FieldContent";
22
- readonly GeoPoint: "GeoPointContent";
23
- readonly Image: "ImageContent";
24
- readonly IntegrationFields: "IntegrationFieldsContent";
25
- readonly Separator: "SeparatorContent";
26
- };
@@ -1,39 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NestableTypes = exports.Links = exports.IntegrationFieldsContent = exports.ImageContentView = exports.ImageContent = exports.GeoPointContent = exports.FieldContent = exports.BooleanContent = void 0;
4
- const tslib_1 = require("tslib");
5
- const BooleanContent_1 = require("./BooleanContent");
6
- const EmbedContent_1 = require("./EmbedContent");
7
- const FieldContent_1 = require("./FieldContent");
8
- const GeoPointContent_1 = require("./GeoPointContent");
9
- const ImageContent_1 = require("./ImageContent");
10
- const IntegrationFieldsContent_1 = require("./IntegrationFieldsContent");
11
- const Link_1 = require("./Link");
12
- const SeparatorContent_1 = require("./SeparatorContent");
13
- const StructuredTextContent_1 = require("./StructuredTextContent");
14
- var BooleanContent_2 = require("./BooleanContent");
15
- Object.defineProperty(exports, "BooleanContent", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(BooleanContent_2).default; } });
16
- (0, tslib_1.__exportStar)(require("./EmbedContent"), exports);
17
- var FieldContent_2 = require("./FieldContent");
18
- Object.defineProperty(exports, "FieldContent", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(FieldContent_2).default; } });
19
- var GeoPointContent_2 = require("./GeoPointContent");
20
- Object.defineProperty(exports, "GeoPointContent", { enumerable: true, get: function () { return GeoPointContent_2.GeoPointContent; } });
21
- var ImageContent_2 = require("./ImageContent");
22
- Object.defineProperty(exports, "ImageContent", { enumerable: true, get: function () { return ImageContent_2.ImageContent; } });
23
- Object.defineProperty(exports, "ImageContentView", { enumerable: true, get: function () { return ImageContent_2.ImageContentView; } });
24
- var IntegrationFieldsContent_2 = require("./IntegrationFieldsContent");
25
- Object.defineProperty(exports, "IntegrationFieldsContent", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(IntegrationFieldsContent_2).default; } });
26
- exports.Links = (0, tslib_1.__importStar)(require("./Link"));
27
- (0, tslib_1.__exportStar)(require("./SeparatorContent"), exports);
28
- (0, tslib_1.__exportStar)(require("./StructuredTextContent"), exports);
29
- exports.NestableTypes = {
30
- Links: Link_1.LinksTypes,
31
- StructuredText: StructuredTextContent_1.StructuredTextContentType,
32
- Boolean: BooleanContent_1.BooleanContentType,
33
- Embed: EmbedContent_1.EmbedContentType,
34
- Field: FieldContent_1.FieldContentType,
35
- GeoPoint: GeoPointContent_1.GeoPointContentType,
36
- Image: ImageContent_1.ImageContentType,
37
- IntegrationFields: IntegrationFieldsContent_1.IntegrationFieldsContentType,
38
- Separator: SeparatorContent_1.SeparatorContentType,
39
- };
@@ -1,14 +0,0 @@
1
- import * as O from "fp-ts/Option";
2
- import type { GroupItemContent } from "../GroupContent";
3
- import { SimpleWidgetContent } from "../index";
4
- export declare const CompositeSliceContentType = "CompositeSliceContent";
5
- export declare type CompositeSliceContent = {
6
- repeat: GroupItemContent[];
7
- nonRepeat: {
8
- [key: string]: SimpleWidgetContent;
9
- };
10
- __TYPE__: typeof CompositeSliceContentType;
11
- };
12
- export declare const CompositeSliceContent: {
13
- fromJson: (prefixes: Array<string>, key: string, value: unknown, fieldTypes: Map<string, string>, fieldPositions: Map<string, number>) => O.Option<CompositeSliceContent>;
14
- };
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CompositeSliceContent = exports.CompositeSliceContentType = void 0;
4
- const tslib_1 = require("tslib");
5
- const Either_1 = require("fp-ts/Either");
6
- const O = (0, tslib_1.__importStar)(require("fp-ts/Option"));
7
- const t = (0, tslib_1.__importStar)(require("io-ts"));
8
- const index_1 = require("../index");
9
- exports.CompositeSliceContentType = "CompositeSliceContent";
10
- const codec = t.exact(t.partial({
11
- repeat: t.array(t.unknown),
12
- "non-repeat": t.UnknownRecord,
13
- }));
14
- exports.CompositeSliceContent = {
15
- fromJson: (prefixes, key, value, fieldTypes, fieldPositions) => {
16
- var _a;
17
- const prefixedRepeatKey = Array.of(prefixes, [key, "repeat"])
18
- .flat()
19
- .join(".");
20
- const decodedValue = codec.decode(value);
21
- if ((0, Either_1.isRight)(decodedValue)) {
22
- const repeatObj = decodedValue.right.repeat;
23
- const nonRepeatObj = (_a = decodedValue.right["non-repeat"]) !== null && _a !== void 0 ? _a : {};
24
- const groupItemsContentsRepeat = index_1.GroupContent.itemsContentsFromJson(prefixedRepeatKey, repeatObj, fieldTypes, fieldPositions);
25
- const sortedFields = Object.entries(nonRepeatObj).sort(([k1], [k2]) => {
26
- var _a, _b;
27
- const p1 = (_a = fieldPositions.get(`${Array.of(prefixes, [key]).flat().join(".")}.${k1}`)) !== null && _a !== void 0 ? _a : 10000;
28
- const p2 = (_b = fieldPositions.get(`${Array.of(prefixes, [key]).flat().join(".")}.${k2}`)) !== null && _b !== void 0 ? _b : 10000;
29
- return p1 - p2;
30
- });
31
- const nonRepeat = sortedFields.reduce((acc, [k, v]) => {
32
- const kp = Array.of(prefixes, [key, "non-repeat", k]).flat().join(".");
33
- const kind = fieldTypes.get(kp);
34
- if (kind) {
35
- const mWidgetContent = index_1.SimpleWidgetContent.from(kind, v);
36
- if (O.isSome(mWidgetContent)) {
37
- acc[k] = mWidgetContent.value;
38
- }
39
- }
40
- return acc;
41
- }, {});
42
- return O.some({
43
- repeat: groupItemsContentsRepeat,
44
- nonRepeat,
45
- __TYPE__: "CompositeSliceContent",
46
- });
47
- }
48
- else {
49
- return O.none;
50
- }
51
- },
52
- };
@@ -1,15 +0,0 @@
1
- import * as O from "fp-ts/Option";
2
- import type { GroupItemContent } from "../GroupContent";
3
- import { SimpleWidgetContent } from "../index";
4
- export declare const SharedSliceContentType = "SharedSliceContent";
5
- export declare type SharedSliceContent = {
6
- variation: string;
7
- primary: {
8
- [key: string]: SimpleWidgetContent;
9
- };
10
- items: GroupItemContent[];
11
- __TYPE__: typeof SharedSliceContentType;
12
- };
13
- export declare const SharedSliceContent: {
14
- fromJson: (prefixes: Array<string>, key: string, value: unknown, fieldTypes: Map<string, string>, fieldPositions: Map<string, number>) => O.Option<SharedSliceContent>;
15
- };
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SharedSliceContent = exports.SharedSliceContentType = void 0;
4
- const tslib_1 = require("tslib");
5
- const Either_1 = require("fp-ts/Either");
6
- const O = (0, tslib_1.__importStar)(require("fp-ts/Option"));
7
- const t = (0, tslib_1.__importStar)(require("io-ts"));
8
- const io_ts_types_1 = require("io-ts-types");
9
- const index_1 = require("../index");
10
- exports.SharedSliceContentType = "SharedSliceContent";
11
- const codec = t.exact(t.type({
12
- variation: t.string,
13
- items: (0, io_ts_types_1.withFallback)(t.array(t.unknown), []),
14
- primary: (0, io_ts_types_1.withFallback)(t.UnknownRecord, {}),
15
- }));
16
- exports.SharedSliceContent = {
17
- fromJson: (prefixes, key, value, fieldTypes, fieldPositions) => {
18
- const r = (0, Either_1.map)((v) => {
19
- const prefixedItemsKey = Array.of(prefixes, [
20
- key,
21
- "variations",
22
- v.variation,
23
- "items",
24
- ])
25
- .flat()
26
- .join(".");
27
- const groupItemsContents = index_1.GroupContent.itemsContentsFromJson(prefixedItemsKey, v.items, fieldTypes, fieldPositions);
28
- const sortedFields = Object.entries(v.primary).sort(([k1], [k2]) => {
29
- var _a, _b;
30
- const p1 = (_a = fieldPositions.get(`${Array.of(prefixes, [key]).flat().join(".")}.${k1}`)) !== null && _a !== void 0 ? _a : 10000;
31
- const p2 = (_b = fieldPositions.get(`${Array.of(prefixes, [key]).flat().join(".")}.${k2}`)) !== null && _b !== void 0 ? _b : 10000;
32
- return p1 - p2;
33
- });
34
- const primary = sortedFields.reduce((acc, [k, w]) => {
35
- const kp = Array.of(prefixes, [
36
- key,
37
- "variations",
38
- v.variation,
39
- "primary",
40
- k,
41
- ])
42
- .flat()
43
- .join(".");
44
- const kind = fieldTypes.get(kp);
45
- if (kind) {
46
- const maybeWidgetContent = index_1.SimpleWidgetContent.from(kind, w);
47
- if (O.isSome(maybeWidgetContent)) {
48
- acc[k] = maybeWidgetContent.value;
49
- }
50
- }
51
- return acc;
52
- }, {});
53
- const result = {
54
- variation: v.variation,
55
- primary,
56
- items: groupItemsContents,
57
- __TYPE__: "SharedSliceContent",
58
- };
59
- return result;
60
- })(codec.decode(value));
61
- return O.fromEither(r);
62
- },
63
- };
@@ -1,6 +0,0 @@
1
- import StaticWidgetContent from "../StaticWidgetContent";
2
- export declare type SimpleSliceContent = StaticWidgetContent;
3
- export declare const SimpleSliceContent: {
4
- fromJson: (prefixes: string[], key: string, value: unknown, fieldTypes: Map<string, string>, fieldPositions: Map<string, number>) => import("fp-ts/lib/Option").Option<StaticWidgetContent>;
5
- is: (value: unknown) => value is StaticWidgetContent;
6
- };
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SimpleSliceContent = void 0;
4
- const tslib_1 = require("tslib");
5
- const StaticWidgetContent_1 = (0, tslib_1.__importDefault)(require("../StaticWidgetContent"));
6
- exports.SimpleSliceContent = StaticWidgetContent_1.default;