@vulog/aima-user 1.1.99 → 1.2.2
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 +13 -0
- package/dist/index.d.mts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +67 -44
- package/dist/index.mjs +66 -44
- package/package.json +5 -5
- package/src/index.ts +1 -0
- package/src/registerUserToService.ts +22 -0
- package/src/types.ts +1 -0
- package/src/updateProfilePersonalInfo.ts +1 -1
package/README.md
CHANGED
|
@@ -217,6 +217,19 @@ const result = await setServicesStatus(client, {
|
|
|
217
217
|
});
|
|
218
218
|
```
|
|
219
219
|
|
|
220
|
+
#### registerUserToService
|
|
221
|
+
|
|
222
|
+
Register a user profile 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
|
+
|
|
224
|
+
```javascript
|
|
225
|
+
await registerUserToService(client, 'profile-uuid-here', 'service-uuid-here');
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
**Parameters:**
|
|
229
|
+
- `client`: AIMA client instance
|
|
230
|
+
- `profileId`: Profile UUID to register
|
|
231
|
+
- `serviceId`: Service UUID to register the profile to
|
|
232
|
+
|
|
220
233
|
## Types
|
|
221
234
|
|
|
222
235
|
### User
|
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,7 +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
|
|
262
|
+
declare const registerUserToService: (client: Client, profileId: string, serviceId: string) => Promise<void>;
|
|
263
|
+
|
|
264
|
+
declare const paths: readonly ["/phoneNumber", "/email", "/idNumber"];
|
|
263
265
|
type Paths$1 = (typeof paths)[number];
|
|
264
266
|
declare const updateProfilePersonalInfo: (client: Client, userId: string, profileId: string, actions: PatchAction<Paths$1>[]) => Promise<void>;
|
|
265
267
|
|
|
@@ -274,4 +276,4 @@ declare const getFleetBillingGroups: (client: Client, options?: PaginableOptions
|
|
|
274
276
|
|
|
275
277
|
declare const getUsersByIds: (client: Client, ids: string[]) => Promise<User[]>;
|
|
276
278
|
|
|
277
|
-
export { type AccountStatus, type Address, type BillingGroup, type CreateBusinessProfile, type CreateUser, type CreateUserOptions, type Entity, type FiscalInformation, type IndividualBusiness, type Label, type PersonalCompany, type PersonalInformationBirth, type PersonalInformationIdentity, type PersonalInformationProfile, type PersonalInformationProfileType, type PersonalInformationUser, type PersonalInformationUserType, type Profile, type ProfileServiceRegistration, type ProfileStatus, type ProfileType, type ResponseFind, type SearchType, type ServiceRegistrationWithReason, type ServiceStatus, type ServicesRegistrationList, type ServicesUpdate, type User, type UserAgreement, type UserFull, type UserProfile, type UserServiceRegistration, type UserUpdateBody, acceptTAndC, accountStatus, addLabelForUser, assignBillingGroup, createBusinessProfile, createUser, findUser, getEntity, getFleetBillingGroups, getLabelsForUser, getProfilePersonalInfoById, getRegistrationOverview, getUserById, getUserPersonalInfoById, getUsersByIds, getUsersPIByIds, personalInformationProfileTypeSchema, personalInformationProfileTypes, personalInformationUserPaths, personalInformationUserTypeSchema, personalInformationUserTypes, removeLabelForUser, setServicesStatus, updateProfilePersonalInfo, updateUser, updateUserPersonalInfo };
|
|
279
|
+
export { type AccountStatus, type Address, type BillingGroup, type CreateBusinessProfile, type CreateUser, type CreateUserOptions, type Entity, type FiscalInformation, type IndividualBusiness, type Label, type PersonalCompany, type PersonalInformationBirth, type PersonalInformationIdentity, type PersonalInformationProfile, type PersonalInformationProfileType, type PersonalInformationUser, type PersonalInformationUserType, type Profile, type ProfileServiceRegistration, type ProfileStatus, type ProfileType, type ResponseFind, type SearchType, type ServiceRegistrationWithReason, type ServiceStatus, type ServicesRegistrationList, type ServicesUpdate, type User, type UserAgreement, type UserFull, type UserProfile, type UserServiceRegistration, type UserUpdateBody, acceptTAndC, accountStatus, addLabelForUser, assignBillingGroup, createBusinessProfile, createUser, findUser, getEntity, getFleetBillingGroups, getLabelsForUser, getProfilePersonalInfoById, getRegistrationOverview, getUserById, getUserPersonalInfoById, getUsersByIds, getUsersPIByIds, personalInformationProfileTypeSchema, personalInformationProfileTypes, personalInformationUserPaths, personalInformationUserTypeSchema, personalInformationUserTypes, registerUserToService, removeLabelForUser, setServicesStatus, updateProfilePersonalInfo, updateUser, updateUserPersonalInfo };
|
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,7 +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
|
|
262
|
+
declare const registerUserToService: (client: Client, profileId: string, serviceId: string) => Promise<void>;
|
|
263
|
+
|
|
264
|
+
declare const paths: readonly ["/phoneNumber", "/email", "/idNumber"];
|
|
263
265
|
type Paths$1 = (typeof paths)[number];
|
|
264
266
|
declare const updateProfilePersonalInfo: (client: Client, userId: string, profileId: string, actions: PatchAction<Paths$1>[]) => Promise<void>;
|
|
265
267
|
|
|
@@ -274,4 +276,4 @@ declare const getFleetBillingGroups: (client: Client, options?: PaginableOptions
|
|
|
274
276
|
|
|
275
277
|
declare const getUsersByIds: (client: Client, ids: string[]) => Promise<User[]>;
|
|
276
278
|
|
|
277
|
-
export { type AccountStatus, type Address, type BillingGroup, type CreateBusinessProfile, type CreateUser, type CreateUserOptions, type Entity, type FiscalInformation, type IndividualBusiness, type Label, type PersonalCompany, type PersonalInformationBirth, type PersonalInformationIdentity, type PersonalInformationProfile, type PersonalInformationProfileType, type PersonalInformationUser, type PersonalInformationUserType, type Profile, type ProfileServiceRegistration, type ProfileStatus, type ProfileType, type ResponseFind, type SearchType, type ServiceRegistrationWithReason, type ServiceStatus, type ServicesRegistrationList, type ServicesUpdate, type User, type UserAgreement, type UserFull, type UserProfile, type UserServiceRegistration, type UserUpdateBody, acceptTAndC, accountStatus, addLabelForUser, assignBillingGroup, createBusinessProfile, createUser, findUser, getEntity, getFleetBillingGroups, getLabelsForUser, getProfilePersonalInfoById, getRegistrationOverview, getUserById, getUserPersonalInfoById, getUsersByIds, getUsersPIByIds, personalInformationProfileTypeSchema, personalInformationProfileTypes, personalInformationUserPaths, personalInformationUserTypeSchema, personalInformationUserTypes, removeLabelForUser, setServicesStatus, updateProfilePersonalInfo, updateUser, updateUserPersonalInfo };
|
|
279
|
+
export { type AccountStatus, type Address, type BillingGroup, type CreateBusinessProfile, type CreateUser, type CreateUserOptions, type Entity, type FiscalInformation, type IndividualBusiness, type Label, type PersonalCompany, type PersonalInformationBirth, type PersonalInformationIdentity, type PersonalInformationProfile, type PersonalInformationProfileType, type PersonalInformationUser, type PersonalInformationUserType, type Profile, type ProfileServiceRegistration, type ProfileStatus, type ProfileType, type ResponseFind, type SearchType, type ServiceRegistrationWithReason, type ServiceStatus, type ServicesRegistrationList, type ServicesUpdate, type User, type UserAgreement, type UserFull, type UserProfile, type UserServiceRegistration, type UserUpdateBody, acceptTAndC, accountStatus, addLabelForUser, assignBillingGroup, createBusinessProfile, createUser, findUser, getEntity, getFleetBillingGroups, getLabelsForUser, getProfilePersonalInfoById, getRegistrationOverview, getUserById, getUserPersonalInfoById, getUsersByIds, getUsersPIByIds, personalInformationProfileTypeSchema, personalInformationProfileTypes, personalInformationUserPaths, personalInformationUserTypeSchema, personalInformationUserTypes, registerUserToService, removeLabelForUser, setServicesStatus, updateProfilePersonalInfo, updateUser, updateUserPersonalInfo };
|
package/dist/index.js
CHANGED
|
@@ -41,6 +41,7 @@ __export(index_exports, {
|
|
|
41
41
|
personalInformationUserPaths: () => personalInformationUserPaths,
|
|
42
42
|
personalInformationUserTypeSchema: () => personalInformationUserTypeSchema,
|
|
43
43
|
personalInformationUserTypes: () => personalInformationUserTypes,
|
|
44
|
+
registerUserToService: () => registerUserToService,
|
|
44
45
|
removeLabelForUser: () => removeLabelForUser,
|
|
45
46
|
setServicesStatus: () => setServicesStatus,
|
|
46
47
|
updateProfilePersonalInfo: () => updateProfilePersonalInfo,
|
|
@@ -206,7 +207,8 @@ var personalInformationUserPaths = [
|
|
|
206
207
|
"/address/country",
|
|
207
208
|
"/address/number",
|
|
208
209
|
"/address/addressAdditionalInformation",
|
|
209
|
-
"/membership"
|
|
210
|
+
"/membership",
|
|
211
|
+
"/idNumber"
|
|
210
212
|
];
|
|
211
213
|
var personalInformationUserTypeSchema = import_zod5.z.enum(personalInformationUserTypes);
|
|
212
214
|
var personalInformationProfileTypes = ["ID_NUMBER", "PHONE_NUMBER", "EMAIL", "BILLING_ADDRESS"];
|
|
@@ -398,22 +400,42 @@ var setServicesStatus = async (client, profileId, servicesUpdate) => {
|
|
|
398
400
|
);
|
|
399
401
|
};
|
|
400
402
|
|
|
401
|
-
// src/
|
|
403
|
+
// src/registerUserToService.ts
|
|
402
404
|
var import_zod14 = require("zod");
|
|
403
|
-
var
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
405
|
+
var registerUserToService = async (client, profileId, serviceId) => {
|
|
406
|
+
const resultProfileId = import_zod14.z.string().uuid().safeParse(profileId);
|
|
407
|
+
if (!resultProfileId.success) {
|
|
408
|
+
throw new TypeError("Invalid profileId", {
|
|
409
|
+
cause: resultProfileId.error.issues
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
const resultServiceId = import_zod14.z.string().uuid().safeParse(serviceId);
|
|
413
|
+
if (!resultServiceId.success) {
|
|
414
|
+
throw new TypeError("Invalid serviceId", {
|
|
415
|
+
cause: resultServiceId.error.issues
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
await client.put(
|
|
419
|
+
`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/profiles/${profileId}/services/${serviceId}`
|
|
420
|
+
);
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
// src/updateProfilePersonalInfo.ts
|
|
424
|
+
var import_zod15 = require("zod");
|
|
425
|
+
var paths = ["/phoneNumber", "/email", "/idNumber"];
|
|
426
|
+
var schema5 = import_zod15.z.object({
|
|
427
|
+
userId: import_zod15.z.string().trim().min(1).uuid(),
|
|
428
|
+
profileId: import_zod15.z.string().trim().min(1).uuid(),
|
|
429
|
+
actions: import_zod15.z.array(
|
|
430
|
+
import_zod15.z.union([
|
|
431
|
+
import_zod15.z.object({
|
|
432
|
+
op: import_zod15.z.enum(["add", "replace"]),
|
|
433
|
+
path: import_zod15.z.enum(paths),
|
|
434
|
+
value: import_zod15.z.string().min(1)
|
|
413
435
|
}),
|
|
414
|
-
|
|
415
|
-
op:
|
|
416
|
-
path:
|
|
436
|
+
import_zod15.z.object({
|
|
437
|
+
op: import_zod15.z.literal("remove"),
|
|
438
|
+
path: import_zod15.z.enum(paths)
|
|
417
439
|
})
|
|
418
440
|
])
|
|
419
441
|
).min(1)
|
|
@@ -437,18 +459,18 @@ var updateProfilePersonalInfo = async (client, userId, profileId, actions) => {
|
|
|
437
459
|
};
|
|
438
460
|
|
|
439
461
|
// src/updateUser.ts
|
|
440
|
-
var
|
|
441
|
-
var schema6 =
|
|
442
|
-
id:
|
|
443
|
-
user:
|
|
444
|
-
locale:
|
|
445
|
-
accountStatus:
|
|
446
|
-
dataPrivacyConsent:
|
|
447
|
-
marketingConsent:
|
|
448
|
-
surveyConsent:
|
|
449
|
-
shareDataConsent:
|
|
450
|
-
profilingConsent:
|
|
451
|
-
membershipNumber:
|
|
462
|
+
var import_zod16 = require("zod");
|
|
463
|
+
var schema6 = import_zod16.z.object({
|
|
464
|
+
id: import_zod16.z.string().trim().min(1).uuid(),
|
|
465
|
+
user: import_zod16.z.object({
|
|
466
|
+
locale: import_zod16.z.string(),
|
|
467
|
+
accountStatus: import_zod16.z.enum(accountStatus),
|
|
468
|
+
dataPrivacyConsent: import_zod16.z.boolean(),
|
|
469
|
+
marketingConsent: import_zod16.z.boolean(),
|
|
470
|
+
surveyConsent: import_zod16.z.boolean(),
|
|
471
|
+
shareDataConsent: import_zod16.z.boolean(),
|
|
472
|
+
profilingConsent: import_zod16.z.boolean(),
|
|
473
|
+
membershipNumber: import_zod16.z.string()
|
|
452
474
|
}).partial()
|
|
453
475
|
});
|
|
454
476
|
var updateUser = async (client, id, user) => {
|
|
@@ -462,19 +484,19 @@ var updateUser = async (client, id, user) => {
|
|
|
462
484
|
};
|
|
463
485
|
|
|
464
486
|
// src/updateUserPersonalInfo.ts
|
|
465
|
-
var
|
|
466
|
-
var schema7 =
|
|
467
|
-
userId:
|
|
468
|
-
actions:
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
op:
|
|
472
|
-
path:
|
|
473
|
-
value:
|
|
487
|
+
var import_zod17 = require("zod");
|
|
488
|
+
var schema7 = import_zod17.z.object({
|
|
489
|
+
userId: import_zod17.z.string().trim().min(1).uuid(),
|
|
490
|
+
actions: import_zod17.z.array(
|
|
491
|
+
import_zod17.z.union([
|
|
492
|
+
import_zod17.z.object({
|
|
493
|
+
op: import_zod17.z.enum(["add", "replace"]),
|
|
494
|
+
path: import_zod17.z.enum(personalInformationUserPaths),
|
|
495
|
+
value: import_zod17.z.string().min(1)
|
|
474
496
|
}),
|
|
475
|
-
|
|
476
|
-
op:
|
|
477
|
-
path:
|
|
497
|
+
import_zod17.z.object({
|
|
498
|
+
op: import_zod17.z.literal("remove"),
|
|
499
|
+
path: import_zod17.z.enum(personalInformationUserPaths)
|
|
478
500
|
})
|
|
479
501
|
])
|
|
480
502
|
).min(1)
|
|
@@ -494,9 +516,9 @@ var updateUserPersonalInfo = async (client, userId, actions) => {
|
|
|
494
516
|
};
|
|
495
517
|
|
|
496
518
|
// src/getEntity.ts
|
|
497
|
-
var
|
|
519
|
+
var import_zod18 = require("zod");
|
|
498
520
|
var getEntity = async (client, entityId) => {
|
|
499
|
-
const result =
|
|
521
|
+
const result = import_zod18.z.string().trim().min(1).uuid().safeParse(entityId);
|
|
500
522
|
if (!result.success) {
|
|
501
523
|
throw new TypeError("Invalid entity id", {
|
|
502
524
|
cause: result.error.issues
|
|
@@ -536,9 +558,9 @@ var getFleetBillingGroups = async (client, options) => {
|
|
|
536
558
|
};
|
|
537
559
|
|
|
538
560
|
// src/getUsersByIds.ts
|
|
539
|
-
var
|
|
540
|
-
var argsSchema4 =
|
|
541
|
-
ids:
|
|
561
|
+
var import_zod19 = require("zod");
|
|
562
|
+
var argsSchema4 = import_zod19.z.object({
|
|
563
|
+
ids: import_zod19.z.array(import_zod19.z.string().trim().min(1).uuid()).min(1)
|
|
542
564
|
});
|
|
543
565
|
var getUsersByIds = async (client, ids) => {
|
|
544
566
|
const result = argsSchema4.safeParse({ ids });
|
|
@@ -572,6 +594,7 @@ var getUsersByIds = async (client, ids) => {
|
|
|
572
594
|
personalInformationUserPaths,
|
|
573
595
|
personalInformationUserTypeSchema,
|
|
574
596
|
personalInformationUserTypes,
|
|
597
|
+
registerUserToService,
|
|
575
598
|
removeLabelForUser,
|
|
576
599
|
setServicesStatus,
|
|
577
600
|
updateProfilePersonalInfo,
|
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"];
|
|
@@ -347,22 +348,42 @@ var setServicesStatus = async (client, profileId, servicesUpdate) => {
|
|
|
347
348
|
);
|
|
348
349
|
};
|
|
349
350
|
|
|
350
|
-
// src/
|
|
351
|
+
// src/registerUserToService.ts
|
|
351
352
|
import { z as z14 } from "zod";
|
|
352
|
-
var
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
353
|
+
var registerUserToService = async (client, profileId, serviceId) => {
|
|
354
|
+
const resultProfileId = z14.string().uuid().safeParse(profileId);
|
|
355
|
+
if (!resultProfileId.success) {
|
|
356
|
+
throw new TypeError("Invalid profileId", {
|
|
357
|
+
cause: resultProfileId.error.issues
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
const resultServiceId = z14.string().uuid().safeParse(serviceId);
|
|
361
|
+
if (!resultServiceId.success) {
|
|
362
|
+
throw new TypeError("Invalid serviceId", {
|
|
363
|
+
cause: resultServiceId.error.issues
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
await client.put(
|
|
367
|
+
`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/profiles/${profileId}/services/${serviceId}`
|
|
368
|
+
);
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
// src/updateProfilePersonalInfo.ts
|
|
372
|
+
import { z as z15 } from "zod";
|
|
373
|
+
var paths = ["/phoneNumber", "/email", "/idNumber"];
|
|
374
|
+
var schema5 = z15.object({
|
|
375
|
+
userId: z15.string().trim().min(1).uuid(),
|
|
376
|
+
profileId: z15.string().trim().min(1).uuid(),
|
|
377
|
+
actions: z15.array(
|
|
378
|
+
z15.union([
|
|
379
|
+
z15.object({
|
|
380
|
+
op: z15.enum(["add", "replace"]),
|
|
381
|
+
path: z15.enum(paths),
|
|
382
|
+
value: z15.string().min(1)
|
|
362
383
|
}),
|
|
363
|
-
|
|
364
|
-
op:
|
|
365
|
-
path:
|
|
384
|
+
z15.object({
|
|
385
|
+
op: z15.literal("remove"),
|
|
386
|
+
path: z15.enum(paths)
|
|
366
387
|
})
|
|
367
388
|
])
|
|
368
389
|
).min(1)
|
|
@@ -386,18 +407,18 @@ var updateProfilePersonalInfo = async (client, userId, profileId, actions) => {
|
|
|
386
407
|
};
|
|
387
408
|
|
|
388
409
|
// src/updateUser.ts
|
|
389
|
-
import { z as
|
|
390
|
-
var schema6 =
|
|
391
|
-
id:
|
|
392
|
-
user:
|
|
393
|
-
locale:
|
|
394
|
-
accountStatus:
|
|
395
|
-
dataPrivacyConsent:
|
|
396
|
-
marketingConsent:
|
|
397
|
-
surveyConsent:
|
|
398
|
-
shareDataConsent:
|
|
399
|
-
profilingConsent:
|
|
400
|
-
membershipNumber:
|
|
410
|
+
import { z as z16 } from "zod";
|
|
411
|
+
var schema6 = z16.object({
|
|
412
|
+
id: z16.string().trim().min(1).uuid(),
|
|
413
|
+
user: z16.object({
|
|
414
|
+
locale: z16.string(),
|
|
415
|
+
accountStatus: z16.enum(accountStatus),
|
|
416
|
+
dataPrivacyConsent: z16.boolean(),
|
|
417
|
+
marketingConsent: z16.boolean(),
|
|
418
|
+
surveyConsent: z16.boolean(),
|
|
419
|
+
shareDataConsent: z16.boolean(),
|
|
420
|
+
profilingConsent: z16.boolean(),
|
|
421
|
+
membershipNumber: z16.string()
|
|
401
422
|
}).partial()
|
|
402
423
|
});
|
|
403
424
|
var updateUser = async (client, id, user) => {
|
|
@@ -411,19 +432,19 @@ var updateUser = async (client, id, user) => {
|
|
|
411
432
|
};
|
|
412
433
|
|
|
413
434
|
// src/updateUserPersonalInfo.ts
|
|
414
|
-
import { z as
|
|
415
|
-
var schema7 =
|
|
416
|
-
userId:
|
|
417
|
-
actions:
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
op:
|
|
421
|
-
path:
|
|
422
|
-
value:
|
|
435
|
+
import { z as z17 } from "zod";
|
|
436
|
+
var schema7 = z17.object({
|
|
437
|
+
userId: z17.string().trim().min(1).uuid(),
|
|
438
|
+
actions: z17.array(
|
|
439
|
+
z17.union([
|
|
440
|
+
z17.object({
|
|
441
|
+
op: z17.enum(["add", "replace"]),
|
|
442
|
+
path: z17.enum(personalInformationUserPaths),
|
|
443
|
+
value: z17.string().min(1)
|
|
423
444
|
}),
|
|
424
|
-
|
|
425
|
-
op:
|
|
426
|
-
path:
|
|
445
|
+
z17.object({
|
|
446
|
+
op: z17.literal("remove"),
|
|
447
|
+
path: z17.enum(personalInformationUserPaths)
|
|
427
448
|
})
|
|
428
449
|
])
|
|
429
450
|
).min(1)
|
|
@@ -443,9 +464,9 @@ var updateUserPersonalInfo = async (client, userId, actions) => {
|
|
|
443
464
|
};
|
|
444
465
|
|
|
445
466
|
// src/getEntity.ts
|
|
446
|
-
import { z as
|
|
467
|
+
import { z as z18 } from "zod";
|
|
447
468
|
var getEntity = async (client, entityId) => {
|
|
448
|
-
const result =
|
|
469
|
+
const result = z18.string().trim().min(1).uuid().safeParse(entityId);
|
|
449
470
|
if (!result.success) {
|
|
450
471
|
throw new TypeError("Invalid entity id", {
|
|
451
472
|
cause: result.error.issues
|
|
@@ -485,9 +506,9 @@ var getFleetBillingGroups = async (client, options) => {
|
|
|
485
506
|
};
|
|
486
507
|
|
|
487
508
|
// src/getUsersByIds.ts
|
|
488
|
-
import { z as
|
|
489
|
-
var argsSchema4 =
|
|
490
|
-
ids:
|
|
509
|
+
import { z as z19 } from "zod";
|
|
510
|
+
var argsSchema4 = z19.object({
|
|
511
|
+
ids: z19.array(z19.string().trim().min(1).uuid()).min(1)
|
|
491
512
|
});
|
|
492
513
|
var getUsersByIds = async (client, ids) => {
|
|
493
514
|
const result = argsSchema4.safeParse({ ids });
|
|
@@ -520,6 +541,7 @@ export {
|
|
|
520
541
|
personalInformationUserPaths,
|
|
521
542
|
personalInformationUserTypeSchema,
|
|
522
543
|
personalInformationUserTypes,
|
|
544
|
+
registerUserToService,
|
|
523
545
|
removeLabelForUser,
|
|
524
546
|
setServicesStatus,
|
|
525
547
|
updateProfilePersonalInfo,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vulog/aima-user",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"author": "Vulog",
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@vulog/aima-client": "1.
|
|
23
|
-
"@vulog/aima-config": "1.
|
|
24
|
-
"@vulog/aima-core": "1.
|
|
22
|
+
"@vulog/aima-client": "1.2.2",
|
|
23
|
+
"@vulog/aima-config": "1.2.2",
|
|
24
|
+
"@vulog/aima-core": "1.2.2"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"zod": "^3.25.76"
|
|
28
28
|
},
|
|
29
29
|
"description": ""
|
|
30
|
-
}
|
|
30
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './getUserPersonalInfoById';
|
|
|
10
10
|
export * from './getUsersPIByIds';
|
|
11
11
|
export * from './label';
|
|
12
12
|
export * from './setServicesStatus';
|
|
13
|
+
export * from './registerUserToService';
|
|
13
14
|
export * from './types';
|
|
14
15
|
export * from './updateProfilePersonalInfo';
|
|
15
16
|
export * from './updateUser';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Client } from '@vulog/aima-client';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export const registerUserToService = async (client: Client, profileId: string, serviceId: string): Promise<void> => {
|
|
5
|
+
const resultProfileId = z.string().uuid().safeParse(profileId);
|
|
6
|
+
if (!resultProfileId.success) {
|
|
7
|
+
throw new TypeError('Invalid profileId', {
|
|
8
|
+
cause: resultProfileId.error.issues,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const resultServiceId = z.string().uuid().safeParse(serviceId);
|
|
13
|
+
if (!resultServiceId.success) {
|
|
14
|
+
throw new TypeError('Invalid serviceId', {
|
|
15
|
+
cause: resultServiceId.error.issues,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
await client.put(
|
|
20
|
+
`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/profiles/${profileId}/services/${serviceId}`
|
|
21
|
+
);
|
|
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({
|