@thejob/schema 1.0.33 → 1.0.35

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NewResumePromptSchema = exports.ResumeSchema = exports.ResumeSectionSchema = void 0;
3
+ exports.NewResumePromptSchema = exports.ResumeSchema = exports.ResumeSchemaV2 = void 0;
4
4
  const common_1 = require("../common");
5
5
  const user_1 = require("../user");
6
6
  const yup_extended_1 = require("../yup-extended");
@@ -10,194 +10,146 @@ const resume_constant_1 = require("./resume.constant");
10
10
  * ResumeGeneralInfoSchema is a schema for the General Information section of a resume.
11
11
  */
12
12
  }
13
- const ResumeGeneralInfoSchema = (0, yup_extended_1.object)({
14
- name: (0, yup_extended_1.object)({
15
- first: (0, yup_extended_1.string)().required().label("First Name"),
16
- last: (0, yup_extended_1.string)().required().label("Last Name"),
17
- }),
18
- headline: (0, yup_extended_1.string)().max(100).optional().label("Headline"),
19
- email: (0, yup_extended_1.string)().email().required().label("Email"),
20
- mobile: (0, yup_extended_1.string)().required().label("Mobile"),
21
- location: (0, yup_extended_1.string)().optional().label("Location"),
22
- });
13
+ const ResumeGeneralInfoSectionSchema = user_1.UserGeneralDetailSchema;
23
14
  {
24
15
  /**
25
- * ResumeSummarySchema is a schema for the Summary section of a resume.
16
+ * ResumeWorkExperienceSectionSchema is a schema for the Work Experience section of a resume.
26
17
  */
27
18
  }
28
- const ResumeSummarySchema = (0, yup_extended_1.string)().required().label("Summary");
29
- // export type TResumeSummarySchema = InferType<typeof ResumeSummarySchema>;
19
+ const ResumeWorkExperienceSectionSchema = (0, yup_extended_1.reach)(user_1.UserSchema, "workExperiences");
30
20
  {
31
21
  /**
32
- * ResumeWorkExperienceSchema is a schema for the Work Experience section of a resume.
22
+ * ResumeEducationSectionSchema is a schema for the Education section of a resume.
33
23
  */
34
24
  }
35
- const ResumeWorkExperienceSchema = (0, yup_extended_1.object)()
36
- .shape({
37
- designation: (0, yup_extended_1.string)().required().label("Designation"),
38
- company: (0, yup_extended_1.string)().required().label("Company"),
39
- startDate: (0, yup_extended_1.string)().required().label("Start Date"),
40
- endDate: (0, yup_extended_1.string)().optional().label("End Date"),
41
- isCurrentJob: (0, yup_extended_1.boolean)().default(false).label("Is Current"),
42
- description: (0, yup_extended_1.string)().optional().label("Description"),
43
- location: (0, yup_extended_1.string)().optional().label("Location"),
44
- isRemote: (0, yup_extended_1.boolean)().default(false).label("Is Remote"),
45
- })
46
- .label("Work Experience");
47
- {
48
- /**
49
- * ResumeEducationSchema is a schema for the Education section of a resume.
50
- */
51
- }
52
- const ResumeEducationSchema = (0, yup_extended_1.object)()
53
- .shape({
54
- institute: (0, yup_extended_1.string)().required().label("Institute"),
55
- course: (0, yup_extended_1.string)().required().label("Course"),
56
- fieldOfStudy: (0, yup_extended_1.string)().optional().label("Field of Study"),
57
- startDate: (0, yup_extended_1.string)().required().label("Start Date"),
58
- endDate: (0, yup_extended_1.string)().optional().label("End Date"),
59
- location: (0, yup_extended_1.string)().optional().label("Location"),
60
- isPursuing: (0, yup_extended_1.boolean)().default(false).label("Is Pursuing"),
61
- isDistanceLearning: (0, yup_extended_1.boolean)().default(false).label("Is Distance Learning"),
62
- description: (0, yup_extended_1.string)().optional().label("Description"),
63
- })
64
- .label("Education");
25
+ const ResumeEducationSectionSchema = (0, yup_extended_1.reach)(user_1.UserSchema, "educations");
65
26
  {
66
27
  /**
67
- * ResumeSkillSchema is a schema for the Skill section of a resume.
28
+ * ResumeSkillSectionSchema is a schema for the Skill section of a resume.
68
29
  */
69
30
  }
