@prismicio/types-internal 2.2.0-alpha.9 → 2.2.0-traverse.alpha-1
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/_internal/utils.d.ts +17 -0
- package/lib/_internal/utils.js +9 -0
- package/lib/common/Asset.d.ts +3 -4
- package/lib/common/Embed.d.ts +1 -2
- package/lib/common/UUID.d.ts +7 -0
- package/lib/common/UUID.js +8 -0
- package/lib/common/index.d.ts +1 -0
- package/lib/common/index.js +1 -0
- package/lib/content/Document.d.ts +22 -3
- package/lib/content/Document.js +71 -1
- package/lib/content/fields/GroupContent.d.ts +12 -0
- package/lib/content/fields/GroupContent.js +46 -1
- package/lib/content/fields/WidgetContent.d.ts +6 -6
- package/lib/content/fields/nestable/NestableContent.d.ts +2 -0
- package/lib/content/fields/nestable/NestableContent.js +29 -1
- package/lib/content/fields/slices/Slice/CompositeSliceContent.d.ts +8 -0
- package/lib/content/fields/slices/Slice/CompositeSliceContent.js +38 -1
- package/lib/content/fields/slices/Slice/RepeatableContent.js +0 -1
- package/lib/content/fields/slices/Slice/SharedSliceContent.d.ts +8 -0
- package/lib/content/fields/slices/Slice/SharedSliceContent.js +40 -1
- package/lib/content/fields/slices/SlicesContent.d.ts +7 -0
- package/lib/content/fields/slices/SlicesContent.js +68 -1
- package/lib/customtypes/CustomType.d.ts +1 -0
- package/lib/customtypes/CustomType.js +8 -1
- package/lib/customtypes/widgets/slices/CompositeSlice.d.ts +2 -0
- package/lib/customtypes/widgets/slices/CompositeSlice.js +5 -1
- package/lib/customtypes/widgets/slices/LegacySlice.d.ts +2 -0
- package/lib/customtypes/widgets/slices/LegacySlice.js +5 -1
- package/lib/customtypes/widgets/slices/SharedSlice.d.ts +4 -0
- package/lib/customtypes/widgets/slices/SharedSlice.js +9 -1
- package/lib/import/converters/Document.d.ts +2 -2
- package/lib/import/converters/Document.js +6 -6
- package/lib/import/converters/fields/Slices/SharedSlice.d.ts +4 -0
- package/lib/import/converters/fields/Slices/SharedSlice.js +19 -0
- package/lib/import/converters/fields/Slices/SharedSliceContent.d.ts +10 -0
- package/lib/import/converters/fields/Slices/SharedSliceContent.js +58 -0
- package/lib/import/converters/fields/Slices/Slices.d.ts +4 -0
- package/lib/import/converters/fields/Slices/Slices.js +16 -0
- package/lib/import/converters/fields/Slices/index.d.ts +1 -0
- package/lib/import/converters/fields/Slices/index.js +4 -0
- package/lib/import/converters/fields/UID.d.ts +1 -1
- package/lib/import/converters/fields/UID.js +0 -2
- package/lib/import/converters/fields/index.d.ts +1 -0
- package/lib/import/converters/fields/index.js +1 -0
- package/lib/import/converters/fields/nestable/Embed.d.ts +2 -1
- package/lib/import/converters/fields/nestable/Embed.js +24 -5
- package/lib/import/converters/fields/nestable/Image.d.ts +2 -2
- package/lib/import/converters/fields/nestable/Image.js +1 -1
- package/lib/import/converters/fields/nestable/Link.d.ts +1 -1
- package/lib/import/converters/fields/nestable/Link.js +6 -6
- package/lib/import/converters/fields/nestable/Nestable.d.ts +4 -3
- package/lib/import/converters/fields/nestable/Nestable.js +2 -2
- package/lib/import/validators/Document.js +2 -2
- package/lib/import/validators/fields/ImportField.d.ts +17 -68
- package/lib/import/validators/fields/ImportField.js +8 -4
- package/lib/import/validators/fields/ImportSlices/ImportSlices.d.ts +8 -0
- package/lib/import/validators/fields/ImportSlices/ImportSlices.js +29 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/SharedSlice.d.ts +14 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/SharedSlice.js +61 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/errors.d.ts +4 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/errors.js +7 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/OptionalSharedSliceId.d.ts +2 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/OptionalSharedSliceId.js +15 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/SharedSliceContent.d.ts +17 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/SharedSliceContent.js +30 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/SharedSliceContentEntry.d.ts +43 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/SharedSliceContentEntry.js +69 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/errors.d.ts +4 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/errors.js +6 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/index.d.ts +2 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/index.js +5 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/types.d.ts +1 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/types.js +2 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceId.d.ts +9 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceId.js +39 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceType.d.ts +11 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceType.js +24 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceVariation.d.ts +11 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceVariation.js +24 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/index.d.ts +5 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/fields/index.js +8 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/index.d.ts +3 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/index.js +6 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/utils.d.ts +339 -0
- package/lib/import/validators/fields/ImportSlices/SharedSlice/utils.js +11 -0
- package/lib/import/validators/fields/ImportSlices/index.d.ts +1 -0
- package/lib/import/validators/fields/ImportSlices/index.js +4 -0
- package/lib/import/validators/fields/ImportSlices/utils.d.ts +4 -0
- package/lib/import/validators/fields/ImportSlices/utils.js +35 -0
- package/lib/import/validators/fields/UID.d.ts +2 -2
- package/lib/import/validators/fields/UID.js +1 -1
- package/lib/import/validators/fields/nestable/Embed.d.ts +6 -23
- package/lib/import/validators/fields/nestable/Embed.js +7 -25
- package/lib/import/validators/fields/nestable/GeoPoint.js +1 -1
- package/lib/import/validators/fields/nestable/Image/Decoder.d.ts +26 -0
- package/lib/import/validators/fields/nestable/Image/Decoder.js +40 -0
- package/lib/import/validators/fields/nestable/Image/Validator.d.ts +33 -0
- package/lib/import/validators/fields/nestable/Image/Validator.js +27 -0
- package/lib/import/validators/fields/nestable/Image/index.d.ts +26 -0
- package/lib/import/validators/fields/nestable/Image/index.js +41 -0
- package/lib/import/validators/fields/nestable/Image/model.d.ts +18 -0
- package/lib/import/validators/fields/nestable/Image/model.js +2 -0
- package/lib/import/validators/fields/nestable/Link.js +2 -2
- package/lib/import/validators/fields/nestable/Nestable.d.ts +9 -60
- package/lib/import/validators/fields/nestable/index.d.ts +1 -0
- package/lib/import/validators/fields/nestable/index.js +1 -0
- package/lib/utils/DocumentId.d.ts +2 -1
- package/lib/utils/DocumentId.js +3 -3
- package/lib/utils/io-ts.d.ts +2 -0
- package/lib/utils/io-ts.js +22 -0
- package/lib/validators/BasicTypes.d.ts +0 -1
- package/lib/validators/BasicTypes.js +7 -8
- package/lib/validators/DefaultOrElse.js +1 -1
- package/lib/validators/NonEmptyString.js +1 -1
- package/lib/validators/function.d.ts +4 -4
- package/lib/validators/function.js +6 -6
- package/package.json +4 -2
- package/src/_internal/utils.ts +39 -0
- package/src/common/Asset.ts +4 -5
- package/src/common/Embed.ts +22 -0
- package/src/common/UUID.ts +19 -0
- package/src/common/index.ts +1 -0
- package/src/content/Document.ts +96 -1
- package/src/content/fields/GroupContent.ts +68 -0
- package/src/content/fields/nestable/NestableContent.ts +32 -0
- package/src/content/fields/slices/Slice/CompositeSliceContent.ts +55 -0
- package/src/content/fields/slices/Slice/RepeatableContent.ts +0 -1
- package/src/content/fields/slices/Slice/SharedSliceContent.ts +60 -0
- package/src/content/fields/slices/SlicesContent.ts +94 -0
- package/src/customtypes/CustomType.ts +17 -0
- package/src/customtypes/widgets/slices/CompositeSlice.ts +7 -0
- package/src/customtypes/widgets/slices/LegacySlice.ts +7 -0
- package/src/customtypes/widgets/slices/SharedSlice.ts +12 -0
- package/src/import/converters/Document.ts +10 -8
- package/src/import/converters/fields/Slices/SharedSlice.ts +24 -0
- package/src/import/converters/fields/Slices/SharedSliceContent.ts +94 -0
- package/src/import/converters/fields/Slices/Slices.ts +20 -0
- package/src/import/converters/fields/Slices/index.ts +1 -0
- package/src/import/converters/fields/UID.ts +1 -5
- package/src/import/converters/fields/index.ts +1 -0
- package/src/import/converters/fields/nestable/Embed.ts +29 -7
- package/src/import/converters/fields/nestable/Image.ts +4 -4
- package/src/import/converters/fields/nestable/Link.ts +5 -5
- package/src/import/converters/fields/nestable/Nestable.ts +7 -5
- package/src/import/validators/Document.ts +3 -3
- package/src/import/validators/fields/ImportField.ts +12 -6
- package/src/import/validators/fields/ImportSlices/ImportSlices.ts +54 -0
- package/src/import/validators/fields/ImportSlices/SharedSlice/SharedSlice.ts +116 -0
- package/src/import/validators/fields/ImportSlices/SharedSlice/errors.ts +6 -0
- package/src/import/validators/fields/ImportSlices/SharedSlice/fields/OptionalSharedSliceId.ts +20 -0
- package/src/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/SharedSliceContent.ts +64 -0
- package/src/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/SharedSliceContentEntry.ts +100 -0
- package/src/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/errors.ts +10 -0
- package/src/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/index.ts +2 -0
- package/src/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceContent/types.ts +1 -0
- package/src/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceId.ts +65 -0
- package/src/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceType.ts +45 -0
- package/src/import/validators/fields/ImportSlices/SharedSlice/fields/SharedSliceVariation.ts +45 -0
- package/src/import/validators/fields/ImportSlices/SharedSlice/fields/index.ts +5 -0
- package/src/import/validators/fields/ImportSlices/SharedSlice/index.ts +3 -0
- package/src/import/validators/fields/ImportSlices/SharedSlice/utils.ts +21 -0
- package/src/import/validators/fields/ImportSlices/index.ts +1 -0
- package/src/import/validators/fields/ImportSlices/utils.ts +43 -0
- package/src/import/validators/fields/UID.ts +2 -2
- package/src/import/validators/fields/nestable/Embed.ts +9 -41
- package/src/import/validators/fields/nestable/GeoPoint.ts +2 -2
- package/src/import/validators/fields/nestable/Image/Decoder.ts +61 -0
- package/src/import/validators/fields/nestable/Image/Validator.ts +38 -0
- package/src/import/validators/fields/nestable/Image/index.ts +75 -0
- package/src/import/validators/fields/nestable/Image/model.ts +18 -0
- package/src/import/validators/fields/nestable/Link.ts +2 -2
- package/src/import/validators/fields/nestable/index.ts +1 -0
- package/src/utils/DocumentId.ts +4 -5
- package/src/utils/io-ts.ts +29 -0
- package/src/validators/BasicTypes.ts +13 -11
- package/src/validators/DefaultOrElse.ts +1 -1
- package/src/validators/NonEmptyString.ts +4 -5
- package/src/validators/function.ts +4 -4
- package/lib/import/validators/fields/nestable/Image.d.ts +0 -62
- package/lib/import/validators/fields/nestable/Image.js +0 -76
- package/src/import/validators/fields/nestable/Image.ts +0 -147
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import * as E from "fp-ts/Either";
|
|
2
|
+
import type { SharedSlice as SharedSliceCustomType } from "../../../../../customtypes";
|
|
3
|
+
import type { Variation } from "../../../../../customtypes";
|
|
4
|
+
export declare const findSlice: (slices: SharedSliceCustomType[]) => (sliceId: string) => E.Either<string, {
|
|
5
|
+
id: string;
|
|
6
|
+
type: "SharedSlice";
|
|
7
|
+
name: string;
|
|
8
|
+
variations: readonly ({
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
imageUrl: string;
|
|
13
|
+
docURL: string;
|
|
14
|
+
version: string;
|
|
15
|
+
} & {
|
|
16
|
+
display?: string;
|
|
17
|
+
primary?: {
|
|
18
|
+
[x: string]: ({
|
|
19
|
+
type: "Boolean";
|
|
20
|
+
} & {
|
|
21
|
+
config?: {
|
|
22
|
+
label?: string | null | undefined;
|
|
23
|
+
default_value?: boolean;
|
|
24
|
+
placeholder_true?: string;
|
|
25
|
+
placeholder_false?: string;
|
|
26
|
+
};
|
|
27
|
+
}) | ({
|
|
28
|
+
type: "Color";
|
|
29
|
+
} & {
|
|
30
|
+
fieldset?: string | null | undefined;
|
|
31
|
+
config?: {
|
|
32
|
+
label?: string | null | undefined;
|
|
33
|
+
placeholder?: string;
|
|
34
|
+
};
|
|
35
|
+
}) | ({
|
|
36
|
+
type: "Date";
|
|
37
|
+
} & {
|
|
38
|
+
fieldset?: string | null | undefined;
|
|
39
|
+
config?: {
|
|
40
|
+
label?: string | null | undefined;
|
|
41
|
+
placeholder?: string;
|
|
42
|
+
default?: string;
|
|
43
|
+
};
|
|
44
|
+
}) | ({
|
|
45
|
+
type: "Embed";
|
|
46
|
+
} & {
|
|
47
|
+
fieldset?: string | null | undefined;
|
|
48
|
+
config?: {
|
|
49
|
+
label?: string | null | undefined;
|
|
50
|
+
placeholder?: string;
|
|
51
|
+
useAsTitle?: boolean;
|
|
52
|
+
};
|
|
53
|
+
}) | ({
|
|
54
|
+
type: "GeoPoint";
|
|
55
|
+
} & {
|
|
56
|
+
fieldset?: string | null | undefined;
|
|
57
|
+
config?: {
|
|
58
|
+
label?: string | null | undefined;
|
|
59
|
+
};
|
|
60
|
+
}) | ({
|
|
61
|
+
type: "Image";
|
|
62
|
+
} & {
|
|
63
|
+
fieldset?: string | null | undefined;
|
|
64
|
+
config?: {
|
|
65
|
+
label?: string | null | undefined;
|
|
66
|
+
placeholder?: string;
|
|
67
|
+
constraint?: {
|
|
68
|
+
width?: number | null;
|
|
69
|
+
height?: number | null;
|
|
70
|
+
};
|
|
71
|
+
thumbnails?: readonly ({
|
|
72
|
+
name: string;
|
|
73
|
+
} & {
|
|
74
|
+
width?: number | null;
|
|
75
|
+
height?: number | null;
|
|
76
|
+
})[];
|
|
77
|
+
};
|
|
78
|
+
}) | ({
|
|
79
|
+
type: "IntegrationFields";
|
|
80
|
+
} & {
|
|
81
|
+
fieldset?: string | null | undefined;
|
|
82
|
+
config?: {
|
|
83
|
+
label?: string | null | undefined;
|
|
84
|
+
placeholder?: string;
|
|
85
|
+
catalog?: string;
|
|
86
|
+
};
|
|
87
|
+
}) | ({
|
|
88
|
+
type: "Link";
|
|
89
|
+
} & {
|
|
90
|
+
fieldset?: string | null | undefined;
|
|
91
|
+
config?: {
|
|
92
|
+
label?: string | null | undefined;
|
|
93
|
+
useAsTitle?: boolean;
|
|
94
|
+
placeholder?: string;
|
|
95
|
+
select?: "media" | "document" | "web" | null;
|
|
96
|
+
customtypes?: readonly string[];
|
|
97
|
+
masks?: readonly string[];
|
|
98
|
+
tags?: readonly string[];
|
|
99
|
+
allowTargetBlank?: boolean;
|
|
100
|
+
};
|
|
101
|
+
}) | ({
|
|
102
|
+
type: "Number";
|
|
103
|
+
} & {
|
|
104
|
+
fieldset?: string | null | undefined;
|
|
105
|
+
config?: {
|
|
106
|
+
label?: string | null | undefined;
|
|
107
|
+
placeholder?: string;
|
|
108
|
+
min?: number;
|
|
109
|
+
max?: number;
|
|
110
|
+
step?: number;
|
|
111
|
+
};
|
|
112
|
+
}) | ({
|
|
113
|
+
type: "Range";
|
|
114
|
+
} & {
|
|
115
|
+
fieldset?: string | null | undefined;
|
|
116
|
+
config?: {
|
|
117
|
+
label?: string | null | undefined;
|
|
118
|
+
placeholder?: string;
|
|
119
|
+
min?: number;
|
|
120
|
+
max?: number;
|
|
121
|
+
step?: number;
|
|
122
|
+
};
|
|
123
|
+
}) | ({
|
|
124
|
+
type: "StructuredText";
|
|
125
|
+
} & {
|
|
126
|
+
fieldset?: string | null | undefined;
|
|
127
|
+
config?: {
|
|
128
|
+
label?: string | null | undefined;
|
|
129
|
+
placeholder?: string;
|
|
130
|
+
useAsTitle?: boolean;
|
|
131
|
+
single?: string;
|
|
132
|
+
multi?: string;
|
|
133
|
+
imageConstraint?: {
|
|
134
|
+
width?: number | null;
|
|
135
|
+
height?: number | null;
|
|
136
|
+
};
|
|
137
|
+
labels?: readonly string[];
|
|
138
|
+
allowTargetBlank?: boolean;
|
|
139
|
+
};
|
|
140
|
+
}) | ({
|
|
141
|
+
type: "Select";
|
|
142
|
+
} & {
|
|
143
|
+
fieldset?: string | null | undefined;
|
|
144
|
+
config?: {
|
|
145
|
+
label?: string | null | undefined;
|
|
146
|
+
placeholder?: string;
|
|
147
|
+
default_value?: string;
|
|
148
|
+
options?: readonly string[];
|
|
149
|
+
};
|
|
150
|
+
}) | ({
|
|
151
|
+
type: "Separator";
|
|
152
|
+
} & {
|
|
153
|
+
config?: {
|
|
154
|
+
label?: string | null | undefined;
|
|
155
|
+
};
|
|
156
|
+
}) | ({
|
|
157
|
+
type: "Text";
|
|
158
|
+
} & {
|
|
159
|
+
fieldset?: string | null | undefined;
|
|
160
|
+
config?: {
|
|
161
|
+
label?: string | null | undefined;
|
|
162
|
+
useAsTitle?: boolean;
|
|
163
|
+
placeholder?: string;
|
|
164
|
+
};
|
|
165
|
+
}) | ({
|
|
166
|
+
type: "Timestamp";
|
|
167
|
+
} & {
|
|
168
|
+
fieldset?: string | null | undefined;
|
|
169
|
+
config?: {
|
|
170
|
+
label?: string | null | undefined;
|
|
171
|
+
placeholder?: string;
|
|
172
|
+
default?: string;
|
|
173
|
+
};
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
items?: {
|
|
177
|
+
[x: string]: ({
|
|
178
|
+
type: "Boolean";
|
|
179
|
+
} & {
|
|
180
|
+
config?: {
|
|
181
|
+
label?: string | null | undefined;
|
|
182
|
+
default_value?: boolean;
|
|
183
|
+
placeholder_true?: string;
|
|
184
|
+
placeholder_false?: string;
|
|
185
|
+
};
|
|
186
|
+
}) | ({
|
|
187
|
+
type: "Color";
|
|
188
|
+
} & {
|
|
189
|
+
fieldset?: string | null | undefined;
|
|
190
|
+
config?: {
|
|
191
|
+
label?: string | null | undefined;
|
|
192
|
+
placeholder?: string;
|
|
193
|
+
};
|
|
194
|
+
}) | ({
|
|
195
|
+
type: "Date";
|
|
196
|
+
} & {
|
|
197
|
+
fieldset?: string | null | undefined;
|
|
198
|
+
config?: {
|
|
199
|
+
label?: string | null | undefined;
|
|
200
|
+
placeholder?: string;
|
|
201
|
+
default?: string;
|
|
202
|
+
};
|
|
203
|
+
}) | ({
|
|
204
|
+
type: "Embed";
|
|
205
|
+
} & {
|
|
206
|
+
fieldset?: string | null | undefined;
|
|
207
|
+
config?: {
|
|
208
|
+
label?: string | null | undefined;
|
|
209
|
+
placeholder?: string;
|
|
210
|
+
useAsTitle?: boolean;
|
|
211
|
+
};
|
|
212
|
+
}) | ({
|
|
213
|
+
type: "GeoPoint";
|
|
214
|
+
} & {
|
|
215
|
+
fieldset?: string | null | undefined;
|
|
216
|
+
config?: {
|
|
217
|
+
label?: string | null | undefined;
|
|
218
|
+
};
|
|
219
|
+
}) | ({
|
|
220
|
+
type: "Image";
|
|
221
|
+
} & {
|
|
222
|
+
fieldset?: string | null | undefined;
|
|
223
|
+
config?: {
|
|
224
|
+
label?: string | null | undefined;
|
|
225
|
+
placeholder?: string;
|
|
226
|
+
constraint?: {
|
|
227
|
+
width?: number | null;
|
|
228
|
+
height?: number | null;
|
|
229
|
+
};
|
|
230
|
+
thumbnails?: readonly ({
|
|
231
|
+
name: string;
|
|
232
|
+
} & {
|
|
233
|
+
width?: number | null;
|
|
234
|
+
height?: number | null;
|
|
235
|
+
})[];
|
|
236
|
+
};
|
|
237
|
+
}) | ({
|
|
238
|
+
type: "IntegrationFields";
|
|
239
|
+
} & {
|
|
240
|
+
fieldset?: string | null | undefined;
|
|
241
|
+
config?: {
|
|
242
|
+
label?: string | null | undefined;
|
|
243
|
+
placeholder?: string;
|
|
244
|
+
catalog?: string;
|
|
245
|
+
};
|
|
246
|
+
}) | ({
|
|
247
|
+
type: "Link";
|
|
248
|
+
} & {
|
|
249
|
+
fieldset?: string | null | undefined;
|
|
250
|
+
config?: {
|
|
251
|
+
label?: string | null | undefined;
|
|
252
|
+
useAsTitle?: boolean;
|
|
253
|
+
placeholder?: string;
|
|
254
|
+
select?: "media" | "document" | "web" | null;
|
|
255
|
+
customtypes?: readonly string[];
|
|
256
|
+
masks?: readonly string[];
|
|
257
|
+
tags?: readonly string[];
|
|
258
|
+
allowTargetBlank?: boolean;
|
|
259
|
+
};
|
|
260
|
+
}) | ({
|
|
261
|
+
type: "Number";
|
|
262
|
+
} & {
|
|
263
|
+
fieldset?: string | null | undefined;
|
|
264
|
+
config?: {
|
|
265
|
+
label?: string | null | undefined;
|
|
266
|
+
placeholder?: string;
|
|
267
|
+
min?: number;
|
|
268
|
+
max?: number;
|
|
269
|
+
step?: number;
|
|
270
|
+
};
|
|
271
|
+
}) | ({
|
|
272
|
+
type: "Range";
|
|
273
|
+
} & {
|
|
274
|
+
fieldset?: string | null | undefined;
|
|
275
|
+
config?: {
|
|
276
|
+
label?: string | null | undefined;
|
|
277
|
+
placeholder?: string;
|
|
278
|
+
min?: number;
|
|
279
|
+
max?: number;
|
|
280
|
+
step?: number;
|
|
281
|
+
};
|
|
282
|
+
}) | ({
|
|
283
|
+
type: "StructuredText";
|
|
284
|
+
} & {
|
|
285
|
+
fieldset?: string | null | undefined;
|
|
286
|
+
config?: {
|
|
287
|
+
label?: string | null | undefined;
|
|
288
|
+
placeholder?: string;
|
|
289
|
+
useAsTitle?: boolean;
|
|
290
|
+
single?: string;
|
|
291
|
+
multi?: string;
|
|
292
|
+
imageConstraint?: {
|
|
293
|
+
width?: number | null;
|
|
294
|
+
height?: number | null;
|
|
295
|
+
};
|
|
296
|
+
labels?: readonly string[];
|
|
297
|
+
allowTargetBlank?: boolean;
|
|
298
|
+
};
|
|
299
|
+
}) | ({
|
|
300
|
+
type: "Select";
|
|
301
|
+
} & {
|
|
302
|
+
fieldset?: string | null | undefined;
|
|
303
|
+
config?: {
|
|
304
|
+
label?: string | null | undefined;
|
|
305
|
+
placeholder?: string;
|
|
306
|
+
default_value?: string;
|
|
307
|
+
options?: readonly string[];
|
|
308
|
+
};
|
|
309
|
+
}) | ({
|
|
310
|
+
type: "Separator";
|
|
311
|
+
} & {
|
|
312
|
+
config?: {
|
|
313
|
+
label?: string | null | undefined;
|
|
314
|
+
};
|
|
315
|
+
}) | ({
|
|
316
|
+
type: "Text";
|
|
317
|
+
} & {
|
|
318
|
+
fieldset?: string | null | undefined;
|
|
319
|
+
config?: {
|
|
320
|
+
label?: string | null | undefined;
|
|
321
|
+
useAsTitle?: boolean;
|
|
322
|
+
placeholder?: string;
|
|
323
|
+
};
|
|
324
|
+
}) | ({
|
|
325
|
+
type: "Timestamp";
|
|
326
|
+
} & {
|
|
327
|
+
fieldset?: string | null | undefined;
|
|
328
|
+
config?: {
|
|
329
|
+
label?: string | null | undefined;
|
|
330
|
+
placeholder?: string;
|
|
331
|
+
default?: string;
|
|
332
|
+
};
|
|
333
|
+
});
|
|
334
|
+
};
|
|
335
|
+
})[];
|
|
336
|
+
} & {
|
|
337
|
+
description?: string;
|
|
338
|
+
}>;
|
|
339
|
+
export declare const findSliceVariation: (slice: SharedSliceCustomType) => (variation: string) => E.Either<string, Variation>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findSliceVariation = exports.findSlice = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const E = (0, tslib_1.__importStar)(require("fp-ts/Either"));
|
|
6
|
+
const function_1 = require("fp-ts/function");
|
|
7
|
+
const errors_1 = require("./errors");
|
|
8
|
+
const findSlice = (slices) => (sliceId) => (0, function_1.pipe)(slices.find((slice) => slice.id === sliceId), E.fromNullable(errors_1.SharedSliceErrors.SliceTypeNotFound(sliceId)));
|
|
9
|
+
exports.findSlice = findSlice;
|
|
10
|
+
const findSliceVariation = (slice) => (variation) => (0, function_1.pipe)(slice.variations.find((v) => v.id === variation), E.fromNullable(errors_1.SharedSliceErrors.VariationNotFound(variation, slice.id)));
|
|
11
|
+
exports.findSliceVariation = findSliceVariation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ImportSlices";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SharedSlice as SharedSliceCustomType, StaticSlices } from "../../../../customtypes";
|
|
2
|
+
import type { SharedSlice, SharedSliceId } from "./SharedSlice";
|
|
3
|
+
export declare const extractSupportedSlices: (staticSlices: StaticSlices) => SharedSliceCustomType[];
|
|
4
|
+
export declare const findImportSharedSliceDuplicateIds: (slices: SharedSlice[]) => SharedSliceId[];
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findImportSharedSliceDuplicateIds = exports.extractSupportedSlices = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const A = (0, tslib_1.__importStar)(require("fp-ts/Array"));
|
|
6
|
+
const function_1 = require("fp-ts/function");
|
|
7
|
+
const O = (0, tslib_1.__importStar)(require("fp-ts/Option"));
|
|
8
|
+
const customtypes_1 = require("../../../../customtypes");
|
|
9
|
+
// Extracts all supported slices from the static slices object
|
|
10
|
+
// For now we only support the SharedSlice, if we want to support other slices in the future, we have to add them here
|
|
11
|
+
const extractSupportedSlices = (staticSlices) => {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
return (0, function_1.pipe)(Object.values((_b = (_a = staticSlices.config) === null || _a === void 0 ? void 0 : _a.choices) !== null && _b !== void 0 ? _b : {}).map((slice) => (0, function_1.pipe)(customtypes_1.SharedSlice.decode(slice), O.fromEither)), A.compact);
|
|
14
|
+
};
|
|
15
|
+
exports.extractSupportedSlices = extractSupportedSlices;
|
|
16
|
+
const findImportSharedSliceDuplicateIds = (slices) => {
|
|
17
|
+
const duplicatesMap = slices.reduce((acc, { id }) => {
|
|
18
|
+
var _a;
|
|
19
|
+
if (id) {
|
|
20
|
+
const currentNumOfDuplicates = (_a = acc[id]) !== null && _a !== void 0 ? _a : 0;
|
|
21
|
+
return {
|
|
22
|
+
...acc,
|
|
23
|
+
[id]: acc[id] === undefined ? 0 : currentNumOfDuplicates + 1,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
return acc;
|
|
27
|
+
}, {});
|
|
28
|
+
return Object.entries(duplicatesMap).flatMap(([id, numOfDuplicates]) => {
|
|
29
|
+
if (numOfDuplicates > 0) {
|
|
30
|
+
return [id];
|
|
31
|
+
}
|
|
32
|
+
return [];
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
exports.findImportSharedSliceDuplicateIds = findImportSharedSliceDuplicateIds;
|
|
@@ -12,4 +12,4 @@ const uidValue = validators_1.String.pipe(new t.Type("ImportUIDField", (u) => va
|
|
|
12
12
|
}
|
|
13
13
|
return t.failure(n, c, "UID can only contain alphanumeric characters, dashes, underscores, and dots");
|
|
14
14
|
}, t.identity));
|
|
15
|
-
exports.ImportUID = (0, ImportContent_1.ImportContent)("UID",
|
|
15
|
+
exports.ImportUID = (0, ImportContent_1.ImportContent)("UID", uidValue);
|
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
import * as t from "io-ts";
|
|
2
|
-
declare const EmbedProto: t.ExactC<t.IntersectionC<[t.TypeC<{
|
|
3
|
-
embed_url: t.Type<string, string, unknown>;
|
|
4
|
-
type: t.StringC;
|
|
5
|
-
}>, t.PartialC<{
|
|
6
|
-
version: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
|
|
7
|
-
title: t.StringC;
|
|
8
|
-
author_name: t.UnionC<[t.StringC, t.NullC]>;
|
|
9
|
-
author_url: t.UnionC<[t.StringC, t.NullC]>;
|
|
10
|
-
provider_name: t.UnionC<[t.StringC, t.NullC]>;
|
|
11
|
-
provider_url: t.UnionC<[t.StringC, t.NullC]>;
|
|
12
|
-
cache_age: t.UnionC<[t.StringC, t.NumberC, t.NullC]>;
|
|
13
|
-
thumbnail_url: t.UnionC<[t.StringC, t.NullC]>;
|
|
14
|
-
thumbnail_width: t.UnionC<[t.NumberC, t.NullC]>;
|
|
15
|
-
thumbnail_height: t.UnionC<[t.NumberC, t.NullC]>;
|
|
16
|
-
html: t.UnionC<[t.StringC, t.NullC]>;
|
|
17
|
-
}>]>>;
|
|
18
|
-
declare type EmbedProto = t.TypeOf<typeof EmbedProto>;
|
|
19
|
-
declare type Embed = EmbedProto & {
|
|
20
|
-
all: unknown;
|
|
21
|
-
};
|
|
22
2
|
export declare const ImportEmbed: t.Type<{
|
|
23
3
|
type: "Embed";
|
|
24
|
-
value:
|
|
25
|
-
|
|
4
|
+
value: {
|
|
5
|
+
embed_url: string;
|
|
6
|
+
} | null;
|
|
7
|
+
}, {
|
|
8
|
+
embed_url: string;
|
|
9
|
+
} | undefined, unknown>;
|
|
26
10
|
export declare type ImportEmbed = t.TypeOf<typeof ImportEmbed>;
|
|
27
|
-
export {};
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ImportEmbed = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const Either = (0, tslib_1.__importStar)(require("fp-ts/
|
|
5
|
+
const Either = (0, tslib_1.__importStar)(require("fp-ts/Either"));
|
|
6
6
|
const function_1 = require("fp-ts/lib/function");
|
|
7
7
|
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
8
|
-
const io_ts_types_1 = require("io-ts-types");
|
|
9
8
|
const validators_1 = require("../../../../validators");
|
|
10
|
-
const BasicTypes_1 = require("../../../../validators/BasicTypes");
|
|
11
9
|
const ImportContent_1 = require("../ImportContent");
|
|
12
10
|
function isValidHttpUrl(param) {
|
|
13
11
|
try {
|
|
@@ -29,26 +27,10 @@ const EmbedUrl = new t.Type("EmbedUrl", (u) => isValidHttpUrl(u), (u, c) => {
|
|
|
29
27
|
return t.failure(u, c, "The value must be a valid http/https url");
|
|
30
28
|
}
|
|
31
29
|
}, t.identity);
|
|
32
|
-
const EmbedProto = t.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
})
|
|
37
|
-
t.partial({
|
|
38
|
-
version: (0, io_ts_types_1.withMessage)(t.union([t.string, t.number, t.null]), () => "The value must be either string, number or null"),
|
|
39
|
-
title: BasicTypes_1.String,
|
|
40
|
-
author_name: BasicTypes_1.StringOrNull,
|
|
41
|
-
author_url: BasicTypes_1.StringOrNull,
|
|
42
|
-
provider_name: BasicTypes_1.StringOrNull,
|
|
43
|
-
provider_url: BasicTypes_1.StringOrNull,
|
|
44
|
-
cache_age: (0, io_ts_types_1.withMessage)(t.union([t.string, t.number, t.null]), () => "The value must be either string, number or null"),
|
|
45
|
-
thumbnail_url: BasicTypes_1.StringOrNull,
|
|
46
|
-
thumbnail_width: BasicTypes_1.NumberOrNull,
|
|
47
|
-
thumbnail_height: BasicTypes_1.NumberOrNull,
|
|
48
|
-
html: BasicTypes_1.StringOrNull,
|
|
49
|
-
}),
|
|
50
|
-
]));
|
|
51
|
-
const embedValue = new t.Type("ImportEmbedValue", (u) => EmbedProto.is(u) && "all" in u, (u) => {
|
|
52
|
-
return (0, function_1.pipe)(EmbedProto.decode(u), Either.map((parsed) => ({ ...parsed, all: u })));
|
|
30
|
+
const EmbedProto = t.type({
|
|
31
|
+
embed_url: EmbedUrl,
|
|
32
|
+
});
|
|
33
|
+
const Embed = new t.Type("ImportEmbedValue", (u) => EmbedProto.is(u), (u) => {
|
|
34
|
+
return (0, function_1.pipe)(EmbedProto.decode(u), Either.map((parsed) => ({ embed_url: parsed.embed_url })));
|
|
53
35
|
}, t.identity);
|
|
54
|
-
exports.ImportEmbed = (0, ImportContent_1.ImportContent)("Embed", (0, validators_1.EmptyObjectOrElse)(
|
|
36
|
+
exports.ImportEmbed = (0, ImportContent_1.ImportContent)("Embed", (0, validators_1.EmptyObjectOrElse)(Embed));
|
|
@@ -6,7 +6,7 @@ const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
|
6
6
|
const validators_1 = require("../../../../validators");
|
|
7
7
|
const function_1 = require("../../../../validators/function");
|
|
8
8
|
const ImportContent_1 = require("../ImportContent");
|
|
9
|
-
const GeooPoint = (0, function_1.
|
|
9
|
+
const GeooPoint = (0, function_1.withCustomError)(t.strict({
|
|
10
10
|
latitude: (0, validators_1.NumberRange)(-90, 90, "latitude"),
|
|
11
11
|
longitude: (0, validators_1.NumberRange)(-180, 180, "longitude"),
|
|
12
12
|
}), () => "GeoPoint must be an object with the properties `latitude` and `longitude` between the given ranges");
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { TypeOf } from "io-ts";
|
|
2
|
+
import type { ImageField } from "./model";
|
|
3
|
+
import type { ImageFieldValidator, ThumbnailsValidator } from "./Validator";
|
|
4
|
+
export declare const decodeImageField: (image: TypeOf<typeof ImageFieldValidator> | undefined, mainImage: TypeOf<typeof ImageFieldValidator>, constraints?: {
|
|
5
|
+
width?: number | null;
|
|
6
|
+
height?: number | null;
|
|
7
|
+
} | undefined) => ImageField;
|
|
8
|
+
export declare const decodeThumbnails: (mainImage: TypeOf<typeof ImageFieldValidator>, thumbnails: TypeOf<typeof ThumbnailsValidator>, field?: ({
|
|
9
|
+
type: "Image";
|
|
10
|
+
} & {
|
|
11
|
+
fieldset?: string | null | undefined;
|
|
12
|
+
config?: {
|
|
13
|
+
label?: string | null | undefined;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
constraint?: {
|
|
16
|
+
width?: number | null;
|
|
17
|
+
height?: number | null;
|
|
18
|
+
};
|
|
19
|
+
thumbnails?: readonly ({
|
|
20
|
+
name: string;
|
|
21
|
+
} & {
|
|
22
|
+
width?: number | null;
|
|
23
|
+
height?: number | null;
|
|
24
|
+
})[];
|
|
25
|
+
};
|
|
26
|
+
}) | undefined) => {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decodeThumbnails = exports.decodeImageField = void 0;
|
|
4
|
+
// This function merges user input with custom type constraints.
|
|
5
|
+
// If `image` is missing, `mainImage` is used for the encoding
|
|
6
|
+
// (case when user input lacks thumbnail definition)
|
|
7
|
+
const decodeImageField = (image, mainImage, constraints) => {
|
|
8
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
9
|
+
const background = (_a = image === null || image === void 0 ? void 0 : image.edit) === null || _a === void 0 ? void 0 : _a.background;
|
|
10
|
+
const width = (_d = (_b = constraints === null || constraints === void 0 ? void 0 : constraints.width) !== null && _b !== void 0 ? _b : (_c = image === null || image === void 0 ? void 0 : image.dimensions) === null || _c === void 0 ? void 0 : _c.width) !== null && _d !== void 0 ? _d : (_e = mainImage.dimensions) === null || _e === void 0 ? void 0 : _e.width;
|
|
11
|
+
const height = (_h = (_f = constraints === null || constraints === void 0 ? void 0 : constraints.height) !== null && _f !== void 0 ? _f : (_g = image === null || image === void 0 ? void 0 : image.dimensions) === null || _g === void 0 ? void 0 : _g.height) !== null && _h !== void 0 ? _h : (_j = mainImage.dimensions) === null || _j === void 0 ? void 0 : _j.height;
|
|
12
|
+
const alt = image === null || image === void 0 ? void 0 : image.alt;
|
|
13
|
+
const copyright = image === null || image === void 0 ? void 0 : image.copyright;
|
|
14
|
+
return {
|
|
15
|
+
id: (_k = image === null || image === void 0 ? void 0 : image.id) !== null && _k !== void 0 ? _k : mainImage === null || mainImage === void 0 ? void 0 : mainImage.id,
|
|
16
|
+
edit: {
|
|
17
|
+
x: (_m = (_l = image === null || image === void 0 ? void 0 : image.edit) === null || _l === void 0 ? void 0 : _l.x) !== null && _m !== void 0 ? _m : 0,
|
|
18
|
+
y: (_p = (_o = image === null || image === void 0 ? void 0 : image.edit) === null || _o === void 0 ? void 0 : _o.y) !== null && _p !== void 0 ? _p : 0,
|
|
19
|
+
zoom: (_r = (_q = image === null || image === void 0 ? void 0 : image.edit) === null || _q === void 0 ? void 0 : _q.zoom) !== null && _r !== void 0 ? _r : 1,
|
|
20
|
+
...(background !== undefined ? { background } : {}),
|
|
21
|
+
},
|
|
22
|
+
dimensions: {
|
|
23
|
+
...(width !== undefined ? { width } : {}),
|
|
24
|
+
...(height !== undefined ? { height } : {}),
|
|
25
|
+
},
|
|
26
|
+
...(alt !== undefined ? { alt } : {}),
|
|
27
|
+
...(copyright !== undefined ? { copyright } : {}),
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
exports.decodeImageField = decodeImageField;
|
|
31
|
+
// Merges provided thumbnails with custom type constraints.
|
|
32
|
+
// If any thumbnail is missing, it is created using the origin image (`mainImage`)
|
|
33
|
+
const decodeThumbnails = (mainImage, thumbnails, field) => {
|
|
34
|
+
var _a, _b, _c;
|
|
35
|
+
return (_c = (_b = (_a = field === null || field === void 0 ? void 0 : field.config) === null || _a === void 0 ? void 0 : _a.thumbnails) === null || _b === void 0 ? void 0 : _b.reduce((acc, thumbnail) => ({
|
|
36
|
+
...acc,
|
|
37
|
+
[thumbnail.name]: (0, exports.decodeImageField)(thumbnails[thumbnail.name], mainImage, thumbnail),
|
|
38
|
+
}), {})) !== null && _c !== void 0 ? _c : {};
|
|
39
|
+
};
|
|
40
|
+
exports.decodeThumbnails = decodeThumbnails;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
export declare const ImageFieldValidator: t.IntersectionC<[t.TypeC<{
|
|
3
|
+
id: t.StringC;
|
|
4
|
+
}>, t.PartialC<{
|
|
5
|
+
dimensions: t.PartialC<{
|
|
6
|
+
width: t.NumberC;
|
|
7
|
+
height: t.NumberC;
|
|
8
|
+
}>;
|
|
9
|
+
edit: t.PartialC<{
|
|
10
|
+
x: t.NumberC;
|
|
11
|
+
y: t.NumberC;
|
|
12
|
+
zoom: t.NumberC;
|
|
13
|
+
background: t.StringC;
|
|
14
|
+
}>;
|
|
15
|
+
copyright: t.UnionC<[t.StringC, t.NullC]>;
|
|
16
|
+
alt: t.UnionC<[t.StringC, t.NullC]>;
|
|
17
|
+
}>]>;
|
|
18
|
+
export declare const ThumbnailsValidator: t.RecordC<t.StringC, t.IntersectionC<[t.TypeC<{
|
|
19
|
+
id: t.StringC;
|
|
20
|
+
}>, t.PartialC<{
|
|
21
|
+
dimensions: t.PartialC<{
|
|
22
|
+
width: t.NumberC;
|
|
23
|
+
height: t.NumberC;
|
|
24
|
+
}>;
|
|
25
|
+
edit: t.PartialC<{
|
|
26
|
+
x: t.NumberC;
|
|
27
|
+
y: t.NumberC;
|
|
28
|
+
zoom: t.NumberC;
|
|
29
|
+
background: t.StringC;
|
|
30
|
+
}>;
|
|
31
|
+
copyright: t.UnionC<[t.StringC, t.NullC]>;
|
|
32
|
+
alt: t.UnionC<[t.StringC, t.NullC]>;
|
|
33
|
+
}>]>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ThumbnailsValidator = exports.ImageFieldValidator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const t = (0, tslib_1.__importStar)(require("io-ts"));
|
|
6
|
+
const BasicTypes_1 = require("../../../../../validators/BasicTypes");
|
|
7
|
+
const function_1 = require("../../../../../validators/function");
|
|
8
|
+
exports.ImageFieldValidator = (0, function_1.withCustomError)(t.intersection([
|
|
9
|
+
t.type({
|
|
10
|
+
id: BasicTypes_1.String,
|
|
11
|
+
}),
|
|
12
|
+
t.partial({
|
|
13
|
+
dimensions: (0, function_1.withCustomError)(t.partial({
|
|
14
|
+
width: BasicTypes_1.Number,
|
|
15
|
+
height: BasicTypes_1.Number,
|
|
16
|
+
}), () => "The value must be an object"),
|
|
17
|
+
edit: (0, function_1.withCustomError)(t.partial({
|
|
18
|
+
x: BasicTypes_1.Number,
|
|
19
|
+
y: BasicTypes_1.Number,
|
|
20
|
+
zoom: BasicTypes_1.Number,
|
|
21
|
+
background: BasicTypes_1.String,
|
|
22
|
+
}), () => "The value must be an object"),
|
|
23
|
+
copyright: BasicTypes_1.StringOrNull,
|
|
24
|
+
alt: BasicTypes_1.StringOrNull,
|
|
25
|
+
}),
|
|
26
|
+
]), () => "The value must be an object");
|
|
27
|
+
exports.ThumbnailsValidator = t.record(t.string, exports.ImageFieldValidator);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as t from "io-ts";
|
|
2
|
+
import type { ImageFieldWithThumbnails } from "./model";
|
|
3
|
+
export declare const ImportImage: (field?: ({
|
|
4
|
+
type: "Image";
|
|
5
|
+
} & {
|
|
6
|
+
fieldset?: string | null | undefined;
|
|
7
|
+
config?: {
|
|
8
|
+
label?: string | null | undefined;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
constraint?: {
|
|
11
|
+
width?: number | null;
|
|
12
|
+
height?: number | null;
|
|
13
|
+
};
|
|
14
|
+
thumbnails?: readonly ({
|
|
15
|
+
name: string;
|
|
16
|
+
} & {
|
|
17
|
+
width?: number | null;
|
|
18
|
+
height?: number | null;
|
|
19
|
+
})[];
|
|
20
|
+
};
|
|
21
|
+
}) | undefined) => t.Type<{
|
|
22
|
+
type: "Image";
|
|
23
|
+
value: ImageFieldWithThumbnails | null;
|
|
24
|
+
}, ImageFieldWithThumbnails | undefined, unknown>;
|
|
25
|
+
export declare type ImportImage = t.TypeOf<ReturnType<typeof ImportImage>>;
|
|
26
|
+
export * from "./model";
|