@ecomiq/core 0.1.2 → 0.1.5

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 (39) hide show
  1. package/dist/api.cjs +19 -5
  2. package/dist/api.cjs.map +1 -1
  3. package/dist/api.js +19 -5
  4. package/dist/api.js.map +1 -1
  5. package/dist/client-4ZTG2RZ3.d.ts +195 -0
  6. package/dist/client-BpX4yR6S.d.cts +195 -0
  7. package/dist/client.cjs +324 -10
  8. package/dist/client.cjs.map +1 -1
  9. package/dist/client.d.cts +13 -83
  10. package/dist/client.d.ts +13 -83
  11. package/dist/client.js +324 -10
  12. package/dist/client.js.map +1 -1
  13. package/dist/index.cjs +475 -10
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +4 -1
  16. package/dist/index.d.ts +4 -1
  17. package/dist/index.js +444 -11
  18. package/dist/index.js.map +1 -1
  19. package/dist/models/customer-address.cjs +41 -0
  20. package/dist/models/customer-address.cjs.map +1 -0
  21. package/dist/models/customer-address.d.cts +160 -0
  22. package/dist/models/customer-address.d.ts +160 -0
  23. package/dist/models/customer-address.js +36 -0
  24. package/dist/models/customer-address.js.map +1 -0
  25. package/dist/models/customer-order.cjs +161 -0
  26. package/dist/models/customer-order.cjs.map +1 -0
  27. package/dist/models/customer-order.d.cts +896 -0
  28. package/dist/models/customer-order.d.ts +896 -0
  29. package/dist/models/customer-order.js +149 -0
  30. package/dist/models/customer-order.js.map +1 -0
  31. package/dist/models/customer-profile.cjs +126 -0
  32. package/dist/models/customer-profile.cjs.map +1 -0
  33. package/dist/models/customer-profile.d.cts +178 -0
  34. package/dist/models/customer-profile.d.ts +178 -0
  35. package/dist/models/customer-profile.js +118 -0
  36. package/dist/models/customer-profile.js.map +1 -0
  37. package/dist/models/settings.d.cts +284 -284
  38. package/dist/models/settings.d.ts +284 -284
  39. package/package.json +16 -1
