@dmptool/types 1.2.6 → 2.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 +1 -1
- package/dist/answers/__tests__/defaults.spec.js +216 -0
- package/dist/answers/answer.d.ts +29 -14
- package/dist/answers/answer.js +11 -5
- package/dist/answers/dateAnswers.d.ts +20 -47
- package/dist/answers/dateAnswers.js +20 -10
- package/dist/answers/graphQLAnswers.d.ts +48 -120
- package/dist/answers/graphQLAnswers.js +46 -21
- package/dist/answers/index.d.ts +155 -1439
- package/dist/answers/index.js +26 -1
- package/dist/answers/numberAnswers.d.ts +38 -92
- package/dist/answers/numberAnswers.js +38 -19
- package/dist/answers/optionBasedAnswers.d.ts +42 -87
- package/dist/answers/optionBasedAnswers.js +37 -21
- package/dist/answers/tableAnswers.d.ts +348 -3032
- package/dist/answers/tableAnswers.js +25 -61
- package/dist/answers/textAnswers.d.ts +32 -68
- package/dist/answers/textAnswers.js +30 -17
- package/dist/questions/__tests__/dateQuestions.spec.js +3 -0
- package/dist/questions/__tests__/defaults.spec.d.ts +1 -0
- package/dist/questions/__tests__/defaults.spec.js +668 -0
- package/dist/questions/__tests__/optionBasedQuestions.spec.js +3 -2
- package/dist/questions/__tests__/tableQuestion.spec.js +22 -23
- package/dist/questions/__tests__/textQuestions.spec.js +32 -0
- package/dist/questions/dateQuestions.d.ts +45 -191
- package/dist/questions/dateQuestions.js +26 -23
- package/dist/questions/graphQLQuestions.d.ts +262 -556
- package/dist/questions/graphQLQuestions.js +225 -223
- package/dist/questions/index.d.ts +689 -7440
- package/dist/questions/index.js +26 -1
- package/dist/questions/numberQuestions.d.ts +85 -331
- package/dist/questions/numberQuestions.js +50 -36
- package/dist/questions/optionBasedQuestions.d.ts +83 -290
- package/dist/questions/optionBasedQuestions.js +58 -41
- package/dist/questions/question.d.ts +72 -35
- package/dist/questions/question.js +14 -5
- package/dist/questions/tableQuestions.d.ts +1977 -9646
- package/dist/questions/tableQuestions.js +184 -192
- package/dist/questions/textQuestions.d.ts +70 -226
- package/dist/questions/textQuestions.js +31 -31
- package/package.json +4 -5
- package/dist/answers/__tests__/usage.spec.js +0 -178
- package/dist/questions/__tests__/usage.spec.d.ts +0 -8
- package/dist/questions/__tests__/usage.spec.js +0 -473
- package/dist/schemas/affiliationSearchAnswer.schema.json +0 -45
- package/dist/schemas/affiliationSearchQuestion.schema.json +0 -140
- package/dist/schemas/anyAnswer.schema.json +0 -605
- package/dist/schemas/anyQuestion.schema.json +0 -2455
- package/dist/schemas/anyTableColumnAnswer.schema.json +0 -466
- package/dist/schemas/anyTableColumnQuestion.schema.json +0 -1092
- package/dist/schemas/booleanAnswer.schema.json +0 -34
- package/dist/schemas/booleanQuestion.schema.json +0 -56
- package/dist/schemas/checkboxesAnswer.schema.json +0 -39
- package/dist/schemas/checkboxesQuestion.schema.json +0 -76
- package/dist/schemas/currencyAnswer.schema.json +0 -34
- package/dist/schemas/currencyQuestion.schema.json +0 -67
- package/dist/schemas/dateAnswer.schema.json +0 -34
- package/dist/schemas/datePickerAnswer.schema.json +0 -37
- package/dist/schemas/datePickerQuestion.schema.json +0 -52
- package/dist/schemas/dateQuestion.schema.json +0 -62
- package/dist/schemas/dateRangeAnswer.schema.json +0 -45
- package/dist/schemas/dateRangeQuestion.schema.json +0 -112
- package/dist/schemas/emailAnswer.schema.json +0 -34
- package/dist/schemas/emailQuestion.schema.json +0 -66
- package/dist/schemas/filteredSearchAnswer.schema.json +0 -40
- package/dist/schemas/filteredSearchQuestion.schema.json +0 -130
- package/dist/schemas/licenseSearchAnswer.schema.json +0 -49
- package/dist/schemas/licenseSearchQuestion.schema.json +0 -164
- package/dist/schemas/metadataStandardSearchAnswer.schema.json +0 -49
- package/dist/schemas/metadataStandardSearchQuestion.schema.json +0 -174
- package/dist/schemas/multiselectBoxAnswer.schema.json +0 -39
- package/dist/schemas/multiselectBoxQuestion.schema.json +0 -85
- package/dist/schemas/numberAnswer.schema.json +0 -34
- package/dist/schemas/numberQuestion.schema.json +0 -63
- package/dist/schemas/numberRangeAnswer.schema.json +0 -45
- package/dist/schemas/numberRangeQuestion.schema.json +0 -94
- package/dist/schemas/numberWithContextAnswer.schema.json +0 -45
- package/dist/schemas/numberWithContextQuestion.schema.json +0 -84
- package/dist/schemas/radioButtonsAnswer.schema.json +0 -34
- package/dist/schemas/radioButtonsQuestion.schema.json +0 -76
- package/dist/schemas/repositorySearchAnswer.schema.json +0 -49
- package/dist/schemas/repositorySearchQuestion.schema.json +0 -180
- package/dist/schemas/researchOutputTableAnswer.schema.json +0 -519
- package/dist/schemas/researchOutputTableQuestion.schema.json +0 -1183
- package/dist/schemas/selectBoxAnswer.schema.json +0 -34
- package/dist/schemas/selectBoxQuestion.schema.json +0 -85
- package/dist/schemas/tableAnswer.schema.json +0 -519
- package/dist/schemas/tableQuestion.schema.json +0 -1183
- package/dist/schemas/textAnswer.schema.json +0 -34
- package/dist/schemas/textAreaAnswer.schema.json +0 -34
- package/dist/schemas/textAreaQuestion.schema.json +0 -70
- package/dist/schemas/textQuestion.schema.json +0 -62
- package/dist/schemas/typeaheadSearchAnswer.schema.json +0 -37
- package/dist/schemas/typeaheadSearchQuestion.schema.json +0 -120
- package/dist/schemas/urlAnswer.schema.json +0 -34
- package/dist/schemas/urlQuestion.schema.json +0 -62
- /package/dist/answers/__tests__/{usage.spec.d.ts → defaults.spec.d.ts} +0 -0
|
@@ -5,14 +5,16 @@ describe("TableQuestionSchema", () => {
|
|
|
5
5
|
it("should validate a valid TableQuestion object", () => {
|
|
6
6
|
const validTableQuestion = {
|
|
7
7
|
type: "table",
|
|
8
|
+
attributes: {
|
|
9
|
+
label: "Table",
|
|
10
|
+
},
|
|
8
11
|
columns: [
|
|
9
12
|
{
|
|
10
13
|
heading: "Name",
|
|
11
14
|
content: {
|
|
12
15
|
type: "text",
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
+
attributes: { maxLength: 100 },
|
|
17
|
+
meta: { schemaVersion: "1.0" }
|
|
16
18
|
}
|
|
17
19
|
},
|
|
18
20
|
{
|
|
@@ -26,15 +28,11 @@ describe("TableQuestionSchema", () => {
|
|
|
26
28
|
max: 65,
|
|
27
29
|
step: 1,
|
|
28
30
|
},
|
|
29
|
-
meta: {
|
|
30
|
-
schemaVersion: "1.0"
|
|
31
|
-
}
|
|
31
|
+
meta: { schemaVersion: "1.0" }
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
],
|
|
35
|
-
meta: {
|
|
36
|
-
schemaVersion: "1.0"
|
|
37
|
-
}
|
|
35
|
+
meta: { schemaVersion: "1.0" }
|
|
38
36
|
};
|
|
39
37
|
expect(() => tableQuestions_1.TableQuestionSchema.parse(validTableQuestion)).not.toThrow();
|
|
40
38
|
});
|
|
@@ -84,9 +82,8 @@ describe("ResearchOutputTableQuestionSchema", () => {
|
|
|
84
82
|
enabled: true,
|
|
85
83
|
content: {
|
|
86
84
|
type: "text",
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
85
|
+
attributes: { maxLength: 255 },
|
|
86
|
+
meta: { schemaVersion: "1.0" }
|
|
90
87
|
}
|
|
91
88
|
},
|
|
92
89
|
{
|
|
@@ -117,12 +114,8 @@ describe("ResearchOutputTableQuestionSchema", () => {
|
|
|
117
114
|
min: 0,
|
|
118
115
|
step: 1,
|
|
119
116
|
context: [
|
|
120
|
-
{ label: 'bytes', value: 'bytes' },
|
|
121
117
|
{ label: 'KB (kilobytes)', value: 'kb' },
|
|
122
|
-
{ label: 'MB (megabytes)', value: 'mb' }
|
|
123
|
-
{ label: 'GB (gigabytes)', value: 'gb' },
|
|
124
|
-
{ label: 'TB (terabytes)', value: 'tb' },
|
|
125
|
-
{ label: 'PB (petabytes)', value: 'pb' }
|
|
118
|
+
{ label: 'MB (megabytes)', value: 'mb' }
|
|
126
119
|
]
|
|
127
120
|
},
|
|
128
121
|
meta: {
|
|
@@ -130,6 +123,16 @@ describe("ResearchOutputTableQuestionSchema", () => {
|
|
|
130
123
|
}
|
|
131
124
|
}
|
|
132
125
|
},
|
|
126
|
+
{
|
|
127
|
+
heading: "My Custom Field",
|
|
128
|
+
required: false,
|
|
129
|
+
enabled: true,
|
|
130
|
+
content: {
|
|
131
|
+
type: "text",
|
|
132
|
+
attributes: { maxLength: 255 },
|
|
133
|
+
meta: { schemaVersion: "1.0" }
|
|
134
|
+
}
|
|
135
|
+
},
|
|
133
136
|
{
|
|
134
137
|
heading: "Repositories",
|
|
135
138
|
required: false,
|
|
@@ -185,15 +188,11 @@ describe("ResearchOutputTableQuestionSchema", () => {
|
|
|
185
188
|
}
|
|
186
189
|
],
|
|
187
190
|
},
|
|
188
|
-
meta: {
|
|
189
|
-
schemaVersion: "1.0"
|
|
190
|
-
}
|
|
191
|
+
meta: { schemaVersion: "1.0" }
|
|
191
192
|
}
|
|
192
193
|
}
|
|
193
194
|
],
|
|
194
|
-
meta: {
|
|
195
|
-
schemaVersion: "1.0"
|
|
196
|
-
}
|
|
195
|
+
meta: { schemaVersion: "1.0" }
|
|
197
196
|
};
|
|
198
197
|
expect(() => tableQuestions_1.ResearchOutputTableQuestionSchema.parse(validResearchOutputTableQuestion)).not.toThrow();
|
|
199
198
|
});
|
|
@@ -31,6 +31,14 @@ describe("Primitive Questions Zod Schemas", () => {
|
|
|
31
31
|
};
|
|
32
32
|
expect(() => textQuestions_1.EmailQuestionSchema.parse(invalidEmailQuestion)).toThrow();
|
|
33
33
|
});
|
|
34
|
+
it('returns the expected default email', () => {
|
|
35
|
+
const expected = {
|
|
36
|
+
type: "email",
|
|
37
|
+
attributes: { maxLength: 255, multiple: false },
|
|
38
|
+
meta: { schemaVersion: "1.0" }
|
|
39
|
+
};
|
|
40
|
+
expect(textQuestions_1.DefaultEmailQuestion).toEqual(expected);
|
|
41
|
+
});
|
|
34
42
|
it("should validate a valid TextAreaQuestion", () => {
|
|
35
43
|
const validTextAreaQuestion = {
|
|
36
44
|
type: "textArea",
|
|
@@ -61,6 +69,14 @@ describe("Primitive Questions Zod Schemas", () => {
|
|
|
61
69
|
};
|
|
62
70
|
expect(() => textQuestions_1.TextAreaQuestionSchema.parse(invalidTextAreaQuestion)).toThrow();
|
|
63
71
|
});
|
|
72
|
+
it('returns the expected default textArea', () => {
|
|
73
|
+
const expected = {
|
|
74
|
+
type: "textArea",
|
|
75
|
+
attributes: { maxLength: 10000, asRichText: true, cols: 20, rows: 2 },
|
|
76
|
+
meta: { schemaVersion: "1.0" }
|
|
77
|
+
};
|
|
78
|
+
expect(textQuestions_1.DefaultTextAreaQuestion).toEqual(expected);
|
|
79
|
+
});
|
|
64
80
|
it("should validate a valid TextQuestion", () => {
|
|
65
81
|
const validTextQuestion = {
|
|
66
82
|
type: "text",
|
|
@@ -89,6 +105,14 @@ describe("Primitive Questions Zod Schemas", () => {
|
|
|
89
105
|
};
|
|
90
106
|
expect(() => textQuestions_1.TextQuestionSchema.parse(invalidTextQuestion)).toThrow();
|
|
91
107
|
});
|
|
108
|
+
it('returns the expected default text', () => {
|
|
109
|
+
const expected = {
|
|
110
|
+
type: "text",
|
|
111
|
+
attributes: { maxLength: 255 },
|
|
112
|
+
meta: { schemaVersion: "1.0" }
|
|
113
|
+
};
|
|
114
|
+
expect(textQuestions_1.DefaultTextQuestion).toEqual(expected);
|
|
115
|
+
});
|
|
92
116
|
it("should validate a valid URLQuestion", () => {
|
|
93
117
|
const validURLQuestion = {
|
|
94
118
|
type: "url",
|
|
@@ -117,4 +141,12 @@ describe("Primitive Questions Zod Schemas", () => {
|
|
|
117
141
|
};
|
|
118
142
|
expect(() => textQuestions_1.URLQuestionSchema.parse(invalidURLQuestion)).toThrow();
|
|
119
143
|
});
|
|
144
|
+
it('returns the expected default url', () => {
|
|
145
|
+
const expected = {
|
|
146
|
+
type: "url",
|
|
147
|
+
attributes: { maxLength: 255 },
|
|
148
|
+
meta: { schemaVersion: "1.0" }
|
|
149
|
+
};
|
|
150
|
+
expect(textQuestions_1.DefaultURLQuestion).toEqual(expected);
|
|
151
|
+
});
|
|
120
152
|
});
|
|
@@ -1,187 +1,87 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
export declare const DateQuestionSchema: z.ZodObject<{
|
|
3
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
4
|
-
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
5
|
-
title: z.ZodOptional<z.ZodString>;
|
|
6
|
-
usageDescription: z.ZodOptional<z.ZodString>;
|
|
7
|
-
}, "strip", z.ZodTypeAny, {
|
|
8
|
-
schemaVersion: string;
|
|
9
|
-
title?: string | undefined;
|
|
10
|
-
usageDescription?: string | undefined;
|
|
11
|
-
}, {
|
|
12
|
-
schemaVersion?: string | undefined;
|
|
13
|
-
title?: string | undefined;
|
|
14
|
-
usageDescription?: string | undefined;
|
|
15
|
-
}>>;
|
|
16
|
-
} & {
|
|
17
3
|
type: z.ZodLiteral<"date">;
|
|
18
|
-
attributes: z.
|
|
19
|
-
label: z.ZodOptional<z.ZodString>;
|
|
20
|
-
help: z.ZodOptional<z.ZodString>;
|
|
21
|
-
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
22
|
-
} & {
|
|
4
|
+
attributes: z.ZodObject<{
|
|
23
5
|
max: z.ZodOptional<z.ZodString>;
|
|
24
6
|
min: z.ZodOptional<z.ZodString>;
|
|
25
7
|
step: z.ZodDefault<z.ZodNumber>;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
max?: string | undefined;
|
|
38
|
-
min?: string | undefined;
|
|
39
|
-
step?: number | undefined;
|
|
40
|
-
}>>;
|
|
41
|
-
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
label: z.ZodOptional<z.ZodString>;
|
|
9
|
+
help: z.ZodOptional<z.ZodString>;
|
|
10
|
+
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
meta: z.ZodObject<{
|
|
13
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
14
|
+
title: z.ZodOptional<z.ZodString>;
|
|
15
|
+
usageDescription: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export declare const DefaultDateQuestion: {
|
|
42
19
|
type: "date";
|
|
43
20
|
attributes: {
|
|
44
21
|
step: number;
|
|
22
|
+
max?: string | undefined;
|
|
23
|
+
min?: string | undefined;
|
|
45
24
|
label?: string | undefined;
|
|
46
25
|
help?: string | undefined;
|
|
47
26
|
labelTranslationKey?: string | undefined;
|
|
48
|
-
max?: string | undefined;
|
|
49
|
-
min?: string | undefined;
|
|
50
27
|
};
|
|
51
28
|
meta: {
|
|
52
29
|
schemaVersion: string;
|
|
53
30
|
title?: string | undefined;
|
|
54
31
|
usageDescription?: string | undefined;
|
|
55
32
|
};
|
|
56
|
-
}
|
|
57
|
-
type: "date";
|
|
58
|
-
attributes?: {
|
|
59
|
-
label?: string | undefined;
|
|
60
|
-
help?: string | undefined;
|
|
61
|
-
labelTranslationKey?: string | undefined;
|
|
62
|
-
max?: string | undefined;
|
|
63
|
-
min?: string | undefined;
|
|
64
|
-
step?: number | undefined;
|
|
65
|
-
} | undefined;
|
|
66
|
-
meta?: {
|
|
67
|
-
schemaVersion?: string | undefined;
|
|
68
|
-
title?: string | undefined;
|
|
69
|
-
usageDescription?: string | undefined;
|
|
70
|
-
} | undefined;
|
|
71
|
-
}>;
|
|
33
|
+
};
|
|
72
34
|
export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
73
|
-
meta: z.ZodDefault<z.ZodObject<{
|
|
74
|
-
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
75
|
-
title: z.ZodOptional<z.ZodString>;
|
|
76
|
-
usageDescription: z.ZodOptional<z.ZodString>;
|
|
77
|
-
}, "strip", z.ZodTypeAny, {
|
|
78
|
-
schemaVersion: string;
|
|
79
|
-
title?: string | undefined;
|
|
80
|
-
usageDescription?: string | undefined;
|
|
81
|
-
}, {
|
|
82
|
-
schemaVersion?: string | undefined;
|
|
83
|
-
title?: string | undefined;
|
|
84
|
-
usageDescription?: string | undefined;
|
|
85
|
-
}>>;
|
|
86
|
-
} & {
|
|
87
35
|
type: z.ZodLiteral<"dateRange">;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
92
|
-
}, "strip", z.ZodTypeAny, {
|
|
93
|
-
label?: string | undefined;
|
|
94
|
-
help?: string | undefined;
|
|
95
|
-
labelTranslationKey?: string | undefined;
|
|
96
|
-
}, {
|
|
97
|
-
label?: string | undefined;
|
|
98
|
-
help?: string | undefined;
|
|
99
|
-
labelTranslationKey?: string | undefined;
|
|
100
|
-
}>>;
|
|
101
|
-
columns: z.ZodDefault<z.ZodObject<{
|
|
102
|
-
start: z.ZodDefault<z.ZodObject<{
|
|
103
|
-
help: z.ZodOptional<z.ZodString>;
|
|
104
|
-
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
36
|
+
columns: z.ZodObject<{
|
|
37
|
+
start: z.ZodObject<{
|
|
38
|
+
label: z.ZodDefault<z.ZodString>;
|
|
105
39
|
max: z.ZodOptional<z.ZodString>;
|
|
106
40
|
min: z.ZodOptional<z.ZodString>;
|
|
107
41
|
step: z.ZodDefault<z.ZodNumber>;
|
|
108
|
-
} & {
|
|
109
|
-
label: z.ZodDefault<z.ZodString>;
|
|
110
|
-
}, "strip", z.ZodTypeAny, {
|
|
111
|
-
label: string;
|
|
112
|
-
step: number;
|
|
113
|
-
help?: string | undefined;
|
|
114
|
-
labelTranslationKey?: string | undefined;
|
|
115
|
-
max?: string | undefined;
|
|
116
|
-
min?: string | undefined;
|
|
117
|
-
}, {
|
|
118
|
-
label?: string | undefined;
|
|
119
|
-
help?: string | undefined;
|
|
120
|
-
labelTranslationKey?: string | undefined;
|
|
121
|
-
max?: string | undefined;
|
|
122
|
-
min?: string | undefined;
|
|
123
|
-
step?: number | undefined;
|
|
124
|
-
}>>;
|
|
125
|
-
end: z.ZodDefault<z.ZodObject<{
|
|
126
42
|
help: z.ZodOptional<z.ZodString>;
|
|
127
43
|
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
end: z.ZodObject<{
|
|
46
|
+
label: z.ZodDefault<z.ZodString>;
|
|
128
47
|
max: z.ZodOptional<z.ZodString>;
|
|
129
48
|
min: z.ZodOptional<z.ZodString>;
|
|
130
49
|
step: z.ZodDefault<z.ZodNumber>;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
},
|
|
50
|
+
help: z.ZodOptional<z.ZodString>;
|
|
51
|
+
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
attributes: z.ZodObject<{
|
|
55
|
+
label: z.ZodOptional<z.ZodString>;
|
|
56
|
+
help: z.ZodOptional<z.ZodString>;
|
|
57
|
+
labelTranslationKey: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
meta: z.ZodObject<{
|
|
60
|
+
schemaVersion: z.ZodDefault<z.ZodString>;
|
|
61
|
+
title: z.ZodOptional<z.ZodString>;
|
|
62
|
+
usageDescription: z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
export declare const DefaultDateRangeQuestion: {
|
|
66
|
+
type: "dateRange";
|
|
67
|
+
columns: {
|
|
68
|
+
start: {
|
|
134
69
|
label: string;
|
|
135
70
|
step: number;
|
|
136
|
-
help?: string | undefined;
|
|
137
|
-
labelTranslationKey?: string | undefined;
|
|
138
71
|
max?: string | undefined;
|
|
139
72
|
min?: string | undefined;
|
|
140
|
-
}, {
|
|
141
|
-
label?: string | undefined;
|
|
142
73
|
help?: string | undefined;
|
|
143
74
|
labelTranslationKey?: string | undefined;
|
|
144
|
-
max?: string | undefined;
|
|
145
|
-
min?: string | undefined;
|
|
146
|
-
step?: number | undefined;
|
|
147
|
-
}>>;
|
|
148
|
-
}, "strip", z.ZodTypeAny, {
|
|
149
|
-
start: {
|
|
150
|
-
label: string;
|
|
151
|
-
step: number;
|
|
152
|
-
help?: string | undefined;
|
|
153
|
-
labelTranslationKey?: string | undefined;
|
|
154
|
-
max?: string | undefined;
|
|
155
|
-
min?: string | undefined;
|
|
156
75
|
};
|
|
157
76
|
end: {
|
|
158
77
|
label: string;
|
|
159
78
|
step: number;
|
|
160
|
-
help?: string | undefined;
|
|
161
|
-
labelTranslationKey?: string | undefined;
|
|
162
79
|
max?: string | undefined;
|
|
163
80
|
min?: string | undefined;
|
|
164
|
-
};
|
|
165
|
-
}, {
|
|
166
|
-
start?: {
|
|
167
|
-
label?: string | undefined;
|
|
168
|
-
help?: string | undefined;
|
|
169
|
-
labelTranslationKey?: string | undefined;
|
|
170
|
-
max?: string | undefined;
|
|
171
|
-
min?: string | undefined;
|
|
172
|
-
step?: number | undefined;
|
|
173
|
-
} | undefined;
|
|
174
|
-
end?: {
|
|
175
|
-
label?: string | undefined;
|
|
176
81
|
help?: string | undefined;
|
|
177
82
|
labelTranslationKey?: string | undefined;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
step?: number | undefined;
|
|
181
|
-
} | undefined;
|
|
182
|
-
}>>;
|
|
183
|
-
}, "strip", z.ZodTypeAny, {
|
|
184
|
-
type: "dateRange";
|
|
83
|
+
};
|
|
84
|
+
};
|
|
185
85
|
attributes: {
|
|
186
86
|
label?: string | undefined;
|
|
187
87
|
help?: string | undefined;
|
|
@@ -192,54 +92,8 @@ export declare const DateRangeQuestionSchema: z.ZodObject<{
|
|
|
192
92
|
title?: string | undefined;
|
|
193
93
|
usageDescription?: string | undefined;
|
|
194
94
|
};
|
|
195
|
-
|
|
196
|
-
start: {
|
|
197
|
-
label: string;
|
|
198
|
-
step: number;
|
|
199
|
-
help?: string | undefined;
|
|
200
|
-
labelTranslationKey?: string | undefined;
|
|
201
|
-
max?: string | undefined;
|
|
202
|
-
min?: string | undefined;
|
|
203
|
-
};
|
|
204
|
-
end: {
|
|
205
|
-
label: string;
|
|
206
|
-
step: number;
|
|
207
|
-
help?: string | undefined;
|
|
208
|
-
labelTranslationKey?: string | undefined;
|
|
209
|
-
max?: string | undefined;
|
|
210
|
-
min?: string | undefined;
|
|
211
|
-
};
|
|
212
|
-
};
|
|
213
|
-
}, {
|
|
214
|
-
type: "dateRange";
|
|
215
|
-
attributes?: {
|
|
216
|
-
label?: string | undefined;
|
|
217
|
-
help?: string | undefined;
|
|
218
|
-
labelTranslationKey?: string | undefined;
|
|
219
|
-
} | undefined;
|
|
220
|
-
meta?: {
|
|
221
|
-
schemaVersion?: string | undefined;
|
|
222
|
-
title?: string | undefined;
|
|
223
|
-
usageDescription?: string | undefined;
|
|
224
|
-
} | undefined;
|
|
225
|
-
columns?: {
|
|
226
|
-
start?: {
|
|
227
|
-
label?: string | undefined;
|
|
228
|
-
help?: string | undefined;
|
|
229
|
-
labelTranslationKey?: string | undefined;
|
|
230
|
-
max?: string | undefined;
|
|
231
|
-
min?: string | undefined;
|
|
232
|
-
step?: number | undefined;
|
|
233
|
-
} | undefined;
|
|
234
|
-
end?: {
|
|
235
|
-
label?: string | undefined;
|
|
236
|
-
help?: string | undefined;
|
|
237
|
-
labelTranslationKey?: string | undefined;
|
|
238
|
-
max?: string | undefined;
|
|
239
|
-
min?: string | undefined;
|
|
240
|
-
step?: number | undefined;
|
|
241
|
-
} | undefined;
|
|
242
|
-
} | undefined;
|
|
243
|
-
}>;
|
|
95
|
+
};
|
|
244
96
|
export type DateQuestionType = z.infer<typeof DateQuestionSchema>;
|
|
245
97
|
export type DateRangeQuestionType = z.infer<typeof DateRangeQuestionSchema>;
|
|
98
|
+
export declare const DateQuestionJSONSchema: z.core.JSONSchema.JSONSchema;
|
|
99
|
+
export declare const DateRangeQuestionJSONSchema: z.core.JSONSchema.JSONSchema;
|
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DateRangeQuestionSchema = exports.DateQuestionSchema = void 0;
|
|
3
|
+
exports.DateRangeQuestionJSONSchema = exports.DateQuestionJSONSchema = exports.DefaultDateRangeQuestion = exports.DateRangeQuestionSchema = exports.DefaultDateQuestion = exports.DateQuestionSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const question_1 = require("./question");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
max: zod_1.z.string().optional(),
|
|
9
|
-
min: zod_1.z.string().optional(),
|
|
10
|
-
step: zod_1.z.number().default(1),
|
|
11
|
-
}));
|
|
6
|
+
const DateAttributesSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.BaseAttributesSchema.shape), { max: zod_1.z.string().optional(), min: zod_1.z.string().optional(), step: zod_1.z.number().default(1) }));
|
|
7
|
+
const DefaultDateAttributes = DateAttributesSchema.parse({});
|
|
12
8
|
// Date question and answer
|
|
13
|
-
exports.DateQuestionSchema = question_1.QuestionSchema.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
9
|
+
exports.DateQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('date'), attributes: DateAttributesSchema }));
|
|
10
|
+
exports.DefaultDateQuestion = exports.DateQuestionSchema.parse({
|
|
11
|
+
type: 'date',
|
|
12
|
+
attributes: DefaultDateAttributes,
|
|
13
|
+
meta: question_1.DefaultMeta
|
|
14
|
+
});
|
|
15
|
+
const DateRangeStartColumnSchema = zod_1.z.object(Object.assign(Object.assign({}, DateAttributesSchema.shape), { label: zod_1.z.string().default('From') }));
|
|
16
|
+
const DateRangeEndColumnSchema = zod_1.z.object(Object.assign(Object.assign({}, DateAttributesSchema.shape), { label: zod_1.z.string().default('To') }));
|
|
17
17
|
// Date range question and answer
|
|
18
|
-
exports.DateRangeQuestionSchema = question_1.QuestionSchema.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
18
|
+
exports.DateRangeQuestionSchema = zod_1.z.object(Object.assign(Object.assign({}, question_1.QuestionSchema.shape), { type: zod_1.z.literal('dateRange'), columns: zod_1.z.object({
|
|
19
|
+
start: DateRangeStartColumnSchema,
|
|
20
|
+
end: DateRangeEndColumnSchema,
|
|
21
|
+
}) }));
|
|
22
|
+
exports.DefaultDateRangeQuestion = exports.DateRangeQuestionSchema.parse({
|
|
23
|
+
type: 'dateRange',
|
|
24
|
+
attributes: question_1.BaseAttributesSchema.parse({}),
|
|
25
|
+
meta: question_1.DefaultMeta,
|
|
26
|
+
columns: {
|
|
27
|
+
start: DateRangeStartColumnSchema.parse({}),
|
|
28
|
+
end: DateRangeEndColumnSchema.parse({})
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
exports.DateQuestionJSONSchema = zod_1.z.toJSONSchema(exports.DateQuestionSchema);
|
|
32
|
+
exports.DateRangeQuestionJSONSchema = zod_1.z.toJSONSchema(exports.DateRangeQuestionSchema);
|