@vulog/aima-user 1.1.98 → 1.2.1

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 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
@@ -259,6 +259,8 @@ 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, profileId: string, serviceId: string) => Promise<void>;
263
+
262
264
  declare const paths: readonly ["/phoneNumber", "/email"];
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>;
@@ -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
@@ -259,6 +259,8 @@ 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, profileId: string, serviceId: string) => Promise<void>;
263
+
262
264
  declare const paths: readonly ["/phoneNumber", "/email"];
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>;
@@ -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,
@@ -398,22 +399,42 @@ var setServicesStatus = async (client, profileId, servicesUpdate) => {
398
399
  );
399
400
  };
400
401
 
401
- // src/updateProfilePersonalInfo.ts
402
+ // src/registerUserToService.ts
402
403
  var import_zod14 = require("zod");
404
+ var registerUserToService = async (client, profileId, serviceId) => {
405
+ const resultProfileId = import_zod14.z.string().uuid().safeParse(profileId);
406
+ if (!resultProfileId.success) {
407
+ throw new TypeError("Invalid profileId", {
408
+ cause: resultProfileId.error.issues
409
+ });
410
+ }
411
+ const resultServiceId = import_zod14.z.string().uuid().safeParse(serviceId);
412
+ if (!resultServiceId.success) {
413
+ throw new TypeError("Invalid serviceId", {
414
+ cause: resultServiceId.error.issues
415
+ });
416
+ }
417
+ await client.put(
418
+ `boapi/proxy/user/fleets/${client.clientOptions.fleetId}/profiles/${profileId}/services/${serviceId}`
419
+ );
420
+ };
421
+
422
+ // src/updateProfilePersonalInfo.ts
423
+ var import_zod15 = require("zod");
403
424
  var paths = ["/phoneNumber", "/email"];
