@thejob/schema 1.0.32 → 1.0.34

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.
Files changed (38) hide show
  1. package/dist/cjs/ai/ai.types.d.ts +138 -142
  2. package/dist/cjs/ai/ai.types.d.ts.map +1 -1
  3. package/dist/cjs/interfaces.index.d.ts +947 -494
  4. package/dist/cjs/interfaces.index.d.ts.map +1 -1
  5. package/dist/cjs/job/utils.d.ts +3 -4
  6. package/dist/cjs/job/utils.d.ts.map +1 -1
  7. package/dist/cjs/job-application/job-application.schema.d.ts +4 -5
  8. package/dist/cjs/job-application/job-application.schema.d.ts.map +1 -1
  9. package/dist/cjs/question/choice-question.schema.js +1 -1
  10. package/dist/cjs/question/input-question.schema.d.ts +2 -2
  11. package/dist/cjs/question/input-question.schema.d.ts.map +1 -1
  12. package/dist/cjs/question/input-question.schema.js +1 -1
  13. package/dist/cjs/resume/resume.constant.d.ts +0 -1
  14. package/dist/cjs/resume/resume.constant.d.ts.map +1 -1
  15. package/dist/cjs/resume/resume.constant.js +0 -1
  16. package/dist/cjs/resume/resume.schema.d.ts +318 -204
  17. package/dist/cjs/resume/resume.schema.d.ts.map +1 -1
  18. package/dist/cjs/resume/resume.schema.js +71 -133
  19. package/dist/esm/ai/ai.types.d.ts +138 -142
  20. package/dist/esm/ai/ai.types.d.ts.map +1 -1
  21. package/dist/esm/interfaces.index.d.ts +947 -494
  22. package/dist/esm/interfaces.index.d.ts.map +1 -1
  23. package/dist/esm/job/utils.d.ts +3 -4
  24. package/dist/esm/job/utils.d.ts.map +1 -1
  25. package/dist/esm/job-application/job-application.schema.d.ts +4 -5
  26. package/dist/esm/job-application/job-application.schema.d.ts.map +1 -1
  27. package/dist/esm/job-application/job-application.schema.js +1 -1
  28. package/dist/esm/question/choice-question.schema.js +1 -1
  29. package/dist/esm/question/input-question.schema.d.ts +2 -2
  30. package/dist/esm/question/input-question.schema.d.ts.map +1 -1
  31. package/dist/esm/question/input-question.schema.js +1 -1
  32. package/dist/esm/resume/resume.constant.d.ts +0 -1
  33. package/dist/esm/resume/resume.constant.d.ts.map +1 -1
  34. package/dist/esm/resume/resume.constant.js +0 -1
  35. package/dist/esm/resume/resume.schema.d.ts +318 -204
  36. package/dist/esm/resume/resume.schema.d.ts.map +1 -1
  37. package/dist/esm/resume/resume.schema.js +72 -134
  38. package/package.json +10 -3
@@ -1,200 +1,138 @@
1
1
  import { DbDefaultSchema } from "../common";
2
- import { UserSchema } from "../user";
3
- import { array, boolean, lazy, object, string, ValidationError, } from "../yup-extended";
2
+ import { UserGeneralDetailSchema, UserSchema } from "../user";
3
+ import { array, boolean, lazy, object, reach, string, ValidationError, } from "../yup-extended";
4
4
  import { ResumeMarkdownStyle, ResumeSectionType, ResumeStatus, SupportedResumeMarkdownStyles, SupportedResumeSectionTypes, SupportedResumeStatuses, } from "./resume.constant";
5
5
  {
6
6
  /**
7
7
  * ResumeGeneralInfoSchema is a schema for the General Information section of a resume.
8
8
  */
9
9
  }
10
- const ResumeGeneralInfoSchema = object({
11
- name: object({
12
- first: string().required().label("First Name"),
13
- last: string().required().label("Last Name"),
14
- }),
15
- headline: string().max(100).optional().label("Headline"),
16
- email: string().email().required().label("Email"),
17
- mobile: string().required().label("Mobile"),
18
- location: string().optional().label("Location"),
19
- });
10
+ const ResumeGeneralInfoSectionSchema = UserGeneralDetailSchema;
20
11
  {
21
12
  /**
22
- * ResumeSummarySchema is a schema for the Summary section of a resume.
13
+ * ResumeWorkExperienceSectionSchema is a schema for the Work Experience section of a resume.
23
14
  */
24
15
  }
