@cofondateurauchomage/libs 1.1.113 → 1.1.114

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/build/api.d.ts CHANGED
@@ -2,18 +2,18 @@ import { IBlogHtmlArticle, IContact, INewsletter, IProject, IProspect, IReaction
2
2
  export type CloudFunctionNames = "createProject" | "updateProject" | "deleteProject" | "createUser" | "updateUser" | "deleteUser" | "updateVisibility" | "addStripeId" | "updatePlan" | "addStatsAssociation" | "updateNewsletter" | "createProspect" | "getProspect" | "updateProspect" | "createReaction" | "deleteReaction" | "createBlogHtmlArticle";
3
3
  export type RouteNames = "checkout_session" | "delete_customer" | "portal_session" | "webhook";
4
4
  export type BodyForO<O extends CloudFunctionNames | RouteNames> = {
5
- createProject: Omit<IProject, "id" | "plan" | "visibility" | "clicks" | "creationDate" | "lastConnection" | "likes" | "stripeId" | "active" | "referrer" | "postedOnLinkedInAt"> & IContact & {
5
+ createProject: Omit<IProject, "id" | "plan" | "visibility" | "clicks" | "creationDate" | "lastConnection" | "stripeId" | "referrer" | "postedOnLinkedInAt"> & IContact & {
6
6
  newsletterMarketing?: boolean;
7
7
  emailProspect: string;
8
8
  };
9
9
  deleteProject: {};
10
- updateProject: Pick<IProject, "name" | "lastName" | "firstName" | "skills" | "yearsOfExperience" | "zipCode" | "city" | "invest" | "status" | "status_detail" | "turnover" | "description" | "partner" | "logo" | "availability"> & Omit<IContact, "email">;
11
- createUser: Omit<IUser, "id" | "plan" | "visibility" | "clicks" | "creationDate" | "lastConnection" | "likes" | "stripeId" | "active" | "referrer"> & IContact & {
10
+ updateProject: Omit<IProject, "id" | "plan" | "visibility" | "clicks" | "creationDate" | "lastConnection" | "stripeId" | "referrer" | "postedOnLinkedInAt" | "partner_swanbase" | "partner_iii"> & Omit<IContact, "email">;
11
+ createUser: Omit<IUser, "id" | "plan" | "visibility" | "clicks" | "creationDate" | "lastConnection" | "stripeId" | "referrer"> & IContact & {
12
12
  newsletterMarketing?: boolean;
13
13
  emailProspect: string;
14
14
  };
15
15
  deleteUser: {};
16
- updateUser: Pick<IUser, "lastName" | "firstName" | "skills" | "yearsOfExperience" | "zipCode" | "city" | "invest" | "motivations" | "partner" | "business" | "photo" | "availability"> & Omit<IContact, "email">;
16
+ updateUser: Omit<IUser, "id" | "plan" | "visibility" | "clicks" | "creationDate" | "lastConnection" | "stripeId" | "referrer"> & Omit<IContact, "email">;
17
17
  updateVisibility: {
18
18
  visibility: TVisibility;
19
19
  };
@@ -1,4 +1,4 @@
1
- import { BodyForO, CloudFunctionNames, RouteNames } from "./api";
1
+ import type { BodyForO, CloudFunctionNames, RouteNames } from "./api";
2
2
  /**
3
3
  * Validate the request body depending on the route.
4
4
  * @param route - Route to know which validators to use.
@@ -6,3 +6,15 @@ import { BodyForO, CloudFunctionNames, RouteNames } from "./api";
6
6
  * @returns
7
7
  */
8
8
  export declare function validateBodyForO<O extends CloudFunctionNames | RouteNames>(route: O, body: unknown): BodyForO<O>;
9
+ /**
10
+ * Custom error class to handle validation errors.
11
+ */
12
+ export declare class ValidationError extends Error {
13
+ code: number;
14
+ /**
15
+ * Creates a new ValidationError.
16
+ * @param code - The HTTP status code.
17
+ * @param message - The error message.
18
+ */
19
+ constructor(code: number, message: string);
20
+ }
@@ -1,214 +1,191 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ValidationError = void 0;
3
4
  exports.validateBodyForO = validateBodyForO;
5
+ const zod_1 = require("zod");
4
6
  const const_1 = require("./const");
5
7
  const regex_1 = require("./regex");
6
- const validate_1 = require("./validate");
7
- //////////////
8
- // Validators
9
- const business = (0, validate_1.isString)().setMax(1000);
10
- const city = (0, validate_1.isMatchRegex)(regex_1.RGX.Name.regex);
11
- const description = (0, validate_1.isString)().setMax(1000);
12
- const email = (0, validate_1.isString)();
13
- const firstName = (0, validate_1.isMatchRegex)(regex_1.RGX.Name.regex);
14
- const invest = (0, validate_1.isNumber)().setMin(0).setMax(1000000).isOptional();
15
- const lastName = (0, validate_1.isMatchRegex)(regex_1.RGX.Name.regex);
16
- const linkedin = (0, validate_1.isMatchRegex)(regex_1.RGX.Linkedin.regex).isOptional();
17
- const website = (0, validate_1.isString)().isOptional();
18
- const motivations = (0, validate_1.isString)().setMax(1000).isOptional();
19
- const name = (0, validate_1.isString)().setMax(50);
20
- const partner = (0, validate_1.isString)().setMax(1000).isOptional();
21
- const skills = new validate_1.Validator((value) => !!(value &&
22
- Array.isArray(value) &&
23
- value.length >= 1 &&
24
- value.length <= 2 &&
25
- value.every((skill) => const_1.SKILLS.includes(skill))));
26
- const stripeId = (0, validate_1.isString)().setMax(50);
27
- const zipCode = (0, validate_1.isNumber)().setMin(1000).setMax(97680);
28
- const newsletterMarketing = (0, validate_1.isBoolean)().isOptional();
29
- const status = (0, validate_1.isMatchEnum)(const_1.PROJECT_STATUS).isOptional();
30
- const status_detail = (0, validate_1.isString)().setMax(1000).isOptional();
31
- const photo = (0, validate_1.isString)().isOptional();
32
- const logo = (0, validate_1.isString)().isOptional();
33
- const plan = (0, validate_1.isMatchEnum)(["free", "pro", "premium"]);
34
- const apiSecretKey = (0, validate_1.isString)();
35
- const tel = (0, validate_1.isMatchRegex)(regex_1.RGX.Tel.regex).isOptional();
36
- const reactionStatus = (0, validate_1.isMatchEnum)(["like", "dislike"]);
37
- const turnover = (0, validate_1.isNumber)().setMin(0).isOptional();
38
- const yearsOfExperience = (0, validate_1.isNumber)().setMin(0).setMax(100).isOptional();
39
- const availability = (0, validate_1.isMatchEnum)(const_1.AVAILABILITY).isOptional();
40
- const validatorsForAllRoutes = {
41
- ///////////////////
42
- // Cloud functions
43
- createProject: {
44
- email,
45
- emailProspect: email,
46
- tel,
47
- linkedin,
48
- website,
49
- name,
50
- lastName,
51
- firstName,
52
- skills,
53
- yearsOfExperience,
54
- zipCode,
55
- city,
56
- invest,
57
- status,
58
- status_detail,
59
- turnover,
60
- description,
61
- partner,
62
- availability,
63
- newsletterMarketing,
64
- logo,
65
- partner_swanbase: (0, validate_1.isBoolean)().isOptional(),
66
- partner_iii: (0, validate_1.isBoolean)().isOptional(),
67
- },
68
- deleteProject: {},
69
- updateProject: {
70
- tel,
71
- linkedin,
72
- website,
73
- name,
74
- firstName,
75
- lastName,
76
- skills,
77
- yearsOfExperience,
78
- zipCode,
79
- city,
80
- invest,
81
- status,
82
- status_detail,
83
- turnover,
84
- description,
85
- partner,
86
- logo,
87
- availability,
88
- },
89
- createUser: {
90
- email,
91
- emailProspect: email,
92
- tel,
93
- linkedin,
94
- website,
95
- lastName,
96
- firstName,
97
- business,
98
- city,
99
- invest,
100
- joblessDate: (0, validate_1.isMatchRegex)(regex_1.RGX.Date.regex).isOptional(),
101
- motivations,
102
- partner,
103
- skills,
104
- yearsOfExperience,
105
- zipCode,
106
- newsletterMarketing,
107
- photo,
108
- availability,
109
- },
110
- deleteUser: {},
111
- updateUser: {
112
- tel,
113
- linkedin,
114
- website,
115
- business,
116
- city,
117
- invest,
118
- motivations,
119
- partner,
120
- skills,
121
- yearsOfExperience,
122
- zipCode,
123
- photo,
124
- firstName,
125
- lastName,
126
- availability,
127
- },
128
- updateVisibility: {
129
- visibility: (0, validate_1.isMatchEnum)(["public", "limited", "private"]),
130
- },
131
- addStripeId: {
132
- apiSecretKey,
133
- email,
134
- stripeId,
135
- },
136
- updatePlan: {
137
- apiSecretKey,
138
- stripeId,
139
- email: (0, validate_1.isString)(),
140
- plan,
141
- },
142
- addStatsAssociation: {},
143
- updateNewsletter: {
144
- match: (0, validate_1.isBoolean)().isOptional(),
145
- marketing: (0, validate_1.isBoolean)().isOptional(),
146
- notification: (0, validate_1.isBoolean)().isOptional(),
147
- feature: (0, validate_1.isBoolean)().isOptional(),
148
- new_profil: (0, validate_1.isBoolean)().isOptional(),
149
- },
150
- createProspect: {
151
- email,
152
- referrer: (0, validate_1.isString)().isOptional(),
153
- },
154
- getProspect: {
155
- email,
156
- },
157
- updateProspect: {
158
- email,
159
- tel: tel.isOptional(),
160
- linkedin: linkedin.isOptional(),
161
- website: website.isOptional(),
162
- lastName: lastName.isOptional(),
163
- firstName: firstName.isOptional(),
164
- business: business.isOptional(),
165
- city: city.isOptional(),
166
- invest: invest.isOptional(),
167
- joblessDate: (0, validate_1.isMatchRegex)(regex_1.RGX.Date.regex).isOptional(),
168
- motivations: motivations.isOptional(),
169
- partner: partner.isOptional(),
170
- skills: skills.isOptional(),
171
- yearsOfExperience: yearsOfExperience.isOptional(),
172
- zipCode: zipCode.isOptional(),
173
- name: name.isOptional(),
174
- status: status.isOptional(),
175
- status_detail: status_detail.isOptional(),
176
- turnover: turnover.isOptional(),
177
- description: description.isOptional(),
178
- partner_swanbase: (0, validate_1.isBoolean)().isOptional(),
179
- partner_iii: (0, validate_1.isBoolean)().isOptional(),
180
- availability: availability.isOptional(),
181
- },
182
- createReaction: {
183
- toId: (0, validate_1.isString)(),
184
- status: reactionStatus,
185
- },
186
- deleteReaction: {
187
- toId: (0, validate_1.isString)(),
188
- },
189
- createBlogHtmlArticle: {
190
- apiSecretKey,
191
- title: (0, validate_1.isString)(),
192
- description: (0, validate_1.isString)(),
193
- slug: (0, validate_1.isString)(),
194
- content: (0, validate_1.isString)(),
195
- toc: (0, validate_1.isString)().isOptional(),
196
- },
197
- //////////
198
- // Routes
199
- checkout_session: {
200
- stripeId: stripeId.isOptional(),
201
- email,
202
- type: (0, validate_1.isMatchEnum)(["user", "project"]),
203
- planOption: (0, validate_1.isMatchEnum)(["month", "annual"]),
204
- },
205
- delete_customer: {
206
- stripeId,
207
- },
208
- portal_session: {
209
- stripeId,
210
- },
211
- webhook: {},
8
+ const utils_1 = require("./utils");
9
+ const zSkill = zod_1.z.enum(const_1.SKILLS);
10
+ const zProjectStatus = zod_1.z.enum(const_1.PROJECT_STATUS);
11
+ const zAmbition = zod_1.z.enum(const_1.AMBITIONS);
12
+ const zProductType = zod_1.z.enum(const_1.PRODUCT_TYPES);
13
+ const zIndustry = zod_1.z.enum(const_1.INDUSTRIES);
14
+ const zAvailability = zod_1.z.enum(const_1.AVAILABILITY);
15
+ const zVisibility = zod_1.z.enum(const_1.VISIBILITIES);
16
+ const zName = zod_1.z.string().regex(regex_1.RGX.Name.regex);
17
+ const zStrMax50 = zod_1.z.string().max(50);
18
+ const zStrMax1000 = zod_1.z.string().max(1000);
19
+ const zLinkedin = zod_1.z.string().regex(regex_1.RGX.Linkedin.regex);
20
+ const zTel = zod_1.z.string().regex(regex_1.RGX.Tel.regex);
21
+ const zSkillsRequired = zod_1.z.array(zSkill).min(1).max(2);
22
+ const zSkillsOptional = zod_1.z.array(zSkill).min(1).max(2).optional();
23
+ const contactCreate = {
24
+ email: zod_1.z.string(),
25
+ emailProspect: zod_1.z.string(),
26
+ tel: zTel.optional(),
27
+ linkedin: zLinkedin.optional(),
28
+ website: zod_1.z.string().optional(),
29
+ newsletterMarketing: zod_1.z.boolean().optional(),
30
+ };
31
+ const contactUpdate = {
32
+ tel: zTel.optional(),
33
+ linkedin: zLinkedin.optional(),
34
+ website: zod_1.z.string().optional(),
35
+ };
36
+ const projectBody = {
37
+ name: zStrMax50,
38
+ lastName: zName,
39
+ firstName: zName,
40
+ description: zStrMax1000,
41
+ status: zProjectStatus.optional(),
42
+ status_detail: zStrMax1000.optional(),
43
+ turnover: zod_1.z.number().min(0).optional(),
44
+ ambitions: zod_1.z.array(zAmbition).optional(),
45
+ productTypes: zod_1.z.array(zProductType).optional(),
46
+ industries: zod_1.z.array(zIndustry).optional(),
47
+ skills: zSkillsRequired,
48
+ yearsOfExperience: zod_1.z.number().min(0).max(100).optional(),
49
+ availability: zAvailability.optional(),
50
+ city: zName,
51
+ invest: zod_1.z.number().min(0).max(1_000_000).optional(),
52
+ partner: zStrMax1000.optional(),
53
+ logo: zod_1.z.string().optional(),
54
+ };
55
+ const userBody = {
56
+ lastName: zName,
57
+ firstName: zName,
58
+ skills: zSkillsRequired,
59
+ yearsOfExperience: zod_1.z.number().min(0).max(100).optional(),
60
+ availability: zAvailability.optional(),
61
+ city: zName,
62
+ invest: zod_1.z.number().min(0).max(1_000_000).optional(),
63
+ motivations: zStrMax1000.optional(),
64
+ partner: zStrMax1000.optional(),
65
+ business: zStrMax1000,
66
+ bestStrength: zStrMax1000.optional(),
67
+ projectStatus: zod_1.z.array(zProjectStatus).optional(),
68
+ ambitions: zod_1.z.array(zAmbition).optional(),
69
+ productTypes: zod_1.z.array(zProductType).optional(),
70
+ industries: zod_1.z.array(zIndustry).optional(),
71
+ photo: zod_1.z.string().optional(),
72
+ };
73
+ function throwFromZodError(error) {
74
+ const issue = error.issues[0];
75
+ const key = issue.path.find((p) => typeof p === "string") ?? "champ";
76
+ const humanKey = (0, utils_1.capitalize)(key.replaceAll("_", " "));
77
+ if (issue.code === "invalid_type" &&
78
+ /\breceived undefined\b/i.test(issue.message)) {
79
+ throw new ValidationError(400, `${humanKey} requis`);
80
+ }
81
+ throw new ValidationError(400, `${humanKey} invalide`);
82
+ }
83
+ const schemasForAllRoutes = {
84
+ createProject: zod_1.z.object({
85
+ ...projectBody,
86
+ partner_swanbase: zod_1.z.boolean().optional(),
87
+ partner_iii: zod_1.z.boolean().optional(),
88
+ ...contactCreate,
89
+ }),
90
+ deleteProject: zod_1.z.object({}),
91
+ updateProject: zod_1.z.object({
92
+ ...projectBody,
93
+ ...contactUpdate,
94
+ }),
95
+ createUser: zod_1.z.object({
96
+ ...userBody,
97
+ ...contactCreate,
98
+ }),
99
+ deleteUser: zod_1.z.object({}),
100
+ updateUser: zod_1.z.object({
101
+ ...userBody,
102
+ ...contactUpdate,
103
+ }),
104
+ updateVisibility: zod_1.z.object({
105
+ visibility: zVisibility,
106
+ }),
107
+ addStripeId: zod_1.z.object({
108
+ apiSecretKey: zod_1.z.string(),
109
+ email: zod_1.z.string(),
110
+ stripeId: zStrMax50,
111
+ }),
112
+ updatePlan: zod_1.z.object({
113
+ apiSecretKey: zod_1.z.string(),
114
+ stripeId: zStrMax50,
115
+ email: zod_1.z.string(),
116
+ plan: zod_1.z.enum(["free", "pro", "premium"]),
117
+ }),
118
+ addStatsAssociation: zod_1.z.object({}),
119
+ updateNewsletter: zod_1.z.object({
120
+ match: zod_1.z.boolean().optional(),
121
+ marketing: zod_1.z.boolean().optional(),
122
+ notification: zod_1.z.boolean().optional(),
123
+ feature: zod_1.z.boolean().optional(),
124
+ new_profil: zod_1.z.boolean().optional(),
125
+ }),
126
+ createProspect: zod_1.z.object({
127
+ email: zod_1.z.string(),
128
+ referrer: zod_1.z.string().optional(),
129
+ }),
130
+ getProspect: zod_1.z.object({
131
+ email: zod_1.z.string(),
132
+ }),
133
+ updateProspect: zod_1.z.object({
134
+ name: zStrMax50.optional(),
135
+ lastName: zName.optional(),
136
+ firstName: zName.optional(),
137
+ description: zStrMax1000.optional(),
138
+ status: zProjectStatus.optional(),
139
+ status_detail: zStrMax1000.optional(),
140
+ turnover: zod_1.z.number().min(0).optional(),
141
+ ambitions: zod_1.z.array(zAmbition).optional(),
142
+ productTypes: zod_1.z.array(zProductType).optional(),
143
+ industries: zod_1.z.array(zIndustry).optional(),
144
+ skills: zSkillsOptional,
145
+ yearsOfExperience: zod_1.z.number().min(0).max(100).optional(),
146
+ availability: zAvailability.optional(),
147
+ city: zName.optional(),
148
+ invest: zod_1.z.number().min(0).max(1_000_000).optional(),
149
+ partner: zStrMax1000.optional(),
150
+ partner_swanbase: zod_1.z.boolean().optional(),
151
+ partner_iii: zod_1.z.boolean().optional(),
152
+ motivations: zStrMax1000.optional(),
153
+ business: zStrMax1000.optional(),
154
+ bestStrength: zStrMax1000.optional(),
155
+ projectStatus: zod_1.z.array(zProjectStatus).optional(),
156
+ email: zod_1.z.string(),
157
+ tel: zTel.optional(),
158
+ linkedin: zLinkedin.optional(),
159
+ website: zod_1.z.string().optional(),
160
+ }),
161
+ createReaction: zod_1.z.object({
162
+ toId: zod_1.z.string(),
163
+ status: zod_1.z.enum(["like", "dislike"]),
164
+ }),
165
+ deleteReaction: zod_1.z.object({
166
+ toId: zod_1.z.string(),
167
+ }),
168
+ createBlogHtmlArticle: zod_1.z.object({
169
+ apiSecretKey: zod_1.z.string(),
170
+ title: zod_1.z.string(),
171
+ description: zod_1.z.string(),
172
+ slug: zod_1.z.string(),
173
+ content: zod_1.z.string(),
174
+ toc: zod_1.z.string().optional(),
175
+ }),
176
+ checkout_session: zod_1.z.object({
177
+ stripeId: zStrMax50.optional(),
178
+ email: zod_1.z.string(),
179
+ type: zod_1.z.enum(["user", "project"]),
180
+ planOption: zod_1.z.enum(["month", "annual"]),
181
+ }),
182
+ delete_customer: zod_1.z.object({
183
+ stripeId: zStrMax50,
184
+ }),
185
+ portal_session: zod_1.z.object({
186
+ stripeId: zStrMax50,
187
+ }),
188
+ webhook: zod_1.z.object({}),
212
189
  };
213
190
  /**
214
191
  * Validate the request body depending on the route.
@@ -217,5 +194,36 @@ const validatorsForAllRoutes = {
217
194
  * @returns
218
195
  */
219
196
  function validateBodyForO(route, body) {
220
- return (0, validate_1.validateBody)(body, validatorsForAllRoutes[route]);
197
+ if (typeof body !== "object" || body === null) {
198
+ throw new ValidationError(400, "Le payload est requis");
199
+ }
200
+ const schema = schemasForAllRoutes[route];
201
+ const parsed = schema.safeParse(body);
202
+ if (!parsed.success) {
203
+ throwFromZodError(parsed.error);
204
+ }
205
+ const input = body;
206
+ const result = {};
207
+ for (const key of Object.keys(schema.shape)) {
208
+ if (input[key] !== undefined) {
209
+ result[key] = input[key];
210
+ }
211
+ }
212
+ return result;
213
+ }
214
+ /**
215
+ * Custom error class to handle validation errors.
216
+ */
217
+ class ValidationError extends Error {
218
+ code;
219
+ /**
220
+ * Creates a new ValidationError.
221
+ * @param code - The HTTP status code.
222
+ * @param message - The error message.
223
+ */
224
+ constructor(code, message) {
225
+ super(message);
226
+ this.code = code;
227
+ }
221
228
  }
229
+ exports.ValidationError = ValidationError;
package/build/const.d.ts CHANGED
@@ -1,6 +1,10 @@
1
- import { TAvailability, TPlan, TProjectStatus, TSkill } from "./db.model";
1
+ import { TAmbition, TAvailability, TIndustry, TPlan, TProductType, TProjectStatus, TSkill, TVisibility } from "./db.model";
2
2
  export declare const EMAIL = "contact@cofondateurauchomage.fr";
3
3
  export declare const SKILLS: TSkill[];
4
4
  export declare const PROJECT_STATUS: TProjectStatus[];
5
5
  export declare const PLANS: TPlan[];
6
+ export declare const VISIBILITIES: TVisibility[];
6
7
  export declare const AVAILABILITY: TAvailability[];
8
+ export declare const AMBITIONS: TAmbition[];
9
+ export declare const PRODUCT_TYPES: TProductType[];
10
+ export declare const INDUSTRIES: TIndustry[];
package/build/const.js CHANGED
@@ -1,14 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AVAILABILITY = exports.PLANS = exports.PROJECT_STATUS = exports.SKILLS = exports.EMAIL = void 0;
3
+ exports.INDUSTRIES = exports.PRODUCT_TYPES = exports.AMBITIONS = exports.AVAILABILITY = exports.VISIBILITIES = exports.PLANS = exports.PROJECT_STATUS = exports.SKILLS = exports.EMAIL = void 0;
4
4
  exports.EMAIL = "contact@cofondateurauchomage.fr";
5
5
  exports.SKILLS = [
6
+ "Tech",
7
+ "Growth",
6
8
  "Sales",
9
+ "Marketing",
7
10
  "Operation",
8
11
  "Design",
9
- "Marketing",
10
12
  "Produit",
11
- "Tech",
13
+ "Finance",
12
14
  ];
13
15
  exports.PROJECT_STATUS = [
14
16
  "idea",
@@ -17,7 +19,35 @@ exports.PROJECT_STATUS = [
17
19
  "growth",
18
20
  ];
19
21
  exports.PLANS = ["free", "pro"];
22
+ exports.VISIBILITIES = ["public", "limited", "private"];
20
23
  exports.AVAILABILITY = [
21
24
  "full_time",
22
25
  "part_time",
23
26
  ];
27
+ exports.AMBITIONS = [
28
+ "side_project",
29
+ "small_team",
30
+ "startup",
31
+ "other",
32
+ ];
33
+ exports.PRODUCT_TYPES = [
34
+ "saas",
35
+ "marketplace",
36
+ "service",
37
+ "app",
38
+ "ecommerce",
39
+ "media",
40
+ "hardware",
41
+ "other",
42
+ ];
43
+ exports.INDUSTRIES = [
44
+ "ai",
45
+ "fintech",
46
+ "hr",
47
+ "healthcare",
48
+ "climate",
49
+ "proptech",
50
+ "retail",
51
+ "edtech",
52
+ "other",
53
+ ];
@@ -10,11 +10,14 @@ export declare enum Collections {
10
10
  visits = "visits",
11
11
  blogHtmlArticles = "blog_html_articles"
12
12
  }
13
- export type TSkill = "Sales" | "Operation" | "Design" | "Marketing" | "Produit" | "Tech";
13
+ export type TSkill = "Sales" | "Operation" | "Design" | "Marketing" | "Produit" | "Tech" | "Growth" | "Finance";
14
14
  export type TPlan = "free" | "pro" | "premium";
15
15
  export type TVisibility = "public" | "limited" | "private";
16
16
  export type TProjectStatus = "idea" | "creation" | "launch" | "growth";
17
17
  export type TAvailability = "full_time" | "part_time";
18
+ export type TAmbition = "side_project" | "small_team" | "startup" | "other";
19
+ export type TProductType = "saas" | "marketplace" | "service" | "app" | "ecommerce" | "media" | "hardware" | "other";
20
+ export type TIndustry = "ai" | "fintech" | "hr" | "healthcare" | "climate" | "proptech" | "retail" | "edtech" | "other";
18
21
  export interface IClicks {
19
22
  linkedin: number;
20
23
  email: number;
@@ -23,22 +26,24 @@ export interface IClicks {
23
26
  website: number;
24
27
  }
25
28
  export interface IUser {
26
- id: string;
27
29
  lastName: string;
28
30
  firstName: string;
29
31
  skills: TSkill[];
30
32
  yearsOfExperience?: number;
31
- zipCode: number;
33
+ availability?: TAvailability;
32
34
  city: string;
33
35
  invest?: number;
34
- joblessDate?: string;
35
36
  motivations?: string;
36
37
  partner?: string;
37
38
  business: string;
38
- availability?: TAvailability;
39
+ bestStrength?: string;
40
+ projectStatus?: TProjectStatus[];
41
+ ambitions?: TAmbition[];
42
+ productTypes?: TProductType[];
43
+ industries?: TIndustry[];
39
44
  photo?: string;
45
+ id: string;
40
46
  plan: TPlan;
41
- active?: boolean;
42
47
  visibility: TVisibility;
43
48
  clicks: IClicks;
44
49
  creationDate: number;
@@ -47,33 +52,34 @@ export interface IUser {
47
52
  referrer?: string;
48
53
  }
49
54
  export interface IProject {
50
- id: string;
51
55
  name: string;
52
56
  lastName: string;
53
57
  firstName: string;
58
+ description: string;
59
+ status?: TProjectStatus;
60
+ status_detail?: string;
61
+ turnover?: number;
62
+ ambitions?: TAmbition[];
63
+ productTypes?: TProductType[];
64
+ industries?: TIndustry[];
54
65
  skills: TSkill[];
55
66
  yearsOfExperience?: number;
56
- zipCode: number;
67
+ availability?: TAvailability;
57
68
  city: string;
58
69
  invest?: number;
59
- status?: TProjectStatus;
60
- status_detail?: string;
61
- turnover?: number;
62
- description: string;
63
70
  partner?: string;
64
- availability?: TAvailability;
65
71
  logo?: string;
72
+ id: string;
66
73
  plan: TPlan;
67
- active?: boolean;
68
74
  visibility: TVisibility;
69
75
  clicks: IClicks;
70
76
  creationDate: number;
71
77
  lastConnection: number;
72
78
  stripeId?: string;
73
- partner_swanbase?: boolean;
74
- partner_iii?: boolean;
75
79
  referrer?: string;
76
80
  postedOnLinkedInAt?: number;
81
+ partner_swanbase?: boolean;
82
+ partner_iii?: boolean;
77
83
  }
78
84
  export interface IContact {
79
85
  email: string;
@@ -102,7 +108,7 @@ export interface INotification {
102
108
  body?: string;
103
109
  link?: string;
104
110
  }
105
- export type IProspect = Partial<Omit<IUser, "id" | "plan" | "visibility" | "clicks" | "lastConnection" | "likes" | "stripeId" | "active" | "photo">> & Partial<Omit<IProject, "id" | "plan" | "visibility" | "clicks" | "creationDate" | "lastConnection" | "likes" | "stripeId" | "active" | "logo" | "postedOnLinkedInAt">> & Partial<IContact> & {
111
+ export type IProspect = Partial<Omit<IUser, "id" | "plan" | "visibility" | "clicks" | "lastConnection" | "stripeId" | "photo">> & Partial<Omit<IProject, "id" | "plan" | "visibility" | "clicks" | "lastConnection" | "stripeId" | "logo" | "postedOnLinkedInAt">> & Partial<IContact> & {
106
112
  email: string;
107
113
  };
108
114
  export type IReactionStatus = "like" | "dislike";
package/build/index.d.ts CHANGED
@@ -4,4 +4,3 @@ export * from "./const";
4
4
  export * from "./db.model";
5
5
  export * from "./regex";
6
6
  export * from "./utils";
7
- export * from "./validate";
package/build/index.js CHANGED
@@ -20,4 +20,3 @@ __exportStar(require("./const"), exports);
20
20
  __exportStar(require("./db.model"), exports);
21
21
  __exportStar(require("./regex"), exports);
22
22
  __exportStar(require("./utils"), exports);
23
- __exportStar(require("./validate"), exports);
@@ -56,6 +56,10 @@ export declare const isBoolean: () => Validator;
56
56
  * Create a new validator for an array.
57
57
  */
58
58
  export declare const isArray: () => Validator;
59
+ /**
60
+ * Create a new validator for an array of a given type.
61
+ */
62
+ export declare const isArrayOf: <T>(validator: Validator) => Validator;
59
63
  /**
60
64
  * Creates a new validator that tests a string value against a given regex pattern.
61
65
  * @param pattern - The regex pattern to test.
package/build/validate.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  //////////////
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.ValidationError = exports.isMatchEnum = exports.isMatchRegex = exports.isArray = exports.isBoolean = exports.isString = exports.isNumber = exports.Validator = void 0;
4
+ exports.ValidationError = exports.isMatchEnum = exports.isMatchRegex = exports.isArrayOf = exports.isArray = exports.isBoolean = exports.isString = exports.isNumber = exports.Validator = void 0;
5
5
  exports.validateBody = validateBody;
6
6
  const utils_1 = require("./utils");
7
7
  const arrayUtils_1 = require("./utils/arrayUtils");
@@ -110,6 +110,11 @@ exports.isBoolean = isBoolean;
110
110
  */
111
111
  const isArray = () => new Validator((value) => Array.isArray(value));
112
112
  exports.isArray = isArray;
113
+ /**
114
+ * Create a new validator for an array of a given type.
115
+ */
116
+ const isArrayOf = (validator) => new Validator((value) => Array.isArray(value) && value.every(validator.validate));
117
+ exports.isArrayOf = isArrayOf;
113
118
  /**
114
119
  * Creates a new validator that tests a string value against a given regex pattern.
115
120
  * @param pattern - The regex pattern to test.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cofondateurauchomage/libs",
3
- "version": "1.1.113",
3
+ "version": "1.1.114",
4
4
  "description": "",
5
5
  "main": "build/index",
6
6
  "scripts": {
@@ -22,5 +22,8 @@
22
22
  },
23
23
  "files": [
24
24
  "build"
25
- ]
25
+ ],
26
+ "dependencies": {
27
+ "zod": "^4.3.6"
28
+ }
26
29
  }