@zyacreatives/shared 2.5.55 → 2.5.57

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.JobSearchDocumentSchema = exports.GetJobsOutputSchema = exports.GetJobsInputSchema = exports.UpdateJobInputSchema = exports.CreateJobInputSchema = exports.NormalizedJobSchema = exports.JobWithRoleDetailsEntitySchema = exports.JobWithGigDetailsEntitySchema = exports.JobEntitySchema = void 0;
3
+ exports.JobSearchDocumentSchema = exports.GetJobsOutputSchema = exports.GetJobsInputSchema = exports.UpdateJobInputSchema = exports.CreateJobInputSchema = exports.NormalizedJobSchema = exports.JobWithRoleDetailsEntitySchema = exports.JobWithGigDetailsEntitySchema = exports.RoleJobEntitySchema = exports.GigJobEntitySchema = exports.RoleDetailsSchema = exports.GigDetailsSchema = exports.JobEntitySchema = exports.JobShape = exports.JobSectionSchema = exports.WageTypeSchema = exports.WageCurrencySchema = exports.ExperienceLevelSchema = exports.JobLocationSchema = exports.GigTypeSchema = exports.JobStatusSchema = exports.WorkModeSchema = exports.EmploymentTypeSchema = exports.JobTypeSchema = void 0;
4
4
  const zod_openapi_1 = require("@hono/zod-openapi");
5
5
  const constants_1 = require("../constants");
6
6
  /**
@@ -8,29 +8,30 @@ const constants_1 = require("../constants");
8
8
  * ENUMS
9
9
  * --------------------------------
10
10
  */
11
- const JobTypeSchema = zod_openapi_1.z.enum(Object.values(constants_1.JOB_TYPE));
12
- const EmploymentTypeSchema = zod_openapi_1.z.enum(Object.values(constants_1.EMPLOYMENT_TYPE));
13
- const WorkModeSchema = zod_openapi_1.z.enum(Object.values(constants_1.WORK_MODE));
14
- const JobStatusSchema = zod_openapi_1.z.enum(Object.values(constants_1.JOB_STATUS));
15
- const GigTypeSchema = zod_openapi_1.z.enum(Object.values(constants_1.GIG_TYPE));
16
- const LocationSchema = zod_openapi_1.z.enum(Object.values(constants_1.JOB_LOCATIONS));
17
- const ExperienceLevelSchema = zod_openapi_1.z.enum(Object.values(constants_1.EXPERIENCE_LEVELS));
18
- const WageCurrencySchema = zod_openapi_1.z.enum(Object.values(constants_1.WAGES_CURRENCY));
19
- const WageTypeSchema = zod_openapi_1.z.enum(Object.values(constants_1.WAGE_TYPES));
11
+ exports.JobTypeSchema = zod_openapi_1.z.enum(Object.values(constants_1.JOB_TYPE));
12
+ exports.EmploymentTypeSchema = zod_openapi_1.z.enum(Object.values(constants_1.EMPLOYMENT_TYPE));
13
+ exports.WorkModeSchema = zod_openapi_1.z.enum(Object.values(constants_1.WORK_MODE));
14
+ exports.JobStatusSchema = zod_openapi_1.z.enum(Object.values(constants_1.JOB_STATUS));
15
+ exports.GigTypeSchema = zod_openapi_1.z.enum(Object.values(constants_1.GIG_TYPE));
16
+ exports.JobLocationSchema = zod_openapi_1.z.enum(Object.values(constants_1.JOB_LOCATIONS));
17
+ exports.ExperienceLevelSchema = zod_openapi_1.z.enum(Object.values(constants_1.EXPERIENCE_LEVELS));
18
+ exports.WageCurrencySchema = zod_openapi_1.z.enum(Object.values(constants_1.WAGES_CURRENCY));
19
+ exports.WageTypeSchema = zod_openapi_1.z.enum(Object.values(constants_1.WAGE_TYPES));
20
+ exports.JobSectionSchema = zod_openapi_1.z.enum(Object.values(constants_1.JOB_SECTIONS));
20
21
  /**
21
22
  * --------------------------------
22
23
  * SHAPE
23
24
  * --------------------------------
24
25
  */