70
- const ResumeSkillSchema = (0, yup_extended_1.object)()
71
- .shape({
72
- name: (0, yup_extended_1.string)().required().label("Name"),
73
- // TODO: Rename proficiencyLevel to proficiency
74
- proficiencyLevel: (0, yup_extended_1.string)().optional().label("Proficiency Level"),
75
- lastUsed: (0, yup_extended_1.string)().optional().label("Last Used"),
76
- })
77
- .label("Skill");
31
+ const ResumeSkillSectionSchema = ((0, yup_extended_1.reach)(user_1.UserSchema, "skills"));
78
32
  {
79
33
  /**
80
- * ResumeProjectSchema is a schema for the Project section of a resume.
34
+ * ResumeProjectSectionSchema is a schema for the Project section of a resume.
81
35
  */
82
36
  }
83
- const ResumeProjectSchema = (0, yup_extended_1.object)()
84
- .shape({
85
- name: (0, yup_extended_1.string)().required().label("Name"),
86
- description: (0, yup_extended_1.string)().required().label("Description"),
87
- startDate: (0, yup_extended_1.string)().required().label("Start Date"),
88
- endDate: (0, yup_extended_1.string)().optional().label("End Date"),
89
- isOngoing: (0, yup_extended_1.boolean)().default(false).label("Is Ongoing"),
90
- link: (0, yup_extended_1.string)().optional().label("Link"),
91
- })
92
- .label("Project");
37
+ const ResumeProjectSectionSchema = (0, yup_extended_1.reach)(user_1.UserSchema, "projects");
93
38
  {
94
39
  /**
95
- * ResumeCertificationSchema is a schema for the Certification section of a resume.
40
+ * ResumeCertificationSectionSchema is a schema for the Certification section of a resume.
96
41
  */
97
42
  }
98
- const ResumeCertificationSchema = (0, yup_extended_1.object)()
99
- .shape({
100
- name: (0, yup_extended_1.string)().required().label("Name"),
101
- description: (0, yup_extended_1.string)().optional().label("Description"),
102
- authority: (0, yup_extended_1.string)().required().label("Authority"),
103
- startDate: (0, yup_extended_1.string)().required().label("Start Date"),
104
- endDate: (0, yup_extended_1.string)().optional().label("End Date"),
105
- isOngoing: (0, yup_extended_1.boolean)().default(false).label("Is Ongoing"),
106
- })
107
- .label("Certification");
43
+ const ResumeCertificationSectionSchema = (0, yup_extended_1.reach)(user_1.UserSchema, "certifications");
108
44
  {
109
45
  /**
110
- * ResumeInterestSchema is a schema for the Interest section of a resume.
46
+ * ResumeInterestSectionSchema is a schema for the Interest section of a resume.
111
47
  */
112
48
  }
113
- const ResumeInterestSchema = (0, yup_extended_1.object)()
114
- .shape({
115
- name: (0, yup_extended_1.string)().required().label("Name"),
116
- category: (0, yup_extended_1.string)().optional().label("Category"),
117
- description: (0, yup_extended_1.string)().optional().label("Description"),
118
- })
119
- .label("Interest");
49
+ const ResumeInterestSectionSchema = (0, yup_extended_1.reach)(user_1.UserSchema, "interests");
120
50
  {
121
51
  /**
122
- * ResumeLanguageSchema is a schema for the Language section of a resume.
52
+ * ResumeLanguageSectionSchema is a schema for the Language section of a resume.
123
53
  */
124
54
  }
