@vulog/aima-user 1.2.1 → 1.2.3
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/README.md +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -8
- package/dist/index.mjs +9 -8
- package/package.json +4 -4
- package/src/registerUserToService.ts +6 -6
- package/src/types.ts +1 -0
- package/src/updateProfilePersonalInfo.ts +1 -1
package/README.md
CHANGED
|
@@ -219,15 +219,15 @@ const result = await setServicesStatus(client, {
|
|
|
219
219
|
|
|
220
220
|
#### registerUserToService
|
|
221
221
|
|
|
222
|
-
Register a user
|
|
222
|
+
Register a user entity to a specific service it's optional if the service is public (users are subscribed by default to public services). but mandatory to be able to book on a private service.
|
|
223
223
|
|
|
224
224
|
```javascript
|
|
225
|
-
await registerUserToService(client, '
|
|
225
|
+
await registerUserToService(client, 'entity-uuid-here', 'service-uuid-here');
|
|
226
226
|
```
|
|
227
227
|
|
|
228
228
|
**Parameters:**
|
|
229
229
|
- `client`: AIMA client instance
|
|
230
|
-
- `
|
|
230
|
+
- `entityId`: Entity UUID to register
|
|
231
231
|
- `serviceId`: Service UUID to register the profile to
|
|
232
232
|
|
|
233
233
|
## Types
|
package/dist/index.d.mts
CHANGED
|
@@ -91,7 +91,7 @@ type User = {
|
|
|
91
91
|
};
|
|
92
92
|
type UserUpdateBody = Partial<Omit<User, 'id' | 'fleetId' | 'agreements' | 'profiles' | 'surveyConsentUpdateDate' | 'shareDataConsentUpdateDate' | 'profilingConsentUpdateDate'>>;
|
|
93
93
|
declare const personalInformationUserTypes: readonly ["IDENTITY", "USERNAME", "BIRTH", "NATIONALITY", "NOTES", "GENDER", "PERSONAL_COMPANY", "FISCAL", "ADDRESS", "MEMBERSHIP"];
|
|
94
|
-
declare const personalInformationUserPaths: readonly ["/identity/firstName", "/identity/lastName", "/identity/middleName", "/identity/preferredName", "/birth/birthDate", "/birth/countryBirth", "/birth/provinceBirth", "/birth/cityBirth", "/nationality", "/notes", "/gender", "/personalCompany/companyName", "/personalCompany/companyVat", "/personalCompany/companyAddress/streetName", "/personalCompany/companyAddress/city", "/personalCompany/companyAddress/postalCode", "/personalCompany/companyAddress/region", "/personalCompany/companyAddress/country", "/personalCompany/companyAddress/number", "/personalCompany/companyAddress/addressAdditionalInformation", "/fiscalInformation/fiscal", "/fiscalInformation/personalVatNumber", "/fiscalInformation/sdi", "/fiscalInformation/pecAddress", "/fiscalInformation/marketReference", "/address/streetName", "/address/city", "/address/postalCode", "/address/region", "/address/country", "/address/number", "/address/addressAdditionalInformation", "/membership"];
|
|
94
|
+
declare const personalInformationUserPaths: readonly ["/identity/firstName", "/identity/lastName", "/identity/middleName", "/identity/preferredName", "/birth/birthDate", "/birth/countryBirth", "/birth/provinceBirth", "/birth/cityBirth", "/nationality", "/notes", "/gender", "/personalCompany/companyName", "/personalCompany/companyVat", "/personalCompany/companyAddress/streetName", "/personalCompany/companyAddress/city", "/personalCompany/companyAddress/postalCode", "/personalCompany/companyAddress/region", "/personalCompany/companyAddress/country", "/personalCompany/companyAddress/number", "/personalCompany/companyAddress/addressAdditionalInformation", "/fiscalInformation/fiscal", "/fiscalInformation/personalVatNumber", "/fiscalInformation/sdi", "/fiscalInformation/pecAddress", "/fiscalInformation/marketReference", "/address/streetName", "/address/city", "/address/postalCode", "/address/region", "/address/country", "/address/number", "/address/addressAdditionalInformation", "/membership", "/idNumber"];
|
|
95
95
|
type PersonalInformationUserType = (typeof personalInformationUserTypes)[number];
|
|
96
96
|
declare const personalInformationUserTypeSchema: z.ZodEnum<["IDENTITY", "USERNAME", "BIRTH", "NATIONALITY", "NOTES", "GENDER", "PERSONAL_COMPANY", "FISCAL", "ADDRESS", "MEMBERSHIP"]>;
|
|
97
97
|
declare const personalInformationProfileTypes: readonly ["ID_NUMBER", "PHONE_NUMBER", "EMAIL", "BILLING_ADDRESS"];
|
|
@@ -259,9 +259,9 @@ declare const schema: z.ZodObject<{
|
|
|
259
259
|
type ServicesUpdate = z.infer<typeof schema>;
|
|
260
260
|
declare const setServicesStatus: (client: Client, profileId: string, servicesUpdate: ServicesUpdate) => Promise<void>;
|
|
261
261
|
|
|
262
|
-
declare const registerUserToService: (client: Client,
|
|
262
|
+
declare const registerUserToService: (client: Client, entityId: string, serviceId: string) => Promise<void>;
|
|
263
263
|
|
|
264
|
-
declare const paths: readonly ["/phoneNumber", "/email"];
|
|
264
|
+
declare const paths: readonly ["/phoneNumber", "/email", "/idNumber"];
|
|
265
265
|
type Paths$1 = (typeof paths)[number];
|
|
266
266
|
declare const updateProfilePersonalInfo: (client: Client, userId: string, profileId: string, actions: PatchAction<Paths$1>[]) => Promise<void>;
|
|
267
267
|
|
package/dist/index.d.ts
CHANGED
|
@@ -91,7 +91,7 @@ type User = {
|
|
|
91
91
|
};
|
|
92
92
|
type UserUpdateBody = Partial<Omit<User, 'id' | 'fleetId' | 'agreements' | 'profiles' | 'surveyConsentUpdateDate' | 'shareDataConsentUpdateDate' | 'profilingConsentUpdateDate'>>;
|
|
93
93
|
declare const personalInformationUserTypes: readonly ["IDENTITY", "USERNAME", "BIRTH", "NATIONALITY", "NOTES", "GENDER", "PERSONAL_COMPANY", "FISCAL", "ADDRESS", "MEMBERSHIP"];
|
|
94
|
-
declare const personalInformationUserPaths: readonly ["/identity/firstName", "/identity/lastName", "/identity/middleName", "/identity/preferredName", "/birth/birthDate", "/birth/countryBirth", "/birth/provinceBirth", "/birth/cityBirth", "/nationality", "/notes", "/gender", "/personalCompany/companyName", "/personalCompany/companyVat", "/personalCompany/companyAddress/streetName", "/personalCompany/companyAddress/city", "/personalCompany/companyAddress/postalCode", "/personalCompany/companyAddress/region", "/personalCompany/companyAddress/country", "/personalCompany/companyAddress/number", "/personalCompany/companyAddress/addressAdditionalInformation", "/fiscalInformation/fiscal", "/fiscalInformation/personalVatNumber", "/fiscalInformation/sdi", "/fiscalInformation/pecAddress", "/fiscalInformation/marketReference", "/address/streetName", "/address/city", "/address/postalCode", "/address/region", "/address/country", "/address/number", "/address/addressAdditionalInformation", "/membership"];
|
|
94
|
+
declare const personalInformationUserPaths: readonly ["/identity/firstName", "/identity/lastName", "/identity/middleName", "/identity/preferredName", "/birth/birthDate", "/birth/countryBirth", "/birth/provinceBirth", "/birth/cityBirth", "/nationality", "/notes", "/gender", "/personalCompany/companyName", "/personalCompany/companyVat", "/personalCompany/companyAddress/streetName", "/personalCompany/companyAddress/city", "/personalCompany/companyAddress/postalCode", "/personalCompany/companyAddress/region", "/personalCompany/companyAddress/country", "/personalCompany/companyAddress/number", "/personalCompany/companyAddress/addressAdditionalInformation", "/fiscalInformation/fiscal", "/fiscalInformation/personalVatNumber", "/fiscalInformation/sdi", "/fiscalInformation/pecAddress", "/fiscalInformation/marketReference", "/address/streetName", "/address/city", "/address/postalCode", "/address/region", "/address/country", "/address/number", "/address/addressAdditionalInformation", "/membership", "/idNumber"];
|
|
95
95
|
type PersonalInformationUserType = (typeof personalInformationUserTypes)[number];
|
|
96
96
|
declare const personalInformationUserTypeSchema: z.ZodEnum<["IDENTITY", "USERNAME", "BIRTH", "NATIONALITY", "NOTES", "GENDER", "PERSONAL_COMPANY", "FISCAL", "ADDRESS", "MEMBERSHIP"]>;
|
|
97
97
|
declare const personalInformationProfileTypes: readonly ["ID_NUMBER", "PHONE_NUMBER", "EMAIL", "BILLING_ADDRESS"];
|
|
@@ -259,9 +259,9 @@ declare const schema: z.ZodObject<{
|
|
|
259
259
|
type ServicesUpdate = z.infer<typeof schema>;
|
|
260
260
|
declare const setServicesStatus: (client: Client, profileId: string, servicesUpdate: ServicesUpdate) => Promise<void>;
|
|
261
261
|
|
|
262
|
-
declare const registerUserToService: (client: Client,
|
|
262
|
+
declare const registerUserToService: (client: Client, entityId: string, serviceId: string) => Promise<void>;
|
|
263
263
|
|
|
264
|
-
declare const paths: readonly ["/phoneNumber", "/email"];
|
|
264
|
+
declare const paths: readonly ["/phoneNumber", "/email", "/idNumber"];
|
|
265
265
|
type Paths$1 = (typeof paths)[number];
|
|
266
266
|
declare const updateProfilePersonalInfo: (client: Client, userId: string, profileId: string, actions: PatchAction<Paths$1>[]) => Promise<void>;
|
|
267
267
|
|
package/dist/index.js
CHANGED
|
@@ -207,7 +207,8 @@ var personalInformationUserPaths = [
|
|
|
207
207
|
"/address/country",
|
|
208
208
|
"/address/number",
|
|
209
209
|
"/address/addressAdditionalInformation",
|
|
210
|
-
"/membership"
|
|
210
|
+
"/membership",
|
|
211
|
+
"/idNumber"
|
|
211
212
|
];
|
|
212
213
|
var personalInformationUserTypeSchema = import_zod5.z.enum(personalInformationUserTypes);
|
|
213
214
|
var personalInformationProfileTypes = ["ID_NUMBER", "PHONE_NUMBER", "EMAIL", "BILLING_ADDRESS"];
|
|
@@ -401,11 +402,11 @@ var setServicesStatus = async (client, profileId, servicesUpdate) => {
|
|
|
401
402
|
|
|
402
403
|
// src/registerUserToService.ts
|
|
403
404
|
var import_zod14 = require("zod");
|
|
404
|
-
var registerUserToService = async (client,
|
|
405
|
-
const
|
|
406
|
-
if (!
|
|
407
|
-
throw new TypeError("Invalid
|
|
408
|
-
cause:
|
|
405
|
+
var registerUserToService = async (client, entityId, serviceId) => {
|
|
406
|
+
const resultEntityId = import_zod14.z.string().uuid().safeParse(entityId);
|
|
407
|
+
if (!resultEntityId.success) {
|
|
408
|
+
throw new TypeError("Invalid entityId", {
|
|
409
|
+
cause: resultEntityId.error.issues
|
|
409
410
|
});
|
|
410
411
|
}
|
|
411
412
|
const resultServiceId = import_zod14.z.string().uuid().safeParse(serviceId);
|
|
@@ -415,13 +416,13 @@ var registerUserToService = async (client, profileId, serviceId) => {
|
|
|
415
416
|
});
|
|
416
417
|
}
|
|
417
418
|
await client.put(
|
|
418
|
-
`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/
|
|
419
|
+
`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/entities/${entityId}/services/${serviceId}`
|
|
419
420
|
);
|
|
420
421
|
};
|
|
421
422
|
|
|
422
423
|
// src/updateProfilePersonalInfo.ts
|
|
423
424
|
var import_zod15 = require("zod");
|
|
424
|
-
var paths = ["/phoneNumber", "/email"];
|
|
425
|
+
var paths = ["/phoneNumber", "/email", "/idNumber"];
|
|
425
426
|
var schema5 = import_zod15.z.object({
|
|
426
427
|
userId: import_zod15.z.string().trim().min(1).uuid(),
|
|
427
428
|
profileId: import_zod15.z.string().trim().min(1).uuid(),
|
package/dist/index.mjs
CHANGED
|
@@ -155,7 +155,8 @@ var personalInformationUserPaths = [
|
|
|
155
155
|
"/address/country",
|
|
156
156
|
"/address/number",
|
|
157
157
|
"/address/addressAdditionalInformation",
|
|
158
|
-
"/membership"
|
|
158
|
+
"/membership",
|
|
159
|
+
"/idNumber"
|
|
159
160
|
];
|
|
160
161
|
var personalInformationUserTypeSchema = z5.enum(personalInformationUserTypes);
|
|
161
162
|
var personalInformationProfileTypes = ["ID_NUMBER", "PHONE_NUMBER", "EMAIL", "BILLING_ADDRESS"];
|
|
@@ -349,11 +350,11 @@ var setServicesStatus = async (client, profileId, servicesUpdate) => {
|
|
|
349
350
|
|
|
350
351
|
// src/registerUserToService.ts
|
|
351
352
|
import { z as z14 } from "zod";
|
|
352
|
-
var registerUserToService = async (client,
|
|
353
|
-
const
|
|
354
|
-
if (!
|
|
355
|
-
throw new TypeError("Invalid
|
|
356
|
-
cause:
|
|
353
|
+
var registerUserToService = async (client, entityId, serviceId) => {
|
|
354
|
+
const resultEntityId = z14.string().uuid().safeParse(entityId);
|
|
355
|
+
if (!resultEntityId.success) {
|
|
356
|
+
throw new TypeError("Invalid entityId", {
|
|
357
|
+
cause: resultEntityId.error.issues
|
|
357
358
|
});
|
|
358
359
|
}
|
|
359
360
|
const resultServiceId = z14.string().uuid().safeParse(serviceId);
|
|
@@ -363,13 +364,13 @@ var registerUserToService = async (client, profileId, serviceId) => {
|
|
|
363
364
|
});
|
|
364
365
|
}
|
|
365
366
|
await client.put(
|
|
366
|
-
`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/
|
|
367
|
+
`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/entities/${entityId}/services/${serviceId}`
|
|
367
368
|
);
|
|
368
369
|
};
|
|
369
370
|
|
|
370
371
|
// src/updateProfilePersonalInfo.ts
|
|
371
372
|
import { z as z15 } from "zod";
|
|
372
|
-
var paths = ["/phoneNumber", "/email"];
|
|
373
|
+
var paths = ["/phoneNumber", "/email", "/idNumber"];
|
|
373
374
|
var schema5 = z15.object({
|
|
374
375
|
userId: z15.string().trim().min(1).uuid(),
|
|
375
376
|
profileId: z15.string().trim().min(1).uuid(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vulog/aima-user",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"author": "Vulog",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@vulog/aima-client": "1.2.
|
|
23
|
-
"@vulog/aima-config": "1.2.
|
|
24
|
-
"@vulog/aima-core": "1.2.
|
|
22
|
+
"@vulog/aima-client": "1.2.3",
|
|
23
|
+
"@vulog/aima-config": "1.2.3",
|
|
24
|
+
"@vulog/aima-core": "1.2.3"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"zod": "^3.25.76"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Client } from '@vulog/aima-client';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
|
-
export const registerUserToService = async (client: Client,
|
|
5
|
-
const
|
|
6
|
-
if (!
|
|
7
|
-
throw new TypeError('Invalid
|
|
8
|
-
cause:
|
|
4
|
+
export const registerUserToService = async (client: Client, entityId: string, serviceId: string): Promise<void> => {
|
|
5
|
+
const resultEntityId = z.string().uuid().safeParse(entityId);
|
|
6
|
+
if (!resultEntityId.success) {
|
|
7
|
+
throw new TypeError('Invalid entityId', {
|
|
8
|
+
cause: resultEntityId.error.issues,
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -17,6 +17,6 @@ export const registerUserToService = async (client: Client, profileId: string, s
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
await client.put(
|
|
20
|
-
`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/
|
|
20
|
+
`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/entities/${entityId}/services/${serviceId}`
|
|
21
21
|
);
|
|
22
22
|
};
|
package/src/types.ts
CHANGED
|
@@ -162,6 +162,7 @@ export const personalInformationUserPaths = [
|
|
|
162
162
|
'/address/number',
|
|
163
163
|
'/address/addressAdditionalInformation',
|
|
164
164
|
'/membership',
|
|
165
|
+
'/idNumber',
|
|
165
166
|
] as const;
|
|
166
167
|
|
|
167
168
|
export type PersonalInformationUserType = (typeof personalInformationUserTypes)[number];
|
|
@@ -2,7 +2,7 @@ import { Client } from '@vulog/aima-client';
|
|
|
2
2
|
import { PatchAction } from '@vulog/aima-core';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
-
const paths = ['/phoneNumber', '/email'] as const;
|
|
5
|
+
const paths = ['/phoneNumber', '/email', '/idNumber'] as const;
|
|
6
6
|
type Paths = (typeof paths)[number];
|
|
7
7
|
|
|
8
8
|
const schema = z.object({
|