25
- const ResumeSummarySchema = string().required().label("Summary");
26
- // export type TResumeSummarySchema = InferType<typeof ResumeSummarySchema>;
16
+ const ResumeWorkExperienceSectionSchema = reach(UserSchema, "workExperiences");
27
17
  {
28
18
  /**
29
- * ResumeWorkExperienceSchema is a schema for the Work Experience section of a resume.
19
+ * ResumeEducationSectionSchema is a schema for the Education section of a resume.
30
20
  */
31
21
  }
32
- const ResumeWorkExperienceSchema = object()
33
- .shape({
34
- designation: string().required().label("Designation"),
35
- company: string().required().label("Company"),
36
- startDate: string().required().label("Start Date"),
37
- endDate: string().optional().label("End Date"),
38
- isCurrentJob: boolean().default(false).label("Is Current"),
39
- description: string().optional().label("Description"),
40
- location: string().optional().label("Location"),
41
- isRemote: boolean().default(false).label("Is Remote"),
42
- })
43
- .label("Work Experience");
44
- {
45
- /**
46
- * ResumeEducationSchema is a schema for the Education section of a resume.
47
- */
48
- }
49
- const ResumeEducationSchema = object()
50
- .shape({
51
- institute: string().required().label("Institute"),
52
- course: string().required().label("Course"),
53
- fieldOfStudy: string().optional().label("Field of Study"),
54
- startDate: string().required().label("Start Date"),
55
- endDate: string().optional().label("End Date"),
56
- location: string().optional().label("Location"),
57
- isPursuing: boolean().default(false).label("Is Pursuing"),
58
- isDistanceLearning: boolean().default(false).label("Is Distance Learning"),
59
- description: string().optional().label("Description"),
60
- })
61
- .label("Education");
22
+ const ResumeEducationSectionSchema = reach(UserSchema, "educations");
62
23
  {
63
24
  /**
64
- * ResumeSkillSchema is a schema for the Skill section of a resume.
25
+ * ResumeSkillSectionSchema is a schema for the Skill section of a resume.
65
26
  */
66
27
  }
67
- const ResumeSkillSchema = object()
68
- .shape({
69
- name: string().required().label("Name"),
70
- // TODO: Rename proficiencyLevel to proficiency
71
- proficiencyLevel: string().optional().label("Proficiency Level"),
72
- lastUsed: string().optional().label("Last Used"),
73
- })
74
- .label("Skill");
28
+ const ResumeSkillSectionSchema = (reach(UserSchema, "skills"));
75
29
  {
76
30
  /**
77
- * ResumeProjectSchema is a schema for the Project section of a resume.
31
+ * ResumeProjectSectionSchema is a schema for the Project section of a resume.
78
32
  */
79
33
  }
80
- const ResumeProjectSchema = object()
81
- .shape({
82
- name: string().required().label("Name"),
83
- description: string().required().label("Description"),
84
- startDate: string().required().label("Start Date"),
85
- endDate: string().optional().label("End Date"),
86
- isOngoing: boolean().default(false).label("Is Ongoing"),
87
- link: string().optional().label("Link"),
88
- })
89
- .label("Project");
34
+ const ResumeProjectSectionSchema = reach(UserSchema, "projects");
90
35
  {
91
36
  /**
92
- * ResumeCertificationSchema is a schema for the Certification section of a resume.
37
+ * ResumeCertificationSectionSchema is a schema for the Certification section of a resume.
93
38
  */
94
39
  }
95
- const ResumeCertificationSchema = object()
96
- .shape({
97
- name: string().required().label("Name"),
98
- description: string().optional().label("Description"),
99
- authority: string().required().label("Authority"),
100
- startDate: string().required().label("Start Date"),
101
- endDate: string().optional().label("End Date"),
102
- isOngoing: boolean().default(false).label("Is Ongoing"),
103
- })
104
- .label("Certification");
40
+ const ResumeCertificationSectionSchema = reach(UserSchema, "certifications");
105
41
  {
106
42
  /**
107
- * ResumeInterestSchema is a schema for the Interest section of a resume.
43
+ * ResumeInterestSectionSchema is a schema for the Interest section of a resume.
108
44
  */
109
45
  }