125
- const ResumeLanguageSchema = (0, yup_extended_1.object)()
126
- .shape({
127
- name: (0, yup_extended_1.string)().required().label("Name"),
128
- proficiency: (0, yup_extended_1.string)().required().label("Proficiency"),
129
- description: (0, yup_extended_1.string)().optional().label("Description"),
130
- })
131
- .label("Language");
55
+ const ResumeLanguageSectionSchema = (0, yup_extended_1.reach)(user_1.UserSchema, "languages");
132
56
  {
133
57
  /**
134
- * ResumeAdditionalInfoSchema is a schema for the Additional Information section of a resume.
58
+ * Note: Not supported yet.
59
+ * ResumeAdditionalInfoSectionSchema is a schema for the Additional Information section of a resume.
135
60
  */
136
61
  }
137
- const ResumeAdditionalInfoSchema = (0, yup_extended_1.object)()
138
- .shape({
139
- title: (0, yup_extended_1.string)().required().label("Title"),
140
- description: (0, yup_extended_1.string)().required().label("Description"),
141
- })
142
- .label("Additional Info");
62
+ // const ResumeAdditionalInfoSectionSchema = <
63
+ // ArraySchema<TUserSchema["additionalInfo"], object>
64
+ // >reach(UserSchema, "additionalInfo");
65
+ // export type TResumeAdditionalInfoSectionSchema = InferType<
66
+ // typeof ResumeAdditionalInfoSectionSchema
67
+ // >;
143
68
  {
144
69
  /**
70
+ * Note: Not supported yet.
145
71
  * ResumeReferenceSectionSchema is a schema for a section of a resume.
146
72
  */
147
73
  }
148
- const ResumeReferenceSectionSchema = (0, yup_extended_1.object)()
149
- .shape({
150
- name: (0, yup_extended_1.string)().required().label("Name"),
151
- designation: (0, yup_extended_1.string)().required().label("Designation"),
152
- company: (0, yup_extended_1.string)().required().label("Company"),
153
- email: (0, yup_extended_1.string)().email().required().label("Email"),
154
- mobile: (0, yup_extended_1.string)().required().label("Mobile"),
155
- profileUrl: (0, yup_extended_1.string)().url().optional().label("Profile URL"),
156
- workedDirectly: (0, yup_extended_1.boolean)().default(false).label("Worked Directly"),
157
- })
158
- .label("Reference Section");
74
+ // const ResumeReferenceSectionSchema = object()
75
+ // .shape({
76
+ // name: string().required().label("Name"),
77
+ // designation: string().required().label("Designation"),
78
+ // company: string().required().label("Company"),
79
+ // email: string().email().required().label("Email"),
80
+ // mobile: string().required().label("Mobile"),
81
+ // profileUrl: string().url().optional().label("Profile URL"),
82
+ // workedDirectly: boolean().default(false).label("Worked Directly"),
83
+ // })
84
+ // .label("Reference Section");
85
+ // export type TResumeReferenceSectionSchema = InferType<
86
+ // typeof ResumeReferenceSectionSchema
87
+ // >;
159
88
  {
160
89
  /**
161
- * ResumeSectionSchema is a lazy schema that dynamically loads the appropriate schema based on the section type.
90
+ * ResumeSchemaV2 is a lazy schema that dynamically loads the appropriate schema based on the section type.
162
91
  */
163
92
  }
