@websolutespa/bom-core 0.2.1 → 0.4.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/CHANGELOG.md +12 -0
- package/dist/index.d.ts +510 -513
- package/dist/index.js +39 -34
- package/dist/index.mjs +38 -33
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,548 +1,545 @@
|
|
|
1
1
|
import { IncomingMessage, ServerResponse } from 'http';
|
|
2
2
|
import { ParsedUrlQuery } from 'querystring';
|
|
3
3
|
|
|
4
|
-
type Json = string | number | boolean | null | Json[] | {
|
|
5
|
-
[key: string]: Json;
|
|
6
|
-
};
|
|
7
|
-
type ValueOf<T> = T[keyof T];
|
|
8
|
-
type LiteralUnion<T extends string | number> = T | Omit<T, T>;
|
|
9
|
-
type PreviewData = string | false | object | undefined;
|
|
10
|
-
type IContextBaseParams = {
|
|
11
|
-
market: string;
|
|
12
|
-
locale: string;
|
|
13
|
-
};
|
|
14
|
-
type IContextParams = IContextBaseParams & {
|
|
15
|
-
id: string;
|
|
16
|
-
};
|
|
17
|
-
type StaticPropsContext<Q extends ParsedUrlQuery = ParsedUrlQuery, D extends PreviewData = PreviewData> = {
|
|
18
|
-
params: Q;
|
|
19
|
-
preview?: boolean;
|
|
20
|
-
previewData?: D;
|
|
21
|
-
locale?: string;
|
|
22
|
-
locales?: string[];
|
|
23
|
-
defaultLocale?: string;
|
|
24
|
-
};
|
|
25
|
-
type IStaticContext<T extends {} = {}> = StaticPropsContext<IContextParams & T>;
|
|
26
|
-
declare type NextApiRequestCookies = Partial<{
|
|
27
|
-
[key: string]: string;
|
|
28
|
-
}>;
|
|
29
|
-
type ServerSidePropsContext<Q extends ParsedUrlQuery = ParsedUrlQuery, D extends PreviewData = PreviewData> = {
|
|
30
|
-
req: IncomingMessage & {
|
|
31
|
-
cookies: NextApiRequestCookies;
|
|
32
|
-
};
|
|
33
|
-
res: ServerResponse;
|
|
34
|
-
params: Q;
|
|
35
|
-
query: ParsedUrlQuery;
|
|
36
|
-
preview?: boolean;
|
|
37
|
-
previewData?: D;
|
|
38
|
-
resolvedUrl: string;
|
|
39
|
-
locale?: string;
|
|
40
|
-
locales?: string[];
|
|
41
|
-
defaultLocale?: string;
|
|
42
|
-
};
|
|
43
|
-
type IServerSideSplatContext<T extends {} = {}> = ServerSidePropsContext<IContextBaseParams & T>;
|
|
44
|
-
type IServerSideContext<T extends {} = {}> = ServerSidePropsContext<IContextParams & T>;
|
|
45
|
-
type StateValue = StateValue[] | {
|
|
46
|
-
[key: string]: StateValue;
|
|
47
|
-
} | number | string | boolean | null | undefined;
|
|
48
|
-
type IPartial<T> = {
|
|
49
|
-
[P in keyof T]?: Partial<T[P]>;
|
|
50
|
-
};
|
|
51
|
-
type IPrettify<T> = {
|
|
52
|
-
[K in keyof T]: T[K];
|
|
53
|
-
} & {};
|
|
54
|
-
type IOverride<T, TypeToReplace, TypeToReplaceWith> = {
|
|
55
|
-
[K in keyof T]: T[K] extends Record<string, unknown> ? IOverride<T[K], TypeToReplace, TypeToReplaceWith> : T[K] extends TypeToReplace ? TypeToReplaceWith : T[K];
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
type ILocalizedString = Record<string, string>;
|
|
59
|
-
type ILocalizable = string | ILocalizedString;
|
|
4
|
+
type Json = string | number | boolean | null | Json[] | {
|
|
5
|
+
[key: string]: Json;
|
|
6
|
+
};
|
|
7
|
+
type ValueOf<T> = T[keyof T];
|
|
8
|
+
type LiteralUnion<T extends string | number> = T | Omit<T, T>;
|
|
9
|
+
type PreviewData = string | false | object | undefined;
|
|
10
|
+
type IContextBaseParams = {
|
|
11
|
+
market: string;
|
|
12
|
+
locale: string;
|
|
13
|
+
};
|
|
14
|
+
type IContextParams = IContextBaseParams & {
|
|
15
|
+
id: string;
|
|
16
|
+
};
|
|
17
|
+
type StaticPropsContext<Q extends ParsedUrlQuery = ParsedUrlQuery, D extends PreviewData = PreviewData> = {
|
|
18
|
+
params: Q;
|
|
19
|
+
preview?: boolean;
|
|
20
|
+
previewData?: D;
|
|
21
|
+
locale?: string;
|
|
22
|
+
locales?: string[];
|
|
23
|
+
defaultLocale?: string;
|
|
24
|
+
};
|
|
25
|
+
type IStaticContext<T extends {} = {}> = StaticPropsContext<IContextParams & T>;
|
|
26
|
+
declare type NextApiRequestCookies = Partial<{
|
|
27
|
+
[key: string]: string;
|
|
28
|
+
}>;
|
|
29
|
+
type ServerSidePropsContext<Q extends ParsedUrlQuery = ParsedUrlQuery, D extends PreviewData = PreviewData> = {
|
|
30
|
+
req: IncomingMessage & {
|
|
31
|
+
cookies: NextApiRequestCookies;
|
|
32
|
+
};
|
|
33
|
+
res: ServerResponse;
|
|
34
|
+
params: Q;
|
|
35
|
+
query: ParsedUrlQuery;
|
|
36
|
+
preview?: boolean;
|
|
37
|
+
previewData?: D;
|
|
38
|
+
resolvedUrl: string;
|
|
39
|
+
locale?: string;
|
|
40
|
+
locales?: string[];
|
|
41
|
+
defaultLocale?: string;
|
|
42
|
+
};
|
|
43
|
+
type IServerSideSplatContext<T extends {} = {}> = ServerSidePropsContext<IContextBaseParams & T>;
|
|
44
|
+
type IServerSideContext<T extends {} = {}> = ServerSidePropsContext<IContextParams & T>;
|
|
45
|
+
type StateValue = StateValue[] | {
|
|
46
|
+
[key: string]: StateValue;
|
|
47
|
+
} | number | string | boolean | null | undefined;
|
|
48
|
+
type IPartial<T> = {
|
|
49
|
+
[P in keyof T]?: Partial<T[P]>;
|
|
50
|
+
};
|
|
51
|
+
type IPrettify<T> = {
|
|
52
|
+
[K in keyof T]: T[K];
|
|
53
|
+
} & {};
|
|
54
|
+
type IOverride<T, TypeToReplace, TypeToReplaceWith> = {
|
|
55
|
+
[K in keyof T]: T[K] extends Record<string, unknown> ? IOverride<T[K], TypeToReplace, TypeToReplaceWith> : T[K] extends TypeToReplace ? TypeToReplaceWith : T[K];
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
type ILocalizedString = Record<string, string>;
|
|
59
|
+
type ILocalizable = string | ILocalizedString;
|
|
60
60
|
type ILocalized<T> = IOverride<T, ILocalizable, string>;
|
|
61
61
|
|
|
62
|
-
type IEquatable = number | string;
|
|
63
|
-
type SchemaType = string;
|
|
64
|
-
type IOption = Record<string, any> & {
|
|
65
|
-
id: IEquatable;
|
|
66
|
-
name: string;
|
|
67
|
-
};
|
|
68
|
-
type ISchema = {
|
|
69
|
-
id: IEquatable;
|
|
70
|
-
schema?: string;
|
|
71
|
-
};
|
|
72
|
-
type IEntity = Record<string, unknown> & ISchema;
|
|
73
|
-
type INamedEntity = IEntity & {
|
|
74
|
-
name: ILocalizable;
|
|
75
|
-
};
|
|
76
|
-
type ITitledEntity = IEntity & {
|
|
77
|
-
title: ILocalizable;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
type IMediaType = 'image' | 'video' | string;
|
|
81
|
-
type IMedia = {
|
|
82
|
-
src: string;
|
|
83
|
-
type: IMediaType;
|
|
84
|
-
alt?: string;
|
|
85
|
-
title?: string;
|
|
86
|
-
abstract?: string;
|
|
87
|
-
width?: number;
|
|
88
|
-
height?: number;
|
|
89
|
-
url?: string;
|
|
90
|
-
media?: IMedia;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
type ICategory = IEntity & {
|
|
94
|
-
category?: IEquatable | ICategory;
|
|
95
|
-
id: IEquatable;
|
|
96
|
-
media?: IMedia;
|
|
97
|
-
order?: number;
|
|
98
|
-
slug: ILocalizable;
|
|
99
|
-
title: ILocalizable;
|
|
100
|
-
};
|
|
101
|
-
type ICategoryItem = ICategory & {
|
|
102
|
-
items: ICategory[];
|
|
103
|
-
};
|
|
104
|
-
type ICategorized = {
|
|
105
|
-
abstract?: ILocalizable;
|
|
106
|
-
category: IEquatable | ICategory;
|
|
107
|
-
id: IEquatable;
|
|
108
|
-
isDefault?: boolean;
|
|
109
|
-
markets?: string[];
|
|
110
|
-
media?: IMedia;
|
|
111
|
-
order?: number;
|
|
112
|
-
schema?: string;
|
|
113
|
-
slug: ILocalizable;
|
|
114
|
-
template?: string;
|
|
115
|
-
title: ILocalizable;
|
|
116
|
-
useSplat?: boolean;
|
|
117
|
-
createdAt?: Date;
|
|
118
|
-
updatedAt?: Date;
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
type IClassNameValue = string | boolean | number | null | undefined;
|
|
122
|
-
type IClassNameCollection = Record<string, IClassNameValue>;
|
|
62
|
+
type IEquatable = number | string;
|
|
63
|
+
type SchemaType = string;
|
|
64
|
+
type IOption = Record<string, any> & {
|
|
65
|
+
id: IEquatable;
|
|
66
|
+
name: string;
|
|
67
|
+
};
|
|
68
|
+
type ISchema = {
|
|
69
|
+
id: IEquatable;
|
|
70
|
+
schema?: string;
|
|
71
|
+
};
|
|
72
|
+
type IEntity = Record<string, unknown> & ISchema;
|
|
73
|
+
type INamedEntity = IEntity & {
|
|
74
|
+
name: ILocalizable;
|
|
75
|
+
};
|
|
76
|
+
type ITitledEntity = IEntity & {
|
|
77
|
+
title: ILocalizable;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
type IMediaType = 'image' | 'video' | string;
|
|
81
|
+
type IMedia = {
|
|
82
|
+
src: string;
|
|
83
|
+
type: IMediaType;
|
|
84
|
+
alt?: string;
|
|
85
|
+
title?: string;
|
|
86
|
+
abstract?: string;
|
|
87
|
+
width?: number;
|
|
88
|
+
height?: number;
|
|
89
|
+
url?: string;
|
|
90
|
+
media?: IMedia;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
type ICategory = IEntity & {
|
|
94
|
+
category?: IEquatable | ICategory;
|
|
95
|
+
id: IEquatable;
|
|
96
|
+
media?: IMedia;
|
|
97
|
+
order?: number;
|
|
98
|
+
slug: ILocalizable;
|
|
99
|
+
title: ILocalizable;
|
|
100
|
+
};
|
|
101
|
+
type ICategoryItem = ICategory & {
|
|
102
|
+
items: ICategory[];
|
|
103
|
+
};
|
|
104
|
+
type ICategorized = {
|
|
105
|
+
abstract?: ILocalizable;
|
|
106
|
+
category: IEquatable | ICategory;
|
|
107
|
+
id: IEquatable;
|
|
108
|
+
isDefault?: boolean;
|
|
109
|
+
markets?: string[];
|
|
110
|
+
media?: IMedia;
|
|
111
|
+
order?: number;
|
|
112
|
+
schema?: string;
|
|
113
|
+
slug: ILocalizable;
|
|
114
|
+
template?: string;
|
|
115
|
+
title: ILocalizable;
|
|
116
|
+
useSplat?: boolean;
|
|
117
|
+
createdAt?: Date;
|
|
118
|
+
updatedAt?: Date;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
type IClassNameValue = string | boolean | number | null | undefined;
|
|
122
|
+
type IClassNameCollection = Record<string, IClassNameValue>;
|
|
123
123
|
type IClassName = IClassNameCollection | IClassNameValue;
|
|
124
124
|
|
|
125
|
-
type FetchRequestOptions = {
|
|
126
|
-
method?: string;
|
|
127
|
-
headers?: {
|
|
128
|
-
[key: string]: string;
|
|
129
|
-
};
|
|
130
|
-
body?: Blob | BufferSource | FormData | URLSearchParams | string | ReadableStream;
|
|
131
|
-
mode?: 'cors' | 'no-cors' | 'same-origin';
|
|
132
|
-
credentials?: 'omit' | 'same-origin' | 'include';
|
|
133
|
-
cache?: 'default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached';
|
|
134
|
-
redirect?: 'follow' | 'error' | 'manual';
|
|
135
|
-
referrer?: string;
|
|
136
|
-
referrerPolicy?: 'no-referrer, no-referrer-when-downgrade, same-origin, origin, strict-origin, origin-when-cross-origin, strict-origin-when-cross-origin, or unsafe-url';
|
|
137
|
-
integrity?: string;
|
|
138
|
-
keepalive?: boolean;
|
|
139
|
-
signal?: AbortSignal;
|
|
140
|
-
};
|
|
141
|
-
type FetchService<T =
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
type
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
type
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
type
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
type
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
type
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
125
|
+
type FetchRequestOptions = {
|
|
126
|
+
method?: string;
|
|
127
|
+
headers?: {
|
|
128
|
+
[key: string]: string;
|
|
129
|
+
};
|
|
130
|
+
body?: Blob | BufferSource | FormData | URLSearchParams | string | ReadableStream;
|
|
131
|
+
mode?: 'cors' | 'no-cors' | 'same-origin';
|
|
132
|
+
credentials?: 'omit' | 'same-origin' | 'include';
|
|
133
|
+
cache?: 'default' | 'no-store' | 'reload' | 'no-cache' | 'force-cache' | 'only-if-cached';
|
|
134
|
+
redirect?: 'follow' | 'error' | 'manual';
|
|
135
|
+
referrer?: string;
|
|
136
|
+
referrerPolicy?: 'no-referrer, no-referrer-when-downgrade, same-origin, origin, strict-origin, origin-when-cross-origin, strict-origin-when-cross-origin, or unsafe-url';
|
|
137
|
+
integrity?: string;
|
|
138
|
+
keepalive?: boolean;
|
|
139
|
+
signal?: AbortSignal;
|
|
140
|
+
};
|
|
141
|
+
type FetchService<T = unknown> = (url: string, options?: FetchRequestOptions, serviceOptions?: any) => Promise<T>;
|
|
142
|
+
type FetchError = any;
|
|
143
|
+
|
|
144
|
+
type ILabel = IEntity & {
|
|
145
|
+
id: IEquatable;
|
|
146
|
+
text?: ILocalizable;
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
type ILocale = IEntity & {
|
|
150
|
+
id: string;
|
|
151
|
+
title?: string;
|
|
152
|
+
isActive?: boolean;
|
|
153
|
+
isDefault?: boolean;
|
|
154
|
+
isHidden?: boolean;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
type IMarket = IEntity & {
|
|
158
|
+
id: string;
|
|
159
|
+
title?: string;
|
|
160
|
+
countries?: string[];
|
|
161
|
+
languages?: string[];
|
|
162
|
+
defaultLanguage?: string;
|
|
163
|
+
isActive?: boolean;
|
|
164
|
+
isDefault?: boolean;
|
|
165
|
+
isHidden?: boolean;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
type IMeta = {
|
|
169
|
+
title?: string;
|
|
170
|
+
description?: string;
|
|
171
|
+
keywords?: string;
|
|
172
|
+
robots?: string;
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
type IRoute = {
|
|
176
|
+
category: IEquatable | ICategory;
|
|
177
|
+
id: string;
|
|
178
|
+
isDefault?: boolean;
|
|
179
|
+
locale: string;
|
|
180
|
+
market: string;
|
|
181
|
+
order?: number;
|
|
182
|
+
page: IEquatable;
|
|
183
|
+
schema: string;
|
|
184
|
+
template?: string;
|
|
185
|
+
title: string;
|
|
186
|
+
media?: IMedia;
|
|
187
|
+
useSplat?: boolean;
|
|
188
|
+
updatedAt?: Date;
|
|
189
|
+
};
|
|
190
|
+
type IRouteCanonical = IRoute & {
|
|
191
|
+
alternates: IRoute[];
|
|
192
|
+
};
|
|
193
|
+
type IRouteLink = {
|
|
194
|
+
href: string;
|
|
195
|
+
id: IEquatable;
|
|
196
|
+
items?: IRouteLink[];
|
|
197
|
+
media?: IMedia;
|
|
198
|
+
title: string;
|
|
199
|
+
};
|
|
200
|
+
type IRouteParams = Record<string, any> & {
|
|
201
|
+
id: IEquatable;
|
|
202
|
+
locale: string;
|
|
203
|
+
market: string;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
type IPage = Record<string, any> & ICategorized & {
|
|
207
|
+
abstract?: string;
|
|
208
|
+
alternates: IRoute[];
|
|
209
|
+
breadcrumb: IRouteLink[];
|
|
210
|
+
content?: string;
|
|
211
|
+
description?: string;
|
|
212
|
+
href: string;
|
|
213
|
+
locale: string;
|
|
214
|
+
market: string;
|
|
215
|
+
meta?: IMeta;
|
|
216
|
+
parentRoute?: IRouteLink;
|
|
217
|
+
slug: string;
|
|
218
|
+
title: string;
|
|
219
|
+
};
|
|
220
|
+
type IPageRelation = {
|
|
221
|
+
relationTo: string;
|
|
222
|
+
value: ICategorized;
|
|
223
|
+
};
|
|
224
|
+
type IPageResult<T extends ICategorized = ICategorized> = IPage & T;
|
|
225
|
+
type PageProps<T extends ICategorized = ICategorized> = {
|
|
226
|
+
layout: ILayout;
|
|
227
|
+
page: IPageResult<T>;
|
|
228
|
+
params: IRouteParams;
|
|
229
|
+
locales?: string[];
|
|
230
|
+
locale?: string;
|
|
231
|
+
defaultLocale?: string;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
type IMenuBase = {
|
|
235
|
+
abstract?: ILocalizable;
|
|
236
|
+
customClass?: string;
|
|
237
|
+
id: IEquatable;
|
|
238
|
+
items?: IMenuItem[];
|
|
239
|
+
media?: IMedia;
|
|
240
|
+
title: ILocalizable;
|
|
241
|
+
};
|
|
242
|
+
type IMenuCategory = IMenuBase & {
|
|
243
|
+
type: 'category';
|
|
244
|
+
href: string;
|
|
245
|
+
category: IEquatable;
|
|
246
|
+
};
|
|
247
|
+
type IMenuGroup = IMenuBase & {
|
|
248
|
+
type: 'group';
|
|
249
|
+
};
|
|
250
|
+
type IMenuLink = IMenuBase & {
|
|
251
|
+
type: 'link';
|
|
252
|
+
href: string;
|
|
253
|
+
target: string;
|
|
254
|
+
};
|
|
255
|
+
type IMenuRoute = IMenuBase & {
|
|
256
|
+
type: 'route';
|
|
257
|
+
href: string;
|
|
258
|
+
page: IEquatable;
|
|
259
|
+
schema: string;
|
|
260
|
+
};
|
|
261
|
+
type IMenuPage = IMenuBase & {
|
|
262
|
+
type: 'page';
|
|
263
|
+
href: string;
|
|
264
|
+
page: IEquatable;
|
|
265
|
+
schema: string;
|
|
266
|
+
};
|
|
267
|
+
type IMenuCustom = Record<string, unknown> & {
|
|
268
|
+
id: IEquatable;
|
|
269
|
+
type: string;
|
|
270
|
+
};
|
|
271
|
+
type IMenuItem = IMenuCategory | IMenuGroup | IMenuLink | IMenuPage | IMenuRoute;
|
|
272
|
+
type IMenu = {
|
|
273
|
+
id: string;
|
|
274
|
+
items: IMenuItem[];
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* this is the original menu model from cms
|
|
278
|
+
*/
|
|
279
|
+
type IUndecoratedMenuBase = {
|
|
280
|
+
abstract?: ILocalizable;
|
|
281
|
+
customClass?: string;
|
|
282
|
+
id?: string;
|
|
283
|
+
items: IUndecoratedMenuItem[];
|
|
284
|
+
markets?: string[];
|
|
285
|
+
media?: IMedia;
|
|
286
|
+
type: string;
|
|
287
|
+
};
|
|
288
|
+
type IUndecoratedMenuCategory = Omit<IUndecoratedMenuBase, 'type'> & {
|
|
289
|
+
type: 'category';
|
|
290
|
+
category: string;
|
|
291
|
+
maxDepth?: number;
|
|
292
|
+
title?: ILocalizable;
|
|
293
|
+
};
|
|
294
|
+
type IUndecoratedMenuGroup = Omit<IUndecoratedMenuBase, 'type'> & {
|
|
295
|
+
type: 'group';
|
|
296
|
+
title: ILocalizable;
|
|
297
|
+
};
|
|
298
|
+
type IUndecoratedMenuLink = Omit<IUndecoratedMenuBase, 'type'> & {
|
|
299
|
+
type: 'link';
|
|
300
|
+
title: ILocalizable;
|
|
301
|
+
href: string;
|
|
302
|
+
target?: string;
|
|
303
|
+
};
|
|
304
|
+
type IUndecoratedMenuPage = Omit<IUndecoratedMenuBase, 'type'> & {
|
|
305
|
+
type: 'page';
|
|
306
|
+
page: IPageRelation;
|
|
307
|
+
title?: ILocalizable;
|
|
308
|
+
};
|
|
309
|
+
type IUndecoratedMenuCustom = Record<string, unknown> & {
|
|
310
|
+
id: IEquatable;
|
|
311
|
+
type: 'custom';
|
|
312
|
+
blockType: string;
|
|
313
|
+
};
|
|
314
|
+
type IUndecoratedMenuItem = IUndecoratedMenuCategory | IUndecoratedMenuGroup | IUndecoratedMenuLink | IUndecoratedMenuPage | IUndecoratedMenuCustom;
|
|
315
|
+
type IUndecoratedMenu = {
|
|
316
|
+
id: string;
|
|
317
|
+
items: IUndecoratedMenuItem[];
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
type ILayout = {
|
|
321
|
+
labels: ILabel[];
|
|
322
|
+
locale: string;
|
|
323
|
+
locales: ILocale[];
|
|
324
|
+
market: string;
|
|
325
|
+
markets: IMarket[];
|
|
326
|
+
menu: Record<string, IMenu>;
|
|
327
|
+
topLevelHrefs: Record<string, string>;
|
|
328
|
+
topLevelRoutes: Record<string, IRouteLink>;
|
|
329
|
+
tree?: IRouteLink;
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
type Pagination = {
|
|
333
|
+
hasNextPage: boolean;
|
|
334
|
+
hasPrevPage: boolean;
|
|
335
|
+
limit: number;
|
|
336
|
+
nextPage: number | null;
|
|
337
|
+
page: number;
|
|
338
|
+
pagingCounter: number;
|
|
339
|
+
prevPage: number | null;
|
|
340
|
+
totalDocs: number;
|
|
341
|
+
totalPages: number;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
type Operator = 'equals' | 'contains' | 'not_equals' | 'in' | 'not_in' | 'exists' | 'greater_than' | 'greater_than_equal' | 'less_than' | 'less_than_equal' | 'like' | 'near';
|
|
345
|
+
type WhereField = {
|
|
346
|
+
[key in Operator]?: unknown;
|
|
347
|
+
};
|
|
348
|
+
type WhereBase = {
|
|
349
|
+
[key: string]: WhereField | Where[];
|
|
350
|
+
};
|
|
351
|
+
type WhereAndOr = {
|
|
352
|
+
or?: Where[];
|
|
353
|
+
and?: Where[];
|
|
354
|
+
};
|
|
355
|
+
type Where = WhereBase & WhereAndOr;
|
|
356
|
+
type QueryParams = {
|
|
357
|
+
where?: Where;
|
|
358
|
+
locale?: string;
|
|
359
|
+
market?: string;
|
|
360
|
+
sort?: string;
|
|
361
|
+
page?: number;
|
|
362
|
+
limit?: number;
|
|
363
|
+
depth?: number;
|
|
364
|
+
draft?: boolean;
|
|
365
|
+
pagination?: boolean;
|
|
366
|
+
richText?: boolean;
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
type IQuerable<T extends IEntity = IEntity> = {
|
|
370
|
+
findOne<B extends T = T>(id: IEquatable, params?: QueryParams): Promise<B | undefined>;
|
|
371
|
+
findMany<B extends T = T>(params?: QueryParams): Promise<B[]>;
|
|
372
|
+
findPaged<B extends T = T>(params?: QueryParams): Promise<{
|
|
373
|
+
docs: B[];
|
|
374
|
+
} & Pagination>;
|
|
375
|
+
create<B extends T = T>(payload: Omit<B, 'id'>): Promise<B>;
|
|
376
|
+
update<B extends T = T>(payload: Partial<B>): Promise<B>;
|
|
377
|
+
delete<B extends T = T>(id: IEquatable): Promise<B | undefined>;
|
|
378
|
+
};
|
|
379
|
+
type FindParams = {
|
|
380
|
+
where?: {
|
|
381
|
+
[key: string]: unknown;
|
|
382
|
+
};
|
|
383
|
+
market?: string;
|
|
384
|
+
locale?: string;
|
|
385
|
+
};
|
|
386
|
+
type FindWhereParams = {
|
|
387
|
+
where: {
|
|
388
|
+
[key: string]: unknown;
|
|
389
|
+
};
|
|
390
|
+
market?: string;
|
|
391
|
+
locale?: string;
|
|
392
|
+
};
|
|
392
393
|
declare function toFindParams(idOrParams: IEquatable | FindWhereParams): FindWhereParams;
|
|
393
394
|
|
|
394
|
-
declare enum RedirectReason {
|
|
395
|
-
MovedPermanently = "301",
|
|
396
|
-
Found = "302",
|
|
397
|
-
TemporaryRedirect = "307",
|
|
398
|
-
PermanentRedirect = "308",
|
|
399
|
-
Gone = "410"
|
|
400
|
-
}
|
|
401
|
-
type IRedirect = {
|
|
402
|
-
id: IEquatable;
|
|
403
|
-
status: RedirectReason;
|
|
404
|
-
from: string;
|
|
405
|
-
to?: string;
|
|
406
|
-
name?: string;
|
|
407
|
-
order?: number;
|
|
408
|
-
isActive: boolean;
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
type IMemoryStore<T extends IEntity = IEntity> = Record<string, T[]>;
|
|
412
|
-
type IStore = Record<string, IQuerable<IEntity>>;
|
|
413
|
-
type IConfig = {
|
|
414
|
-
collections: string[];
|
|
415
|
-
mocks: string[];
|
|
416
|
-
pages: string[];
|
|
417
|
-
};
|
|
418
|
-
type IPackages = {
|
|
419
|
-
icons: string;
|
|
420
|
-
models: string;
|
|
421
|
-
ui: string;
|
|
422
|
-
};
|
|
423
|
-
type ICollectionDescription = {
|
|
424
|
-
singularName: string;
|
|
425
|
-
pluralName: string;
|
|
426
|
-
pluralDisplayName: string;
|
|
427
|
-
displayName: string;
|
|
428
|
-
title: string;
|
|
429
|
-
};
|
|
430
|
-
type ISerializedCollection = {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
pluralDisplayName: string;
|
|
434
|
-
displayName: string;
|
|
435
|
-
items: IEntity[];
|
|
436
|
-
};
|
|
395
|
+
declare enum RedirectReason {
|
|
396
|
+
MovedPermanently = "301",
|
|
397
|
+
Found = "302",
|
|
398
|
+
TemporaryRedirect = "307",
|
|
399
|
+
PermanentRedirect = "308",
|
|
400
|
+
Gone = "410"
|
|
401
|
+
}
|
|
402
|
+
type IRedirect = {
|
|
403
|
+
id: IEquatable;
|
|
404
|
+
status: RedirectReason;
|
|
405
|
+
from: string;
|
|
406
|
+
to?: string;
|
|
407
|
+
name?: string;
|
|
408
|
+
order?: number;
|
|
409
|
+
isActive: boolean;
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
type IMemoryStore<T extends IEntity = IEntity> = Record<string, T[]>;
|
|
413
|
+
type IStore = Record<string, IQuerable<IEntity>>;
|
|
414
|
+
type IConfig = {
|
|
415
|
+
collections: string[];
|
|
416
|
+
mocks: string[];
|
|
417
|
+
pages: string[];
|
|
418
|
+
};
|
|
419
|
+
type IPackages = {
|
|
420
|
+
icons: string;
|
|
421
|
+
models: string;
|
|
422
|
+
ui: string;
|
|
423
|
+
};
|
|
424
|
+
type ICollectionDescription = {
|
|
425
|
+
singularName: string;
|
|
426
|
+
pluralName: string;
|
|
427
|
+
pluralDisplayName: string;
|
|
428
|
+
displayName: string;
|
|
429
|
+
title: string;
|
|
430
|
+
};
|
|
431
|
+
type ISerializedCollection<T extends IEntity = IEntity> = ICollectionDescription & {
|
|
432
|
+
items: T[];
|
|
433
|
+
};
|
|
437
434
|
type ISerializedStore = Record<string, ISerializedCollection>;
|
|
438
435
|
|
|
439
|
-
type ITemplate = {
|
|
440
|
-
id: IEquatable;
|
|
441
|
-
name: ILocalizable;
|
|
442
|
-
collections: string[];
|
|
436
|
+
type ITemplate = {
|
|
437
|
+
id: IEquatable;
|
|
438
|
+
name: ILocalizable;
|
|
439
|
+
collections: string[];
|
|
443
440
|
};
|
|
444
441
|
|
|
445
|
-
declare function isCategory(value?: ICategory | IEquatable): value is ICategory;
|
|
446
|
-
declare function asCategoryId(value?: ICategory | IEquatable): string | undefined;
|
|
447
|
-
declare function getRootCategory(categories: ICategory[]): ICategory | undefined;
|
|
448
|
-
declare function getParentCategoriesById(id: string | undefined, categories: ICategory[]): ICategory[];
|
|
449
|
-
declare function getCategorySegments(item: ICategorized, categories: ICategory[]): ICategory[];
|
|
442
|
+
declare function isCategory(value?: ICategory | IEquatable): value is ICategory;
|
|
443
|
+
declare function asCategoryId(value?: ICategory | IEquatable): string | undefined;
|
|
444
|
+
declare function getRootCategory(categories: ICategory[]): ICategory | undefined;
|
|
445
|
+
declare function getParentCategoriesById(id: string | undefined, categories: ICategory[]): ICategory[];
|
|
446
|
+
declare function getCategorySegments(item: ICategorized, categories: ICategory[]): ICategory[];
|
|
450
447
|
declare function getCategorySegmentsByCategory(item: ICategory, categories: ICategory[]): ICategory[];
|
|
451
448
|
|
|
452
449
|
declare function getClassNames(...props: Array<IClassName>): string;
|
|
453
450
|
|
|
454
|
-
declare function getCollectionDescription(text: string): ICollectionDescription;
|
|
455
|
-
declare function
|
|
456
|
-
declare function
|
|
457
|
-
declare function
|
|
458
|
-
declare function
|
|
459
|
-
declare function toPluralName(text: string): string;
|
|
451
|
+
declare function getCollectionDescription(text: string): ICollectionDescription;
|
|
452
|
+
declare function camelToSnakeCase(text: string): string;
|
|
453
|
+
declare function isValidCollectionDescription(description: ICollectionDescription): boolean;
|
|
454
|
+
declare function toDisplayName(text: string): string;
|
|
455
|
+
declare function toPluralName(text: string): string;
|
|
460
456
|
declare function toTitleCase(text: string): string;
|
|
457
|
+
declare function toValidCollectionName(text: string): string;
|
|
461
458
|
|
|
462
459
|
declare function consoleWarn(message: string, component?: string): void;
|
|
463
460
|
|
|
464
|
-
declare function httpFetch(url: string, options?: FetchRequestOptions, serviceOptions?: any): Promise<any>;
|
|
465
|
-
declare function httpGet(url: string, options?: FetchRequestOptions): Promise<any>;
|
|
466
|
-
declare function httpPost(url: string, payload: any, options?: FetchRequestOptions): Promise<any>;
|
|
467
|
-
declare function httpPut(url: string, payload: any, options?: FetchRequestOptions): Promise<any>;
|
|
468
|
-
declare function httpPatch(url: string, payload: any, options?: FetchRequestOptions): Promise<any>;
|
|
461
|
+
declare function httpFetch(url: string, options?: FetchRequestOptions, serviceOptions?: any): Promise<any>;
|
|
462
|
+
declare function httpGet(url: string, options?: FetchRequestOptions): Promise<any>;
|
|
463
|
+
declare function httpPost(url: string, payload: any, options?: FetchRequestOptions): Promise<any>;
|
|
464
|
+
declare function httpPut(url: string, payload: any, options?: FetchRequestOptions): Promise<any>;
|
|
465
|
+
declare function httpPatch(url: string, payload: any, options?: FetchRequestOptions): Promise<any>;
|
|
469
466
|
declare function httpDelete(url: string, options?: FetchRequestOptions): Promise<any>;
|
|
470
467
|
|
|
471
|
-
declare class JsonService<T extends IEntity = IEntity> implements IQuerable<T> {
|
|
472
|
-
items: T[];
|
|
473
|
-
constructor(items: T[]);
|
|
474
|
-
getItems<B extends T = T>(): Promise<B[]>;
|
|
475
|
-
findOne<B extends T = T>(id: IEquatable, params?: QueryParams): Promise<B | undefined>;
|
|
476
|
-
findMany<B extends T = T>(params?: QueryParams): Promise<B[]>;
|
|
477
|
-
findPaged<B extends T = T>(params?: QueryParams): Promise<{
|
|
478
|
-
docs: B[];
|
|
479
|
-
} & Pagination>;
|
|
480
|
-
create<B extends T = T>(payload: Omit<B, 'id'>): Promise<B>;
|
|
481
|
-
update<B extends T = T>(payload: Partial<B>): Promise<B>;
|
|
482
|
-
delete<B extends T = T>(id: IEquatable): Promise<B | undefined>;
|
|
483
|
-
protected decorator_<B extends T = T>(item: B, params?: QueryParams): B;
|
|
484
|
-
protected newUUID_(): number;
|
|
485
|
-
protected evaluateValue_(value: unknown): unknown;
|
|
486
|
-
protected existsClause_(value: unknown, exists?: boolean): boolean;
|
|
487
|
-
protected equalsClause_(value: unknown, equals?: unknown): boolean;
|
|
488
|
-
protected inClause_(value: unknown, values?: unknown[]): boolean;
|
|
489
|
-
protected notInClause_(value: unknown, values?: unknown[]): boolean;
|
|
490
|
-
protected likeClause_(value: unknown, query?: string): boolean;
|
|
491
|
-
protected whereItem_<B extends T = T>(item: B, where?: Where): boolean;
|
|
492
|
-
protected whereItems_<B extends T = T>(items: B[], where?: Where): B[];
|
|
493
|
-
protected sortCollection_<B extends T = T>(items: B[], sort?: string): B[];
|
|
494
|
-
protected paginatedItems_<B extends T = T>(items: B[], page?: number, limit?: number): ({
|
|
495
|
-
docs: B[];
|
|
496
|
-
} & Pagination);
|
|
468
|
+
declare class JsonService<T extends IEntity = IEntity> implements IQuerable<T> {
|
|
469
|
+
items: T[];
|
|
470
|
+
constructor(items: T[]);
|
|
471
|
+
getItems<B extends T = T>(): Promise<B[]>;
|
|
472
|
+
findOne<B extends T = T>(id: IEquatable, params?: QueryParams): Promise<B | undefined>;
|
|
473
|
+
findMany<B extends T = T>(params?: QueryParams): Promise<B[]>;
|
|
474
|
+
findPaged<B extends T = T>(params?: QueryParams): Promise<{
|
|
475
|
+
docs: B[];
|
|
476
|
+
} & Pagination>;
|
|
477
|
+
create<B extends T = T>(payload: Omit<B, 'id'>): Promise<B>;
|
|
478
|
+
update<B extends T = T>(payload: Partial<B>): Promise<B>;
|
|
479
|
+
delete<B extends T = T>(id: IEquatable): Promise<B | undefined>;
|
|
480
|
+
protected decorator_<B extends T = T>(item: B, params?: QueryParams): B;
|
|
481
|
+
protected newUUID_(): number;
|
|
482
|
+
protected evaluateValue_(value: unknown): unknown;
|
|
483
|
+
protected existsClause_(value: unknown, exists?: boolean): boolean;
|
|
484
|
+
protected equalsClause_(value: unknown, equals?: unknown): boolean;
|
|
485
|
+
protected inClause_(value: unknown, values?: unknown[]): boolean;
|
|
486
|
+
protected notInClause_(value: unknown, values?: unknown[]): boolean;
|
|
487
|
+
protected likeClause_(value: unknown, query?: string): boolean;
|
|
488
|
+
protected whereItem_<B extends T = T>(item: B, where?: Where): boolean;
|
|
489
|
+
protected whereItems_<B extends T = T>(items: B[], where?: Where): B[];
|
|
490
|
+
protected sortCollection_<B extends T = T>(items: B[], sort?: string): B[];
|
|
491
|
+
protected paginatedItems_<B extends T = T>(items: B[], page?: number, limit?: number): ({
|
|
492
|
+
docs: B[];
|
|
493
|
+
} & Pagination);
|
|
497
494
|
}
|
|
498
495
|
|
|
499
|
-
declare function isLocalizedString(value: any): value is ILocalizedString;
|
|
500
|
-
declare function localizedToString(json: ILocalizedString, locale?: string, defaultLocale?: string): string;
|
|
501
|
-
declare function localize(value: ILocalizable, locale?: string, defaultLocale?: string): string;
|
|
502
|
-
declare function localizeValue(value: any, locale?: string, defaultLocale?: string): any;
|
|
496
|
+
declare function isLocalizedString(value: any): value is ILocalizedString;
|
|
497
|
+
declare function localizedToString(json: ILocalizedString, locale?: string, defaultLocale?: string): string;
|
|
498
|
+
declare function localize(value: ILocalizable, locale?: string, defaultLocale?: string): string;
|
|
499
|
+
declare function localizeValue(value: any, locale?: string, defaultLocale?: string): any;
|
|
503
500
|
declare function localizeItem(item: any, locale?: string, defaultLocale?: string): any;
|
|
504
501
|
|
|
505
|
-
declare function qsSerialize(queryParams?: QueryParams): string;
|
|
506
|
-
declare function asEquatable(value: string): IEquatable;
|
|
507
|
-
declare function deserializeValue(value: string): string | boolean | number;
|
|
508
|
-
declare function deserializeKey(value: string): string | number;
|
|
502
|
+
declare function qsSerialize(queryParams?: QueryParams): string;
|
|
503
|
+
declare function asEquatable(value: string): IEquatable;
|
|
504
|
+
declare function deserializeValue(value: string): string | boolean | number;
|
|
505
|
+
declare function deserializeKey(value: string): string | number;
|
|
509
506
|
declare function qsDeserialize(query?: string, deserializedParams?: {}): QueryParams;
|
|
510
507
|
|
|
511
|
-
declare function collectRoutes(store: IMemoryStore<ICategorized>, categories: ICategory[], markets: IMarket[], locales: ILocale[]): IRoute[];
|
|
512
|
-
declare function eachMarketLocale(markets: IMarket[], locales: ILocale[], callback: (market: IMarket, locale: ILocale, markets: IMarket[], locales: ILocale[]) => void): void;
|
|
513
|
-
declare function eachCategorized(store: IMemoryStore<ICategorized>, callback: (item: ICategorized, key: string) => void): void;
|
|
514
|
-
declare enum RouteStrategy {
|
|
515
|
-
Auto = "auto",
|
|
516
|
-
Default = "default",
|
|
517
|
-
Manual = "manual"
|
|
518
|
-
}
|
|
508
|
+
declare function collectRoutes(store: IMemoryStore<ICategorized>, categories: ICategory[], markets: IMarket[], locales: ILocale[]): IRoute[];
|
|
509
|
+
declare function eachMarketLocale(markets: IMarket[], locales: ILocale[], callback: (market: IMarket, locale: ILocale, markets: IMarket[], locales: ILocale[]) => void): void;
|
|
510
|
+
declare function eachCategorized(store: IMemoryStore<ICategorized>, callback: (item: ICategorized, key: string) => void): void;
|
|
511
|
+
declare enum RouteStrategy {
|
|
512
|
+
Auto = "auto",
|
|
513
|
+
Default = "default",
|
|
514
|
+
Manual = "manual"
|
|
515
|
+
}
|
|
519
516
|
declare function getRouteHref(segments: ICategory[], market: IMarket, locale: ILocale, markets: IMarket[], locales: ILocale[]): string;
|
|
520
517
|
|
|
521
518
|
declare function textToSlug(title: string): string;
|
|
522
519
|
|
|
523
|
-
type ListItem<T> = {
|
|
524
|
-
[K in keyof T]: {
|
|
525
|
-
readonly key: string;
|
|
526
|
-
readonly value: T[K];
|
|
527
|
-
};
|
|
528
|
-
}[keyof T];
|
|
529
|
-
/**
|
|
530
|
-
* Helper to produce an array of enum descriptors.
|
|
531
|
-
* @param enumeration Enumeration object.
|
|
532
|
-
* @param separatorRegex Regex that would catch the separator in your enum key.
|
|
533
|
-
*/
|
|
520
|
+
type ListItem<T> = {
|
|
521
|
+
[K in keyof T]: {
|
|
522
|
+
readonly key: string;
|
|
523
|
+
readonly value: T[K];
|
|
524
|
+
};
|
|
525
|
+
}[keyof T];
|
|
526
|
+
/**
|
|
527
|
+
* Helper to produce an array of enum descriptors.
|
|
528
|
+
* @param enumeration Enumeration object.
|
|
529
|
+
* @param separatorRegex Regex that would catch the separator in your enum key.
|
|
530
|
+
*/
|
|
534
531
|
declare function enumToList<T extends Record<string, number | string>>(enumeration: T, separatorRegex?: RegExp): ListItem<T>[];
|
|
535
532
|
|
|
536
|
-
declare function getIsDevelopment(): boolean;
|
|
537
|
-
declare function getIsProduction(): boolean;
|
|
538
|
-
declare const isDevelopment: boolean;
|
|
539
|
-
declare const isProduction: boolean;
|
|
540
|
-
declare const isStage: boolean;
|
|
541
|
-
declare const isBrowser: boolean;
|
|
542
|
-
declare function
|
|
543
|
-
declare function
|
|
544
|
-
declare function
|
|
545
|
-
declare function
|
|
546
|
-
declare function
|
|
547
|
-
|
|
548
|
-
export { FetchRequestOptions, FetchService, FindParams, FindWhereParams, ICategorized, ICategory, ICategoryItem, IClassName, IClassNameCollection, IClassNameValue, ICollectionDescription, IConfig, IContextBaseParams, IContextParams, IEntity, IEquatable, ILabel, ILayout, ILocale, ILocalizable, ILocalized, ILocalizedString, IMarket, IMedia, IMediaType, IMemoryStore, IMenu, IMenuBase, IMenuCategory, IMenuCustom, IMenuGroup, IMenuItem, IMenuLink, IMenuPage, IMenuRoute, INamedEntity, IOption, IOverride, IPackages, IPage, IPageRelation, IPageResult, IPartial, IPrettify, IQuerable, IRedirect, IRoute, IRouteCanonical, IRouteLink, IRouteParams, ISchema, ISerializedCollection, ISerializedStore, IServerSideContext, IServerSideSplatContext, IStaticContext, IStore, ITemplate, ITitledEntity, IUndecoratedMenu, IUndecoratedMenuBase, IUndecoratedMenuCategory, IUndecoratedMenuCustom, IUndecoratedMenuGroup, IUndecoratedMenuItem, IUndecoratedMenuLink, IUndecoratedMenuPage, Json, JsonService, LiteralUnion, NextApiRequestCookies, Operator, PageProps, Pagination, PreviewData, QueryParams, RedirectReason, RouteStrategy, SchemaType, ServerSidePropsContext, StateValue, StaticPropsContext, ValueOf, Where, WhereAndOr, WhereBase, WhereField, asCategoryId, asEquatable, asServerProps, awaitAll, camelToSnakeCase, collectRoutes, consoleWarn,
|
|
533
|
+
declare function getIsDevelopment(): boolean;
|
|
534
|
+
declare function getIsProduction(): boolean;
|
|
535
|
+
declare const isDevelopment: boolean;
|
|
536
|
+
declare const isProduction: boolean;
|
|
537
|
+
declare const isStage: boolean;
|
|
538
|
+
declare const isBrowser: boolean;
|
|
539
|
+
declare function getEnv(): Record<string, Json>;
|
|
540
|
+
declare function withSchema<Component extends {}, Schema>(component: Component, schema: Schema): Component & Schema;
|
|
541
|
+
declare function asServerProps(props: any): any;
|
|
542
|
+
declare function awaitAll(array: any, callback: (item: any, index: number) => Promise<any>): Promise<any[]>;
|
|
543
|
+
declare function merge(target: any, source: any): any;
|
|
544
|
+
|
|
545
|
+
export { FetchError, FetchRequestOptions, FetchService, FindParams, FindWhereParams, ICategorized, ICategory, ICategoryItem, IClassName, IClassNameCollection, IClassNameValue, ICollectionDescription, IConfig, IContextBaseParams, IContextParams, IEntity, IEquatable, ILabel, ILayout, ILocale, ILocalizable, ILocalized, ILocalizedString, IMarket, IMedia, IMediaType, IMemoryStore, IMenu, IMenuBase, IMenuCategory, IMenuCustom, IMenuGroup, IMenuItem, IMenuLink, IMenuPage, IMenuRoute, INamedEntity, IOption, IOverride, IPackages, IPage, IPageRelation, IPageResult, IPartial, IPrettify, IQuerable, IRedirect, IRoute, IRouteCanonical, IRouteLink, IRouteParams, ISchema, ISerializedCollection, ISerializedStore, IServerSideContext, IServerSideSplatContext, IStaticContext, IStore, ITemplate, ITitledEntity, IUndecoratedMenu, IUndecoratedMenuBase, IUndecoratedMenuCategory, IUndecoratedMenuCustom, IUndecoratedMenuGroup, IUndecoratedMenuItem, IUndecoratedMenuLink, IUndecoratedMenuPage, Json, JsonService, LiteralUnion, NextApiRequestCookies, Operator, PageProps, Pagination, PreviewData, QueryParams, RedirectReason, RouteStrategy, SchemaType, ServerSidePropsContext, StateValue, StaticPropsContext, ValueOf, Where, WhereAndOr, WhereBase, WhereField, asCategoryId, asEquatable, asServerProps, awaitAll, camelToSnakeCase, collectRoutes, consoleWarn, deserializeKey, deserializeValue, eachCategorized, eachMarketLocale, enumToList, getCategorySegments, getCategorySegmentsByCategory, getClassNames, getCollectionDescription, getEnv, getIsDevelopment, getIsProduction, getParentCategoriesById, getRootCategory, getRouteHref, httpDelete, httpFetch, httpGet, httpPatch, httpPost, httpPut, isBrowser, isCategory, isDevelopment, isLocalizedString, isProduction, isStage, isValidCollectionDescription, localize, localizeItem, localizeValue, localizedToString, merge, qsDeserialize, qsSerialize, textToSlug, toDisplayName, toFindParams, toPluralName, toTitleCase, toValidCollectionName, withSchema };
|