@vulog/aima-user 1.1.99 → 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 +13 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +64 -42
- package/dist/index.mjs +63 -42
- package/package.json +4 -4
- package/src/index.ts +1 -0
- package/src/registerUserToService.ts +22 -0
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/
|
|
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 =
|
|
405
|
-
userId:
|
|
406
|
-
profileId:
|
|
407
|
-
actions:
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
op:
|
|
411
|
-
path:
|
|
412
|
-
value:
|
|
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
|
-
|
|
415
|
-
op:
|
|
416
|
-
path:
|
|
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
|
|
441
|
-
var schema6 =
|
|
442
|
-
id:
|
|
443
|
-
user:
|
|
444
|
-
locale:
|
|
445
|
-
accountStatus:
|
|
446
|
-
dataPrivacyConsent:
|
|
447
|
-
marketingConsent:
|
|
448
|
-
surveyConsent:
|
|
449
|
-
shareDataConsent:
|
|
450
|
-
profilingConsent:
|
|
451
|
-
membershipNumber:
|
|
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
|
|
466
|
-
var schema7 =
|
|
467
|
-
userId:
|
|
468
|
-
actions:
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
op:
|
|
472
|
-
path:
|
|
473
|
-
value:
|
|
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
|
-
|
|
476
|
-
op:
|
|
477
|
-
path:
|
|
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
|
|
518
|
+
var import_zod18 = require("zod");
|
|
498
519
|
var getEntity = async (client, entityId) => {
|
|
499
|
-
const result =
|
|
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
|
|
540
|
-
var argsSchema4 =
|
|
541
|
-
ids:
|
|
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/
|
|
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 =
|
|
354
|
-
userId:
|
|
355
|
-
profileId:
|
|
356
|
-
actions:
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
op:
|
|
360
|
-
path:
|
|
361
|
-
value:
|
|
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
|
-
|
|
364
|
-
op:
|
|
365
|
-
path:
|
|
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
|
|
390
|
-
var schema6 =
|
|
391
|
-
id:
|
|
392
|
-
user:
|
|
393
|
-
locale:
|
|
394
|
-
accountStatus:
|
|
395
|
-
dataPrivacyConsent:
|
|
396
|
-
marketingConsent:
|
|
397
|
-
surveyConsent:
|
|
398
|
-
shareDataConsent:
|
|
399
|
-
profilingConsent:
|
|
400
|
-
membershipNumber:
|
|
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
|
|
415
|
-
var schema7 =
|
|
416
|
-
userId:
|
|
417
|
-
actions:
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
op:
|
|
421
|
-
path:
|
|
422
|
-
value:
|
|
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
|
-
|
|
425
|
-
op:
|
|
426
|
-
path:
|
|
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
|
|
466
|
+
import { z as z18 } from "zod";
|
|
447
467
|
var getEntity = async (client, entityId) => {
|
|
448
|
-
const result =
|
|
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
|
|
489
|
-
var argsSchema4 =
|
|
490
|
-
ids:
|
|
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
|
|
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
|
|
23
|
-
"@vulog/aima-config": "1.1
|
|
24
|
-
"@vulog/aima-core": "1.1
|
|
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
|
+
};
|