110
- const ResumeInterestSchema = object()
111
- .shape({
112
- name: string().required().label("Name"),
113
- category: string().optional().label("Category"),
114
- description: string().optional().label("Description"),
115
- })
116
- .label("Interest");
46
+ const ResumeInterestSectionSchema = reach(UserSchema, "interests");
117
47
  {
118
48
  /**
119
- * ResumeLanguageSchema is a schema for the Language section of a resume.
49
+ * ResumeLanguageSectionSchema is a schema for the Language section of a resume.
120
50
  */
121
51
  }
122
- const ResumeLanguageSchema = object()
123
- .shape({
124
- name: string().required().label("Name"),
125
- proficiency: string().required().label("Proficiency"),
126
- description: string().optional().label("Description"),
127
- })
128
- .label("Language");
52
+ const ResumeLanguageSectionSchema = reach(UserSchema, "languages");
129
53
  {
130
54
  /**
131
- * ResumeAdditionalInfoSchema is a schema for the Additional Information section of a resume.
55
+ * Note: Not supported yet.
56
+ * ResumeAdditionalInfoSectionSchema is a schema for the Additional Information section of a resume.
132
57
  */
133
58
  }
134
- const ResumeAdditionalInfoSchema = object()
135
- .shape({
136
- title: string().required().label("Title"),
137
- description: string().required().label("Description"),
138
- })
139
- .label("Additional Info");
59
+ // const ResumeAdditionalInfoSectionSchema = <
60
+ // ArraySchema<TUserSchema["additionalInfo"], object>
61
+ // >reach(UserSchema, "additionalInfo");
62
+ // export type TResumeAdditionalInfoSectionSchema = InferType<
63
+ // typeof ResumeAdditionalInfoSectionSchema
64
+ // >;
140
65
  {
141
66
  /**
67
+ * Note: Not supported yet.
142
68
  * ResumeReferenceSectionSchema is a schema for a section of a resume.
143
69
  */
144
70
  }
145
- const ResumeReferenceSectionSchema = object()
146
- .shape({
147
- name: string().required().label("Name"),
148
- designation: string().required().label("Designation"),
149
- company: string().required().label("Company"),
150
- email: string().email().required().label("Email"),
151
- mobile: string().required().label("Mobile"),
152
- profileUrl: string().url().optional().label("Profile URL"),
153
- workedDirectly: boolean().default(false).label("Worked Directly"),
154
- })
155
- .label("Reference Section");
71
+ // const ResumeReferenceSectionSchema = object()
72
+ // .shape({
73
+ // name: string().required().label("Name"),
74
+ // designation: string().required().label("Designation"),
75
+ // company: string().required().label("Company"),
76
+ // email: string().email().required().label("Email"),
77
+ // mobile: string().required().label("Mobile"),
78
+ // profileUrl: string().url().optional().label("Profile URL"),
79
+ // workedDirectly: boolean().default(false).label("Worked Directly"),
80
+ // })
81
+ // .label("Reference Section");
82
+ // export type TResumeReferenceSectionSchema = InferType<
83
+ // typeof ResumeReferenceSectionSchema
84
+ // >;
156
85
  {
157
86
  /**
158
- * ResumeSectionSchema is a lazy schema that dynamically loads the appropriate schema based on the section type.
87
+ * ResumeSchemaV2 is a lazy schema that dynamically loads the appropriate schema based on the section type.
159
88
  */
160
89
  }
