@frt-platform/report-core 1.0.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 +367 -0
- package/dist/index.d.mts +350 -0
- package/dist/index.d.ts +350 -0
- package/dist/index.js +236 -0
- package/dist/index.mjs +197 -0
- package/package.json +36 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const REPORT_TEMPLATE_VERSION = 1;
|
|
4
|
+
declare const REPORT_TEMPLATE_FIELD_TYPES: readonly ["shortText", "longText", "number", "date", "checkbox", "singleSelect", "multiSelect", "starRating"];
|
|
5
|
+
type ReportTemplateFieldType = (typeof REPORT_TEMPLATE_FIELD_TYPES)[number];
|
|
6
|
+
declare const ReportTemplateFieldSchema: z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
type: z.ZodString;
|
|
9
|
+
label: z.ZodString;
|
|
10
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
+
description: z.ZodOptional<z.ZodString>;
|
|
12
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
13
|
+
options: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
14
|
+
allowOther: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">, z.ZodNull]>>;
|
|
16
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
minValue: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
maxValue: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
step: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
minSelections: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
maxSelections: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
dataClassification: z.ZodOptional<z.ZodEnum<["none", "personal", "special"]>>;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
id: string;
|
|
26
|
+
type: string;
|
|
27
|
+
label: string;
|
|
28
|
+
required?: boolean | undefined;
|
|
29
|
+
description?: string | undefined;
|
|
30
|
+
placeholder?: string | undefined;
|
|
31
|
+
options?: string[] | undefined;
|
|
32
|
+
allowOther?: boolean | undefined;
|
|
33
|
+
defaultValue?: string | number | boolean | string[] | null | undefined;
|
|
34
|
+
minLength?: number | undefined;
|
|
35
|
+
maxLength?: number | undefined;
|
|
36
|
+
minValue?: number | undefined;
|
|
37
|
+
maxValue?: number | undefined;
|
|
38
|
+
step?: number | undefined;
|
|
39
|
+
minSelections?: number | undefined;
|
|
40
|
+
maxSelections?: number | undefined;
|
|
41
|
+
dataClassification?: "none" | "personal" | "special" | undefined;
|
|
42
|
+
}, {
|
|
43
|
+
id: string;
|
|
44
|
+
type: string;
|
|
45
|
+
label: string;
|
|
46
|
+
required?: boolean | undefined;
|
|
47
|
+
description?: string | undefined;
|
|
48
|
+
placeholder?: string | undefined;
|
|
49
|
+
options?: string[] | undefined;
|
|
50
|
+
allowOther?: boolean | undefined;
|
|
51
|
+
defaultValue?: string | number | boolean | string[] | null | undefined;
|
|
52
|
+
minLength?: number | undefined;
|
|
53
|
+
maxLength?: number | undefined;
|
|
54
|
+
minValue?: number | undefined;
|
|
55
|
+
maxValue?: number | undefined;
|
|
56
|
+
step?: number | undefined;
|
|
57
|
+
minSelections?: number | undefined;
|
|
58
|
+
maxSelections?: number | undefined;
|
|
59
|
+
dataClassification?: "none" | "personal" | "special" | undefined;
|
|
60
|
+
}>;
|
|
61
|
+
type ReportTemplateField = z.infer<typeof ReportTemplateFieldSchema>;
|
|
62
|
+
declare const ReportTemplateSectionSchema: z.ZodObject<{
|
|
63
|
+
id: z.ZodString;
|
|
64
|
+
title: z.ZodOptional<z.ZodString>;
|
|
65
|
+
description: z.ZodOptional<z.ZodString>;
|
|
66
|
+
fields: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
67
|
+
id: z.ZodString;
|
|
68
|
+
type: z.ZodString;
|
|
69
|
+
label: z.ZodString;
|
|
70
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
71
|
+
description: z.ZodOptional<z.ZodString>;
|
|
72
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
73
|
+
options: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
74
|
+
allowOther: z.ZodOptional<z.ZodBoolean>;
|
|
75
|
+
defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">, z.ZodNull]>>;
|
|
76
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
77
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
minValue: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
maxValue: z.ZodOptional<z.ZodNumber>;
|
|
80
|
+
step: z.ZodOptional<z.ZodNumber>;
|
|
81
|
+
minSelections: z.ZodOptional<z.ZodNumber>;
|
|
82
|
+
maxSelections: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
dataClassification: z.ZodOptional<z.ZodEnum<["none", "personal", "special"]>>;
|
|
84
|
+
}, "strip", z.ZodTypeAny, {
|
|
85
|
+
id: string;
|
|
86
|
+
type: string;
|
|
87
|
+
label: string;
|
|
88
|
+
required?: boolean | undefined;
|
|
89
|
+
description?: string | undefined;
|
|
90
|
+
placeholder?: string | undefined;
|
|
91
|
+
options?: string[] | undefined;
|
|
92
|
+
allowOther?: boolean | undefined;
|
|
93
|
+
defaultValue?: string | number | boolean | string[] | null | undefined;
|
|
94
|
+
minLength?: number | undefined;
|
|
95
|
+
maxLength?: number | undefined;
|
|
96
|
+
minValue?: number | undefined;
|
|
97
|
+
maxValue?: number | undefined;
|
|
98
|
+
step?: number | undefined;
|
|
99
|
+
minSelections?: number | undefined;
|
|
100
|
+
maxSelections?: number | undefined;
|
|
101
|
+
dataClassification?: "none" | "personal" | "special" | undefined;
|
|
102
|
+
}, {
|
|
103
|
+
id: string;
|
|
104
|
+
type: string;
|
|
105
|
+
label: string;
|
|
106
|
+
required?: boolean | undefined;
|
|
107
|
+
description?: string | undefined;
|
|
108
|
+
placeholder?: string | undefined;
|
|
109
|
+
options?: string[] | undefined;
|
|
110
|
+
allowOther?: boolean | undefined;
|
|
111
|
+
defaultValue?: string | number | boolean | string[] | null | undefined;
|
|
112
|
+
minLength?: number | undefined;
|
|
113
|
+
maxLength?: number | undefined;
|
|
114
|
+
minValue?: number | undefined;
|
|
115
|
+
maxValue?: number | undefined;
|
|
116
|
+
step?: number | undefined;
|
|
117
|
+
minSelections?: number | undefined;
|
|
118
|
+
maxSelections?: number | undefined;
|
|
119
|
+
dataClassification?: "none" | "personal" | "special" | undefined;
|
|
120
|
+
}>, "many">>;
|
|
121
|
+
}, "strip", z.ZodTypeAny, {
|
|
122
|
+
id: string;
|
|
123
|
+
fields: {
|
|
124
|
+
id: string;
|
|
125
|
+
type: string;
|
|
126
|
+
label: string;
|
|
127
|
+
required?: boolean | undefined;
|
|
128
|
+
description?: string | undefined;
|
|
129
|
+
placeholder?: string | undefined;
|
|
130
|
+
options?: string[] | undefined;
|
|
131
|
+
allowOther?: boolean | undefined;
|
|
132
|
+
defaultValue?: string | number | boolean | string[] | null | undefined;
|
|
133
|
+
minLength?: number | undefined;
|
|
134
|
+
maxLength?: number | undefined;
|
|
135
|
+
minValue?: number | undefined;
|
|
136
|
+
maxValue?: number | undefined;
|
|
137
|
+
step?: number | undefined;
|
|
138
|
+
minSelections?: number | undefined;
|
|
139
|
+
maxSelections?: number | undefined;
|
|
140
|
+
dataClassification?: "none" | "personal" | "special" | undefined;
|
|
141
|
+
}[];
|
|
142
|
+
description?: string | undefined;
|
|
143
|
+
title?: string | undefined;
|
|
144
|
+
}, {
|
|
145
|
+
id: string;
|
|
146
|
+
description?: string | undefined;
|
|
147
|
+
title?: string | undefined;
|
|
148
|
+
fields?: {
|
|
149
|
+
id: string;
|
|
150
|
+
type: string;
|
|
151
|
+
label: string;
|
|
152
|
+
required?: boolean | undefined;
|
|
153
|
+
description?: string | undefined;
|
|
154
|
+
placeholder?: string | undefined;
|
|
155
|
+
options?: string[] | undefined;
|
|
156
|
+
allowOther?: boolean | undefined;
|
|
157
|
+
defaultValue?: string | number | boolean | string[] | null | undefined;
|
|
158
|
+
minLength?: number | undefined;
|
|
159
|
+
maxLength?: number | undefined;
|
|
160
|
+
minValue?: number | undefined;
|
|
161
|
+
maxValue?: number | undefined;
|
|
162
|
+
step?: number | undefined;
|
|
163
|
+
minSelections?: number | undefined;
|
|
164
|
+
maxSelections?: number | undefined;
|
|
165
|
+
dataClassification?: "none" | "personal" | "special" | undefined;
|
|
166
|
+
}[] | undefined;
|
|
167
|
+
}>;
|
|
168
|
+
type ReportTemplateSection = z.infer<typeof ReportTemplateSectionSchema>;
|
|
169
|
+
declare const ReportTemplateSchemaValidator: z.ZodObject<{
|
|
170
|
+
version: z.ZodDefault<z.ZodNumber>;
|
|
171
|
+
title: z.ZodOptional<z.ZodString>;
|
|
172
|
+
description: z.ZodOptional<z.ZodString>;
|
|
173
|
+
sections: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
174
|
+
id: z.ZodString;
|
|
175
|
+
title: z.ZodOptional<z.ZodString>;
|
|
176
|
+
description: z.ZodOptional<z.ZodString>;
|
|
177
|
+
fields: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
178
|
+
id: z.ZodString;
|
|
179
|
+
type: z.ZodString;
|
|
180
|
+
label: z.ZodString;
|
|
181
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
182
|
+
description: z.ZodOptional<z.ZodString>;
|
|
183
|
+
placeholder: z.ZodOptional<z.ZodString>;
|
|
184
|
+
options: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
185
|
+
allowOther: z.ZodOptional<z.ZodBoolean>;
|
|
186
|
+
defaultValue: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">, z.ZodNull]>>;
|
|
187
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
188
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
189
|
+
minValue: z.ZodOptional<z.ZodNumber>;
|
|
190
|
+
maxValue: z.ZodOptional<z.ZodNumber>;
|
|
191
|
+
step: z.ZodOptional<z.ZodNumber>;
|
|
192
|
+
minSelections: z.ZodOptional<z.ZodNumber>;
|
|
193
|
+
maxSelections: z.ZodOptional<z.ZodNumber>;
|
|
194
|
+
dataClassification: z.ZodOptional<z.ZodEnum<["none", "personal", "special"]>>;
|
|
195
|
+
}, "strip", z.ZodTypeAny, {
|
|
196
|
+
id: string;
|
|
197
|
+
type: string;
|
|
198
|
+
label: string;
|
|
199
|
+
required?: boolean | undefined;
|
|
200
|
+
description?: string | undefined;
|
|
201
|
+
placeholder?: string | undefined;
|
|
202
|
+
options?: string[] | undefined;
|
|
203
|
+
allowOther?: boolean | undefined;
|
|
204
|
+
defaultValue?: string | number | boolean | string[] | null | undefined;
|
|
205
|
+
minLength?: number | undefined;
|
|
206
|
+
maxLength?: number | undefined;
|
|
207
|
+
minValue?: number | undefined;
|
|
208
|
+
maxValue?: number | undefined;
|
|
209
|
+
step?: number | undefined;
|
|
210
|
+
minSelections?: number | undefined;
|
|
211
|
+
maxSelections?: number | undefined;
|
|
212
|
+
dataClassification?: "none" | "personal" | "special" | undefined;
|
|
213
|
+
}, {
|
|
214
|
+
id: string;
|
|
215
|
+
type: string;
|
|
216
|
+
label: string;
|
|
217
|
+
required?: boolean | undefined;
|
|
218
|
+
description?: string | undefined;
|
|
219
|
+
placeholder?: string | undefined;
|
|
220
|
+
options?: string[] | undefined;
|
|
221
|
+
allowOther?: boolean | undefined;
|
|
222
|
+
defaultValue?: string | number | boolean | string[] | null | undefined;
|
|
223
|
+
minLength?: number | undefined;
|
|
224
|
+
maxLength?: number | undefined;
|
|
225
|
+
minValue?: number | undefined;
|
|
226
|
+
maxValue?: number | undefined;
|
|
227
|
+
step?: number | undefined;
|
|
228
|
+
minSelections?: number | undefined;
|
|
229
|
+
maxSelections?: number | undefined;
|
|
230
|
+
dataClassification?: "none" | "personal" | "special" | undefined;
|
|
231
|
+
}>, "many">>;
|
|
232
|
+
}, "strip", z.ZodTypeAny, {
|
|
233
|
+
id: string;
|
|
234
|
+
fields: {
|
|
235
|
+
id: string;
|
|
236
|
+
type: string;
|
|
237
|
+
label: string;
|
|
238
|
+
required?: boolean | undefined;
|
|
239
|
+
description?: string | undefined;
|
|
240
|
+
placeholder?: string | undefined;
|
|
241
|
+
options?: string[] | undefined;
|
|
242
|
+
allowOther?: boolean | undefined;
|
|
243
|
+
defaultValue?: string | number | boolean | string[] | null | undefined;
|
|
244
|
+
minLength?: number | undefined;
|
|
245
|
+
maxLength?: number | undefined;
|
|
246
|
+
minValue?: number | undefined;
|
|
247
|
+
maxValue?: number | undefined;
|
|
248
|
+
step?: number | undefined;
|
|
249
|
+
minSelections?: number | undefined;
|
|
250
|
+
maxSelections?: number | undefined;
|
|
251
|
+
dataClassification?: "none" | "personal" | "special" | undefined;
|
|
252
|
+
}[];
|
|
253
|
+
description?: string | undefined;
|
|
254
|
+
title?: string | undefined;
|
|
255
|
+
}, {
|
|
256
|
+
id: string;
|
|
257
|
+
description?: string | undefined;
|
|
258
|
+
title?: string | undefined;
|
|
259
|
+
fields?: {
|
|
260
|
+
id: string;
|
|
261
|
+
type: string;
|
|
262
|
+
label: string;
|
|
263
|
+
required?: boolean | undefined;
|
|
264
|
+
description?: string | undefined;
|
|
265
|
+
placeholder?: string | undefined;
|
|
266
|
+
options?: string[] | undefined;
|
|
267
|
+
allowOther?: boolean | undefined;
|
|
268
|
+
defaultValue?: string | number | boolean | string[] | null | undefined;
|
|
269
|
+
minLength?: number | undefined;
|
|
270
|
+
maxLength?: number | undefined;
|
|
271
|
+
minValue?: number | undefined;
|
|
272
|
+
maxValue?: number | undefined;
|
|
273
|
+
step?: number | undefined;
|
|
274
|
+
minSelections?: number | undefined;
|
|
275
|
+
maxSelections?: number | undefined;
|
|
276
|
+
dataClassification?: "none" | "personal" | "special" | undefined;
|
|
277
|
+
}[] | undefined;
|
|
278
|
+
}>, "many">>;
|
|
279
|
+
}, "strip", z.ZodTypeAny, {
|
|
280
|
+
version: number;
|
|
281
|
+
sections: {
|
|
282
|
+
id: string;
|
|
283
|
+
fields: {
|
|
284
|
+
id: string;
|
|
285
|
+
type: string;
|
|
286
|
+
label: string;
|
|
287
|
+
required?: boolean | undefined;
|
|
288
|
+
description?: string | undefined;
|
|
289
|
+
placeholder?: string | undefined;
|
|
290
|
+
options?: string[] | undefined;
|
|
291
|
+
allowOther?: boolean | undefined;
|
|
292
|
+
defaultValue?: string | number | boolean | string[] | null | undefined;
|
|
293
|
+
minLength?: number | undefined;
|
|
294
|
+
maxLength?: number | undefined;
|
|
295
|
+
minValue?: number | undefined;
|
|
296
|
+
maxValue?: number | undefined;
|
|
297
|
+
step?: number | undefined;
|
|
298
|
+
minSelections?: number | undefined;
|
|
299
|
+
maxSelections?: number | undefined;
|
|
300
|
+
dataClassification?: "none" | "personal" | "special" | undefined;
|
|
301
|
+
}[];
|
|
302
|
+
description?: string | undefined;
|
|
303
|
+
title?: string | undefined;
|
|
304
|
+
}[];
|
|
305
|
+
description?: string | undefined;
|
|
306
|
+
title?: string | undefined;
|
|
307
|
+
}, {
|
|
308
|
+
description?: string | undefined;
|
|
309
|
+
title?: string | undefined;
|
|
310
|
+
version?: number | undefined;
|
|
311
|
+
sections?: {
|
|
312
|
+
id: string;
|
|
313
|
+
description?: string | undefined;
|
|
314
|
+
title?: string | undefined;
|
|
315
|
+
fields?: {
|
|
316
|
+
id: string;
|
|
317
|
+
type: string;
|
|
318
|
+
label: string;
|
|
319
|
+
required?: boolean | undefined;
|
|
320
|
+
description?: string | undefined;
|
|
321
|
+
placeholder?: string | undefined;
|
|
322
|
+
options?: string[] | undefined;
|
|
323
|
+
allowOther?: boolean | undefined;
|
|
324
|
+
defaultValue?: string | number | boolean | string[] | null | undefined;
|
|
325
|
+
minLength?: number | undefined;
|
|
326
|
+
maxLength?: number | undefined;
|
|
327
|
+
minValue?: number | undefined;
|
|
328
|
+
maxValue?: number | undefined;
|
|
329
|
+
step?: number | undefined;
|
|
330
|
+
minSelections?: number | undefined;
|
|
331
|
+
maxSelections?: number | undefined;
|
|
332
|
+
dataClassification?: "none" | "personal" | "special" | undefined;
|
|
333
|
+
}[] | undefined;
|
|
334
|
+
}[] | undefined;
|
|
335
|
+
}>;
|
|
336
|
+
type ReportTemplateSchema = z.infer<typeof ReportTemplateSchemaValidator>;
|
|
337
|
+
|
|
338
|
+
declare const DEFAULT_FIELD_LABEL = "Untitled question";
|
|
339
|
+
declare const CORE_FIELD_DEFAULTS: Record<ReportTemplateFieldType, Record<string, unknown>>;
|
|
340
|
+
|
|
341
|
+
declare function createUniqueId(prefix: string, existing: Iterable<string>): string;
|
|
342
|
+
|
|
343
|
+
declare function parseReportTemplateSchema(raw: unknown): ReportTemplateSchema;
|
|
344
|
+
declare function normalizeReportTemplateSchema(schema: ReportTemplateSchema): ReportTemplateSchema;
|
|
345
|
+
declare function parseReportTemplateSchemaFromString(raw: string): ReportTemplateSchema;
|
|
346
|
+
declare function serializeReportTemplateSchema(schema: ReportTemplateSchema): string;
|
|
347
|
+
|
|
348
|
+
declare function migrateLegacySchema(raw: unknown): unknown;
|
|
349
|
+
|
|
350
|
+
export { CORE_FIELD_DEFAULTS, DEFAULT_FIELD_LABEL, REPORT_TEMPLATE_FIELD_TYPES, REPORT_TEMPLATE_VERSION, type ReportTemplateField, ReportTemplateFieldSchema, type ReportTemplateFieldType, type ReportTemplateSchema, ReportTemplateSchemaValidator, type ReportTemplateSection, ReportTemplateSectionSchema, createUniqueId, migrateLegacySchema, normalizeReportTemplateSchema, parseReportTemplateSchema, parseReportTemplateSchemaFromString, serializeReportTemplateSchema };
|