25
- const JobShape = zod_openapi_1.z.object({
26
+ exports.JobShape = zod_openapi_1.z.object({
26
27
  title: zod_openapi_1.z.string().min(3).max(255),
27
28
  brandId: zod_openapi_1.z.cuid2(),
28
- jobType: JobTypeSchema,
29
- employmentType: EmploymentTypeSchema.optional(),
30
- workMode: WorkModeSchema,
31
- gigType: GigTypeSchema.optional(),
32
- location: LocationSchema,
33
- jobSections: zod_openapi_1.z.array(zod_openapi_1.z.enum(Object.values(constants_1.JOB_SECTIONS))),
29
+ jobType: exports.JobTypeSchema,
30
+ employmentType: exports.EmploymentTypeSchema.optional(),
31
+ workMode: exports.WorkModeSchema,
32
+ gigType: exports.GigTypeSchema.optional(),
33
+ location: exports.JobLocationSchema,
34
+ jobSections: zod_openapi_1.z.array(exports.JobSectionSchema),
34
35
  });
35
36
  /**
36
37
  * --------------------------------
@@ -40,8 +41,8 @@ const JobShape = zod_openapi_1.z.object({
40
41
  exports.JobEntitySchema = zod_openapi_1.z
41
42
  .object({
42
43
  id: zod_openapi_1.z.cuid2(),
43
- ...JobShape.shape,
44
- status: JobStatusSchema,
44
+ ...exports.JobShape.shape,
45
+ status: exports.JobStatusSchema,
45
46
  brandName: zod_openapi_1.z.string(),
46
47
  brandImgUrl: zod_openapi_1.z.string().nullable().optional(),
47
48
  isApplied: zod_openapi_1.z.boolean().default(false),
@@ -56,7 +57,7 @@ exports.JobEntitySchema = zod_openapi_1.z
56
57
  * ROLE / GIG DETAILS
57
58
  * --------------------------------
58
59
  */
59
- const GigDetailsSchema = zod_openapi_1.z.object({
60
+ exports.GigDetailsSchema = zod_openapi_1.z.object({
60
61
  overview: zod_openapi_1.z.string(),
61
62
  deliverables: zod_openapi_1.z.string(),
62
63
  employeeRequirements: zod_openapi_1.z.string().optional(),
@@ -64,11 +65,11 @@ const GigDetailsSchema = zod_openapi_1.z.object({
64
65
  requiredSkills: zod_openapi_1.z.array(zod_openapi_1.z.string()),
65
66
  wagesMin: zod_openapi_1.z.number().nullable().optional(),
66
67
  wagesMax: zod_openapi_1.z.number().nullable().optional(),
67
- wagesCurrency: WageCurrencySchema.optional(),
68
- wagesType: WageTypeSchema.optional(),
68
+ wagesCurrency: exports.WageCurrencySchema.optional(),
69
+ wagesType: exports.WageTypeSchema.optional(),
69
70
  });
70
- const RoleDetailsSchema = zod_openapi_1.z.object({
71
- experienceLevel: ExperienceLevelSchema,
71
+ exports.RoleDetailsSchema = zod_openapi_1.z.object({
72
+ experienceLevel: exports.ExperienceLevelSchema,
72
73
  overview: zod_openapi_1.z.string(),
73
74
  keyResponsibilities: zod_openapi_1.z.string(),
74
75
  requiredSkills: zod_openapi_1.z.array(zod_openapi_1.z.string()),
@@ -76,14 +77,41 @@ const RoleDetailsSchema = zod_openapi_1.z.object({
76
77
  companyBenefits: zod_openapi_1.z.string().optional(),
77
78
  wagesMin: zod_openapi_1.z.number().nullable().optional(),
78
79
  wagesMax: zod_openapi_1.z.number().nullable().optional(),
79
- wagesCurrency: WageCurrencySchema.optional(),
80
- wagesType: WageTypeSchema.optional(),
80
+ wagesCurrency: exports.WageCurrencySchema.optional(),
81
+ wagesType: exports.WageTypeSchema.optional(),
81
82
  });
82
- exports.JobWithGigDetailsEntitySchema = exports.JobEntitySchema.extend(GigDetailsSchema.shape);
83
- exports.JobWithRoleDetailsEntitySchema = exports.JobEntitySchema.extend(RoleDetailsSchema.shape);
83
+ /**
84
+ * --------------------------------
85
+ * DETAILED ENTITIES
86
+ * --------------------------------
87
+ */
88
+ exports.GigJobEntitySchema = exports.JobEntitySchema.extend({
89
+ jobType: zod_openapi_1.z.literal(constants_1.JOB_TYPE.GIG),
90
+ gigType: exports.GigTypeSchema,
91
+ employmentType: exports.EmploymentTypeSchema.optional(),
92
+ ...exports.GigDetailsSchema.shape,
93
+ }).openapi("GigJob");
94
+ exports.RoleJobEntitySchema = exports.JobEntitySchema.extend({
95
+ jobType: zod_openapi_1.z.literal(constants_1.JOB_TYPE.ROLE),
96
+ employmentType: exports.EmploymentTypeSchema,
97
+ gigType: exports.GigTypeSchema.optional(),
98
+ ...exports.RoleDetailsSchema.shape,
99
+ }).openapi("RoleJob");
100
+ /**
101
+ * Backwards-compatible names.
102
+ */
103
+ exports.JobWithGigDetailsEntitySchema = exports.GigJobEntitySchema;
104
+ exports.JobWithRoleDetailsEntitySchema = exports.RoleJobEntitySchema;
105
+ /**
106
+ * Keep this as a regular union.
107
+ *
108
+ * Do not use discriminatedUnion here because JobEntitySchema has jobType as
109
+ * "GIG" | "ROLE", while GigJobEntitySchema and RoleJobEntitySchema use
110
+ * literals. That makes the discriminator ambiguous.
111
+ */
84
112
  exports.NormalizedJobSchema = zod_openapi_1.z.union([
85
- exports.JobWithGigDetailsEntitySchema,
86
- exports.JobWithRoleDetailsEntitySchema,
113
+ exports.GigJobEntitySchema,
114
+ exports.RoleJobEntitySchema,
87
115
  exports.JobEntitySchema,
88
116
  ]);
89
117
  /**
@@ -91,7 +119,7 @@ exports.NormalizedJobSchema = zod_openapi_1.z.union([
91
119
  * INPUTS
92
120
  * --------------------------------
93
121
  */
94
- exports.CreateJobInputSchema = JobShape.superRefine((data, ctx) => {
122
+ exports.CreateJobInputSchema = exports.JobShape.superRefine((data, ctx) => {
95
123
  if (data.jobType === constants_1.JOB_TYPE.ROLE && !data.employmentType) {
96
124
  ctx.addIssue({
97
125
  path: ["employmentType"],
@@ -109,12 +137,12 @@ exports.CreateJobInputSchema = JobShape.superRefine((data, ctx) => {
109
137
  });
110
138
  exports.UpdateJobInputSchema = exports.CreateJobInputSchema.partial().extend({
111
139
  id: zod_openapi_1.z.cuid2(),
112
- status: JobStatusSchema.optional(),
140
+ status: exports.JobStatusSchema.optional(),
113
141
  version: zod_openapi_1.z.int(),
114
142
  });
115
143
  exports.GetJobsInputSchema = zod_openapi_1.z.object({
116
144
  q: zod_openapi_1.z.string().optional(),
117
- jobType: JobTypeSchema.optional(),
145
+ jobType: exports.JobTypeSchema.optional(),
118
146
  page: zod_openapi_1.z.coerce.number().min(1).default(1),
119
147
  limit: zod_openapi_1.z.coerce.number().min(1).max(100).default(20),
120
148
  });
@@ -132,13 +160,18 @@ exports.GetJobsOutputSchema = zod_openapi_1.z.object({
132
160
  hasNextPage: zod_openapi_1.z.boolean(),
133
161
  hasPrevPage: zod_openapi_1.z.boolean(),
134
162
  });
163
+ /**
164
+ * --------------------------------
165
+ * SEARCH DOCUMENT
166
+ * --------------------------------
167
+ */
135
168
  exports.JobSearchDocumentSchema = zod_openapi_1.z.object({
136
169
  id: zod_openapi_1.z.cuid2(),
137
170
  title: zod_openapi_1.z.string(),
138
171
  brandId: zod_openapi_1.z.cuid2(),
139
172
  brandName: zod_openapi_1.z.string(),
140
173
  brandImgUrl: zod_openapi_1.z.string().nullable().optional(),
141
- jobType: zod_openapi_1.z.enum(["GIG", "ROLE"]),
174
+ jobType: zod_openapi_1.z.enum([constants_1.JOB_TYPE.GIG, constants_1.JOB_TYPE.ROLE]),
142
175
  location: zod_openapi_1.z.string(),
143
176
  overview: zod_openapi_1.z.string(),
144
177
  requiredSkills: zod_openapi_1.z.array(zod_openapi_1.z.string()),