@zyacreatives/shared 2.5.49 → 2.5.51

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,206 +1,127 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SearchCreativeOutputSchema = exports.SearchCreativeInputSchema = exports.CreativeWithUserEntitySchema = exports.UpdateCreativeOutputSchema = exports.GetCreativeOutputSchema = exports.CreateCreativeOutputSchema = exports.GetCreativeQuerySchema = exports.GetCreativeInputSchema = exports.UpdateCreativeProfileInputSchema = exports.CreateCreativeProfileInputSchema = exports.CreativeEntitySchema = exports.MinimalCreativeEntitySchema = void 0;
3
+ exports.SearchCreativeOutputSchema = exports.SearchCreativeInputSchema = exports.CreativeWithUserEntitySchema = exports.UpdateCreativeOutputSchema = exports.GetCreativeOutputSchema = exports.CreateCreativeOutputSchema = exports.GetCreativeQuerySchema = exports.GetCreativeInputSchema = exports.UpdateCreativeProfileInputSchema = exports.CreateCreativeProfileInputSchema = exports.MinimalCreativeEntitySchema = exports.CreativeEntitySchema = void 0;
4
4
  const zod_openapi_1 = require("@hono/zod-openapi");
5
5
  const constants_1 = require("../constants");
6
6
  const common_1 = require("./common");
7
7
  const user_1 = require("./user");