164
- exports.ResumeSectionSchema = (0, yup_extended_1.lazy)((section) => {
93
+ exports.ResumeSchemaV2 = (0, yup_extended_1.array)()
94
+ .of((0, yup_extended_1.lazy)((section) => {
165
95
  const { id } = section;
166
96
  return (0, yup_extended_1.object)({
167
- id: (0, yup_extended_1.string)().oneOf(resume_constant_1.SupportedResumeSectionTypes).required().label("Section"),
168
- data: (0, yup_extended_1.array)()
169
- .of((0, yup_extended_1.lazy)(() => {
97
+ id: (0, yup_extended_1.string)()
98
+ .oneOf(resume_constant_1.SupportedResumeSectionTypes)
99
+ .required()
100
+ .label("Section"),
101
+ data: (0, yup_extended_1.lazy)(() => {
170
102
  switch (id) {
171
103
  case resume_constant_1.ResumeSectionType.GeneralInfo:
172
- return ResumeGeneralInfoSchema;
173
- case resume_constant_1.ResumeSectionType.Summary:
174
- return ResumeSummarySchema;
104
+ // GeneralInfo schema is a single object schema, use it directly with null default
105
+ return ResumeGeneralInfoSectionSchema.nullable().default(null);
175
106
  case resume_constant_1.ResumeSectionType.WorkExperience:
176
- return ResumeWorkExperienceSchema;
107
+ // WorkExperience schema is already an array schema, use it directly with empty array default
108
+ return ResumeWorkExperienceSectionSchema.default([]);
177
109
  case resume_constant_1.ResumeSectionType.Education:
178
- return ResumeEducationSchema;
110
+ // Education schema is already an array schema, use it directly with empty array default
111
+ return ResumeEducationSectionSchema.default([]);
179
112
  case resume_constant_1.ResumeSectionType.Skill:
180
- return ResumeSkillSchema;
113
+ // Skill schema is already an array schema, use it directly with empty array default
114
+ return ResumeSkillSectionSchema.default([]);
181
115
  case resume_constant_1.ResumeSectionType.Project:
182
- return ResumeProjectSchema;
116
+ // Project schema is already an array schema, use it directly with empty array default
117
+ return ResumeProjectSectionSchema.default([]);
183
118
  case resume_constant_1.ResumeSectionType.Certification:
184
- return ResumeCertificationSchema;
119
+ // Certification schema is already an array schema, use it directly with empty array default
120
+ return ResumeCertificationSectionSchema.default([]);
185
121
  case resume_constant_1.ResumeSectionType.Interest:
186
- return ResumeInterestSchema;
122
+ // Interest schema is already an array schema, use it directly with empty array default
123
+ return ResumeInterestSectionSchema.default([]);
187
124
  case resume_constant_1.ResumeSectionType.Language:
188
- return ResumeLanguageSchema;
189
- case resume_constant_1.ResumeSectionType.AdditionalInfo:
190
- return ResumeAdditionalInfoSchema;
191
- case resume_constant_1.ResumeSectionType.Reference:
192
- return ResumeReferenceSectionSchema;
125
+ // Language schema is already an array schema, use it directly with empty array default
126
+ return ResumeLanguageSectionSchema.default([]);
127
+ // case ResumeSectionType.AdditionalInfo:
128
+ // // AdditionalInfo schema is already an array schema, use it directly with empty array default
129
+ // return ResumeAdditionalInfoSectionSchema.default([]);
130
+ // case ResumeSectionType.Reference:
131
+ // return array().of(ResumeReferenceSectionSchema).required().label("Data");
193
132
  default:
194
133
  throw new yup_extended_1.ValidationError(`Invalid Section Type: ${id}`);
195
134
  }
196
- }))
197
- .required()
198
- .label("Data"),
135
+ }),
199
136
  });
200
- });
137
+ }))
138
+ .required()
139
+ .default([])
140
+ .label("Resume Schema V2");
141
+ // export type TResumeSectionMap = {
142
+ // [ResumeSectionType.GeneralInfo]: TResumeGeneralInfoSectionSchema;
143
+ // [ResumeSectionType.WorkExperience]: TResumeWorkExperienceSectionSchema;
144
+ // [ResumeSectionType.Education]: TResumeEducationSectionSchema;
145
+ // [ResumeSectionType.Skill]: TResumeSkillSectionSchema;
146
+ // [ResumeSectionType.Project]: TResumeProjectSectionSchema;
147
+ // [ResumeSectionType.Certification]: TResumeCertificationSectionSchema;
148
+ // [ResumeSectionType.Interest]: TResumeInterestSectionSchema;
149
+ // [ResumeSectionType.Language]: TResumeLanguageSectionSchema;
150
+ // // [ResumeSectionType.AdditionalInfo]: TResumeAdditionalInfoSectionSchema;
151
+ // // [ResumeSectionType.Reference]: TResumeReferenceSectionSchema;
152
+ // };
201
153
  {
202
154
  /**
203
155
  * ResumeSchema is a schema for a resume.