@se-studio/contentful-rest-api 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +467 -0
- package/dist/index.d.ts +462 -0
- package/dist/index.js +1435 -0
- package/dist/index.js.map +1 -0
- package/package.json +55 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
import { BaseCmsConfig, IArticle, INavigationItem, IPage, IVisual, IInternalLink, INavigation, IPerson } from '@se-studio/core-data-types';
|
|
2
|
+
import { EntrySkeletonType, EntryFieldTypes, Entry, CreateClientParams, ContentfulClientApi } from 'contentful';
|
|
3
|
+
|
|
4
|
+
interface BaseExternalVideoFields {
|
|
5
|
+
name: EntryFieldTypes.Symbol;
|
|
6
|
+
nameAsCaption?: EntryFieldTypes.Boolean;
|
|
7
|
+
url: EntryFieldTypes.Symbol;
|
|
8
|
+
preview?: EntryFieldTypes.AssetLink;
|
|
9
|
+
posterImage?: EntryFieldTypes.AssetLink;
|
|
10
|
+
autoPlay?: EntryFieldTypes.Boolean;
|
|
11
|
+
loop?: EntryFieldTypes.Boolean;
|
|
12
|
+
hideControls?: EntryFieldTypes.Boolean;
|
|
13
|
+
dontCrop?: EntryFieldTypes.Boolean;
|
|
14
|
+
verticalCropPosition?: EntryFieldTypes.Symbol<'Bottom' | 'Middle' | 'Top'>;
|
|
15
|
+
horizontalCropPosition?: EntryFieldTypes.Symbol<'Center' | 'Left' | 'Right'>;
|
|
16
|
+
horizontalPosition?: EntryFieldTypes.Symbol<'Left' | 'Middle' | 'Right'>;
|
|
17
|
+
width?: EntryFieldTypes.Integer;
|
|
18
|
+
}
|
|
19
|
+
type BaseExternalVideoSkeleton = EntrySkeletonType<BaseExternalVideoFields, 'externalVideo'>;
|
|
20
|
+
|
|
21
|
+
interface BaseMediaFields {
|
|
22
|
+
name: EntryFieldTypes.Symbol;
|
|
23
|
+
nameAsCaption?: EntryFieldTypes.Boolean;
|
|
24
|
+
asset: EntryFieldTypes.AssetLink;
|
|
25
|
+
dontCrop?: EntryFieldTypes.Boolean;
|
|
26
|
+
verticalCropPosition?: EntryFieldTypes.Symbol<'Bottom' | 'Middle' | 'Top'>;
|
|
27
|
+
horizontalCropPosition?: EntryFieldTypes.Symbol<'Left' | 'Middle' | 'Right'>;
|
|
28
|
+
autoplay?: EntryFieldTypes.Boolean;
|
|
29
|
+
loop?: EntryFieldTypes.Boolean;
|
|
30
|
+
loopDelayMs?: EntryFieldTypes.Integer;
|
|
31
|
+
hideControls?: EntryFieldTypes.Boolean;
|
|
32
|
+
horizontalPosition?: EntryFieldTypes.Symbol<'Left' | 'Middle' | 'Right'>;
|
|
33
|
+
width?: EntryFieldTypes.Integer;
|
|
34
|
+
}
|
|
35
|
+
type BaseMediaSkeleton = EntrySkeletonType<BaseMediaFields, 'media'>;
|
|
36
|
+
|
|
37
|
+
interface BaseNavigationItemFields<TConfig extends BaseCmsConfig> {
|
|
38
|
+
title: EntryFieldTypes.Symbol;
|
|
39
|
+
useTitle: EntryFieldTypes.Boolean;
|
|
40
|
+
navigationItems?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseNavigationItemSkeleton<TConfig>>>;
|
|
41
|
+
text?: EntryFieldTypes.Symbol;
|
|
42
|
+
internal?: EntryFieldTypes.EntryLink<BaseLink<TConfig>>;
|
|
43
|
+
link?: EntryFieldTypes.Symbol;
|
|
44
|
+
isButton?: EntryFieldTypes.Boolean;
|
|
45
|
+
isOutlined?: EntryFieldTypes.Boolean;
|
|
46
|
+
backgroundColour?: EntryFieldTypes.Symbol<TConfig['ColourName'] | TConfig['GradientName']>;
|
|
47
|
+
textColour?: EntryFieldTypes.Symbol<TConfig['ColourName']>;
|
|
48
|
+
icon?: EntryFieldTypes.AssetLink;
|
|
49
|
+
variant?: EntryFieldTypes.Symbol<TConfig['ButtonVariant']>;
|
|
50
|
+
size?: EntryFieldTypes.Symbol<TConfig['ButtonSize']>;
|
|
51
|
+
longText?: EntryFieldTypes.RichText;
|
|
52
|
+
}
|
|
53
|
+
type BaseNavigationItemSkeleton<TConfig extends BaseCmsConfig> = EntrySkeletonType<BaseNavigationItemFields<TConfig>, 'navigationItem'>;
|
|
54
|
+
|
|
55
|
+
interface BaseNavigationFields<TConfig extends BaseCmsConfig> {
|
|
56
|
+
adminLabel: EntryFieldTypes.Symbol;
|
|
57
|
+
name: EntryFieldTypes.Symbol;
|
|
58
|
+
backgroundColour?: EntryFieldTypes.Symbol<TConfig['ColourName'] | TConfig['GradientName']>;
|
|
59
|
+
textColour?: EntryFieldTypes.Symbol<TConfig['ColourName']>;
|
|
60
|
+
entries?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseNavigationItemSkeleton<TConfig>>>;
|
|
61
|
+
}
|
|
62
|
+
type BaseNavigationSkeleton<TConfig extends BaseCmsConfig> = EntrySkeletonType<BaseNavigationFields<TConfig>, 'navigation'>;
|
|
63
|
+
|
|
64
|
+
interface BaseSchemaFields {
|
|
65
|
+
cmsLabel: EntryFieldTypes.Symbol;
|
|
66
|
+
markup: EntryFieldTypes.Object;
|
|
67
|
+
}
|
|
68
|
+
type BaseSchemaSkeleton = EntrySkeletonType<BaseSchemaFields, 'schema'>;
|
|
69
|
+
|
|
70
|
+
interface BaseTemplateFields<TConfig extends BaseCmsConfig> {
|
|
71
|
+
cmsLabel: EntryFieldTypes.Symbol;
|
|
72
|
+
preContent?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseContent<TConfig>>>;
|
|
73
|
+
postContent?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseContent<TConfig>>>;
|
|
74
|
+
menu?: EntryFieldTypes.EntryLink<BaseNavigationSkeleton<TConfig>>;
|
|
75
|
+
footer?: EntryFieldTypes.EntryLink<BaseNavigationSkeleton<TConfig>>;
|
|
76
|
+
backgroundColour?: EntryFieldTypes.Symbol<TConfig['ColourName'] | TConfig['GradientName']>;
|
|
77
|
+
textColour?: EntryFieldTypes.Symbol<TConfig['ColourName']>;
|
|
78
|
+
flags?: EntryFieldTypes.Array<EntryFieldTypes.Symbol<'Sticky nav'>>;
|
|
79
|
+
}
|
|
80
|
+
type BaseTemplateSkeleton<TConfig extends BaseCmsConfig> = EntrySkeletonType<BaseTemplateFields<TConfig>, 'template'>;
|
|
81
|
+
|
|
82
|
+
interface BaseArticleTypeFields<TConfig extends BaseCmsConfig> {
|
|
83
|
+
name: EntryFieldTypes.Symbol;
|
|
84
|
+
slug: EntryFieldTypes.Symbol;
|
|
85
|
+
indexPageName: EntryFieldTypes.Symbol;
|
|
86
|
+
indexPageSlug: EntryFieldTypes.Symbol;
|
|
87
|
+
indexPageDescription: EntryFieldTypes.Symbol;
|
|
88
|
+
featuredImage: EntryFieldTypes.AssetLink;
|
|
89
|
+
menu?: EntryFieldTypes.EntryLink<BaseNavigationSkeleton<TConfig>>;
|
|
90
|
+
footer?: EntryFieldTypes.EntryLink<BaseNavigationSkeleton<TConfig>>;
|
|
91
|
+
indexPageTemplate?: EntryFieldTypes.EntryLink<BaseTemplateSkeleton<TConfig>>;
|
|
92
|
+
indexPageTopContent?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseContent<TConfig>>>;
|
|
93
|
+
indexPageStructuredData?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseSchemaSkeleton>>;
|
|
94
|
+
visuals?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseExternalVideoSkeleton | BaseMediaSkeleton>>;
|
|
95
|
+
articleTemplate?: EntryFieldTypes.EntryLink<BaseTemplateSkeleton<TConfig>>;
|
|
96
|
+
articlePageTopContent?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseContent<TConfig>>>;
|
|
97
|
+
structuredData?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseSchemaSkeleton>>;
|
|
98
|
+
backgroundColour?: EntryFieldTypes.Symbol<TConfig['ColourName'] | TConfig['GradientName']>;
|
|
99
|
+
textColour?: EntryFieldTypes.Symbol<TConfig['ColourName']>;
|
|
100
|
+
indexed: EntryFieldTypes.Boolean;
|
|
101
|
+
hidden: EntryFieldTypes.Boolean;
|
|
102
|
+
indexPageHidden?: EntryFieldTypes.Boolean;
|
|
103
|
+
articlePageHidden?: EntryFieldTypes.Boolean;
|
|
104
|
+
flags?: EntryFieldTypes.Array<EntryFieldTypes.Symbol<'Sticky nav'>>;
|
|
105
|
+
searchTemplate?: EntryFieldTypes.EntryLink<BaseTemplateSkeleton<TConfig>>;
|
|
106
|
+
searchTopContent?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseContent<TConfig>>>;
|
|
107
|
+
}
|
|
108
|
+
type BaseArticleTypeSkeleton<TConfig extends BaseCmsConfig> = EntrySkeletonType<BaseArticleTypeFields<TConfig>, 'articleType'>;
|
|
109
|
+
|
|
110
|
+
interface BasePersonFields<TConfig extends BaseCmsConfig> {
|
|
111
|
+
name: EntryFieldTypes.Symbol;
|
|
112
|
+
slug: EntryFieldTypes.Symbol;
|
|
113
|
+
jobTitle: EntryFieldTypes.Symbol;
|
|
114
|
+
description?: EntryFieldTypes.Text;
|
|
115
|
+
phoneNumber?: EntryFieldTypes.Symbol;
|
|
116
|
+
emailAddress?: EntryFieldTypes.Symbol;
|
|
117
|
+
linkedIn?: EntryFieldTypes.Symbol;
|
|
118
|
+
media?: EntryFieldTypes.AssetLink;
|
|
119
|
+
location?: EntryFieldTypes.Symbol;
|
|
120
|
+
content?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseContent<TConfig>>>;
|
|
121
|
+
structuredData?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseSchemaSkeleton>>;
|
|
122
|
+
indexed: EntryFieldTypes.Boolean;
|
|
123
|
+
hidden: EntryFieldTypes.Boolean;
|
|
124
|
+
bio?: EntryFieldTypes.RichText;
|
|
125
|
+
textColour?: EntryFieldTypes.Symbol<TConfig['ColourName']>;
|
|
126
|
+
backgroundColour?: EntryFieldTypes.Symbol<TConfig['ColourName'] | TConfig['GradientName']>;
|
|
127
|
+
visuals?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseExternalVideoSkeleton | BaseMediaSkeleton>>;
|
|
128
|
+
}
|
|
129
|
+
type BasePersonSkeleton<TConfig extends BaseCmsConfig> = EntrySkeletonType<BasePersonFields<TConfig>, 'person'>;
|
|
130
|
+
|
|
131
|
+
interface BaseTagTypeFields {
|
|
132
|
+
name: EntryFieldTypes.Symbol;
|
|
133
|
+
}
|
|
134
|
+
type BaseTagTypeSkeleton = EntrySkeletonType<BaseTagTypeFields, 'tagType'>;
|
|
135
|
+
|
|
136
|
+
interface BaseTagFields<TConfig extends BaseCmsConfig> {
|
|
137
|
+
cmsLabel: EntryFieldTypes.Symbol;
|
|
138
|
+
name: EntryFieldTypes.Symbol;
|
|
139
|
+
tagType: EntryFieldTypes.EntryLink<BaseTagTypeSkeleton>;
|
|
140
|
+
slug: EntryFieldTypes.Symbol;
|
|
141
|
+
description: EntryFieldTypes.Symbol;
|
|
142
|
+
featuredImage: EntryFieldTypes.AssetLink;
|
|
143
|
+
visuals?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseExternalVideoSkeleton | BaseMediaSkeleton>>;
|
|
144
|
+
menu?: EntryFieldTypes.EntryLink<BaseNavigationSkeleton<TConfig>>;
|
|
145
|
+
footer?: EntryFieldTypes.EntryLink<BaseNavigationSkeleton<TConfig>>;
|
|
146
|
+
template?: EntryFieldTypes.EntryLink<BaseTemplateSkeleton<TConfig>>;
|
|
147
|
+
topContent?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseContent<TConfig>>>;
|
|
148
|
+
structuredData?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseSchemaSkeleton>>;
|
|
149
|
+
backgroundColour?: EntryFieldTypes.Symbol<TConfig['ColourName'] | TConfig['GradientName']>;
|
|
150
|
+
textColour?: EntryFieldTypes.Symbol<TConfig['ColourName']>;
|
|
151
|
+
indexed: EntryFieldTypes.Boolean;
|
|
152
|
+
hidden: EntryFieldTypes.Boolean;
|
|
153
|
+
}
|
|
154
|
+
type BaseTagSkeleton<TConfig extends BaseCmsConfig> = EntrySkeletonType<BaseTagFields<TConfig>, 'tag'>;
|
|
155
|
+
|
|
156
|
+
interface BaseArticleFields<TConfig extends BaseCmsConfig> {
|
|
157
|
+
cmsLabel: EntryFieldTypes.Symbol;
|
|
158
|
+
articleType: EntryFieldTypes.EntryLink<BaseArticleTypeSkeleton<TConfig>>;
|
|
159
|
+
title: EntryFieldTypes.Symbol;
|
|
160
|
+
description?: EntryFieldTypes.Text;
|
|
161
|
+
author?: EntryFieldTypes.EntryLink<BasePersonSkeleton<TConfig>>;
|
|
162
|
+
subtitle?: EntryFieldTypes.Symbol;
|
|
163
|
+
date: EntryFieldTypes.Date;
|
|
164
|
+
slug: EntryFieldTypes.Symbol;
|
|
165
|
+
featuredImage: EntryFieldTypes.AssetLink;
|
|
166
|
+
visuals?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseExternalVideoSkeleton | BaseMediaSkeleton>>;
|
|
167
|
+
icon?: EntryFieldTypes.AssetLink;
|
|
168
|
+
tags?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseTagSkeleton<TConfig>>>;
|
|
169
|
+
topContent?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseContent<TConfig>>>;
|
|
170
|
+
content?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseContent<TConfig>>>;
|
|
171
|
+
bottomContent?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseContent<TConfig>>>;
|
|
172
|
+
menu?: EntryFieldTypes.EntryLink<BaseNavigationSkeleton<TConfig>>;
|
|
173
|
+
footer?: EntryFieldTypes.EntryLink<BaseNavigationSkeleton<TConfig>>;
|
|
174
|
+
template?: EntryFieldTypes.EntryLink<BaseTemplateSkeleton<TConfig>>;
|
|
175
|
+
backgroundColour?: EntryFieldTypes.Symbol<TConfig['ColourName'] | TConfig['GradientName']>;
|
|
176
|
+
textColour?: EntryFieldTypes.Symbol<TConfig['ColourName']>;
|
|
177
|
+
indexed: EntryFieldTypes.Boolean;
|
|
178
|
+
hidden: EntryFieldTypes.Boolean;
|
|
179
|
+
redirectTo?: EntryFieldTypes.Symbol;
|
|
180
|
+
structuredData?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseSchemaSkeleton>>;
|
|
181
|
+
externalLink?: EntryFieldTypes.Symbol;
|
|
182
|
+
flags?: EntryFieldTypes.Array<EntryFieldTypes.Symbol<'Sticky nav'>>;
|
|
183
|
+
}
|
|
184
|
+
type BaseArticleSkeleton<TConfig extends BaseCmsConfig> = EntrySkeletonType<BaseArticleFields<TConfig>, 'article'>;
|
|
185
|
+
|
|
186
|
+
interface BaseLinkFields<TConfig extends BaseCmsConfig> {
|
|
187
|
+
name: EntryFieldTypes.Symbol;
|
|
188
|
+
useName: EntryFieldTypes.Boolean;
|
|
189
|
+
linkText?: EntryFieldTypes.Symbol;
|
|
190
|
+
internal?: EntryFieldTypes.EntryLink<BaseArticleSkeleton<TConfig> | BaseArticleTypeSkeleton<TConfig> | BasePageSkeleton<TConfig> | BasePageVariantSkeleton<TConfig> | BasePersonSkeleton<TConfig> | BaseTagSkeleton<TConfig>>;
|
|
191
|
+
external?: EntryFieldTypes.Symbol;
|
|
192
|
+
isButton?: EntryFieldTypes.Boolean;
|
|
193
|
+
isOutlined?: EntryFieldTypes.Boolean;
|
|
194
|
+
backgroundColour?: EntryFieldTypes.Symbol<TConfig['ColourName'] | TConfig['GradientName']>;
|
|
195
|
+
textColour?: EntryFieldTypes.Symbol<TConfig['ColourName']>;
|
|
196
|
+
icon?: EntryFieldTypes.AssetLink;
|
|
197
|
+
downloadAsset?: EntryFieldTypes.AssetLink;
|
|
198
|
+
variant?: EntryFieldTypes.Symbol<TConfig['ButtonVariant']>;
|
|
199
|
+
size?: EntryFieldTypes.Symbol<TConfig['ButtonSize']>;
|
|
200
|
+
}
|
|
201
|
+
type BaseLinkSkeleton<TConfig extends BaseCmsConfig> = EntrySkeletonType<BaseLinkFields<TConfig>, 'link'>;
|
|
202
|
+
|
|
203
|
+
interface BaseCollectionFields<TConfig extends BaseCmsConfig> {
|
|
204
|
+
cmsLabel: EntryFieldTypes.Symbol;
|
|
205
|
+
heading?: EntryFieldTypes.Symbol;
|
|
206
|
+
collectionType: EntryFieldTypes.Symbol<TConfig['CollectionType']>;
|
|
207
|
+
textSize?: EntryFieldTypes.Symbol<'Large' | 'Medium' | 'Small'>;
|
|
208
|
+
showHeading: EntryFieldTypes.Boolean;
|
|
209
|
+
anchor?: EntryFieldTypes.Symbol;
|
|
210
|
+
backgroundColour?: EntryFieldTypes.Symbol<TConfig['ColourName'] | TConfig['GradientName']>;
|
|
211
|
+
backgroundVisual?: EntryFieldTypes.AssetLink;
|
|
212
|
+
mobileBackgroundVisual?: EntryFieldTypes.AssetLink;
|
|
213
|
+
backgroundOverlayOpacity?: EntryFieldTypes.Number;
|
|
214
|
+
textColour?: EntryFieldTypes.Symbol<TConfig['ColourName']>;
|
|
215
|
+
preHeading?: EntryFieldTypes.Symbol;
|
|
216
|
+
postHeading?: EntryFieldTypes.Symbol;
|
|
217
|
+
body?: EntryFieldTypes.RichText;
|
|
218
|
+
icon?: EntryFieldTypes.AssetLink;
|
|
219
|
+
links?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseLinkSkeleton<TConfig> | BaseLink<TConfig>>>;
|
|
220
|
+
contents?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseContent<TConfig> | BaseLink<TConfig>>>;
|
|
221
|
+
visual?: EntryFieldTypes.EntryLink<BaseExternalVideoSkeleton | BaseMediaSkeleton>;
|
|
222
|
+
mobileVisual?: EntryFieldTypes.EntryLink<BaseExternalVideoSkeleton | BaseMediaSkeleton>;
|
|
223
|
+
visualCustomSize?: EntryFieldTypes.Integer;
|
|
224
|
+
additionalCopy?: EntryFieldTypes.RichText;
|
|
225
|
+
}
|
|
226
|
+
type BaseCollectionSkeleton<TConfig extends BaseCmsConfig> = EntrySkeletonType<BaseCollectionFields<TConfig>, 'collection'>;
|
|
227
|
+
|
|
228
|
+
interface BaseComponentFields<TConfig extends BaseCmsConfig> {
|
|
229
|
+
cmsLabel: EntryFieldTypes.Symbol;
|
|
230
|
+
heading?: EntryFieldTypes.Symbol;
|
|
231
|
+
showHeading: EntryFieldTypes.Boolean;
|
|
232
|
+
componentType: EntryFieldTypes.Symbol<TConfig['ComponentType']>;
|
|
233
|
+
textSize?: EntryFieldTypes.Symbol<'Large' | 'Medium' | 'Small'>;
|
|
234
|
+
anchor?: EntryFieldTypes.Symbol;
|
|
235
|
+
backgroundColour?: EntryFieldTypes.Symbol<TConfig['ColourName'] | TConfig['GradientName']>;
|
|
236
|
+
backgroundVisual?: EntryFieldTypes.AssetLink;
|
|
237
|
+
mobileBackgroundVisual?: EntryFieldTypes.AssetLink;
|
|
238
|
+
backgroundOverlayOpacity?: EntryFieldTypes.Number;
|
|
239
|
+
textColour?: EntryFieldTypes.Symbol<TConfig['ColourName']>;
|
|
240
|
+
preHeading?: EntryFieldTypes.Symbol;
|
|
241
|
+
postHeading?: EntryFieldTypes.Symbol;
|
|
242
|
+
body?: EntryFieldTypes.RichText;
|
|
243
|
+
icon?: EntryFieldTypes.AssetLink;
|
|
244
|
+
links?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseLink<TConfig> | BaseLinkSkeleton<TConfig>>>;
|
|
245
|
+
visual?: EntryFieldTypes.EntryLink<BaseExternalVideoSkeleton | BaseMediaSkeleton>;
|
|
246
|
+
mobileVisual?: EntryFieldTypes.EntryLink<BaseExternalVideoSkeleton | BaseMediaSkeleton>;
|
|
247
|
+
visualCustomSize?: EntryFieldTypes.Integer;
|
|
248
|
+
otherMedia?: EntryFieldTypes.Array<EntryFieldTypes.AssetLink>;
|
|
249
|
+
otherVisuals?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseExternalVideoSkeleton | BaseMediaSkeleton>>;
|
|
250
|
+
additionalCopy?: EntryFieldTypes.RichText;
|
|
251
|
+
}
|
|
252
|
+
type BaseComponentSkeleton<TConfig extends BaseCmsConfig> = EntrySkeletonType<BaseComponentFields<TConfig>, 'component'>;
|
|
253
|
+
|
|
254
|
+
interface BaseExternalComponentFields<TConfig extends BaseCmsConfig> {
|
|
255
|
+
cmsLabel: EntryFieldTypes.Symbol;
|
|
256
|
+
externalComponentType: EntryFieldTypes.Symbol<TConfig['ExternalComponentType']>;
|
|
257
|
+
heading?: EntryFieldTypes.Symbol;
|
|
258
|
+
data: EntryFieldTypes.Object;
|
|
259
|
+
backgroundColour?: EntryFieldTypes.Symbol<TConfig['ColourName'] | TConfig['GradientName']>;
|
|
260
|
+
textColour?: EntryFieldTypes.Symbol<TConfig['ColourName']>;
|
|
261
|
+
}
|
|
262
|
+
type BaseExternalComponentSkeleton<TConfig extends BaseCmsConfig> = EntrySkeletonType<BaseExternalComponentFields<TConfig>, 'externalComponent'>;
|
|
263
|
+
|
|
264
|
+
interface BasePageFields<TConfig extends BaseCmsConfig> {
|
|
265
|
+
cmsLabel: EntryFieldTypes.Symbol;
|
|
266
|
+
title: EntryFieldTypes.Symbol;
|
|
267
|
+
slug: EntryFieldTypes.Symbol;
|
|
268
|
+
description?: EntryFieldTypes.Text;
|
|
269
|
+
featuredImage: EntryFieldTypes.AssetLink;
|
|
270
|
+
visuals?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseExternalVideoSkeleton | BaseMediaSkeleton>>;
|
|
271
|
+
tags?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseTagSkeleton<TConfig>>>;
|
|
272
|
+
menu?: EntryFieldTypes.EntryLink<BaseNavigationSkeleton<TConfig>>;
|
|
273
|
+
footer?: EntryFieldTypes.EntryLink<BaseNavigationSkeleton<TConfig>>;
|
|
274
|
+
template?: EntryFieldTypes.EntryLink<BaseTemplateSkeleton<TConfig>>;
|
|
275
|
+
topContent?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseContent<TConfig>>>;
|
|
276
|
+
content?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseContent<TConfig>>>;
|
|
277
|
+
bottomContent?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseContent<TConfig>>>;
|
|
278
|
+
structuredData?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseSchemaSkeleton>>;
|
|
279
|
+
backgroundColour?: EntryFieldTypes.Symbol<TConfig['ColourName'] | TConfig['GradientName']>;
|
|
280
|
+
textColour?: EntryFieldTypes.Symbol<TConfig['ColourName']>;
|
|
281
|
+
indexed: EntryFieldTypes.Boolean;
|
|
282
|
+
hidden: EntryFieldTypes.Boolean;
|
|
283
|
+
}
|
|
284
|
+
type BasePageSkeleton<TConfig extends BaseCmsConfig> = EntrySkeletonType<BasePageFields<TConfig>, 'page'>;
|
|
285
|
+
|
|
286
|
+
interface BaseAlternatePageContentFields<TConfig extends BaseCmsConfig> {
|
|
287
|
+
cmsLabel: EntryFieldTypes.Symbol;
|
|
288
|
+
sourceContent: EntryFieldTypes.EntryLink<BaseContent<TConfig>>;
|
|
289
|
+
replacementContent?: EntryFieldTypes.EntryLink<BaseContent<TConfig>>;
|
|
290
|
+
}
|
|
291
|
+
type BaseAlternatePageContentSkeleton<TConfig extends BaseCmsConfig> = EntrySkeletonType<BaseAlternatePageContentFields<TConfig>, 'alternatePageContent'>;
|
|
292
|
+
|
|
293
|
+
interface BasePageVariantFields<TConfig extends BaseCmsConfig> {
|
|
294
|
+
cmsLabel: EntryFieldTypes.Symbol;
|
|
295
|
+
title?: EntryFieldTypes.Symbol;
|
|
296
|
+
slug: EntryFieldTypes.Symbol;
|
|
297
|
+
originalPage: EntryFieldTypes.EntryLink<BasePageSkeleton<TConfig>>;
|
|
298
|
+
alternativeContents?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseAlternatePageContentSkeleton<TConfig>>>;
|
|
299
|
+
description?: EntryFieldTypes.Symbol;
|
|
300
|
+
featuredImage?: EntryFieldTypes.AssetLink;
|
|
301
|
+
structuredData?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseSchemaSkeleton>>;
|
|
302
|
+
tags?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseTagSkeleton<TConfig>>>;
|
|
303
|
+
template?: EntryFieldTypes.EntryLink<BaseTemplateSkeleton<TConfig>>;
|
|
304
|
+
menu?: EntryFieldTypes.EntryLink<BaseNavigationSkeleton<TConfig>>;
|
|
305
|
+
footer?: EntryFieldTypes.EntryLink<BaseNavigationSkeleton<TConfig>>;
|
|
306
|
+
backgroundColour?: EntryFieldTypes.Symbol<TConfig['ColourName'] | TConfig['GradientName']>;
|
|
307
|
+
textColour?: EntryFieldTypes.Symbol<TConfig['ColourName']>;
|
|
308
|
+
indexed: EntryFieldTypes.Boolean;
|
|
309
|
+
hidden: EntryFieldTypes.Boolean;
|
|
310
|
+
redirectTo?: EntryFieldTypes.Symbol;
|
|
311
|
+
visuals?: EntryFieldTypes.Array<EntryFieldTypes.EntryLink<BaseExternalVideoSkeleton | BaseMediaSkeleton>>;
|
|
312
|
+
}
|
|
313
|
+
type BasePageVariantSkeleton<TConfig extends BaseCmsConfig> = EntrySkeletonType<BasePageVariantFields<TConfig>, 'pageVariant'>;
|
|
314
|
+
|
|
315
|
+
type BaseContent<TConfig extends BaseCmsConfig> = BaseCollectionSkeleton<TConfig> | BaseComponentSkeleton<TConfig> | BaseExternalComponentSkeleton<TConfig> | BaseExternalVideoSkeleton | BaseMediaSkeleton | BasePersonSkeleton<TConfig>;
|
|
316
|
+
type BaseLink<TConfig extends BaseCmsConfig> = BaseArticleSkeleton<TConfig> | BaseArticleTypeSkeleton<TConfig> | BaseLinkSkeleton<TConfig> | BasePageSkeleton<TConfig> | BasePageVariantSkeleton<TConfig> | BasePersonSkeleton<TConfig> | BaseTagSkeleton<TConfig>;
|
|
317
|
+
type BaseLinkTypes<TConfig extends BaseCmsConfig> = BaseLink<TConfig>['contentTypeId'];
|
|
318
|
+
|
|
319
|
+
declare function baseArticleConverter<TConfig extends BaseCmsConfig>(context: ConverterContext<TConfig>, entry: Entry<BaseArticleSkeleton<TConfig>, DefaultChainModifier, string>): IArticle<TConfig>;
|
|
320
|
+
|
|
321
|
+
declare function baseCollectionConverter<TConfig extends BaseCmsConfig>(context: ConverterContext<TConfig>, entry: Entry<BaseCollectionSkeleton<TConfig>, DefaultChainModifier, string>): TConfig['Collection'];
|
|
322
|
+
|
|
323
|
+
declare function baseComponentConverter<TConfig extends BaseCmsConfig>(context: ConverterContext<TConfig>, entry: Entry<BaseComponentSkeleton<TConfig>, DefaultChainModifier, string>): TConfig['Component'];
|
|
324
|
+
|
|
325
|
+
declare function baseNavigationItemConverter<TConfig extends BaseCmsConfig>(context: ConverterContext<TConfig>, entry: Entry<BaseNavigationItemSkeleton<TConfig>, DefaultChainModifier, string>): INavigationItem<TConfig>;
|
|
326
|
+
|
|
327
|
+
declare function basePageConverter<TConfig extends BaseCmsConfig>(context: ConverterContext<TConfig>, entry: Entry<BasePageSkeleton<TConfig>, DefaultChainModifier, string>): IPage<TConfig>;
|
|
328
|
+
|
|
329
|
+
type LinkResolverFunction<TConfig extends BaseCmsConfig> = (context: ConverterContext<TConfig>, entry: Entry<BaseLink<TConfig>, DefaultChainModifier, string>) => IInternalLink<TConfig>;
|
|
330
|
+
type LinkResolverMap<TConfig extends BaseCmsConfig> = Map<BaseLinkTypes<TConfig>, LinkResolverFunction<TConfig>>;
|
|
331
|
+
type ConverterContext<TConfig extends BaseCmsConfig> = {
|
|
332
|
+
includes: Map<string, PossibleResolvedEntry<TConfig>>;
|
|
333
|
+
assets: Map<string, IVisual>;
|
|
334
|
+
linkResolver: LinkResolverMap<TConfig>;
|
|
335
|
+
navigationItemResolver: typeof baseNavigationItemConverter<TConfig>;
|
|
336
|
+
pageResolver: typeof basePageConverter<TConfig>;
|
|
337
|
+
articleResolver: typeof baseArticleConverter<TConfig>;
|
|
338
|
+
componentResolver: typeof baseComponentConverter<TConfig>;
|
|
339
|
+
collectionResolver: typeof baseCollectionConverter<TConfig>;
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
interface ContentfulConfig {
|
|
343
|
+
spaceId: string;
|
|
344
|
+
accessToken: string;
|
|
345
|
+
environment?: string;
|
|
346
|
+
host?: string;
|
|
347
|
+
options?: Partial<Omit<CreateClientParams, 'space' | 'accessToken'>>;
|
|
348
|
+
}
|
|
349
|
+
type ContentfulClient = ContentfulClientApi<undefined>;
|
|
350
|
+
interface CacheConfig {
|
|
351
|
+
tags?: string[];
|
|
352
|
+
revalidate?: number | false;
|
|
353
|
+
cache?: 'force-cache' | 'no-store';
|
|
354
|
+
}
|
|
355
|
+
interface RetryConfig {
|
|
356
|
+
maxRetries?: number;
|
|
357
|
+
initialDelay?: number;
|
|
358
|
+
maxDelay?: number;
|
|
359
|
+
backoffMultiplier?: number;
|
|
360
|
+
}
|
|
361
|
+
interface FetchOptions {
|
|
362
|
+
locale?: string;
|
|
363
|
+
preview?: boolean;
|
|
364
|
+
include?: number;
|
|
365
|
+
cache?: CacheConfig;
|
|
366
|
+
retry?: RetryConfig;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
type DefaultChainModifier = 'WITHOUT_LINK_RESOLUTION';
|
|
370
|
+
type ResolvedEntry<TConfig extends BaseCmsConfig> = IPage<TConfig> | IArticle<TConfig> | INavigation<TConfig> | INavigationItem<TConfig> | IInternalLink<TConfig> | TConfig['Component'] | TConfig['Collection'] | TConfig['ExternalComponent'] | IPerson<TConfig>;
|
|
371
|
+
type PossibleResolvedEntry<TConfig extends BaseCmsConfig> = {
|
|
372
|
+
id: string;
|
|
373
|
+
type: string;
|
|
374
|
+
entry: Entry<EntrySkeletonType, DefaultChainModifier, string>;
|
|
375
|
+
resolved?: ResolvedEntry<TConfig>;
|
|
376
|
+
};
|
|
377
|
+
declare function contentfulPageRest<TConfig extends BaseCmsConfig>(context: Omit<ConverterContext<TConfig>, 'includes' | 'assets'>, config: ContentfulConfig, slug: string, options?: FetchOptions): Promise<IPage<TConfig> | null>;
|
|
378
|
+
declare function createBaseConverterContext<TConfig extends BaseCmsConfig>(): Omit<ConverterContext<TConfig>, 'includes' | 'assets'>;
|
|
379
|
+
declare function contentfulArticleRest<TConfig extends BaseCmsConfig>(context: Omit<ConverterContext<TConfig>, 'includes' | 'assets'>, config: ContentfulConfig, slug: string, articleTypeSlug: string, options?: FetchOptions): Promise<IArticle<TConfig> | null>;
|
|
380
|
+
|
|
381
|
+
declare function createContentfulClient(config: ContentfulConfig): ContentfulClient;
|
|
382
|
+
declare function createContentfulPreviewClient(config: ContentfulConfig): ContentfulClient;
|
|
383
|
+
declare function getContentfulClient(config: ContentfulConfig, preview?: boolean): ContentfulClientApi<'WITHOUT_LINK_RESOLUTION'>;
|
|
384
|
+
|
|
385
|
+
declare class ContentfulError extends Error {
|
|
386
|
+
readonly statusCode?: number | undefined;
|
|
387
|
+
readonly details?: unknown | undefined;
|
|
388
|
+
constructor(message: string, statusCode?: number | undefined, details?: unknown | undefined);
|
|
389
|
+
}
|
|
390
|
+
declare class RateLimitError extends ContentfulError {
|
|
391
|
+
readonly retryAfter?: number | undefined;
|
|
392
|
+
constructor(message: string, retryAfter?: number | undefined, details?: unknown);
|
|
393
|
+
}
|
|
394
|
+
declare class EntryNotFoundError extends ContentfulError {
|
|
395
|
+
readonly entryId: string;
|
|
396
|
+
readonly contentType?: string | undefined;
|
|
397
|
+
constructor(entryId: string, contentType?: string | undefined);
|
|
398
|
+
}
|
|
399
|
+
declare class AuthenticationError extends ContentfulError {
|
|
400
|
+
constructor(message?: string);
|
|
401
|
+
}
|
|
402
|
+
declare class ValidationError extends ContentfulError {
|
|
403
|
+
readonly validationErrors?: unknown | undefined;
|
|
404
|
+
constructor(message: string, validationErrors?: unknown | undefined);
|
|
405
|
+
}
|
|
406
|
+
declare function isContentfulError(error: unknown): error is ContentfulError;
|
|
407
|
+
declare function isRateLimitError(error: unknown): error is RateLimitError;
|
|
408
|
+
declare function isRetryableError(error: unknown): boolean;
|
|
409
|
+
declare function getRetryAfter(error: unknown): number | undefined;
|
|
410
|
+
|
|
411
|
+
declare function calculateBackoffDelay(attempt: number, config: Required<RetryConfig>, retryAfter?: number): number;
|
|
412
|
+
declare function withRetry<T>(fn: () => Promise<T>, config?: RetryConfig): Promise<T>;
|
|
413
|
+
declare class RateLimiter {
|
|
414
|
+
private readonly maxTokens;
|
|
415
|
+
private readonly refillRate;
|
|
416
|
+
private tokens;
|
|
417
|
+
private lastRefill;
|
|
418
|
+
constructor(maxTokens: number, refillRate: number);
|
|
419
|
+
private refill;
|
|
420
|
+
tryConsume(): boolean;
|
|
421
|
+
consume(): Promise<void>;
|
|
422
|
+
getAvailableTokens(): number;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
interface MemoryDelta {
|
|
426
|
+
heapUsedMB: number;
|
|
427
|
+
heapTotalMB: number;
|
|
428
|
+
rssMB: number;
|
|
429
|
+
externalMB: number;
|
|
430
|
+
}
|
|
431
|
+
interface TimingResult {
|
|
432
|
+
label: string;
|
|
433
|
+
duration: number;
|
|
434
|
+
memoryDelta?: MemoryDelta;
|
|
435
|
+
children?: TimingResult[];
|
|
436
|
+
metadata?: Record<string, unknown>;
|
|
437
|
+
}
|
|
438
|
+
declare class Timer {
|
|
439
|
+
private startTime;
|
|
440
|
+
private memoryStart?;
|
|
441
|
+
private label;
|
|
442
|
+
private children;
|
|
443
|
+
private metadata;
|
|
444
|
+
private trackMemory;
|
|
445
|
+
constructor(label: string, trackMemory?: boolean);
|
|
446
|
+
addMetadata(key: string, value: unknown): void;
|
|
447
|
+
child(label: string): Timer;
|
|
448
|
+
end(): TimingResult;
|
|
449
|
+
endAndLog(): TimingResult;
|
|
450
|
+
static time<T>(label: string, fn: () => Promise<T>, metadata?: Record<string, unknown>): Promise<{
|
|
451
|
+
result: T;
|
|
452
|
+
timing: TimingResult;
|
|
453
|
+
}>;
|
|
454
|
+
static timeSync<T>(label: string, fn: () => T, metadata?: Record<string, unknown>): {
|
|
455
|
+
result: T;
|
|
456
|
+
timing: TimingResult;
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
declare function logTimingResult(result: TimingResult): void;
|
|
460
|
+
declare function createTimer(label: string): Timer;
|
|
461
|
+
|
|
462
|
+
export { AuthenticationError, type CacheConfig, type ContentfulClient, type ContentfulConfig, ContentfulError, type ConverterContext, EntryNotFoundError, type FetchOptions, RateLimitError, RateLimiter, type RetryConfig, Timer, type TimingResult, ValidationError, basePageConverter, calculateBackoffDelay, contentfulArticleRest, contentfulPageRest, createBaseConverterContext, createContentfulClient, createContentfulPreviewClient, createTimer, getContentfulClient, getRetryAfter, isContentfulError, isRateLimitError, isRetryableError, logTimingResult, withRetry };
|