161
- export const ResumeSectionSchema = lazy((section) => {
90
+ export const ResumeSchemaV2 = array()
91
+ .of(lazy((section) => {
162
92
  const { id } = section;
163
93
  return object({
164
- id: string().oneOf(SupportedResumeSectionTypes).required().label("Section"),
165
- data: array()
166
- .of(lazy(() => {
94
+ id: string()
95
+ .oneOf(SupportedResumeSectionTypes)
96
+ .required()
97
+ .label("Section"),
98
+ data: lazy(() => {
167
99
  switch (id) {
168
100
  case ResumeSectionType.GeneralInfo:
169
- return ResumeGeneralInfoSchema;
170
- case ResumeSectionType.Summary:
171
- return ResumeSummarySchema;
101
+ // GeneralInfo schema is a single object schema, use it directly with null default
102
+ return ResumeGeneralInfoSectionSchema.nullable().default(null);
172
103
  case ResumeSectionType.WorkExperience:
173
- return ResumeWorkExperienceSchema;
104
+ // WorkExperience schema is already an array schema, use it directly with empty array default
105
+ return ResumeWorkExperienceSectionSchema.default([]);
174
106
  case ResumeSectionType.Education:
175
- return ResumeEducationSchema;
107
+ // Education schema is already an array schema, use it directly with empty array default
108
+ return ResumeEducationSectionSchema.default([]);
176
109
  case ResumeSectionType.Skill:
177
- return ResumeSkillSchema;
110
+ // Skill schema is already an array schema, use it directly with empty array default
111
+ return ResumeSkillSectionSchema.default([]);
178
112
  case ResumeSectionType.Project:
179
- return ResumeProjectSchema;
113
+ // Project schema is already an array schema, use it directly with empty array default
114
+ return ResumeProjectSectionSchema.default([]);
180
115
  case ResumeSectionType.Certification:
181
- return ResumeCertificationSchema;
116
+ // Certification schema is already an array schema, use it directly with empty array default
117
+ return ResumeCertificationSectionSchema.default([]);
182
118
  case ResumeSectionType.Interest:
183
- return ResumeInterestSchema;
119
+ // Interest schema is already an array schema, use it directly with empty array default
120
+ return ResumeInterestSectionSchema.default([]);
184
121
  case ResumeSectionType.Language:
185
- return ResumeLanguageSchema;
186
- case ResumeSectionType.AdditionalInfo:
187
- return ResumeAdditionalInfoSchema;
188
- case ResumeSectionType.Reference:
189
- return ResumeReferenceSectionSchema;
122
+ // Language schema is already an array schema, use it directly with empty array default
123
+ return ResumeLanguageSectionSchema.default([]);
124
+ // case ResumeSectionType.AdditionalInfo:
125
+ // // AdditionalInfo schema is already an array schema, use it directly with empty array default
126
+ // return ResumeAdditionalInfoSectionSchema.default([]);
127
+ // case ResumeSectionType.Reference:
128
+ // return array().of(ResumeReferenceSectionSchema).required().label("Data");
190
129
  default:
191
130
  throw new ValidationError(`Invalid Section Type: ${id}`);
192
131
  }
193
- }))
194
- .required()
195
- .label("Data"),
132
+ }),
196
133
  });
197
- });
134
+ }))
135
+ .label("Resume Schema V2");
198
136
  {
199
137
  /**
200
138
  * ResumeSchema is a schema for a resume.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thejob/schema",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/esm/index.d.ts",
@@ -13,8 +13,8 @@
13
13
  "build": "npm run clean && npm run build:cjs && npm run build:esm",
14
14
  "postbuild": "npm run generate-interface --stage=interfaceCleanup",
15
15
  "test": "jest",
16
- "lint": "eslint . --max-warnings 0",
17
- "lint:fix": "eslint --fix --ext .ts,.json,.js",
16
+ "lint": "eslint . --max-warnings 50",
17
+ "lint:fix": "eslint --fix --ext .ts,.js .",
18
18
  "test:watch": "jest --watch",
19
19
  "dev": "npm run test:watch"
20
20
  },
@@ -22,9 +22,15 @@
22
22
  "dist"
23
23
  ],
24
24
  "devDependencies": {
25
+ "@eslint/js": "^9.33.0",
25
26
  "@jest/globals": "^29.7.0",
26
27
  "@types/jest": "^29.5.14",
27
28
  "@types/validator": "^13.12.2",
29
+ "@typescript-eslint/eslint-plugin": "^8.40.0",
30
+ "@typescript-eslint/parser": "^8.40.0",
31
+ "eslint": "^9.33.0",
32
+ "eslint-config-prettier": "^10.1.8",
33
+ "eslint-plugin-only-warn": "^1.1.0",
28
34
  "jest": "^29.7.0",
29
35
  "nodemon": "^3.1.9",
30
36
  "rimraf": "^6.0.1",
@@ -35,6 +41,7 @@
35
41
  },
36
42
  "dependencies": {
37
43
  "dayjs": "^1.11.13",
44
+ "graphql-request": "^7.2.0",
38
45
  "mongoose": "^8.11.0",
39
46
  "validator": "^13.12.0",
40
47
  "yup": "^1.6.1",