@thejob/schema 1.0.26 → 1.0.28
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/dist/cjs/common/common.schema.d.ts.map +1 -1
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +5 -0
- package/dist/cjs/interfaces.index.d.ts +103 -77
- package/dist/cjs/interfaces.index.d.ts.map +1 -1
- package/dist/cjs/job/job.schema.d.ts +23 -8
- package/dist/cjs/job/job.schema.d.ts.map +1 -1
- package/dist/cjs/job/job.schema.js +3 -1
- package/dist/cjs/job/utils.d.ts +3 -2
- package/dist/cjs/job/utils.d.ts.map +1 -1
- package/dist/cjs/job-application/job-application.schema.d.ts +19 -11
- package/dist/cjs/job-application/job-application.schema.d.ts.map +1 -1
- package/dist/cjs/job-application/job-application.schema.js +54 -52
- package/dist/cjs/job-role-template/job-role-template.schema.d.ts +23 -8
- package/dist/cjs/job-role-template/job-role-template.schema.d.ts.map +1 -1
- package/dist/cjs/page/page-location/page-location.schema.d.ts.map +1 -1
- package/dist/cjs/question/choice-question.schema.d.ts +44 -3
- package/dist/cjs/question/choice-question.schema.d.ts.map +1 -1
- package/dist/cjs/question/choice-question.schema.js +38 -11
- package/dist/cjs/question/input-question.schema.d.ts +26 -4
- package/dist/cjs/question/input-question.schema.d.ts.map +1 -1
- package/dist/cjs/question/input-question.schema.js +15 -2
- package/dist/cjs/question/question.schema.d.ts +2 -17
- package/dist/cjs/question/question.schema.d.ts.map +1 -1
- package/dist/cjs/question/question.schema.js +3 -11
- package/dist/esm/common/common.schema.d.ts.map +1 -1
- package/dist/esm/common/common.schema.js +1 -1
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +5 -0
- package/dist/esm/interfaces.index.d.ts +103 -77
- package/dist/esm/interfaces.index.d.ts.map +1 -1
- package/dist/esm/job/job.schema.d.ts +23 -8
- package/dist/esm/job/job.schema.d.ts.map +1 -1
- package/dist/esm/job/job.schema.js +3 -1
- package/dist/esm/job/utils.d.ts +3 -2
- package/dist/esm/job/utils.d.ts.map +1 -1
- package/dist/esm/job-application/job-application.schema.d.ts +19 -11
- package/dist/esm/job-application/job-application.schema.d.ts.map +1 -1
- package/dist/esm/job-application/job-application.schema.js +56 -54
- package/dist/esm/job-role-template/job-role-template.schema.d.ts +23 -8
- package/dist/esm/job-role-template/job-role-template.schema.d.ts.map +1 -1
- package/dist/esm/page/page-location/page-location.schema.d.ts.map +1 -1
- package/dist/esm/page/page-location/page-location.schema.js +1 -1
- package/dist/esm/question/choice-question.schema.d.ts +44 -3
- package/dist/esm/question/choice-question.schema.d.ts.map +1 -1
- package/dist/esm/question/choice-question.schema.js +41 -14
- package/dist/esm/question/input-question.schema.d.ts +26 -4
- package/dist/esm/question/input-question.schema.d.ts.map +1 -1
- package/dist/esm/question/input-question.schema.js +15 -2
- package/dist/esm/question/question.schema.d.ts +2 -17
- package/dist/esm/question/question.schema.d.ts.map +1 -1
- package/dist/esm/question/question.schema.js +5 -13
- package/package.json +1 -1
|
@@ -5,7 +5,6 @@ const common_1 = require("../common");
|
|
|
5
5
|
const utils_1 = require("../job/utils");
|
|
6
6
|
const location_1 = require("../location");
|
|
7
7
|
const phone_1 = require("../phone");
|
|
8
|
-
const question_1 = require("../question");
|
|
9
8
|
const resume_1 = require("../resume");
|
|
10
9
|
const user_1 = require("../user");
|
|
11
10
|
const yup_extended_1 = require("../yup-extended");
|
|
@@ -41,57 +40,60 @@ exports.JobApplicationSchema = (0, yup_extended_1.object)()
|
|
|
41
40
|
.default(job_application_constant_1.JobApplicationStatus.Open)
|
|
42
41
|
.label("Status"),
|
|
43
42
|
questionnaire: (0, yup_extended_1.array)().of((0, yup_extended_1.lazy)((question) => {
|
|
44
|
-
const StringSchema =
|
|
45
|
-
return (0, utils_1.getSchemaByQuestion)(question.type)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
})
|
|
43
|
+
// const StringSchema = string().max(500);
|
|
44
|
+
return (0, utils_1.getSchemaByQuestion)(question.type);
|
|
45
|
+
// .concat(
|
|
46
|
+
// object().shape({
|
|
47
|
+
// answers: mixed<
|
|
48
|
+
// string | TNameIdLogoSchema | TOtherValueSchema
|
|
49
|
+
// >().when("type", {
|
|
50
|
+
// is: (type: QuestionType) => type === QuestionType.Input,
|
|
51
|
+
// then: () =>
|
|
52
|
+
// lazy(() => {
|
|
53
|
+
// if (question.isOptional) {
|
|
54
|
+
// return StringSchema.optional().label("Answer");
|
|
55
|
+
// } else {
|
|
56
|
+
// return StringSchema.required().label("Answer");
|
|
57
|
+
// }
|
|
58
|
+
// }),
|
|
59
|
+
// otherwise: () =>
|
|
60
|
+
// lazy(() => {
|
|
61
|
+
// const commonSchema = mixed().oneOfSchema([
|
|
62
|
+
// StringSchema,
|
|
63
|
+
// NameIdLogoSchema,
|
|
64
|
+
// OtherValueSchema,
|
|
65
|
+
// ]);
|
|
66
|
+
// if (question.answerChoiceType === AnswerChoiceType.Multiple) {
|
|
67
|
+
// return lazy(() => {
|
|
68
|
+
// const subCommonSchema = array().of(commonSchema);
|
|
69
|
+
// if (question.isOptional) {
|
|
70
|
+
// return subCommonSchema
|
|
71
|
+
// .optional()
|
|
72
|
+
// .default([])
|
|
73
|
+
// .label("Answer");
|
|
74
|
+
// } else {
|
|
75
|
+
// return subCommonSchema
|
|
76
|
+
// .default([])
|
|
77
|
+
// .min(1, "Select at least 1 option")
|
|
78
|
+
// .required("Select at least 1 option")
|
|
79
|
+
// .label("Answer");
|
|
80
|
+
// }
|
|
81
|
+
// });
|
|
82
|
+
// } else {
|
|
83
|
+
// return lazy(() => {
|
|
84
|
+
// if (question.isOptional) {
|
|
85
|
+
// return commonSchema.optional().label("Answer");
|
|
86
|
+
// } else {
|
|
87
|
+
// return commonSchema
|
|
88
|
+
// .required("Select an option")
|
|
89
|
+
// .label("Answer");
|
|
90
|
+
// }
|
|
91
|
+
// });
|
|
92
|
+
// }
|
|
93
|
+
// }),
|
|
94
|
+
// }),
|
|
95
|
+
// })
|
|
96
|
+
// );
|
|
95
97
|
})),
|
|
96
98
|
history: (0, yup_extended_1.array)()
|
|
97
99
|
.of((0, yup_extended_1.object)().shape({
|
|
@@ -20,16 +20,32 @@ export declare const JobRoleTemplateSchema: import("yup").ObjectSchema<{
|
|
|
20
20
|
otherValue: string | string[];
|
|
21
21
|
} | undefined>;
|
|
22
22
|
tags: any[] | undefined;
|
|
23
|
-
questionnaire: {
|
|
24
|
-
description?: string | undefined;
|
|
23
|
+
questionnaire: ({
|
|
25
24
|
label?: string | undefined;
|
|
26
25
|
isNew?: boolean | undefined;
|
|
27
26
|
isOptional?: boolean | undefined;
|
|
28
27
|
readonly?: boolean | undefined;
|
|
29
|
-
preferredAnswer?:
|
|
28
|
+
preferredAnswer?: string | undefined;
|
|
29
|
+
answers?: string | undefined;
|
|
30
|
+
type: import("..").QuestionType.Input;
|
|
31
|
+
default: boolean;
|
|
32
|
+
title: string;
|
|
33
|
+
} | {
|
|
34
|
+
label?: string | undefined;
|
|
35
|
+
isNew?: boolean | undefined;
|
|
36
|
+
isOptional?: boolean | undefined;
|
|
37
|
+
readonly?: boolean | undefined;
|
|
38
|
+
preferredAnswer?: import("..").TMixedValue | import("..").TMixedValue[] | undefined;
|
|
39
|
+
answers?: import("..").TMixedValue | (string | number | boolean | {
|
|
40
|
+
logo?: string | undefined;
|
|
41
|
+
name: string;
|
|
42
|
+
id: string;
|
|
43
|
+
} | {
|
|
44
|
+
value: "others" | (string | undefined)[];
|
|
45
|
+
otherValue: string | string[];
|
|
46
|
+
} | undefined)[] | undefined;
|
|
30
47
|
optionsFrom?: string | undefined;
|
|
31
|
-
|
|
32
|
-
type: NonNullable<import("..").QuestionType | undefined>;
|
|
48
|
+
type: import("..").QuestionType.Choice;
|
|
33
49
|
default: boolean;
|
|
34
50
|
title: string;
|
|
35
51
|
options: (string | {
|
|
@@ -39,9 +55,8 @@ export declare const JobRoleTemplateSchema: import("yup").ObjectSchema<{
|
|
|
39
55
|
} | {
|
|
40
56
|
value: "others" | (string | undefined)[];
|
|
41
57
|
otherValue: string | string[];
|
|
42
|
-
})[];
|
|
43
|
-
|
|
44
|
-
}[] | undefined;
|
|
58
|
+
} | undefined)[];
|
|
59
|
+
} | {})[] | undefined;
|
|
45
60
|
}, import("yup").AnyObject, {
|
|
46
61
|
headline: undefined;
|
|
47
62
|
slug: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"job-role-template.schema.d.ts","sourceRoot":"","sources":["../../../src/job-role-template/job-role-template.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"job-role-template.schema.d.ts","sourceRoot":"","sources":["../../../src/job-role-template/job-role-template.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAQhC,CAAC;AAEH,MAAM,MAAM,sBAAsB,GAAG,SAAS,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-location.schema.d.ts","sourceRoot":"","sources":["../../../../src/page/page-location/page-location.schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"page-location.schema.d.ts","sourceRoot":"","sources":["../../../../src/page/page-location/page-location.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA2B,MAAM,oBAAoB,CAAC;AAExE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;MAgBD,CAAC;AAE/B,MAAM,MAAM,mBAAmB,GAAG,SAAS,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -1,5 +1,46 @@
|
|
|
1
|
-
import { InferType
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { InferType } from "../yup-extended";
|
|
2
|
+
import { QuestionType } from "./question.constant";
|
|
3
|
+
import { TMixedValue } from "./question.schema";
|
|
4
|
+
export declare const ChoiceQuestionSchema: import("yup").ObjectSchema<{
|
|
5
|
+
label: string | undefined;
|
|
6
|
+
default: boolean;
|
|
7
|
+
title: string;
|
|
8
|
+
type: QuestionType.Choice;
|
|
9
|
+
isOptional: boolean | undefined;
|
|
10
|
+
readonly: boolean | undefined;
|
|
11
|
+
isNew: boolean | undefined;
|
|
12
|
+
} & {
|
|
13
|
+
type: QuestionType.Choice;
|
|
14
|
+
optionsFrom: string | undefined;
|
|
15
|
+
options: (string | {
|
|
16
|
+
logo?: string | undefined;
|
|
17
|
+
name: string;
|
|
18
|
+
id: string;
|
|
19
|
+
} | {
|
|
20
|
+
value: "others" | (string | undefined)[];
|
|
21
|
+
otherValue: string | string[];
|
|
22
|
+
} | undefined)[];
|
|
23
|
+
preferredAnswer: TMixedValue | TMixedValue[] | undefined;
|
|
24
|
+
answers: TMixedValue | (string | number | boolean | {
|
|
25
|
+
logo?: string | undefined;
|
|
26
|
+
name: string;
|
|
27
|
+
id: string;
|
|
28
|
+
} | {
|
|
29
|
+
value: "others" | (string | undefined)[];
|
|
30
|
+
otherValue: string | string[];
|
|
31
|
+
} | undefined)[] | undefined;
|
|
32
|
+
}, import("yup").AnyObject, {
|
|
33
|
+
label: undefined;
|
|
34
|
+
default: false;
|
|
35
|
+
title: undefined;
|
|
36
|
+
type: undefined;
|
|
37
|
+
isOptional: undefined;
|
|
38
|
+
readonly: undefined;
|
|
39
|
+
isNew: undefined;
|
|
40
|
+
optionsFrom: undefined;
|
|
41
|
+
options: "";
|
|
42
|
+
preferredAnswer: undefined;
|
|
43
|
+
answers: undefined;
|
|
44
|
+
}, "">;
|
|
4
45
|
export type TChoiceQuestionSchema = InferType<typeof ChoiceQuestionSchema>;
|
|
5
46
|
//# sourceMappingURL=choice-question.schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"choice-question.schema.d.ts","sourceRoot":"","sources":["../../../src/question/choice-question.schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"choice-question.schema.d.ts","sourceRoot":"","sources":["../../../src/question/choice-question.schema.ts"],"names":[],"mappings":"AAOA,OAAO,EAAS,SAAS,EAA+B,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAoB,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAkB,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA4HhE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA4BhC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,SAAS,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -79,30 +79,57 @@ const ChoicePreferredAnswerSchema = (label = "Preferred answer") => (0, yup_exte
|
|
|
79
79
|
.optional()
|
|
80
80
|
.label(label),
|
|
81
81
|
});
|
|
82
|
-
|
|
82
|
+
const ChoiceAnswerSchema = (0, yup_extended_1.lazy)((question) => {
|
|
83
|
+
const commonSchema = (0, yup_extended_1.mixed)().oneOfSchema([
|
|
84
|
+
(0, yup_extended_1.string)().max(500),
|
|
85
|
+
common_1.NameIdLogoSchema,
|
|
86
|
+
common_1.OtherValueSchema,
|
|
87
|
+
]);
|
|
88
|
+
if (question.answerChoiceType === question_constant_1.AnswerChoiceType.Multiple) {
|
|
89
|
+
const multiAnswerSchema = (0, yup_extended_1.array)().of(commonSchema);
|
|
90
|
+
if (question.isOptional) {
|
|
91
|
+
return multiAnswerSchema.optional().default([]);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
return multiAnswerSchema
|
|
95
|
+
.min(1, "Select at least one option.")
|
|
96
|
+
.required("Select at least one option.")
|
|
97
|
+
.default([]);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
// Single choice
|
|
102
|
+
if (question.isOptional) {
|
|
103
|
+
return commonSchema.optional();
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
return commonSchema.required("Select an option.");
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
exports.ChoiceQuestionSchema = question_schema_1.QuestionSchema.concat((0, yup_extended_1.object)().shape({
|
|
83
111
|
type: (0, yup_extended_1.string)()
|
|
84
112
|
.oneOf([question_constant_1.QuestionType.Choice])
|
|
85
113
|
.required()
|
|
86
114
|
.label("Question type"),
|
|
87
|
-
optionsFrom: (0, yup_extended_1.
|
|
88
|
-
.oneOf([common_1.Common.Skill, common_1.Common.EducationLevel, common_1.Common.ExperienceLevel])
|
|
89
|
-
.optional()
|
|
90
|
-
.label("Option field"),
|
|
115
|
+
optionsFrom: (0, yup_extended_1.string)().optional().label("Options From"),
|
|
91
116
|
options: (0, yup_extended_1.array)()
|
|
92
117
|
.of((0, yup_extended_1.lazy)((option) => {
|
|
93
118
|
if (typeof option === "string") {
|
|
94
119
|
return (0, yup_extended_1.string)();
|
|
95
120
|
}
|
|
96
121
|
else {
|
|
97
|
-
return (0, yup_extended_1.mixed)().oneOfSchema([
|
|
122
|
+
return (0, yup_extended_1.mixed)().oneOfSchema([
|
|
123
|
+
common_1.NameIdLogoSchema,
|
|
124
|
+
common_1.OtherValueSchema,
|
|
125
|
+
]);
|
|
98
126
|
}
|
|
99
127
|
}))
|
|
100
128
|
.min(1)
|
|
101
129
|
.required()
|
|
102
130
|
.label("Options"),
|
|
103
|
-
|
|
104
|
-
.oneOf(question_constant_1.SupportedAnswerChoiceTypes)
|
|
105
|
-
.required()
|
|
106
|
-
.label("Type"),
|
|
131
|
+
// preferredAnswer uses the existing validation
|
|
107
132
|
preferredAnswer: ChoicePreferredAnswerSchema("Preferred answer"),
|
|
108
|
-
|
|
133
|
+
// The answers field now has its own complete validation logic
|
|
134
|
+
answers: ChoiceAnswerSchema,
|
|
135
|
+
}));
|
|
@@ -1,5 +1,27 @@
|
|
|
1
|
-
import { InferType
|
|
2
|
-
import {
|
|
3
|
-
export declare const InputQuestionSchema: ObjectSchema<
|
|
4
|
-
|
|
1
|
+
import { InferType } from "../yup-extended";
|
|
2
|
+
import { QuestionType } from "./question.constant";
|
|
3
|
+
export declare const InputQuestionSchema: import("yup").ObjectSchema<{
|
|
4
|
+
label: string | undefined;
|
|
5
|
+
default: boolean;
|
|
6
|
+
title: string;
|
|
7
|
+
type: QuestionType.Input;
|
|
8
|
+
isOptional: boolean | undefined;
|
|
9
|
+
readonly: boolean | undefined;
|
|
10
|
+
isNew: boolean | undefined;
|
|
11
|
+
} & {
|
|
12
|
+
type: QuestionType.Input;
|
|
13
|
+
preferredAnswer: string | undefined;
|
|
14
|
+
answers: string | undefined;
|
|
15
|
+
}, import("yup").AnyObject, {
|
|
16
|
+
label: undefined;
|
|
17
|
+
default: false;
|
|
18
|
+
title: undefined;
|
|
19
|
+
type: undefined;
|
|
20
|
+
isOptional: undefined;
|
|
21
|
+
readonly: undefined;
|
|
22
|
+
isNew: undefined;
|
|
23
|
+
preferredAnswer: undefined;
|
|
24
|
+
answers: undefined;
|
|
25
|
+
}, "">;
|
|
26
|
+
export type TInputQuestionSchema = InferType<typeof InputQuestionSchema>;
|
|
5
27
|
//# sourceMappingURL=input-question.schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-question.schema.d.ts","sourceRoot":"","sources":["../../../src/question/input-question.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"input-question.schema.d.ts","sourceRoot":"","sources":["../../../src/question/input-question.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;MAgB/B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,SAAS,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -2,7 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InputQuestionSchema = void 0;
|
|
4
4
|
const yup_extended_1 = require("../yup-extended");
|
|
5
|
+
const question_constant_1 = require("./question.constant");
|
|
5
6
|
const question_schema_1 = require("./question.schema");
|
|
6
|
-
exports.InputQuestionSchema =
|
|
7
|
+
exports.InputQuestionSchema = question_schema_1.QuestionSchema.concat((0, yup_extended_1.object)().shape({
|
|
8
|
+
type: (0, yup_extended_1.string)()
|
|
9
|
+
.oneOf([question_constant_1.QuestionType.Input])
|
|
10
|
+
.required()
|
|
11
|
+
.label("Question type"),
|
|
7
12
|
preferredAnswer: (0, yup_extended_1.string)().max(100).optional().label("Preferred Answer"),
|
|
8
|
-
|
|
13
|
+
answers: (0, yup_extended_1.string)()
|
|
14
|
+
.max(500)
|
|
15
|
+
.when("isOptional", {
|
|
16
|
+
is: false,
|
|
17
|
+
then: (schema) => schema.required("This field is required."),
|
|
18
|
+
otherwise: (schema) => schema.optional(),
|
|
19
|
+
})
|
|
20
|
+
.label("Answer"),
|
|
21
|
+
}));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { TNameIdLogoSchema, TOtherValueSchema } from "../common";
|
|
2
2
|
import { InferType } from "../yup-extended";
|
|
3
|
-
|
|
4
|
-
export type TMixedValue = string | boolean | number | TNameIdLogoSchema | TOtherValueSchema | Array<string | boolean | number | TNameIdLogoSchema | TOtherValueSchema>;
|
|
3
|
+
export type TMixedValue = string | boolean | number | TNameIdLogoSchema | TOtherValueSchema;
|
|
5
4
|
export declare const QuestionSchema: import("yup").ObjectSchema<{
|
|
6
5
|
label: string | undefined;
|
|
7
6
|
default: boolean;
|
|
@@ -9,12 +8,6 @@ export declare const QuestionSchema: import("yup").ObjectSchema<{
|
|
|
9
8
|
type: NonNullable<import("./question.constant").QuestionType | undefined>;
|
|
10
9
|
isOptional: boolean | undefined;
|
|
11
10
|
readonly: boolean | undefined;
|
|
12
|
-
preferredAnswer: TMixedValue | undefined;
|
|
13
|
-
optionsFrom: string | undefined;
|
|
14
|
-
options: ({} | undefined)[] | undefined;
|
|
15
|
-
description: string | undefined;
|
|
16
|
-
answers: TMixedValue | undefined;
|
|
17
|
-
answerChoiceType: NonNullable<AnswerChoiceType | undefined>;
|
|
18
11
|
isNew: boolean | undefined;
|
|
19
12
|
}, import("yup").AnyObject, {
|
|
20
13
|
label: undefined;
|
|
@@ -23,15 +16,7 @@ export declare const QuestionSchema: import("yup").ObjectSchema<{
|
|
|
23
16
|
type: undefined;
|
|
24
17
|
isOptional: undefined;
|
|
25
18
|
readonly: undefined;
|
|
26
|
-
preferredAnswer: undefined;
|
|
27
|
-
optionsFrom: undefined;
|
|
28
|
-
options: "";
|
|
29
|
-
description: undefined;
|
|
30
|
-
answers: undefined;
|
|
31
|
-
answerChoiceType: AnswerChoiceType.Single;
|
|
32
19
|
isNew: undefined;
|
|
33
20
|
}, "">;
|
|
34
|
-
export type TQuestionSchema = Omit<InferType<typeof QuestionSchema>, "options"
|
|
35
|
-
options: Array<TNameIdLogoSchema | TOtherValueSchema | string>;
|
|
36
|
-
};
|
|
21
|
+
export type TQuestionSchema = Omit<InferType<typeof QuestionSchema>, "options">;
|
|
37
22
|
//# sourceMappingURL=question.schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"question.schema.d.ts","sourceRoot":"","sources":["../../../src/question/question.schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"question.schema.d.ts","sourceRoot":"","sources":["../../../src/question/question.schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAW,SAAS,EAAkB,MAAM,iBAAiB,CAAC;AAGrE,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,OAAO,GACP,MAAM,GACN,iBAAiB,GACjB,iBAAiB,CAAC;AAEtB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;MAQzB,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,cAAc,CAAC,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -10,16 +10,8 @@ exports.QuestionSchema = (0, yup_extended_1.object)().shape({
|
|
|
10
10
|
type: (0, yup_extended_1.string)().oneOf(question_constant_1.SupportedQuestionTypes).required().label("Type"),
|
|
11
11
|
isOptional: (0, yup_extended_1.boolean)().optional().label("Mark if the question is optional"),
|
|
12
12
|
readonly: (0, yup_extended_1.boolean)().optional().label("Readonly"),
|
|
13
|
-
preferredAnswer: (0, yup_extended_1.mixed)().optional().label("Preferred Answer"),
|
|
14
|
-
optionsFrom: (0, yup_extended_1.string)().optional().label("Options From"),
|
|
15
|
-
options: (0, yup_extended_1.array)().of((0, yup_extended_1.mixed)()).optional().label("Options"),
|
|
16
|
-
description: (0, yup_extended_1.string)().optional().label("Content"),
|
|
17
|
-
answers: (0, yup_extended_1.mixed)().optional().label("Answer"),
|
|
18
|
-
answerChoiceType: (0, yup_extended_1.string)()
|
|
19
|
-
.oneOf(question_constant_1.SupportedAnswerChoiceTypes)
|
|
20
|
-
.required()
|
|
21
|
-
.default(question_constant_1.AnswerChoiceType.Single)
|
|
22
|
-
.label("Answer Choice Type"),
|
|
23
13
|
isNew: (0, yup_extended_1.boolean)().optional().label("Is New"),
|
|
24
14
|
});
|
|
25
|
-
//
|
|
15
|
+
// Note: The TMixedValue and TQuestionSchema types might need adjustments
|
|
16
|
+
// depending on how you use them downstream, but this is the logical
|
|
17
|
+
// change for the schema itself.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.schema.d.ts","sourceRoot":"","sources":["../../../src/common/common.schema.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"common.schema.d.ts","sourceRoot":"","sources":["../../../src/common/common.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,SAAS,EAKV,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,gBAAgB;;;;;;;;MAOlB,CAAC;AACZ,MAAM,MAAM,iBAAiB,GAAG,SAAS,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEnE,eAAO,MAAM,gBAAgB;;;;;;MAwBlB,CAAC;AACZ,MAAM,MAAM,iBAAiB,GAAG,SAAS,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEnE,eAAO,MAAM,uBAAuB;;;;MAIlC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,SAAS,CAC9C,OAAO,uBAAuB,CAC/B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;;MAYjB,CAAC;AAEZ,MAAM,MAAM,gBAAgB,GAAG,SAAS,CAAC,OAAO,eAAe,CAAC,CAAC;AAEjE,eAAO,MAAM,uBAAuB,GAAI,WAAU,MAAW;;;;;;;;MAKzD,CAAC;AAEL,MAAM,MAAM,wBAAwB,GAAG,SAAS,CAC9C,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAC3C,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;MAGnC,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,SAAS,CAC/C,OAAO,wBAAwB,CAChC,CAAC"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -23,4 +23,9 @@ export * from "./group";
|
|
|
23
23
|
export * from "./social-account";
|
|
24
24
|
export * from "./yup-extended";
|
|
25
25
|
export * from './interfaces.index';
|
|
26
|
+
export * from './interfaces.index';
|
|
27
|
+
export * from './interfaces.index';
|
|
28
|
+
export * from './interfaces.index';
|
|
29
|
+
export * from './interfaces.index';
|
|
30
|
+
export * from './interfaces.index';
|
|
26
31
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,MAAM,CAAC;AACrB,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -23,3 +23,8 @@ export * from "./group";
|
|
|
23
23
|
export * from "./social-account";
|
|
24
24
|
export * from "./yup-extended";
|
|
25
25
|
export * from './interfaces.index';
|
|
26
|
+
export * from './interfaces.index';
|
|
27
|
+
export * from './interfaces.index';
|
|
28
|
+
export * from './interfaces.index';
|
|
29
|
+
export * from './interfaces.index';
|
|
30
|
+
export * from './interfaces.index';
|