@datawheel/bespoke 0.9.3 → 1.0.0-beta.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/README.md +8 -0
- package/css/mixins.scss +178 -0
- package/dist/Search-CpmCBiYZ.d.mts +129 -0
- package/dist/auth-D3PWImeZ.d.mts +139 -0
- package/dist/auth.d.mts +42 -0
- package/dist/auth.js +1 -1
- package/dist/cms.css +1 -1
- package/dist/cms.d.mts +13 -0
- package/dist/cms.js +38 -66
- package/dist/explore.css +1 -1
- package/dist/explore.d.mts +40 -0
- package/dist/explore.js +8 -36
- package/dist/index.d.mts +24 -0
- package/dist/index.js +1 -1
- package/dist/redux-store.d.mts +176 -0
- package/dist/redux-store.js +3 -4
- package/dist/report.css +1 -1
- package/dist/report.d.mts +132 -0
- package/dist/report.js +14 -42
- package/dist/server.d.mts +109 -0
- package/dist/server.js +10 -11
- package/dist/store-D5N14riO.d.mts +888 -0
- package/dist/types-WI9fSG9b.d.mts +847 -0
- package/package.json +72 -39
|
@@ -0,0 +1,847 @@
|
|
|
1
|
+
import { Model, Sequelize, ForeignKey } from 'sequelize';
|
|
2
|
+
|
|
3
|
+
type BlockType = "generator" | "image" | "paragraph" | "selector" | "stat" | "subtitle" | "title" | "visualization" | "nav" | "reset_button" | "fallback" | "section_flag";
|
|
4
|
+
type BlockSettings = {
|
|
5
|
+
width?: {
|
|
6
|
+
stretch: boolean;
|
|
7
|
+
unit: string;
|
|
8
|
+
value: string;
|
|
9
|
+
};
|
|
10
|
+
display?: string;
|
|
11
|
+
align?: string;
|
|
12
|
+
access?: string[];
|
|
13
|
+
allowed?: string;
|
|
14
|
+
allowedLogic?: string;
|
|
15
|
+
fallback?: boolean;
|
|
16
|
+
};
|
|
17
|
+
type TypeGeneratorSettings = {
|
|
18
|
+
useProxy?: string;
|
|
19
|
+
};
|
|
20
|
+
type TypeImageSettings = unknown;
|
|
21
|
+
type TypeParagraphSettings = unknown;
|
|
22
|
+
type TypeSelectorSettings = unknown;
|
|
23
|
+
type TypeStatSettings = {
|
|
24
|
+
name: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
};
|
|
27
|
+
type TypeSubtitleSettings = unknown;
|
|
28
|
+
type TypeTitleSettings = {
|
|
29
|
+
order?: string;
|
|
30
|
+
};
|
|
31
|
+
type TypeVizSettings = unknown;
|
|
32
|
+
type TypeResetButtonSettings = unknown;
|
|
33
|
+
type TypeNavSettings = {
|
|
34
|
+
min?: string;
|
|
35
|
+
max?: string;
|
|
36
|
+
variant?: string;
|
|
37
|
+
scrollPadding?: number;
|
|
38
|
+
};
|
|
39
|
+
type TypeFallbackSettings = unknown;
|
|
40
|
+
type EntitySettings$2 = {
|
|
41
|
+
generator: TypeGeneratorSettings;
|
|
42
|
+
section_flag: TypeGeneratorSettings;
|
|
43
|
+
image: TypeImageSettings;
|
|
44
|
+
paragraph: TypeParagraphSettings;
|
|
45
|
+
selector: TypeSelectorSettings;
|
|
46
|
+
stat: TypeStatSettings;
|
|
47
|
+
subtitle: TypeSubtitleSettings;
|
|
48
|
+
title: TypeTitleSettings;
|
|
49
|
+
visualization: TypeVizSettings;
|
|
50
|
+
nav: TypeNavSettings;
|
|
51
|
+
reset_button: TypeResetButtonSettings;
|
|
52
|
+
fallback: TypeFallbackSettings;
|
|
53
|
+
};
|
|
54
|
+
interface Content {
|
|
55
|
+
api?: string;
|
|
56
|
+
simple?: {
|
|
57
|
+
compare?: string;
|
|
58
|
+
limit?: number;
|
|
59
|
+
};
|
|
60
|
+
simpleEnabled?: boolean;
|
|
61
|
+
logic?: string;
|
|
62
|
+
}
|
|
63
|
+
interface LocaleContent {
|
|
64
|
+
id: number;
|
|
65
|
+
locale: string;
|
|
66
|
+
content: Content;
|
|
67
|
+
}
|
|
68
|
+
interface Block<T extends BlockType> {
|
|
69
|
+
/** Entity ID */
|
|
70
|
+
id: number;
|
|
71
|
+
/** Parent Report ID */
|
|
72
|
+
section_id: number;
|
|
73
|
+
blockcol: string;
|
|
74
|
+
blockrow: string;
|
|
75
|
+
contentByLocale: Record<string, LocaleContent>;
|
|
76
|
+
settings: Partial<EntitySettings$2[T]> & BlockSettings;
|
|
77
|
+
shared: boolean;
|
|
78
|
+
type: T;
|
|
79
|
+
original_type?: T;
|
|
80
|
+
}
|
|
81
|
+
interface NestedBlock<T extends BlockType> extends Block<T> {
|
|
82
|
+
inputs: AnyBlock[];
|
|
83
|
+
consumers: AnyBlock[];
|
|
84
|
+
}
|
|
85
|
+
interface NormalizedBlock<T extends BlockType> extends Block<T> {
|
|
86
|
+
inputs: number[];
|
|
87
|
+
consumers: number[];
|
|
88
|
+
}
|
|
89
|
+
type AnyBlock = Block<"image"> | Block<"paragraph"> | Block<"selector"> | Block<"stat"> | Block<"subtitle"> | Block<"title"> | Block<"generator"> | Block<"visualization"> | Block<"nav"> | Block<"reset_button"> | Block<"fallback"> | Block<"section_flag">;
|
|
90
|
+
type AnyNestedBlock = NestedBlock<"image"> | NestedBlock<"paragraph"> | NestedBlock<"selector"> | NestedBlock<"stat"> | NestedBlock<"subtitle"> | NestedBlock<"title"> | NestedBlock<"generator"> | NestedBlock<"visualization"> | NestedBlock<"nav"> | NestedBlock<"reset_button"> | NestedBlock<"fallback"> | NestedBlock<"section_flag">;
|
|
91
|
+
type AnyNormalizedBlock = NormalizedBlock<"image"> | NormalizedBlock<"paragraph"> | NormalizedBlock<"selector"> | NormalizedBlock<"stat"> | NormalizedBlock<"subtitle"> | NormalizedBlock<"title"> | NormalizedBlock<"generator"> | NormalizedBlock<"visualization"> | NormalizedBlock<"nav"> | NormalizedBlock<"reset_button"> | NormalizedBlock<"fallback"> | NormalizedBlock<"section_flag">;
|
|
92
|
+
|
|
93
|
+
interface VariantLocaleAttribute {
|
|
94
|
+
name: string;
|
|
95
|
+
type: "constant" | "variable";
|
|
96
|
+
value: string;
|
|
97
|
+
}
|
|
98
|
+
interface VariantLocaleSettings {
|
|
99
|
+
idKey: string;
|
|
100
|
+
labelKey: string;
|
|
101
|
+
accessor: string;
|
|
102
|
+
path: string;
|
|
103
|
+
properties?: Record<string, unknown>;
|
|
104
|
+
attributes: VariantLocaleAttribute[];
|
|
105
|
+
zValueKey: string;
|
|
106
|
+
[key: string]: unknown;
|
|
107
|
+
}
|
|
108
|
+
interface VariantSettings {
|
|
109
|
+
overrideNames?: boolean;
|
|
110
|
+
overrideRelevance?: boolean;
|
|
111
|
+
regenerateSlugs?: boolean;
|
|
112
|
+
keepOldMembers?: boolean;
|
|
113
|
+
doIngest?: boolean;
|
|
114
|
+
order?: number;
|
|
115
|
+
[key: string]: unknown;
|
|
116
|
+
}
|
|
117
|
+
interface Variant {
|
|
118
|
+
id: number;
|
|
119
|
+
dimension_id: number;
|
|
120
|
+
settings: VariantSettings;
|
|
121
|
+
config: Record<string, VariantLocaleSettings>;
|
|
122
|
+
name: string;
|
|
123
|
+
slug: string;
|
|
124
|
+
visible: boolean;
|
|
125
|
+
members_count?: number;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
interface Dimension {
|
|
129
|
+
/** Entity ID */
|
|
130
|
+
id: number;
|
|
131
|
+
/** Parent Report ID */
|
|
132
|
+
report_id: number;
|
|
133
|
+
name: string;
|
|
134
|
+
ordering: number;
|
|
135
|
+
settings: Record<string, unknown>;
|
|
136
|
+
visible: boolean;
|
|
137
|
+
}
|
|
138
|
+
interface NestedDimension extends Dimension {
|
|
139
|
+
variants: Variant[];
|
|
140
|
+
}
|
|
141
|
+
interface NormalizedDimension extends Dimension {
|
|
142
|
+
variants: number[];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
interface FormatterContent {
|
|
146
|
+
description: string;
|
|
147
|
+
inputType: string;
|
|
148
|
+
logic: string;
|
|
149
|
+
testValue: string;
|
|
150
|
+
type: string;
|
|
151
|
+
[key: string]: string;
|
|
152
|
+
}
|
|
153
|
+
interface Formatter {
|
|
154
|
+
id: number;
|
|
155
|
+
name: string;
|
|
156
|
+
content: FormatterContent;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
type Position = "NAV" | "TOP" | "BOTTOM" | "DEFAULT";
|
|
160
|
+
|
|
161
|
+
type EntitySettings$1 = {
|
|
162
|
+
allowed: string;
|
|
163
|
+
allowedLogic: string;
|
|
164
|
+
icon: string;
|
|
165
|
+
position: string;
|
|
166
|
+
memberImageBg: boolean;
|
|
167
|
+
optionsMenu: boolean;
|
|
168
|
+
showAnchor: boolean;
|
|
169
|
+
sectionType: string;
|
|
170
|
+
comparisonHide: boolean;
|
|
171
|
+
comparisonMerge: boolean;
|
|
172
|
+
hidden: boolean;
|
|
173
|
+
showInPdf: "always" | "never" | "optional";
|
|
174
|
+
margin: "0px" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
175
|
+
columnGutter: "0px" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
176
|
+
width: "full" | "center";
|
|
177
|
+
style: "none" | "card";
|
|
178
|
+
tags?: string | string[];
|
|
179
|
+
};
|
|
180
|
+
interface Section {
|
|
181
|
+
/** Entity ID */
|
|
182
|
+
id: number;
|
|
183
|
+
/** Parent Report ID */
|
|
184
|
+
report_id: number;
|
|
185
|
+
heading: number;
|
|
186
|
+
ordering: string;
|
|
187
|
+
settings: EntitySettings$1 & {
|
|
188
|
+
name: string;
|
|
189
|
+
columnSettings: Record<string, {
|
|
190
|
+
width?: number;
|
|
191
|
+
full?: boolean;
|
|
192
|
+
}>;
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
interface NestedSection extends Section {
|
|
196
|
+
blocks: AnyNestedBlock[];
|
|
197
|
+
}
|
|
198
|
+
interface NormalizedSection extends Section {
|
|
199
|
+
blocks: number[];
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
type ReportType = "report" | "story";
|
|
203
|
+
type TypeReportSettings = {
|
|
204
|
+
label: string;
|
|
205
|
+
title?: string;
|
|
206
|
+
subtitle?: string;
|
|
207
|
+
comparison?: boolean;
|
|
208
|
+
compareLevels?: boolean;
|
|
209
|
+
order?: number;
|
|
210
|
+
hide?: boolean;
|
|
211
|
+
position?: Position;
|
|
212
|
+
pdf?: {
|
|
213
|
+
enabled: boolean;
|
|
214
|
+
variants: string[];
|
|
215
|
+
privacy?: string[];
|
|
216
|
+
sectionSelection?: boolean;
|
|
217
|
+
navBlockId?: number;
|
|
218
|
+
};
|
|
219
|
+
xlsx?: {
|
|
220
|
+
enabled: boolean;
|
|
221
|
+
variants: string[];
|
|
222
|
+
privacy?: string[];
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
type TypeStorySettings = {
|
|
226
|
+
label: string;
|
|
227
|
+
title?: string;
|
|
228
|
+
subtitle?: string;
|
|
229
|
+
};
|
|
230
|
+
type EntitySettings = {
|
|
231
|
+
report: TypeReportSettings;
|
|
232
|
+
story: TypeStorySettings;
|
|
233
|
+
};
|
|
234
|
+
interface Report<T extends ReportType> {
|
|
235
|
+
/** Entity ID */
|
|
236
|
+
id: number;
|
|
237
|
+
name: string;
|
|
238
|
+
visible: boolean;
|
|
239
|
+
date: string;
|
|
240
|
+
type: T;
|
|
241
|
+
settings: EntitySettings[T];
|
|
242
|
+
}
|
|
243
|
+
interface NestedReport<T extends ReportType> extends Report<T> {
|
|
244
|
+
dimensions: NestedDimension[];
|
|
245
|
+
sections: NestedSection[];
|
|
246
|
+
}
|
|
247
|
+
interface NormalizedReport<T extends ReportType> extends Report<T> {
|
|
248
|
+
dimensions: number[];
|
|
249
|
+
sections: number[];
|
|
250
|
+
}
|
|
251
|
+
type AnyReport = Report<"report"> | Report<"story">;
|
|
252
|
+
type AnyNestedReport = NestedReport<"report"> | NestedReport<"story">;
|
|
253
|
+
type AnyNormalizedReport = NormalizedReport<"report"> | NormalizedReport<"story">;
|
|
254
|
+
|
|
255
|
+
interface DataSourceContent {
|
|
256
|
+
pattern: string;
|
|
257
|
+
logic: string;
|
|
258
|
+
testUrl: string;
|
|
259
|
+
useProxy: boolean;
|
|
260
|
+
order: number;
|
|
261
|
+
access: string[];
|
|
262
|
+
[key: string]: string | boolean | number | string[];
|
|
263
|
+
}
|
|
264
|
+
interface DataSource {
|
|
265
|
+
id: number;
|
|
266
|
+
name: string;
|
|
267
|
+
description: string;
|
|
268
|
+
content: DataSourceContent;
|
|
269
|
+
settings?: Record<string, unknown>;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
type SimpleEntityMap = {
|
|
273
|
+
block: AnyBlock;
|
|
274
|
+
dimension: Dimension;
|
|
275
|
+
formatter: Formatter;
|
|
276
|
+
report: AnyReport;
|
|
277
|
+
section: Section;
|
|
278
|
+
variant: Variant;
|
|
279
|
+
datasource: DataSource;
|
|
280
|
+
};
|
|
281
|
+
type NestedEntityMap = {
|
|
282
|
+
block: AnyNestedBlock;
|
|
283
|
+
dimension: NestedDimension;
|
|
284
|
+
formatter: Formatter;
|
|
285
|
+
report: AnyNestedReport;
|
|
286
|
+
section: NestedSection;
|
|
287
|
+
variant: Variant;
|
|
288
|
+
datasource: DataSource;
|
|
289
|
+
};
|
|
290
|
+
type NormalizedEntityMap = {
|
|
291
|
+
block: AnyNormalizedBlock;
|
|
292
|
+
dimension: NormalizedDimension;
|
|
293
|
+
formatter: Formatter;
|
|
294
|
+
report: AnyNormalizedReport;
|
|
295
|
+
section: NormalizedSection;
|
|
296
|
+
variant: Variant;
|
|
297
|
+
datasource: DataSource;
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
interface BlockContentCreationAttributes {
|
|
301
|
+
locale: LocaleContent["locale"];
|
|
302
|
+
}
|
|
303
|
+
declare class BlockContentModel extends Model<LocaleContent, BlockContentCreationAttributes> {
|
|
304
|
+
id: number;
|
|
305
|
+
locale: LocaleContent["locale"];
|
|
306
|
+
content: LocaleContent["content"];
|
|
307
|
+
}
|
|
308
|
+
declare function initModel$c(sequelize: Sequelize): () => typeof BlockContentModel;
|
|
309
|
+
|
|
310
|
+
interface BlockInputAttributes {
|
|
311
|
+
id: number;
|
|
312
|
+
block_id: number;
|
|
313
|
+
input_id: number;
|
|
314
|
+
}
|
|
315
|
+
interface BlockInputCreationAttributes {
|
|
316
|
+
block_id: number;
|
|
317
|
+
input_id: number;
|
|
318
|
+
}
|
|
319
|
+
declare class BlockInputModel extends Model<BlockInputAttributes, BlockInputCreationAttributes> {
|
|
320
|
+
id: number;
|
|
321
|
+
block_id: number;
|
|
322
|
+
input_id: number;
|
|
323
|
+
}
|
|
324
|
+
declare function initModel$b(sequelize: Sequelize): () => typeof BlockInputModel;
|
|
325
|
+
|
|
326
|
+
interface BlockAttributes {
|
|
327
|
+
id: number;
|
|
328
|
+
section_id: ForeignKey<number>;
|
|
329
|
+
block_input?: BlockInputAttributes;
|
|
330
|
+
blockcol: string;
|
|
331
|
+
blockrow: string;
|
|
332
|
+
settings: Record<string, unknown>;
|
|
333
|
+
shared: boolean;
|
|
334
|
+
type: string;
|
|
335
|
+
}
|
|
336
|
+
interface BlockCreationAttributes {
|
|
337
|
+
blockcol: string;
|
|
338
|
+
blockrow: string;
|
|
339
|
+
section_id: number;
|
|
340
|
+
type: BlockType;
|
|
341
|
+
contentByLocale: {
|
|
342
|
+
locale: string;
|
|
343
|
+
}[];
|
|
344
|
+
inputs?: BlockCreationAttributes[];
|
|
345
|
+
consumers?: BlockCreationAttributes[];
|
|
346
|
+
}
|
|
347
|
+
declare class BlockModel extends Model<BlockAttributes, BlockCreationAttributes> {
|
|
348
|
+
id: number;
|
|
349
|
+
section_id: number;
|
|
350
|
+
block_input?: BlockInputAttributes;
|
|
351
|
+
contentByLocale: BlockContentModel[];
|
|
352
|
+
inputs: BlockModel[];
|
|
353
|
+
consumers: BlockModel[];
|
|
354
|
+
getContent(locale: string): BlockContentModel;
|
|
355
|
+
toJSON(): AnyNestedBlock;
|
|
356
|
+
}
|
|
357
|
+
declare function initModel$a(sequelize: Sequelize): (models: ReportsDB) => typeof BlockModel;
|
|
358
|
+
|
|
359
|
+
interface FormatterAttributes {
|
|
360
|
+
id: number;
|
|
361
|
+
name: string;
|
|
362
|
+
content: FormatterContent;
|
|
363
|
+
}
|
|
364
|
+
interface FormatterCreationAttributes {
|
|
365
|
+
name: string;
|
|
366
|
+
content?: FormatterContent;
|
|
367
|
+
}
|
|
368
|
+
declare class FormatterModel extends Model<FormatterAttributes, FormatterCreationAttributes> {
|
|
369
|
+
id: number;
|
|
370
|
+
name: string;
|
|
371
|
+
content: FormatterContent;
|
|
372
|
+
}
|
|
373
|
+
declare function initModel$9(sequelize: Sequelize): () => typeof FormatterModel;
|
|
374
|
+
|
|
375
|
+
declare class ImageContentModel extends Model {
|
|
376
|
+
id: number;
|
|
377
|
+
locale: string;
|
|
378
|
+
meta: string;
|
|
379
|
+
}
|
|
380
|
+
declare function initModel$8(sequelize: Sequelize): () => typeof ImageContentModel;
|
|
381
|
+
|
|
382
|
+
interface ImageAttributes {
|
|
383
|
+
id: number;
|
|
384
|
+
url: string;
|
|
385
|
+
author: string;
|
|
386
|
+
license: string;
|
|
387
|
+
splash: any;
|
|
388
|
+
thumb: any;
|
|
389
|
+
}
|
|
390
|
+
interface ImageCreationAttributes {
|
|
391
|
+
url: string;
|
|
392
|
+
}
|
|
393
|
+
declare class ImageModel extends Model<ImageAttributes, ImageCreationAttributes> {
|
|
394
|
+
id: number;
|
|
395
|
+
url: string;
|
|
396
|
+
author: string;
|
|
397
|
+
license: string;
|
|
398
|
+
splash: any;
|
|
399
|
+
thumb: any;
|
|
400
|
+
contentByLocale: ImageContentModel[];
|
|
401
|
+
getContent(locale: string): ImageContentModel;
|
|
402
|
+
}
|
|
403
|
+
declare function initModel$7(sequelize: Sequelize): (models: ReportsDB) => typeof ImageModel;
|
|
404
|
+
|
|
405
|
+
interface VariantAttributes {
|
|
406
|
+
id: number;
|
|
407
|
+
dimension_id: number;
|
|
408
|
+
settings: Record<string, unknown>;
|
|
409
|
+
config: Record<string, VariantLocaleSettings>;
|
|
410
|
+
name: string;
|
|
411
|
+
slug: string;
|
|
412
|
+
visible: boolean;
|
|
413
|
+
}
|
|
414
|
+
interface VariantCreationAttributes {
|
|
415
|
+
dimension_id: number;
|
|
416
|
+
slug: Variant["slug"];
|
|
417
|
+
name: Variant["name"];
|
|
418
|
+
}
|
|
419
|
+
declare class VariantModel extends Model<VariantAttributes, VariantCreationAttributes> {
|
|
420
|
+
id: number;
|
|
421
|
+
dimension_id: number;
|
|
422
|
+
config: Variant["config"];
|
|
423
|
+
name: Variant["name"];
|
|
424
|
+
settings: Variant["settings"];
|
|
425
|
+
slug: Variant["slug"];
|
|
426
|
+
visible: Variant["visible"];
|
|
427
|
+
dimension: DimensionModel;
|
|
428
|
+
members: SearchModel[];
|
|
429
|
+
get report(): ReportModel;
|
|
430
|
+
toJSON(): Variant;
|
|
431
|
+
}
|
|
432
|
+
declare function initModel$6(sequelize: Sequelize): (models: ReportsDB) => typeof VariantModel;
|
|
433
|
+
|
|
434
|
+
interface DimensionAttributes {
|
|
435
|
+
id: number;
|
|
436
|
+
report_id: number;
|
|
437
|
+
name: string;
|
|
438
|
+
ordering: NestedDimension["ordering"];
|
|
439
|
+
settings: Record<string, unknown>;
|
|
440
|
+
visible: boolean;
|
|
441
|
+
}
|
|
442
|
+
interface DimensionCreationAttributes {
|
|
443
|
+
report_id: number;
|
|
444
|
+
name: string;
|
|
445
|
+
ordering?: number;
|
|
446
|
+
variants?: VariantCreationAttributes[];
|
|
447
|
+
}
|
|
448
|
+
declare class DimensionModel extends Model<DimensionAttributes, DimensionCreationAttributes> {
|
|
449
|
+
id: number;
|
|
450
|
+
report_id: number;
|
|
451
|
+
name: string;
|
|
452
|
+
ordering: number;
|
|
453
|
+
report: ReportModel;
|
|
454
|
+
variants: VariantModel[];
|
|
455
|
+
toJSON(): NestedDimension;
|
|
456
|
+
}
|
|
457
|
+
declare function initModel$5(sequelize: Sequelize): (models: ReportsDB) => typeof DimensionModel;
|
|
458
|
+
|
|
459
|
+
interface SectionAttributes {
|
|
460
|
+
id: number;
|
|
461
|
+
report_id: number;
|
|
462
|
+
heading: NestedSection["heading"];
|
|
463
|
+
ordering: NestedSection["ordering"];
|
|
464
|
+
settings: NestedSection["settings"];
|
|
465
|
+
}
|
|
466
|
+
interface SectionCreationAttributes {
|
|
467
|
+
report_id: SectionAttributes["report_id"];
|
|
468
|
+
ordering: SectionAttributes["ordering"];
|
|
469
|
+
blocks?: BlockCreationAttributes[];
|
|
470
|
+
}
|
|
471
|
+
declare class SectionModel extends Model<SectionAttributes, SectionCreationAttributes> {
|
|
472
|
+
id: number;
|
|
473
|
+
report_id: number;
|
|
474
|
+
blocks: BlockModel[];
|
|
475
|
+
toJSON(): NestedSection;
|
|
476
|
+
}
|
|
477
|
+
declare function initModel$4(sequelize: Sequelize): (models: ReportsDB) => typeof SectionModel;
|
|
478
|
+
|
|
479
|
+
interface ReportAttributes {
|
|
480
|
+
id: number;
|
|
481
|
+
date: string;
|
|
482
|
+
name: string;
|
|
483
|
+
settings: Record<string, unknown>;
|
|
484
|
+
type: AnyReport["type"];
|
|
485
|
+
visible: boolean;
|
|
486
|
+
}
|
|
487
|
+
interface ReportCreationAttributes {
|
|
488
|
+
name: string;
|
|
489
|
+
dimensions?: DimensionCreationAttributes[];
|
|
490
|
+
sections?: SectionCreationAttributes[];
|
|
491
|
+
}
|
|
492
|
+
declare class ReportModel extends Model<ReportAttributes, ReportCreationAttributes> {
|
|
493
|
+
id: number;
|
|
494
|
+
date: Date;
|
|
495
|
+
name: string;
|
|
496
|
+
settings: Record<string, unknown>;
|
|
497
|
+
type: AnyReport["type"];
|
|
498
|
+
visible: boolean;
|
|
499
|
+
dimensions: DimensionModel[];
|
|
500
|
+
sections: SectionModel[];
|
|
501
|
+
toJSON(): AnyNestedReport;
|
|
502
|
+
}
|
|
503
|
+
declare function initModel$3(sequelize: Sequelize): (models: ReportsDB) => typeof ReportModel;
|
|
504
|
+
|
|
505
|
+
interface SearchContentByLocale {
|
|
506
|
+
locale: string;
|
|
507
|
+
name: string;
|
|
508
|
+
}
|
|
509
|
+
interface SearchContentAttributes {
|
|
510
|
+
id: number;
|
|
511
|
+
annotations: Record<string, unknown>;
|
|
512
|
+
attributes: Record<string, unknown>;
|
|
513
|
+
contentByLocale?: SearchContentByLocale[];
|
|
514
|
+
keywords: string[];
|
|
515
|
+
locale: string;
|
|
516
|
+
name: string;
|
|
517
|
+
}
|
|
518
|
+
interface SearchContentCreationAttributes {
|
|
519
|
+
name: string;
|
|
520
|
+
}
|
|
521
|
+
declare class SearchContentModel extends Model<SearchContentAttributes, SearchContentCreationAttributes> {
|
|
522
|
+
id: number;
|
|
523
|
+
annotations: Record<string, unknown>;
|
|
524
|
+
attributes: Record<string, unknown>;
|
|
525
|
+
keywords: string[];
|
|
526
|
+
locale: string;
|
|
527
|
+
name: string;
|
|
528
|
+
}
|
|
529
|
+
declare function initModel$2(sequelize: Sequelize): () => typeof SearchContentModel;
|
|
530
|
+
|
|
531
|
+
interface DataSourceAttributes {
|
|
532
|
+
id: number;
|
|
533
|
+
name: string;
|
|
534
|
+
description: string;
|
|
535
|
+
content: DataSourceContent;
|
|
536
|
+
}
|
|
537
|
+
interface DataSourceCreationAttributes {
|
|
538
|
+
name: string;
|
|
539
|
+
content?: DataSourceContent;
|
|
540
|
+
}
|
|
541
|
+
declare class DataSourceModel extends Model<DataSourceAttributes, DataSourceCreationAttributes> {
|
|
542
|
+
id: number;
|
|
543
|
+
name: string;
|
|
544
|
+
content: DataSourceContent;
|
|
545
|
+
}
|
|
546
|
+
declare function initModel$1(sequelize: Sequelize): () => typeof DataSourceModel;
|
|
547
|
+
|
|
548
|
+
declare const modelFactoryMap: {
|
|
549
|
+
block: typeof initModel$a;
|
|
550
|
+
block_content: typeof initModel$c;
|
|
551
|
+
block_input: typeof initModel$b;
|
|
552
|
+
formatter: typeof initModel$9;
|
|
553
|
+
image: typeof initModel$7;
|
|
554
|
+
image_content: typeof initModel$8;
|
|
555
|
+
report: typeof initModel$3;
|
|
556
|
+
dimension: typeof initModel$5;
|
|
557
|
+
variant: typeof initModel$6;
|
|
558
|
+
search: typeof initModel;
|
|
559
|
+
search_content: typeof initModel$2;
|
|
560
|
+
section: typeof initModel$4;
|
|
561
|
+
datasource: typeof initModel$1;
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
type AssociationFactoryMap = typeof modelFactoryMap;
|
|
565
|
+
type ModelFactoryMap = {
|
|
566
|
+
[K in keyof AssociationFactoryMap]: ReturnType<AssociationFactoryMap[K]>;
|
|
567
|
+
};
|
|
568
|
+
type ReportsDB = {
|
|
569
|
+
sequelize: Sequelize;
|
|
570
|
+
} & {
|
|
571
|
+
[K in keyof ModelFactoryMap]: ReturnType<ModelFactoryMap[K]>;
|
|
572
|
+
};
|
|
573
|
+
|
|
574
|
+
interface SearchAttributes {
|
|
575
|
+
id: string;
|
|
576
|
+
zvalue: number;
|
|
577
|
+
slug: string;
|
|
578
|
+
image_id: number;
|
|
579
|
+
content_id: number;
|
|
580
|
+
dimension_id: number;
|
|
581
|
+
variant_id: number;
|
|
582
|
+
report_id: number;
|
|
583
|
+
visible: boolean;
|
|
584
|
+
}
|
|
585
|
+
interface SearchCreationAttributes {
|
|
586
|
+
id: string;
|
|
587
|
+
slug: string;
|
|
588
|
+
zvalue: number;
|
|
589
|
+
dimension_id: number;
|
|
590
|
+
variant_id: number;
|
|
591
|
+
report_id: number;
|
|
592
|
+
}
|
|
593
|
+
declare class SearchModel extends Model<SearchAttributes, SearchCreationAttributes> {
|
|
594
|
+
id: string;
|
|
595
|
+
slug: string;
|
|
596
|
+
visible: boolean;
|
|
597
|
+
zvalue: number;
|
|
598
|
+
content_id: number;
|
|
599
|
+
dimension_id: number;
|
|
600
|
+
image_id: number;
|
|
601
|
+
report_id: number;
|
|
602
|
+
variant_id: number;
|
|
603
|
+
dimension: DimensionModel;
|
|
604
|
+
image: ImageModel;
|
|
605
|
+
report: ReportModel;
|
|
606
|
+
variant: VariantModel;
|
|
607
|
+
contentByLocale: SearchContentModel[];
|
|
608
|
+
getContent(locale: string): SearchContentModel;
|
|
609
|
+
}
|
|
610
|
+
declare function initModel(sequelize: Sequelize): (models: ReportsDB) => typeof SearchModel;
|
|
611
|
+
|
|
612
|
+
interface SuccessResult<T> {
|
|
613
|
+
ok: true;
|
|
614
|
+
status: number;
|
|
615
|
+
wrapper: boolean;
|
|
616
|
+
data: T;
|
|
617
|
+
}
|
|
618
|
+
interface FailureResult<E = string> {
|
|
619
|
+
ok: false;
|
|
620
|
+
status: number;
|
|
621
|
+
error: E;
|
|
622
|
+
}
|
|
623
|
+
type Result<T, E = string> = SuccessResult<T> | FailureResult<E>;
|
|
624
|
+
type EntityType = "block" | "dimension" | "formatter" | "report" | "section" | "variant" | "datasource";
|
|
625
|
+
type CreateParams = {
|
|
626
|
+
block: Pick<SimpleEntityMap["block"], "blockcol" | "blockrow" | "section_id" | "type"> & {
|
|
627
|
+
locales: Array<string>;
|
|
628
|
+
};
|
|
629
|
+
dimension: Pick<NestedEntityMap["dimension"], "name" | "report_id" | "ordering">;
|
|
630
|
+
formatter: Pick<SimpleEntityMap["formatter"], "name" | "content">;
|
|
631
|
+
report: Pick<SimpleEntityMap["report"], "name">;
|
|
632
|
+
section: Pick<SimpleEntityMap["section"], "ordering" | "report_id">;
|
|
633
|
+
variant: Pick<SimpleEntityMap["variant"], "name" | "slug" | "dimension_id">;
|
|
634
|
+
datasource: Pick<SimpleEntityMap["datasource"], "name" | "description" | "content">;
|
|
635
|
+
};
|
|
636
|
+
type CreateBulkParams = {
|
|
637
|
+
block: (Pick<SimpleEntityMap["block"], "blockcol" | "blockrow" | "section_id" | "type"> & {
|
|
638
|
+
locales: Array<string>;
|
|
639
|
+
})[];
|
|
640
|
+
section: Pick<SimpleEntityMap["section"], "ordering" | "report_id">[];
|
|
641
|
+
};
|
|
642
|
+
type ReadParams = {
|
|
643
|
+
id?: number | number[];
|
|
644
|
+
include?: boolean | string;
|
|
645
|
+
locales?: string[];
|
|
646
|
+
};
|
|
647
|
+
type UpdateParams = {
|
|
648
|
+
block: Partial<NestedEntityMap["block"]> & {
|
|
649
|
+
id: number;
|
|
650
|
+
inputAction?: {
|
|
651
|
+
operation: "create" | "delete";
|
|
652
|
+
input: {
|
|
653
|
+
input_id: number;
|
|
654
|
+
block_id: number;
|
|
655
|
+
};
|
|
656
|
+
};
|
|
657
|
+
};
|
|
658
|
+
dimension: Partial<NestedEntityMap["dimension"]> & {
|
|
659
|
+
id: number;
|
|
660
|
+
};
|
|
661
|
+
formatter: Partial<NestedEntityMap["formatter"]> & {
|
|
662
|
+
id: number;
|
|
663
|
+
};
|
|
664
|
+
report: Partial<NestedEntityMap["report"]> & {
|
|
665
|
+
id: number;
|
|
666
|
+
};
|
|
667
|
+
section: Partial<NestedEntityMap["section"]> & {
|
|
668
|
+
id: number;
|
|
669
|
+
};
|
|
670
|
+
variant: Partial<NestedEntityMap["variant"]> & {
|
|
671
|
+
id: number;
|
|
672
|
+
};
|
|
673
|
+
datasource: Partial<NestedEntityMap["datasource"]> & {
|
|
674
|
+
id: number;
|
|
675
|
+
};
|
|
676
|
+
};
|
|
677
|
+
type UpdateBulkParams = {
|
|
678
|
+
block: Partial<NestedEntityMap["block"]> & {
|
|
679
|
+
id: number;
|
|
680
|
+
inputAction?: {
|
|
681
|
+
operation: "create" | "delete";
|
|
682
|
+
input: {
|
|
683
|
+
input_id: number;
|
|
684
|
+
block_id: number;
|
|
685
|
+
};
|
|
686
|
+
};
|
|
687
|
+
notInclude?: boolean;
|
|
688
|
+
}[];
|
|
689
|
+
section: Partial<NestedEntityMap["section"]> & {
|
|
690
|
+
id: number;
|
|
691
|
+
}[];
|
|
692
|
+
};
|
|
693
|
+
type DeleteParams = number;
|
|
694
|
+
type CreateResponse<T extends EntityType> = NestedEntityMap[T];
|
|
695
|
+
type UpdateResponse<T extends EntityType> = NestedEntityMap[T];
|
|
696
|
+
type DeleteResponse = {
|
|
697
|
+
id: number;
|
|
698
|
+
parentType?: string;
|
|
699
|
+
parentId?: number;
|
|
700
|
+
};
|
|
701
|
+
type CreateBulkResponse<T extends keyof CreateBulkParams> = NestedEntityMap[T][];
|
|
702
|
+
type UpdateBulkResponse<T extends keyof UpdateBulkParams> = NestedEntityMap[T][];
|
|
703
|
+
interface CreateMethod<T extends EntityType> {
|
|
704
|
+
(params: CreateParams[T]): Promise<Result<CreateResponse<T>>>;
|
|
705
|
+
}
|
|
706
|
+
interface CreateBulkMethod<T extends keyof CreateBulkParams> {
|
|
707
|
+
(params: CreateBulkParams[T]): Promise<Result<CreateBulkResponse<T>>>;
|
|
708
|
+
}
|
|
709
|
+
interface ReadMethod<T extends EntityType> {
|
|
710
|
+
(): Promise<Result<SimpleEntityMap[T][]>>;
|
|
711
|
+
(params: {
|
|
712
|
+
id: number | number[];
|
|
713
|
+
}): Promise<Result<SimpleEntityMap[T][]>>;
|
|
714
|
+
(params: {
|
|
715
|
+
id?: number | number[];
|
|
716
|
+
include: false;
|
|
717
|
+
}): Promise<Result<SimpleEntityMap[T][]>>;
|
|
718
|
+
(params: {
|
|
719
|
+
id?: number | number[];
|
|
720
|
+
include: true;
|
|
721
|
+
}): Promise<Result<NestedEntityMap[T][]>>;
|
|
722
|
+
(params: ReadParams): Promise<Result<SimpleEntityMap[T][] | NestedEntityMap[T][]>>;
|
|
723
|
+
}
|
|
724
|
+
interface UpdateMethod<T extends EntityType> {
|
|
725
|
+
(params: UpdateParams[T]): Promise<Result<UpdateResponse<T>>>;
|
|
726
|
+
}
|
|
727
|
+
interface UpdateBulkMethod<T extends keyof UpdateBulkParams> {
|
|
728
|
+
(params: UpdateBulkParams[T]): Promise<Result<UpdateBulkResponse<T>>>;
|
|
729
|
+
}
|
|
730
|
+
interface DeleteMethod {
|
|
731
|
+
(params: DeleteParams): Promise<Result<DeleteResponse>>;
|
|
732
|
+
}
|
|
733
|
+
interface SearchReportParams {
|
|
734
|
+
query: string;
|
|
735
|
+
locale: string;
|
|
736
|
+
limit: number;
|
|
737
|
+
offset?: number;
|
|
738
|
+
visible: boolean;
|
|
739
|
+
includes: boolean;
|
|
740
|
+
noImage: boolean;
|
|
741
|
+
format: "results" | "profiles" | "grouped";
|
|
742
|
+
variant: number[];
|
|
743
|
+
dimension: number[];
|
|
744
|
+
report: number[];
|
|
745
|
+
all?: boolean;
|
|
746
|
+
origin?: "flexsearch" | "typesense";
|
|
747
|
+
sort?: "report" | "name" | string;
|
|
748
|
+
direction?: string;
|
|
749
|
+
}
|
|
750
|
+
interface SearchReportItem {
|
|
751
|
+
name: string;
|
|
752
|
+
id: string;
|
|
753
|
+
path: string;
|
|
754
|
+
confidence: number;
|
|
755
|
+
members: Array<Record<string, any>>;
|
|
756
|
+
}
|
|
757
|
+
interface SearchReportResponse {
|
|
758
|
+
meta: {
|
|
759
|
+
[key: string]: any;
|
|
760
|
+
};
|
|
761
|
+
results: Array<SearchReportItem>;
|
|
762
|
+
}
|
|
763
|
+
interface UpdateMemberParams {
|
|
764
|
+
content_id: number;
|
|
765
|
+
contentByLocale: Record<string, any>[];
|
|
766
|
+
image: Record<string, any> | null;
|
|
767
|
+
image_id: number;
|
|
768
|
+
}
|
|
769
|
+
interface UpdateMemberResponse extends SearchAttributes {
|
|
770
|
+
}
|
|
771
|
+
interface ReadMetadataParams {
|
|
772
|
+
report_id?: number;
|
|
773
|
+
count?: boolean | string;
|
|
774
|
+
}
|
|
775
|
+
interface ReadMetadataResponse {
|
|
776
|
+
data: {
|
|
777
|
+
[key: string]: any;
|
|
778
|
+
}[];
|
|
779
|
+
}
|
|
780
|
+
interface SearchUsersParams {
|
|
781
|
+
query?: string;
|
|
782
|
+
role_id?: string;
|
|
783
|
+
page?: number;
|
|
784
|
+
[key: string]: any;
|
|
785
|
+
}
|
|
786
|
+
interface UpdateUserParams {
|
|
787
|
+
user_id: string;
|
|
788
|
+
roles?: {
|
|
789
|
+
id: string;
|
|
790
|
+
name: string;
|
|
791
|
+
}[];
|
|
792
|
+
app_metadata?: {
|
|
793
|
+
[key: string]: any;
|
|
794
|
+
};
|
|
795
|
+
user_metadata?: {
|
|
796
|
+
[key: string]: any;
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
interface UpdateMyDataParams {
|
|
800
|
+
report_id?: number;
|
|
801
|
+
user_metadata?: Record<string, any>;
|
|
802
|
+
}
|
|
803
|
+
interface ReadPrivateBlocksParams {
|
|
804
|
+
report_id: number;
|
|
805
|
+
locale: string;
|
|
806
|
+
section_id: number[];
|
|
807
|
+
userToken?: string | null;
|
|
808
|
+
}
|
|
809
|
+
interface InternalReadPrivateBlocksParams extends ReadPrivateBlocksParams {
|
|
810
|
+
roles: string[];
|
|
811
|
+
}
|
|
812
|
+
interface ReadPrivateBlocksResponse {
|
|
813
|
+
params: {
|
|
814
|
+
[key: string]: any;
|
|
815
|
+
};
|
|
816
|
+
data: {
|
|
817
|
+
[key: string]: any;
|
|
818
|
+
}[];
|
|
819
|
+
}
|
|
820
|
+
interface RevalidateReportRequest {
|
|
821
|
+
profilePrefix: string;
|
|
822
|
+
reportId: number;
|
|
823
|
+
variantPaths?: {
|
|
824
|
+
variantId: number;
|
|
825
|
+
prefix: string;
|
|
826
|
+
variantSlug: string;
|
|
827
|
+
}[];
|
|
828
|
+
}
|
|
829
|
+
interface RevalidateReportResponse {
|
|
830
|
+
reportId: number;
|
|
831
|
+
revalidated: number;
|
|
832
|
+
samples: string[];
|
|
833
|
+
paths: string[];
|
|
834
|
+
}
|
|
835
|
+
interface RevalidateUrlRequest {
|
|
836
|
+
target: string;
|
|
837
|
+
}
|
|
838
|
+
interface RevalidateUrlResponse {
|
|
839
|
+
target: string;
|
|
840
|
+
}
|
|
841
|
+
interface ReadEnvSecretsResponse {
|
|
842
|
+
secrets: {
|
|
843
|
+
[key: string]: any;
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
export { type AnyBlock as A, type VariantAttributes as B, SearchContentModel as C, type DataSource as D, type InternalReadPrivateBlocksParams as E, type Formatter as F, type CreateMethod as G, type DeleteMethod as H, ImageModel as I, type ReadMethod as J, type UpdateMethod as K, type CreateBulkMethod as L, type UpdateBulkMethod as M, type NestedDimension as N, type UpdateMemberParams as O, type UpdateMemberResponse as P, type NormalizedEntityMap as Q, type Result as R, type SearchUsersParams as S, type NestedEntityMap as T, type UpdateUserParams as U, type Variant as V, type AnyNestedBlock as a, type AnyReport as b, type AnyNestedReport as c, type Section as d, type NestedSection as e, type DeleteParams as f, type ReadParams as g, type Dimension as h, type SearchReportParams as i, type SearchReportResponse as j, type ReadMetadataParams as k, type ReadMetadataResponse as l, type UpdateMyDataParams as m, type ReadPrivateBlocksParams as n, type ReadPrivateBlocksResponse as o, type RevalidateUrlRequest as p, type RevalidateUrlResponse as q, type RevalidateReportRequest as r, type RevalidateReportResponse as s, type ReadEnvSecretsResponse as t, type SearchReportItem as u, type ReportsDB as v, type SearchAttributes as w, type SearchContentAttributes as x, type ReportAttributes as y, type DimensionAttributes as z };
|