@@ -0,0 +1,178 @@
1
+ import { z } from 'zod';
2
+
3
+ /** Cuerpo de `POST /v1/customer/register` (proxy `customer/register`). */
4
+ declare const CustomerRegisterRequestSchema: z.ZodObject<{
5
+ email: z.ZodString;
6
+ firstName: z.ZodString;
7
+ lastName: z.ZodString;
8
+ countryIsoCode: z.ZodString;
9
+ password: z.ZodString;
10
+ phone: z.ZodOptional<z.ZodString>;
11
+ }, "strip", z.ZodTypeAny, {
12
+ email: string;
13
+ firstName: string;
14
+ lastName: string;
15
+ countryIsoCode: string;
16
+ password: string;
17
+ phone?: string | undefined;
18
+ }, {
19
+ email: string;
20
+ firstName: string;
21
+ lastName: string;
22
+ countryIsoCode: string;
23
+ password: string;
24
+ phone?: string | undefined;
25
+ }>;
26
+ type CustomerRegisterRequest = z.infer<typeof CustomerRegisterRequestSchema>;
27
+ /** Cuerpo de `PATCH /v1/customer` (proxy `customer`). */
28
+ declare const CustomerProfilePatchSchema: z.ZodObject<{
29
+ firstName: z.ZodString;
30
+ lastName: z.ZodString;
31
+ phone: z.ZodString;
32
+ identificationNumber: z.ZodNullable<z.ZodString>;
33
+ identificationType: z.ZodNullable<z.ZodString>;
34
+ entityName: z.ZodNullable<z.ZodString>;
35
+ entityIdentificationNumber: z.ZodNullable<z.ZodString>;
36
+ gender: z.ZodNullable<z.ZodString>;
37
+ role: z.ZodNullable<z.ZodString>;
38
+ companyName: z.ZodNullable<z.ZodString>;
39
+ dateOfBirth: z.ZodNullable<z.ZodString>;
40
+ consent: z.ZodBoolean;
41
+ countryIsoCode: z.ZodString;
42
+ }, "strip", z.ZodTypeAny, {
43
+ gender: string | null;
44
+ phone: string;
45
+ firstName: string;
46
+ lastName: string;
47
+ countryIsoCode: string;
48
+ identificationNumber: string | null;
49
+ identificationType: string | null;
50
+ entityName: string | null;
51
+ entityIdentificationNumber: string | null;
52
+ role: string | null;
53
+ companyName: string | null;
54
+ dateOfBirth: string | null;
55
+ consent: boolean;
56
+ }, {
57
+ gender: string | null;
58
+ phone: string;
59
+ firstName: string;
60
+ lastName: string;
61
+ countryIsoCode: string;
62
+ identificationNumber: string | null;
63
+ identificationType: string | null;
64
+ entityName: string | null;
65
+ entityIdentificationNumber: string | null;
66
+ role: string | null;
67
+ companyName: string | null;
68
+ dateOfBirth: string | null;
69
+ consent: boolean;
70
+ }>;
71
+ type CustomerProfilePatch = z.infer<typeof CustomerProfilePatchSchema>;
72
+ /** Perfil mostrado en cuenta (subset de GET customer). */
73
+ declare const CustomerProfileSchema: z.ZodObject<{
74
+ firstName: z.ZodString;
75
+ lastName: z.ZodString;
76
+ phone: z.ZodString;
77
+ email: z.ZodString;
78
+ identificationNumber: z.ZodNullable<z.ZodString>;
79
+ identificationType: z.ZodNullable<z.ZodString>;
80
+ countryIsoCode: z.ZodString;
81
+ consent: z.ZodBoolean;
82
+ entityName: z.ZodNullable<z.ZodString>;
83
+ entityIdentificationNumber: z.ZodNullable<z.ZodString>;
84
+ gender: z.ZodNullable<z.ZodString>;
85
+ role: z.ZodNullable<z.ZodString>;
86
+ companyName: z.ZodNullable<z.ZodString>;
87
+ dateOfBirth: z.ZodNullable<z.ZodString>;
88
+ }, "strip", z.ZodTypeAny, {
89
+ gender: string | null;
90
+ phone: string;
91
+ email: string;
92
+ firstName: string;
93
+ lastName: string;
94
+ countryIsoCode: string;
95
+ identificationNumber: string | null;
96
+ identificationType: string | null;
97
+ entityName: string | null;
98
+ entityIdentificationNumber: string | null;
99
+ role: string | null;
100
+ companyName: string | null;
101
+ dateOfBirth: string | null;
102
+ consent: boolean;
103
+ }, {
104
+ gender: string | null;
105
+ phone: string;
106
+ email: string;
107
+ firstName: string;
108
+ lastName: string;
109
+ countryIsoCode: string;
110
+ identificationNumber: string | null;
111
+ identificationType: string | null;
112
+ entityName: string | null;
113
+ entityIdentificationNumber: string | null;
114
+ role: string | null;
115
+ companyName: string | null;
116
+ dateOfBirth: string | null;
117
+ consent: boolean;
118
+ }>;
119
+ type CustomerProfile = z.infer<typeof CustomerProfileSchema>;
120
+ /** Respuesta de `GET /v1/customer/me` (proxy `customer`). */
121
+ declare const CustomerMeSchema: z.ZodObject<{
122
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
123
+ storeId: z.ZodOptional<z.ZodString>;
124
+ email: z.ZodString;
125
+ firstName: z.ZodString;
126
+ lastName: z.ZodString;
127
+ phone: z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>, string, string | null | undefined>;
128
+ identificationNumber: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
129
+ identificationType: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
130
+ entityName: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
131
+ entityIdentificationNumber: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
132
+ gender: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
133
+ role: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
134
+ companyName: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
135
+ dateOfBirth: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
136
+ countryIsoCode: z.ZodEffects<z.ZodOptional<z.ZodString>, string, string | undefined>;
137
+ consent: z.ZodEffects<z.ZodOptional<z.ZodBoolean>, boolean, boolean | undefined>;
138
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
139
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
140
+ storeId: z.ZodOptional<z.ZodString>;
141
+ email: z.ZodString;
142
+ firstName: z.ZodString;
143
+ lastName: z.ZodString;
144
+ phone: z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>, string, string | null | undefined>;
145
+ identificationNumber: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
146
+ identificationType: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
147
+ entityName: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
148
+ entityIdentificationNumber: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
149
+ gender: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
150
+ role: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
151
+ companyName: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
152
+ dateOfBirth: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
153
+ countryIsoCode: z.ZodEffects<z.ZodOptional<z.ZodString>, string, string | undefined>;
154
+ consent: z.ZodEffects<z.ZodOptional<z.ZodBoolean>, boolean, boolean | undefined>;
155
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
156
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
157
+ storeId: z.ZodOptional<z.ZodString>;
158
+ email: z.ZodString;
159
+ firstName: z.ZodString;
160
+ lastName: z.ZodString;
161
+ phone: z.ZodEffects<z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>, string, string | null | undefined>;
162
+ identificationNumber: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
163
+ identificationType: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
164
+ entityName: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
165
+ entityIdentificationNumber: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
166
+ gender: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
167
+ role: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
168
+ companyName: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
169
+ dateOfBirth: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodString>>, string | null, string | null | undefined>;
170
+ countryIsoCode: z.ZodEffects<z.ZodOptional<z.ZodString>, string, string | undefined>;
171
+ consent: z.ZodEffects<z.ZodOptional<z.ZodBoolean>, boolean, boolean | undefined>;
172
+ }, z.ZodTypeAny, "passthrough">>;
173
+ type CustomerMe = z.infer<typeof CustomerMeSchema>;
174
+ declare function customerMeToProfile(me: CustomerMe): CustomerProfile;
175
+ declare function customerMeToProfilePatch(me: CustomerMe): CustomerProfilePatch;
176
+ declare function customerProfileToPatch(profile: CustomerProfile): CustomerProfilePatch;
177
+
178
+ export { type CustomerMe, CustomerMeSchema, type CustomerProfile, type CustomerProfilePatch, CustomerProfilePatchSchema, CustomerProfileSchema, type CustomerRegisterRequest, CustomerRegisterRequestSchema, customerMeToProfile, customerMeToProfilePatch, customerProfileToPatch };
@@ -0,0 +1,118 @@
1
+ import { z } from 'zod';
2
+
3
+ // src/models/customer-profile.ts
4
+ var DEFAULT_COUNTRY_CODE = "PE";
5
+ var CustomerRegisterRequestSchema = z.object({
6
+ email: z.string().email(),
7
+ firstName: z.string().trim().min(1),
8
+ lastName: z.string().trim().min(1),
9
+ countryIsoCode: z.string().trim().length(2),
10
+ password: z.string().min(1),
11
+ phone: z.string().trim().min(1).optional()
12
+ });
13
+ var CustomerProfilePatchSchema = z.object({
14
+ firstName: z.string().trim().min(1),
15
+ lastName: z.string().trim().min(1),
16
+ phone: z.string().trim(),
17
+ identificationNumber: z.string().nullable(),
18
+ identificationType: z.string().nullable(),
19
+ entityName: z.string().nullable(),
20
+ entityIdentificationNumber: z.string().nullable(),
21
+ gender: z.string().nullable(),
22
+ role: z.string().nullable(),
23
+ companyName: z.string().nullable(),
24
+ dateOfBirth: z.string().nullable(),
25
+ consent: z.boolean(),
26
+ countryIsoCode: z.string().trim().length(2)
27
+ });
28
+ var CustomerProfileSchema = z.object({
29
+ firstName: z.string(),
30
+ lastName: z.string(),
31
+ phone: z.string(),
32
+ email: z.string().email(),
33
+ identificationNumber: z.string().nullable(),
34
+ identificationType: z.string().nullable(),
35
+ countryIsoCode: z.string(),
36
+ consent: z.boolean(),
37
+ entityName: z.string().nullable(),
38
+ entityIdentificationNumber: z.string().nullable(),
39
+ gender: z.string().nullable(),
40
+ role: z.string().nullable(),
41
+ companyName: z.string().nullable(),
42
+ dateOfBirth: z.string().nullable()
43
+ });
44
+ var nullableString = z.string().nullable().optional().transform((v) => v ?? null);
45
+ var CustomerMeSchema = z.object({
46
+ id: z.union([z.string(), z.number()]),
47
+ storeId: z.string().optional(),
48
+ email: z.string().email(),
49
+ firstName: z.string(),
50
+ lastName: z.string(),
51
+ phone: z.union([z.string(), z.null()]).optional().transform((v) => v ?? ""),
52
+ identificationNumber: nullableString,
53
+ identificationType: nullableString,
54
+ entityName: nullableString,
55
+ entityIdentificationNumber: nullableString,
56
+ gender: nullableString,
57
+ role: nullableString,
58
+ companyName: nullableString,
59
+ dateOfBirth: nullableString,
60
+ countryIsoCode: z.string().optional().transform((v) => v?.trim().length === 2 ? v.trim() : DEFAULT_COUNTRY_CODE),
61
+ consent: z.boolean().optional().transform((v) => v ?? false)
62
+ }).passthrough();
63
+ function customerMeToProfile(me) {
64
+ return CustomerProfileSchema.parse({
65
+ firstName: me.firstName,
66
+ lastName: me.lastName,
67
+ phone: me.phone,
68
+ email: me.email,
69
+ identificationNumber: me.identificationNumber,
70
+ identificationType: me.identificationType,
71
+ countryIsoCode: me.countryIsoCode,
72
+ consent: me.consent,
73
+ entityName: me.entityName,
74
+ entityIdentificationNumber: me.entityIdentificationNumber,
75
+ gender: me.gender,
76
+ role: me.role,
77
+ companyName: me.companyName,
78
+ dateOfBirth: me.dateOfBirth
79
+ });
80
+ }
81
+ function customerMeToProfilePatch(me) {
82
+ return CustomerProfilePatchSchema.parse({
83
+ firstName: me.firstName,
84
+ lastName: me.lastName,
85
+ phone: me.phone,
86
+ identificationNumber: me.identificationNumber,
87
+ identificationType: me.identificationType,
88
+ entityName: me.entityName,
89
+ entityIdentificationNumber: me.entityIdentificationNumber,
90
+ gender: me.gender,
91
+ role: me.role,
92
+ companyName: me.companyName,
93
+ dateOfBirth: me.dateOfBirth,
94
+ consent: me.consent,
95
+ countryIsoCode: me.countryIsoCode || DEFAULT_COUNTRY_CODE
96
+ });
97
+ }
98
+ function customerProfileToPatch(profile) {
99
+ return CustomerProfilePatchSchema.parse({
100
+ firstName: profile.firstName,
101
+ lastName: profile.lastName,
102
+ phone: profile.phone,
103
+ identificationNumber: profile.identificationNumber,
104
+ identificationType: profile.identificationType,
105
+ entityName: profile.entityName,
106
+ entityIdentificationNumber: profile.entityIdentificationNumber,
107
+ gender: profile.gender,
108
+ role: profile.role,
109
+ companyName: profile.companyName,
110
+ dateOfBirth: profile.dateOfBirth,
111
+ consent: profile.consent,
112
+ countryIsoCode: profile.countryIsoCode || DEFAULT_COUNTRY_CODE
113
+ });
114
+ }
115
+
116
+ export { CustomerMeSchema, CustomerProfilePatchSchema, CustomerProfileSchema, CustomerRegisterRequestSchema, customerMeToProfile, customerMeToProfilePatch, customerProfileToPatch };
117
+ //# sourceMappingURL=customer-profile.js.map
118
+ //# sourceMappingURL=customer-profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/models/customer-profile.ts"],"names":[],"mappings":";;;AAEA,IAAM,oBAAA,GAAuB,IAAA;AAGtB,IAAM,6BAAA,GAAgC,EAAE,MAAA,CAAO;AAAA,EACpD,KAAA,EAAO,CAAA,CAAE,MAAA,EAAO,CAAE,KAAA,EAAM;AAAA,EACxB,WAAW,CAAA,CAAE,MAAA,GAAS,IAAA,EAAK,CAAE,IAAI,CAAC,CAAA;AAAA,EAClC,UAAU,CAAA,CAAE,MAAA,GAAS,IAAA,E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B,MAAM,OAAA,CAAQ,IAAA;AAAA,IACd,aAAa,OAAA,CAAQ,WAAA;AAAA,IACrB,aAAa,OAAA,CAAQ,WAAA;AAAA,IACrB,SAAS,OAAA,CAAQ,OAAA;AAAA,IACjB,cAAA,EAAgB,QAAQ,cAAA,IAAkB;AAAA,GAC3C,CAAA;AACH","file":"customer-profile.js","sourcesContent":["import { z } from 'zod'\n\nconst DEFAULT_COUNTRY_CODE = 'PE'\n\n/** Cuerpo de `POST /v1/customer/register` (proxy `customer/register`). */\nexport const CustomerRegisterRequestSchema = z.object({\n email: z.string().email(),\n firstName: z.string().trim().min(1),\n lastName: z.string().trim().min(1),\n countryIsoCode: z.string().trim().length(2),\n password: z.string().min(1),\n phone: z.string().trim().min(1).optional(),\n})\n\nexport type CustomerRegisterRequest = z.infer<typeof CustomerRegisterRequestSchema>\n\n/** Cuerpo de `PATCH /v1/customer` (proxy `customer`). */\nexport const CustomerProfilePatchSchema = z.object({\n firstName: z.string().trim().min(1),\n lastName: z.string().trim().min(1),\n phone: z.string().trim(),\n identificationNumber: z.string().nullable(),\n identificationType: z.string().nullable(),\n entityName: z.string().nullable(),\n entityIdentificationNumber: z.string().nullable(),\n gender: z.string().nullable(),\n role: z.string().nullable(),\n companyName: z.string().nullable(),\n dateOfBirth: z.string().nullable(),\n consent: z.boolean(),\n countryIsoCode: z.string().trim().length(2),\n})\n\nexport type CustomerProfilePatch = z.infer<typeof CustomerProfilePatchSchema>\n\n/** Perfil mostrado en cuenta (subset de GET customer). */\nexport const CustomerProfileSchema = z.object({\n firstName: z.string(),\n lastName: z.string(),\n phone: z.string(),\n email: z.string().email(),\n identificationNumber: z.string().nullable(),\n identificationType: z.string().nullable(),\n countryIsoCode: z.string(),\n consent: z.boolean(),\n entityName: z.string().nullable(),\n entityIdentificationNumber: z.string().nullable(),\n gender: z.string().nullable(),\n role: z.string().nullable(),\n companyName: z.string().nullable(),\n dateOfBirth: z.string().nullable(),\n})\n\nexport type CustomerProfile = z.infer<typeof CustomerProfileSchema>\n\nconst nullableString = z.string().nullable().optional().transform((v) => v ?? null)\n\n/** Respuesta de `GET /v1/customer/me` (proxy `customer`). */\nexport const CustomerMeSchema = z\n .object({\n id: z.union([z.string(), z.number()]),\n storeId: z.string().optional(),\n email: z.string().email(),\n firstName: z.string(),\n lastName: z.string(),\n phone: z\n .union([z.string(), z.null()])\n .optional()\n .transform((v) => v ?? ''),\n identificationNumber: nullableString,\n identificationType: nullableString,\n entityName: nullableString,\n entityIdentificationNumber: nullableString,\n gender: nullableString,\n role: nullableString,\n companyName: nullableString,\n dateOfBirth: nullableString,\n countryIsoCode: z\n .string()\n .optional()\n .transform((v) => (v?.trim().length === 2 ? v.trim() : DEFAULT_COUNTRY_CODE)),\n consent: z.boolean().optional().transform((v) => v ?? false),\n })\n .passthrough()\n\nexport type CustomerMe = z.infer<typeof CustomerMeSchema>\n\nexport function customerMeToProfile(me: CustomerMe): CustomerProfile {\n return CustomerProfileSchema.parse({\n firstName: me.firstName,\n lastName: me.lastName,\n phone: me.phone,\n email: me.email,\n identificationNumber: me.identificationNumber,\n identificationType: me.identificationType,\n countryIsoCode: me.countryIsoCode,\n consent: me.consent,\n entityName: me.entityName,\n entityIdentificationNumber: me.entityIdentificationNumber,\n gender: me.gender,\n role: me.role,\n companyName: me.companyName,\n dateOfBirth: me.dateOfBirth,\n })\n}\n\nexport function customerMeToProfilePatch(me: CustomerMe): CustomerProfilePatch {\n return CustomerProfilePatchSchema.parse({\n firstName: me.firstName,\n lastName: me.lastName,\n phone: me.phone,\n identificationNumber: me.identificationNumber,\n identificationType: me.identificationType,\n entityName: me.entityName,\n entityIdentificationNumber: me.entityIdentificationNumber,\n gender: me.gender,\n role: me.role,\n companyName: me.companyName,\n dateOfBirth: me.dateOfBirth,\n consent: me.consent,\n countryIsoCode: me.countryIsoCode || DEFAULT_COUNTRY_CODE,\n })\n}\n\nexport function customerProfileToPatch(profile: CustomerProfile): CustomerProfilePatch {\n return CustomerProfilePatchSchema.parse({\n firstName: profile.firstName,\n lastName: profile.lastName,\n phone: profile.phone,\n identificationNumber: profile.identificationNumber,\n identificationType: profile.identificationType,\n entityName: profile.entityName,\n entityIdentificationNumber: profile.entityIdentificationNumber,\n gender: profile.gender,\n role: profile.role,\n companyName: profile.companyName,\n dateOfBirth: profile.dateOfBirth,\n consent: profile.consent,\n countryIsoCode: profile.countryIsoCode || DEFAULT_COUNTRY_CODE,\n })\n}\n"]}