404
- var schema5 = import_zod14.z.object({
405
- userId: import_zod14.z.string().trim().min(1).uuid(),
406
- profileId: import_zod14.z.string().trim().min(1).uuid(),
407
- actions: import_zod14.z.array(
408
- import_zod14.z.union([
409
- import_zod14.z.object({
410
- op: import_zod14.z.enum(["add", "replace"]),
411
- path: import_zod14.z.enum(paths),
412
- value: import_zod14.z.string().min(1)
425
+ var schema5 = import_zod15.z.object({
426
+ userId: import_zod15.z.string().trim().min(1).uuid(),
427
+ profileId: import_zod15.z.string().trim().min(1).uuid(),
428
+ actions: import_zod15.z.array(
429
+ import_zod15.z.union([
430
+ import_zod15.z.object({
431
+ op: import_zod15.z.enum(["add", "replace"]),
432
+ path: import_zod15.z.enum(paths),
433
+ value: import_zod15.z.string().min(1)
413
434
  }),
414
- import_zod14.z.object({
415
- op: import_zod14.z.literal("remove"),
416
- path: import_zod14.z.enum(paths)
435
+ import_zod15.z.object({
436
+ op: import_zod15.z.literal("remove"),
437
+ path: import_zod15.z.enum(paths)
417
438
  })
418
439
  ])
419
440
  ).min(1)
@@ -437,18 +458,18 @@ var updateProfilePersonalInfo = async (client, userId, profileId, actions) => {
437
458
  };
438
459
 
439
460
  // src/updateUser.ts
440
- var import_zod15 = require("zod");
441
- var schema6 = import_zod15.z.object({
442
- id: import_zod15.z.string().trim().min(1).uuid(),
443
- user: import_zod15.z.object({
444
- locale: import_zod15.z.string(),
445
- accountStatus: import_zod15.z.enum(accountStatus),
446
- dataPrivacyConsent: import_zod15.z.boolean(),
447
- marketingConsent: import_zod15.z.boolean(),
448
- surveyConsent: import_zod15.z.boolean(),
449
- shareDataConsent: import_zod15.z.boolean(),
450
- profilingConsent: import_zod15.z.boolean(),
451
- membershipNumber: import_zod15.z.string()
461
+ var import_zod16 = require("zod");
462
+ var schema6 = import_zod16.z.object({
463
+ id: import_zod16.z.string().trim().min(1).uuid(),
464
+ user: import_zod16.z.object({
465
+ locale: import_zod16.z.string(),
466
+ accountStatus: import_zod16.z.enum(accountStatus),
467
+ dataPrivacyConsent: import_zod16.z.boolean(),
468
+ marketingConsent: import_zod16.z.boolean(),
469
+ surveyConsent: import_zod16.z.boolean(),
470
+ shareDataConsent: import_zod16.z.boolean(),
471
+ profilingConsent: import_zod16.z.boolean(),
472
+ membershipNumber: import_zod16.z.string()
452
473
  }).partial()
453
474
  });
454
475
  var updateUser = async (client, id, user) => {
@@ -462,19 +483,19 @@ var updateUser = async (client, id, user) => {
462
483
  };
463
484
 
464
485
  // src/updateUserPersonalInfo.ts
465
- var import_zod16 = require("zod");
466
- var schema7 = import_zod16.z.object({
467
- userId: import_zod16.z.string().trim().min(1).uuid(),
468
- actions: import_zod16.z.array(
469
- import_zod16.z.union([
470
- import_zod16.z.object({
471
- op: import_zod16.z.enum(["add", "replace"]),
472
- path: import_zod16.z.enum(personalInformationUserPaths),
473
- value: import_zod16.z.string().min(1)
486
+ var import_zod17 = require("zod");
487
+ var schema7 = import_zod17.z.object({
488
+ userId: import_zod17.z.string().trim().min(1).uuid(),
489
+ actions: import_zod17.z.array(
490
+ import_zod17.z.union([
491
+ import_zod17.z.object({
492
+ op: import_zod17.z.enum(["add", "replace"]),
493
+ path: import_zod17.z.enum(personalInformationUserPaths),
494
+ value: import_zod17.z.string().min(1)
474
495
  }),
475
- import_zod16.z.object({
476
- op: import_zod16.z.literal("remove"),
477
- path: import_zod16.z.enum(personalInformationUserPaths)
496
+ import_zod17.z.object({
497
+ op: import_zod17.z.literal("remove"),
498
+ path: import_zod17.z.enum(personalInformationUserPaths)
478
499
  })
479
500
  ])
480
501
  ).min(1)
@@ -494,9 +515,9 @@ var updateUserPersonalInfo = async (client, userId, actions) => {
494
515
  };
495
516
 
496
517
  // src/getEntity.ts
497
- var import_zod17 = require("zod");
518
+ var import_zod18 = require("zod");
498
519
  var getEntity = async (client, entityId) => {
499
- const result = import_zod17.z.string().trim().min(1).uuid().safeParse(entityId);
520
+ const result = import_zod18.z.string().trim().min(1).uuid().safeParse(entityId);
500
521
  if (!result.success) {
501
522
  throw new TypeError("Invalid entity id", {
502
523
  cause: result.error.issues
@@ -536,9 +557,9 @@ var getFleetBillingGroups = async (client, options) => {
536
557
  };
537
558
 
538
559
  // src/getUsersByIds.ts
539
- var import_zod18 = require("zod");
540
- var argsSchema4 = import_zod18.z.object({
541
- ids: import_zod18.z.array(import_zod18.z.string().trim().min(1).uuid()).min(1)
560
+ var import_zod19 = require("zod");
561
+ var argsSchema4 = import_zod19.z.object({
562
+ ids: import_zod19.z.array(import_zod19.z.string().trim().min(1).uuid()).min(1)
542
563
  });
543
564
  var getUsersByIds = async (client, ids) => {
544
565
  const result = argsSchema4.safeParse({ ids });
@@ -572,6 +593,7 @@ var getUsersByIds = async (client, ids) => {
572
593
  personalInformationUserPaths,
573
594
  personalInformationUserTypeSchema,
574
595
  personalInformationUserTypes,
596
+ registerUserToService,
575
597
  removeLabelForUser,
576
598
  setServicesStatus,
577
599
  updateProfilePersonalInfo,
package/dist/index.mjs CHANGED
@@ -347,22 +347,42 @@ var setServicesStatus = async (client, profileId, servicesUpdate) => {
347
347
  );
348
348
  };
349
349
 
350
- // src/updateProfilePersonalInfo.ts
350
+ // src/registerUserToService.ts
351
351
  import { z as z14 } from "zod";
352
+ var registerUserToService = async (client, profileId, serviceId) => {
353
+ const resultProfileId = z14.string().uuid().safeParse(profileId);
354
+ if (!resultProfileId.success) {
355
+ throw new TypeError("Invalid profileId", {
356
+ cause: resultProfileId.error.issues
357
+ });
358
+ }
359
+ const resultServiceId = z14.string().uuid().safeParse(serviceId);
360
+ if (!resultServiceId.success) {
361
+ throw new TypeError("Invalid serviceId", {
362
+ cause: resultServiceId.error.issues
363
+ });
364
+ }
365
+ await client.put(
366
+ `boapi/proxy/user/fleets/${client.clientOptions.fleetId}/profiles/${profileId}/services/${serviceId}`
367
+ );
368
+ };
369
+
370
+ // src/updateProfilePersonalInfo.ts
371
+ import { z as z15 } from "zod";
352
372
  var paths = ["/phoneNumber", "/email"];
353
- var schema5 = z14.object({
354
- userId: z14.string().trim().min(1).uuid(),
355
- profileId: z14.string().trim().min(1).uuid(),
356
- actions: z14.array(
357
- z14.union([
358
- z14.object({
359
- op: z14.enum(["add", "replace"]),
360
- path: z14.enum(paths),
361
- value: z14.string().min(1)
373
+ var schema5 = z15.object({
374
+ userId: z15.string().trim().min(1).uuid(),
375
+ profileId: z15.string().trim().min(1).uuid(),
376
+ actions: z15.array(
377
+ z15.union([
378
+ z15.object({
379
+ op: z15.enum(["add", "replace"]),
380
+ path: z15.enum(paths),
381
+ value: z15.string().min(1)
362
382
  }),
363
- z14.object({
364
- op: z14.literal("remove"),
365
- path: z14.enum(paths)
383
+ z15.object({
384
+ op: z15.literal("remove"),
385
+ path: z15.enum(paths)
366
386
  })
367
387
  ])
368
388
  ).min(1)
@@ -386,18 +406,18 @@ var updateProfilePersonalInfo = async (client, userId, profileId, actions) => {
386
406
  };
387
407
 
388
408
  // src/updateUser.ts
389
- import { z as z15 } from "zod";
390
- var schema6 = z15.object({
391
- id: z15.string().trim().min(1).uuid(),
392
- user: z15.object({
393
- locale: z15.string(),
394
- accountStatus: z15.enum(accountStatus),
395
- dataPrivacyConsent: z15.boolean(),
396
- marketingConsent: z15.boolean(),
397
- surveyConsent: z15.boolean(),
398
- shareDataConsent: z15.boolean(),
399
- profilingConsent: z15.boolean(),
400
- membershipNumber: z15.string()
409
+ import { z as z16 } from "zod";
410
+ var schema6 = z16.object({
411
+ id: z16.string().trim().min(1).uuid(),
412
+ user: z16.object({
413
+ locale: z16.string(),
414
+ accountStatus: z16.enum(accountStatus),
415
+ dataPrivacyConsent: z16.boolean(),
416
+ marketingConsent: z16.boolean(),
417
+ surveyConsent: z16.boolean(),
418
+ shareDataConsent: z16.boolean(),
419
+ profilingConsent: z16.boolean(),
420
+ membershipNumber: z16.string()
401
421
  }).partial()
402
422
  });
403
423
  var updateUser = async (client, id, user) => {
@@ -411,19 +431,19 @@ var updateUser = async (client, id, user) => {
411
431
  };
412
432
 
413
433
  // src/updateUserPersonalInfo.ts
414
- import { z as z16 } from "zod";
415
- var schema7 = z16.object({
416
- userId: z16.string().trim().min(1).uuid(),
417
- actions: z16.array(
418
- z16.union([
419
- z16.object({
420
- op: z16.enum(["add", "replace"]),
421
- path: z16.enum(personalInformationUserPaths),
422
- value: z16.string().min(1)
434
+ import { z as z17 } from "zod";
435
+ var schema7 = z17.object({
436
+ userId: z17.string().trim().min(1).uuid(),
437
+ actions: z17.array(
438
+ z17.union([
439
+ z17.object({
440
+ op: z17.enum(["add", "replace"]),
441
+ path: z17.enum(personalInformationUserPaths),
442
+ value: z17.string().min(1)
423
443
  }),
424
- z16.object({
425
- op: z16.literal("remove"),
426
- path: z16.enum(personalInformationUserPaths)
444
+ z17.object({
445
+ op: z17.literal("remove"),
446
+ path: z17.enum(personalInformationUserPaths)
427
447
  })
428
448
  ])
429
449
  ).min(1)
@@ -443,9 +463,9 @@ var updateUserPersonalInfo = async (client, userId, actions) => {
443
463
  };
444
464
 
445
465
  // src/getEntity.ts
446
- import { z as z17 } from "zod";
466
+ import { z as z18 } from "zod";
447
467
  var getEntity = async (client, entityId) => {
448
- const result = z17.string().trim().min(1).uuid().safeParse(entityId);
468
+ const result = z18.string().trim().min(1).uuid().safeParse(entityId);
449
469
  if (!result.success) {
450
470
  throw new TypeError("Invalid entity id", {
451
471
  cause: result.error.issues
@@ -485,9 +505,9 @@ var getFleetBillingGroups = async (client, options) => {
485
505
  };
486
506
 
487
507
  // src/getUsersByIds.ts
488
- import { z as z18 } from "zod";
489
- var argsSchema4 = z18.object({
490
- ids: z18.array(z18.string().trim().min(1).uuid()).min(1)
508
+ import { z as z19 } from "zod";
509
+ var argsSchema4 = z19.object({
510
+ ids: z19.array(z19.string().trim().min(1).uuid()).min(1)
491
511
  });
492
512
  var getUsersByIds = async (client, ids) => {
493
513
  const result = argsSchema4.safeParse({ ids });
@@ -520,6 +540,7 @@ export {
520
540
  personalInformationUserPaths,
521
541
  personalInformationUserTypeSchema,
522
542
  personalInformationUserTypes,
543
+ registerUserToService,
523
544
  removeLabelForUser,
524
545
  setServicesStatus,
525
546
  updateProfilePersonalInfo,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vulog/aima-user",
3
- "version": "1.1.98",
3
+ "version": "1.2.1",
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.1.98",
23
- "@vulog/aima-config": "1.1.98",
24
- "@vulog/aima-core": "1.1.98"
22
+ "@vulog/aima-client": "1.2.1",
23
+ "@vulog/aima-config": "1.2.1",
24
+ "@vulog/aima-core": "1.2.1"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "zod": "^3.25.76"
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
+ };