8
- // -----------------------------------------------------------------------------
9
- // Minimal Creative Entity
10
- // -----------------------------------------------------------------------------
11
- exports.MinimalCreativeEntitySchema = zod_openapi_1.z.object({
12
- id: zod_openapi_1.z.cuid2().openapi({ example: "cre_cksd0v6q0000s9a5y8z7p3x9" }),
13
- userId: zod_openapi_1.z.cuid2().openapi({ example: "user_abc123" }),
14
- bio: zod_openapi_1.z.string().optional().openapi({
15
- example: "A multi-disciplinary designer specializing in brand identity.",
16
- }),
17
- role: zod_openapi_1.z.string().optional().openapi({ example: "Designer" }),
18
- location: zod_openapi_1.z.string().optional().openapi({ example: "London, UK" }),
19
- experienceLevel: zod_openapi_1.z
20
- .enum(Object.values(constants_1.EXPERIENCE_LEVELS))
21
- .optional()
22
- .openapi({ example: constants_1.EXPERIENCE_LEVELS.YEAR_0_1 }),
23
- disciplines: zod_openapi_1.z
24
- .array(zod_openapi_1.z.string())
25
- .optional()
26
- .openapi({ example: ["Design", "Art Direction"] }),
27
- createdAt: zod_openapi_1.z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
28
- updatedAt: zod_openapi_1.z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
29
- });
30
- // -----------------------------------------------------------------------------
31
- // Full Creative Entity
32
- // -----------------------------------------------------------------------------
33
- exports.CreativeEntitySchema = zod_openapi_1.z
34
- .object({
35
- id: zod_openapi_1.z.cuid2().openapi({ example: "cre_cksd0v6q0000s9a5y8z7p3x9" }),
36
- userId: zod_openapi_1.z.cuid2().openapi({ example: "user_abc123" }),
37
- bio: zod_openapi_1.z.string().optional().openapi({
38
- example: "A multi-disciplinary designer specializing in brand identity.",
39
- }),
40
- role: zod_openapi_1.z.string().optional().openapi({ example: "Designer" }),
41
- version: zod_openapi_1.z.int(),
42
- location: zod_openapi_1.z.string().optional().openapi({ example: "London, UK" }),
43
- experienceLevel: zod_openapi_1.z
44
- .enum(Object.values(constants_1.EXPERIENCE_LEVELS))
45
- .optional()
46
- .openapi({ example: constants_1.EXPERIENCE_LEVELS.YEAR_0_1 }),
47
- disciplines: zod_openapi_1.z
48
- .array(zod_openapi_1.z.string())
49
- .optional()
50
- .openapi({ example: ["Design", "Art Direction"] }),
8
+ /**
9
+ * --------------------------------
10
+ * SHAPE
11
+ * --------------------------------
12
+ */
13
+ const CreativeShape = zod_openapi_1.z.object({
14
+ bio: zod_openapi_1.z.string().max(600).default(""),
15
+ role: zod_openapi_1.z.string().default(""),
16
+ location: zod_openapi_1.z.string().max(100).default(""),
17
+ experienceLevel: zod_openapi_1.z.enum(Object.values(constants_1.EXPERIENCE_LEVELS)),
18
+ disciplines: zod_openapi_1.z.array(zod_openapi_1.z.string()).default([]),
51
19
  workExperience: zod_openapi_1.z
52
- .object({
20
+ .array(zod_openapi_1.z.object({
53
21
  companyName: zod_openapi_1.z.string(),
54
22
  position: zod_openapi_1.z.string(),
55
- startDate: zod_openapi_1.z.coerce.date().optional(),
56
- endDate: zod_openapi_1.z.coerce.date().optional(),
57
- currentlyWorking: zod_openapi_1.z.boolean().optional(),
58
- description: zod_openapi_1.z.string(),
59
- })
60
- .array()
61
- .optional(),
23
+ startDate: zod_openapi_1.z.string().datetime().optional(),
24
+ endDate: zod_openapi_1.z.string().datetime().optional(),
25
+ currentlyWorking: zod_openapi_1.z.boolean().default(false),
26
+ description: zod_openapi_1.z.string().default(""),
27
+ }))
28
+ .default([]),
62
29
  links: zod_openapi_1.z
63
- .object({
64
- url: zod_openapi_1.z.union([
65
- zod_openapi_1.z.url({ message: "Please enter a valid URL" }),
66
- zod_openapi_1.z.literal(""),
67
- ]),
68
- type: zod_openapi_1.z.enum(constants_1.LINK_TYPES),
69
- })
70
- .array()
71
- .optional(),
30
+ .array(zod_openapi_1.z.object({
31
+ url: zod_openapi_1.z.url(),
32
+ type: zod_openapi_1.z.enum(constants_1.LINK_TYPES).default(constants_1.LINK_TYPES.GENERIC_WEBSITE),
33
+ }))
34
+ .default([]),
72
35
  achievements: zod_openapi_1.z
73
- .object({
36
+ .array(zod_openapi_1.z.object({
74
37
  title: zod_openapi_1.z.string(),
75
- link: zod_openapi_1.z.string().optional(),
76
- year: zod_openapi_1.z.coerce.number().int().optional(),
77
- })
78
- .array()
79
- .optional(),
80
- createdAt: zod_openapi_1.z.coerce
81
- .date()
82
- .optional()
83
- .openapi({ example: "2025-10-13T09:00:00.000Z" }),
84
- updatedAt: zod_openapi_1.z.coerce.date().openapi({ example: "2025-10-13T09:00:00.000Z" }),
85
- })
86
- .openapi({
87
- title: "CreativeEntitySchema",
88
- description: "Represents a creative profile, including bio, experience level, location, disciplines and timestamps.",
38
+ link: zod_openapi_1.z.url().optional(),
39
+ year: zod_openapi_1.z.number().int().optional(),
40
+ }))
41
+ .default([]),
89
42
  });
90
- // -----------------------------------------------------------------------------
91
- // Creative Profile Actions (Create / Update)
92
- // -----------------------------------------------------------------------------
93
- exports.CreateCreativeProfileInputSchema = zod_openapi_1.z
43
+ /**
44
+ * --------------------------------
45
+ * ENTITY (DTO)
46
+ * --------------------------------
47
+ */
48
+ exports.CreativeEntitySchema = zod_openapi_1.z
94
49
  .object({
95
- experienceLevel: zod_openapi_1.z
96
- .enum(constants_1.EXPERIENCE_LEVELS)
97
- .describe("Overall experience range of the creative.")
98
- .openapi({ example: constants_1.EXPERIENCE_LEVELS.YEAR_1_3 }),
99
- role: zod_openapi_1.z.string().openapi({ example: "Designer" }),
100
- location: zod_openapi_1.z
101
- .string()
102
- .max(100)
103
- .describe("Primary location where the creative works or resides.")
104
- .openapi({ example: "Lagos, Nigeria" }),
105
- disciplineSlugs: zod_openapi_1.z
106
- .array(zod_openapi_1.z.string())
107
- .min(1, "At least one discipline is required")
108
- .default([])
109
- .describe("List of discipline slugs representing the creative’s fields.")
110
- .openapi({ example: ["ui-ux", "frontend"] }),
50
+ id: zod_openapi_1.z.cuid2(),
51
+ userId: zod_openapi_1.z.cuid2(),
52
+ ...CreativeShape.shape,
53
+ createdAt: zod_openapi_1.z.string().datetime(),
54
+ updatedAt: zod_openapi_1.z.string().datetime(),
55
+ version: zod_openapi_1.z.int(),
111
56
  })
112
- .openapi({
113
- title: "create creative profile",
114
- description: "Payload for creating a new creative profile.",
57
+ .openapi("Creative");
58
+ exports.MinimalCreativeEntitySchema = exports.CreativeEntitySchema.pick({
59
+ id: true,
60
+ userId: true,
61
+ bio: true,
62
+ role: true,
63
+ location: true,
64
+ experienceLevel: true,
65
+ disciplines: true,
66
+ createdAt: true,
67
+ updatedAt: true,
115
68
  });
116
- exports.UpdateCreativeProfileInputSchema = zod_openapi_1.z
117
- .object({
118
- experienceLevel: zod_openapi_1.z
119
- .enum(constants_1.EXPERIENCE_LEVELS)
120
- .optional()
121
- .openapi({ example: constants_1.EXPERIENCE_LEVELS.YEAR_3_5 }),
122
- role: zod_openapi_1.z.string().optional().openapi({ example: "Designer" }),
123
- bio: zod_openapi_1.z
124
- .string()
125
- .max(600)
126
- .optional()
127
- .openapi({ example: "I am a freelance UI/UX designer." }),
128
- location: zod_openapi_1.z
129
- .string()
130
- .max(100)
131
- .optional()
132
- .openapi({ example: "Lagos, Nigeria" }),
69
+ /**
70
+ * --------------------------------
71
+ * INPUT DTOs
72
+ * --------------------------------
73
+ */
74
+ exports.CreateCreativeProfileInputSchema = CreativeShape.pick({
75
+ experienceLevel: true,
76
+ role: true,
77
+ location: true,
78
+ }).extend({
133
79
  disciplineSlugs: zod_openapi_1.z
134
80
  .array(zod_openapi_1.z.string())
135
- .min(1, "At least one discipline is required")
136
- .optional()
137
- .openapi({ example: ["frontend", "ui-ux"] }),
138
- workExperience: zod_openapi_1.z
139
- .object({
140
- companyName: zod_openapi_1.z.string(),
141
- position: zod_openapi_1.z.string(),
142
- startDate: zod_openapi_1.z.string().optional(),
143
- endDate: zod_openapi_1.z.string().optional(),
144
- currentlyWorking: zod_openapi_1.z.boolean().default(false),
145
- description: zod_openapi_1.z.string().optional(),
146
- })
147
- .array()
148
- .optional(),
149
- links: zod_openapi_1.z
150
- .object({
151
- url: zod_openapi_1.z.union([
152
- zod_openapi_1.z.url({ message: "Please enter a valid URL" }),
153
- zod_openapi_1.z.literal(""),
154
- ]),
155
- type: zod_openapi_1.z.enum(constants_1.LINK_TYPES),
156
- })
157
- .array()
158
- .optional(),
81
+ .min(1, "At least one discipline is required"),
82
+ });
83
+ exports.UpdateCreativeProfileInputSchema = CreativeShape.partial()
84
+ .extend({
85
+ disciplineSlugs: zod_openapi_1.z.array(zod_openapi_1.z.string()).optional(),
159
86
  version: zod_openapi_1.z.int(),
160
- achievements: zod_openapi_1.z
161
- .object({
162
- title: zod_openapi_1.z.string(),
163
- link: zod_openapi_1.z.string().optional(),
164
- year: zod_openapi_1.z.coerce.number().int().optional(),
165
- })
166
- .array()
167
- .optional(),
168
87
  })
169
- .openapi({
170
- title: "update creative profile",
88
+ .refine((d) => Object.values(d).some((v) => v !== undefined), {
89
+ message: "At least one field must be provided",
171
90
  });
172
- // -----------------------------------------------------------------------------
173
- // Queries & Outputs
174
- // -----------------------------------------------------------------------------
91
+ /**
92
+ * --------------------------------
93
+ * GET
94
+ * --------------------------------
95
+ */
175
96
  exports.GetCreativeInputSchema = zod_openapi_1.z.object({
176
97
  value: zod_openapi_1.z.cuid2(),
177
98
  by: common_1.ProfileIdentifierSchema.shape.by,
178
99
  });
179
100
  exports.GetCreativeQuerySchema = common_1.ProfileIdentifierSchema;
180
- // Re-exports for explicit intent
101
+ /**
102
+ * --------------------------------
103
+ * OUTPUT ALIASES
104
+ * --------------------------------
105
+ */
181
106
  exports.CreateCreativeOutputSchema = exports.CreativeEntitySchema;
182
107
  exports.GetCreativeOutputSchema = exports.CreativeEntitySchema;
183
108
  exports.UpdateCreativeOutputSchema = exports.CreativeEntitySchema;
184
- // -----------------------------------------------------------------------------
185
- // Entity With User
186
- // -----------------------------------------------------------------------------
109
+ /**
110
+ * --------------------------------
111
+ * ENTITY WITH USER
112
+ * --------------------------------
113
+ */
187
114
  exports.CreativeWithUserEntitySchema = exports.MinimalCreativeEntitySchema.extend({
188
115
  user: user_1.MinimalUserSchema,
189
116
  });
190
- // -----------------------------------------------------------------------------
191
- // Search Actions
192
- // -----------------------------------------------------------------------------
117
+ /**
118
+ * --------------------------------
119
+ * SEARCH
120
+ * --------------------------------
121
+ */
193
122
  exports.SearchCreativeInputSchema = zod_openapi_1.z.object({
194
- string: zod_openapi_1.z
195
- .string()
196
- .min(1, { message: "Search string cannot be empty" })
197
- .max(200, { message: "Search string cannot exceed 200 characters" }),
198
- limit: zod_openapi_1.z.coerce
199
- .number()
200
- .int({ message: "Limit must be an integer" })
201
- .min(1, { message: "Limit must be at least 1" })
202
- .max(100, { message: "Limit cannot exceed 100" })
203
- .default(20),
123
+ string: zod_openapi_1.z.string().min(1).max(200),
124
+ limit: zod_openapi_1.z.coerce.number().int().min(1).max(100).default(20),
204
125
  cursor: zod_openapi_1.z.string().optional(),
205
126
  });
206
127
  exports.SearchCreativeOutputSchema = zod_openapi_1.z.object({