@vulog/aima-user 1.1.76 → 1.1.77

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/dist/index.d.mts CHANGED
@@ -181,6 +181,8 @@ declare const getUserById: (client: Client, id: string, addAccountStatus?: boole
181
181
 
182
182
  declare const getUserPersonalInfoById: (client: Client, id: string, types: PersonalInformationUserType[]) => Promise<PersonalInformationUser>;
183
183
 
184
+ declare const getUsersPIByIds: (client: Client, ids: string[], types: PersonalInformationUserType[]) => Promise<PersonalInformationUser[]>;
185
+
184
186
  declare const getLabelsForUser: (client: Client, userId: string) => Promise<Label[]>;
185
187
  declare const addLabelForUser: (client: Client, userId: string, labelId: number) => Promise<void>;
186
188
  declare const removeLabelForUser: (client: Client, userId: string, labelId: number) => Promise<void>;
@@ -230,4 +232,4 @@ declare const updateUser: (client: Client, id: string, user: UserUpdateBody) =>
230
232
  type Paths = (typeof personalInformationUserPaths)[number];
231
233
  declare const updateUserPersonalInfo: (client: Client, userId: string, actions: PatchAction<Paths>[]) => Promise<void>;
232
234
 
233
- export { type AccountStatus, type Address, type CreateBusinessProfile, type CreateUser, type CreateUserOptions, type FiscalInformation, type IndividualBusiness, type Label, type PersonalCompany, type PersonalInformationBirth, type PersonalInformationIdentity, type PersonalInformationProfile, type PersonalInformationProfileType, type PersonalInformationUser, type PersonalInformationUserType, type ProfileServiceRegistration, type ProfileStatus, type ProfileType, type ResponseFind, type SearchType, type ServiceRegistrationWithReason, type ServicesRegistrationList, type ServicesUpdate, type User, type UserAgreement, type UserProfile, type UserServiceRegistration, type UserUpdateBody, acceptTAndC, accountStatus, addLabelForUser, assignBillingGroup, createBusinessProfile, createUser, findUser, getLabelsForUser, getProfilePersonalInfoById, getRegistrationOverview, getUserById, getUserPersonalInfoById, personalInformationProfileTypeSchema, personalInformationProfileTypes, personalInformationUserPaths, personalInformationUserTypeSchema, personalInformationUserTypes, removeLabelForUser, setServicesStatus, updateProfilePersonalInfo, updateUser, updateUserPersonalInfo };
235
+ export { type AccountStatus, type Address, type CreateBusinessProfile, type CreateUser, type CreateUserOptions, type FiscalInformation, type IndividualBusiness, type Label, type PersonalCompany, type PersonalInformationBirth, type PersonalInformationIdentity, type PersonalInformationProfile, type PersonalInformationProfileType, type PersonalInformationUser, type PersonalInformationUserType, type ProfileServiceRegistration, type ProfileStatus, type ProfileType, type ResponseFind, type SearchType, type ServiceRegistrationWithReason, type ServicesRegistrationList, type ServicesUpdate, type User, type UserAgreement, type UserProfile, type UserServiceRegistration, type UserUpdateBody, acceptTAndC, accountStatus, addLabelForUser, assignBillingGroup, createBusinessProfile, createUser, findUser, getLabelsForUser, getProfilePersonalInfoById, getRegistrationOverview, getUserById, getUserPersonalInfoById, getUsersPIByIds, personalInformationProfileTypeSchema, personalInformationProfileTypes, personalInformationUserPaths, personalInformationUserTypeSchema, personalInformationUserTypes, removeLabelForUser, setServicesStatus, updateProfilePersonalInfo, updateUser, updateUserPersonalInfo };
package/dist/index.d.ts CHANGED
@@ -181,6 +181,8 @@ declare const getUserById: (client: Client, id: string, addAccountStatus?: boole
181
181
 
182
182
  declare const getUserPersonalInfoById: (client: Client, id: string, types: PersonalInformationUserType[]) => Promise<PersonalInformationUser>;
183
183
 
184
+ declare const getUsersPIByIds: (client: Client, ids: string[], types: PersonalInformationUserType[]) => Promise<PersonalInformationUser[]>;
185
+
184
186
  declare const getLabelsForUser: (client: Client, userId: string) => Promise<Label[]>;
185
187
  declare const addLabelForUser: (client: Client, userId: string, labelId: number) => Promise<void>;
186
188
  declare const removeLabelForUser: (client: Client, userId: string, labelId: number) => Promise<void>;
@@ -230,4 +232,4 @@ declare const updateUser: (client: Client, id: string, user: UserUpdateBody) =>
230
232
  type Paths = (typeof personalInformationUserPaths)[number];
231
233
  declare const updateUserPersonalInfo: (client: Client, userId: string, actions: PatchAction<Paths>[]) => Promise<void>;
232
234
 
233
- export { type AccountStatus, type Address, type CreateBusinessProfile, type CreateUser, type CreateUserOptions, type FiscalInformation, type IndividualBusiness, type Label, type PersonalCompany, type PersonalInformationBirth, type PersonalInformationIdentity, type PersonalInformationProfile, type PersonalInformationProfileType, type PersonalInformationUser, type PersonalInformationUserType, type ProfileServiceRegistration, type ProfileStatus, type ProfileType, type ResponseFind, type SearchType, type ServiceRegistrationWithReason, type ServicesRegistrationList, type ServicesUpdate, type User, type UserAgreement, type UserProfile, type UserServiceRegistration, type UserUpdateBody, acceptTAndC, accountStatus, addLabelForUser, assignBillingGroup, createBusinessProfile, createUser, findUser, getLabelsForUser, getProfilePersonalInfoById, getRegistrationOverview, getUserById, getUserPersonalInfoById, personalInformationProfileTypeSchema, personalInformationProfileTypes, personalInformationUserPaths, personalInformationUserTypeSchema, personalInformationUserTypes, removeLabelForUser, setServicesStatus, updateProfilePersonalInfo, updateUser, updateUserPersonalInfo };
235
+ export { type AccountStatus, type Address, type CreateBusinessProfile, type CreateUser, type CreateUserOptions, type FiscalInformation, type IndividualBusiness, type Label, type PersonalCompany, type PersonalInformationBirth, type PersonalInformationIdentity, type PersonalInformationProfile, type PersonalInformationProfileType, type PersonalInformationUser, type PersonalInformationUserType, type ProfileServiceRegistration, type ProfileStatus, type ProfileType, type ResponseFind, type SearchType, type ServiceRegistrationWithReason, type ServicesRegistrationList, type ServicesUpdate, type User, type UserAgreement, type UserProfile, type UserServiceRegistration, type UserUpdateBody, acceptTAndC, accountStatus, addLabelForUser, assignBillingGroup, createBusinessProfile, createUser, findUser, getLabelsForUser, getProfilePersonalInfoById, getRegistrationOverview, getUserById, getUserPersonalInfoById, getUsersPIByIds, personalInformationProfileTypeSchema, personalInformationProfileTypes, personalInformationUserPaths, personalInformationUserTypeSchema, personalInformationUserTypes, removeLabelForUser, setServicesStatus, updateProfilePersonalInfo, updateUser, updateUserPersonalInfo };
package/dist/index.js CHANGED
@@ -32,6 +32,7 @@ __export(index_exports, {
32
32
  getRegistrationOverview: () => getRegistrationOverview,
33
33
  getUserById: () => getUserById,
34
34
  getUserPersonalInfoById: () => getUserPersonalInfoById,
35
+ getUsersPIByIds: () => getUsersPIByIds,
35
36
  personalInformationProfileTypeSchema: () => personalInformationProfileTypeSchema,
36
37
  personalInformationProfileTypes: () => personalInformationProfileTypes,
37
38
  personalInformationUserPaths: () => personalInformationUserPaths,
@@ -299,14 +300,35 @@ var getUserPersonalInfoById = async (client, id, types) => {
299
300
  ).then(({ data }) => data);
300
301
  };
301
302
 
302
- // src/label.ts
303
+ // src/getUsersPIByIds.ts
303
304
  var import_zod11 = require("zod");
304
- var schema3 = import_zod11.z.object({
305
- userId: import_zod11.z.string().uuid()
305
+ var argsSchema3 = import_zod11.z.object({
306
+ ids: import_zod11.z.array(import_zod11.z.string().trim().min(1).uuid()).min(1),
307
+ types: import_zod11.z.array(personalInformationUserTypeSchema).min(1)
308
+ });
309
+ var getUsersPIByIds = async (client, ids, types) => {
310
+ const result = argsSchema3.safeParse({ ids, types });
311
+ if (!result.success) {
312
+ throw new TypeError("Invalid args", {
313
+ cause: result.error.issues
314
+ });
315
+ }
316
+ return client.post(
317
+ `/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/pi/list?${result.data.types.map((type) => `types=${type}`).join("&")}`,
318
+ {
319
+ userIds: result.data.ids
320
+ }
321
+ ).then(({ data }) => data);
322
+ };
323
+
324
+ // src/label.ts
325
+ var import_zod12 = require("zod");
326
+ var schema3 = import_zod12.z.object({
327
+ userId: import_zod12.z.string().uuid()
306
328
  });
307
- var schemaData = import_zod11.z.object({
308
- userId: import_zod11.z.string().uuid(),
309
- labelId: import_zod11.z.number().positive()
329
+ var schemaData = import_zod12.z.object({
330
+ userId: import_zod12.z.string().uuid(),
331
+ labelId: import_zod12.z.number().positive()
310
332
  });
311
333
  var getLabelsForUser = async (client, userId) => {
312
334
  const result = schema3.safeParse({ userId });
@@ -341,21 +363,21 @@ var removeLabelForUser = async (client, userId, labelId) => {
341
363
  };
342
364
 
343
365
  // src/setServicesStatus.ts
344
- var import_zod12 = require("zod");
366
+ var import_zod13 = require("zod");
345
367
  var registrationStatus = ["APPROVED", "INCOMPLETE", "PENDING", "REJECTED", "SUSPENDED", "UNREGISTERED"];
346
- var schema4 = import_zod12.z.object({
347
- disableEmailNotification: import_zod12.z.boolean(),
348
- operatorProfileId: import_zod12.z.string().uuid(),
349
- actions: import_zod12.z.array(
350
- import_zod12.z.object({
351
- reasonForChange: import_zod12.z.string(),
352
- serviceId: import_zod12.z.string().uuid(),
353
- status: import_zod12.z.enum(registrationStatus)
368
+ var schema4 = import_zod13.z.object({
369
+ disableEmailNotification: import_zod13.z.boolean(),
370
+ operatorProfileId: import_zod13.z.string().uuid(),
371
+ actions: import_zod13.z.array(
372
+ import_zod13.z.object({
373
+ reasonForChange: import_zod13.z.string(),
374
+ serviceId: import_zod13.z.string().uuid(),
375
+ status: import_zod13.z.enum(registrationStatus)
354
376
  })
355
377
  ).min(1)
356
378
  });
357
379
  var setServicesStatus = async (client, profileId, servicesUpdate) => {
358
- const resultProfileId = import_zod12.z.string().uuid().safeParse(profileId);
380
+ const resultProfileId = import_zod13.z.string().uuid().safeParse(profileId);
359
381
  if (!resultProfileId.success) {
360
382
  throw new TypeError("Invalid profileId", {
361
383
  cause: resultProfileId.error.issues
@@ -374,21 +396,21 @@ var setServicesStatus = async (client, profileId, servicesUpdate) => {
374
396
  };
375
397
 
376
398
  // src/updateProfilePersonalInfo.ts
377
- var import_zod13 = require("zod");
399
+ var import_zod14 = require("zod");
378
400
  var paths = ["/phoneNumber", "/email"];
379
- var schema5 = import_zod13.z.object({
380
- userId: import_zod13.z.string().trim().min(1).uuid(),
381
- profileId: import_zod13.z.string().trim().min(1).uuid(),
382
- actions: import_zod13.z.array(
383
- import_zod13.z.union([
384
- import_zod13.z.object({
385
- op: import_zod13.z.enum(["add", "replace"]),
386
- path: import_zod13.z.enum(paths),
387
- value: import_zod13.z.string().min(1)
401
+ var schema5 = import_zod14.z.object({
402
+ userId: import_zod14.z.string().trim().min(1).uuid(),
403
+ profileId: import_zod14.z.string().trim().min(1).uuid(),
404
+ actions: import_zod14.z.array(
405
+ import_zod14.z.union([
406
+ import_zod14.z.object({
407
+ op: import_zod14.z.enum(["add", "replace"]),
408
+ path: import_zod14.z.enum(paths),
409
+ value: import_zod14.z.string().min(1)
388
410
  }),
389
- import_zod13.z.object({
390
- op: import_zod13.z.literal("remove"),
391
- path: import_zod13.z.enum(paths)
411
+ import_zod14.z.object({
412
+ op: import_zod14.z.literal("remove"),
413
+ path: import_zod14.z.enum(paths)
392
414
  })
393
415
  ])
394
416
  ).min(1)
@@ -412,18 +434,18 @@ var updateProfilePersonalInfo = async (client, userId, profileId, actions) => {
412
434
  };
413
435
 
414
436
  // src/updateUser.ts
415
- var import_zod14 = require("zod");
416
- var schema6 = import_zod14.z.object({
417
- id: import_zod14.z.string().trim().min(1).uuid(),
418
- user: import_zod14.z.object({
419
- locale: import_zod14.z.string(),
420
- accountStatus: import_zod14.z.enum(accountStatus),
421
- dataPrivacyConsent: import_zod14.z.boolean(),
422
- marketingConsent: import_zod14.z.boolean(),
423
- surveyConsent: import_zod14.z.boolean(),
424
- shareDataConsent: import_zod14.z.boolean(),
425
- profilingConsent: import_zod14.z.boolean(),
426
- membershipNumber: import_zod14.z.string()
437
+ var import_zod15 = require("zod");
438
+ var schema6 = import_zod15.z.object({
439
+ id: import_zod15.z.string().trim().min(1).uuid(),
440
+ user: import_zod15.z.object({
441
+ locale: import_zod15.z.string(),
442
+ accountStatus: import_zod15.z.enum(accountStatus),
443
+ dataPrivacyConsent: import_zod15.z.boolean(),
444
+ marketingConsent: import_zod15.z.boolean(),
445
+ surveyConsent: import_zod15.z.boolean(),
446
+ shareDataConsent: import_zod15.z.boolean(),
447
+ profilingConsent: import_zod15.z.boolean(),
448
+ membershipNumber: import_zod15.z.string()
427
449
  }).partial()
428
450
  });
429
451
  var updateUser = async (client, id, user) => {
@@ -437,19 +459,19 @@ var updateUser = async (client, id, user) => {
437
459
  };
438
460
 
439
461
  // src/updateUserPersonalInfo.ts
440
- var import_zod15 = require("zod");
441
- var schema7 = import_zod15.z.object({
442
- userId: import_zod15.z.string().trim().min(1).uuid(),
443
- actions: import_zod15.z.array(
444
- import_zod15.z.union([
445
- import_zod15.z.object({
446
- op: import_zod15.z.enum(["add", "replace"]),
447
- path: import_zod15.z.enum(personalInformationUserPaths),
448
- value: import_zod15.z.string().min(1)
462
+ var import_zod16 = require("zod");
463
+ var schema7 = import_zod16.z.object({
464
+ userId: import_zod16.z.string().trim().min(1).uuid(),
465
+ actions: import_zod16.z.array(
466
+ import_zod16.z.union([
467
+ import_zod16.z.object({
468
+ op: import_zod16.z.enum(["add", "replace"]),
469
+ path: import_zod16.z.enum(personalInformationUserPaths),
470
+ value: import_zod16.z.string().min(1)
449
471
  }),
450
- import_zod15.z.object({
451
- op: import_zod15.z.literal("remove"),
452
- path: import_zod15.z.enum(personalInformationUserPaths)
472
+ import_zod16.z.object({
473
+ op: import_zod16.z.literal("remove"),
474
+ path: import_zod16.z.enum(personalInformationUserPaths)
453
475
  })
454
476
  ])
455
477
  ).min(1)
@@ -481,6 +503,7 @@ var updateUserPersonalInfo = async (client, userId, actions) => {
481
503
  getRegistrationOverview,
482
504
  getUserById,
483
505
  getUserPersonalInfoById,
506
+ getUsersPIByIds,
484
507
  personalInformationProfileTypeSchema,
485
508
  personalInformationProfileTypes,
486
509
  personalInformationUserPaths,
package/dist/index.mjs CHANGED
@@ -252,14 +252,35 @@ var getUserPersonalInfoById = async (client, id, types) => {
252
252
  ).then(({ data }) => data);
253
253
  };
254
254
 
255
- // src/label.ts
255
+ // src/getUsersPIByIds.ts
256
256
  import { z as z11 } from "zod";
257
- var schema3 = z11.object({
258
- userId: z11.string().uuid()
257
+ var argsSchema3 = z11.object({
258
+ ids: z11.array(z11.string().trim().min(1).uuid()).min(1),
259
+ types: z11.array(personalInformationUserTypeSchema).min(1)
260
+ });
261
+ var getUsersPIByIds = async (client, ids, types) => {
262
+ const result = argsSchema3.safeParse({ ids, types });
263
+ if (!result.success) {
264
+ throw new TypeError("Invalid args", {
265
+ cause: result.error.issues
266
+ });
267
+ }
268
+ return client.post(
269
+ `/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/pi/list?${result.data.types.map((type) => `types=${type}`).join("&")}`,
270
+ {
271
+ userIds: result.data.ids
272
+ }
273
+ ).then(({ data }) => data);
274
+ };
275
+
276
+ // src/label.ts
277
+ import { z as z12 } from "zod";
278
+ var schema3 = z12.object({
279
+ userId: z12.string().uuid()
259
280
  });
260
- var schemaData = z11.object({
261
- userId: z11.string().uuid(),
262
- labelId: z11.number().positive()
281
+ var schemaData = z12.object({
282
+ userId: z12.string().uuid(),
283
+ labelId: z12.number().positive()
263
284
  });
264
285
  var getLabelsForUser = async (client, userId) => {
265
286
  const result = schema3.safeParse({ userId });
@@ -294,21 +315,21 @@ var removeLabelForUser = async (client, userId, labelId) => {
294
315
  };
295
316
 
296
317
  // src/setServicesStatus.ts
297
- import { z as z12 } from "zod";
318
+ import { z as z13 } from "zod";
298
319
  var registrationStatus = ["APPROVED", "INCOMPLETE", "PENDING", "REJECTED", "SUSPENDED", "UNREGISTERED"];
299
- var schema4 = z12.object({
300
- disableEmailNotification: z12.boolean(),
301
- operatorProfileId: z12.string().uuid(),
302
- actions: z12.array(
303
- z12.object({
304
- reasonForChange: z12.string(),
305
- serviceId: z12.string().uuid(),
306
- status: z12.enum(registrationStatus)
320
+ var schema4 = z13.object({
321
+ disableEmailNotification: z13.boolean(),
322
+ operatorProfileId: z13.string().uuid(),
323
+ actions: z13.array(
324
+ z13.object({
325
+ reasonForChange: z13.string(),
326
+ serviceId: z13.string().uuid(),
327
+ status: z13.enum(registrationStatus)
307
328
  })
308
329
  ).min(1)
309
330
  });
310
331
  var setServicesStatus = async (client, profileId, servicesUpdate) => {
311
- const resultProfileId = z12.string().uuid().safeParse(profileId);
332
+ const resultProfileId = z13.string().uuid().safeParse(profileId);
312
333
  if (!resultProfileId.success) {
313
334
  throw new TypeError("Invalid profileId", {
314
335
  cause: resultProfileId.error.issues
@@ -327,21 +348,21 @@ var setServicesStatus = async (client, profileId, servicesUpdate) => {
327
348
  };
328
349
 
329
350
  // src/updateProfilePersonalInfo.ts
330
- import { z as z13 } from "zod";
351
+ import { z as z14 } from "zod";
331
352
  var paths = ["/phoneNumber", "/email"];
332
- var schema5 = z13.object({
333
- userId: z13.string().trim().min(1).uuid(),
334
- profileId: z13.string().trim().min(1).uuid(),
335
- actions: z13.array(
336
- z13.union([
337
- z13.object({
338
- op: z13.enum(["add", "replace"]),
339
- path: z13.enum(paths),
340
- value: z13.string().min(1)
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)
341
362
  }),
342
- z13.object({
343
- op: z13.literal("remove"),
344
- path: z13.enum(paths)
363
+ z14.object({
364
+ op: z14.literal("remove"),
365
+ path: z14.enum(paths)
345
366
  })
346
367
  ])
347
368
  ).min(1)
@@ -365,18 +386,18 @@ var updateProfilePersonalInfo = async (client, userId, profileId, actions) => {
365
386
  };
366
387
 
367
388
  // src/updateUser.ts
368
- import { z as z14 } from "zod";
369
- var schema6 = z14.object({
370
- id: z14.string().trim().min(1).uuid(),
371
- user: z14.object({
372
- locale: z14.string(),
373
- accountStatus: z14.enum(accountStatus),
374
- dataPrivacyConsent: z14.boolean(),
375
- marketingConsent: z14.boolean(),
376
- surveyConsent: z14.boolean(),
377
- shareDataConsent: z14.boolean(),
378
- profilingConsent: z14.boolean(),
379
- membershipNumber: z14.string()
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()
380
401
  }).partial()
381
402
  });
382
403
  var updateUser = async (client, id, user) => {
@@ -390,19 +411,19 @@ var updateUser = async (client, id, user) => {
390
411
  };
391
412
 
392
413
  // src/updateUserPersonalInfo.ts
393
- import { z as z15 } from "zod";
394
- var schema7 = z15.object({
395
- userId: z15.string().trim().min(1).uuid(),
396
- actions: z15.array(
397
- z15.union([
398
- z15.object({
399
- op: z15.enum(["add", "replace"]),
400
- path: z15.enum(personalInformationUserPaths),
401
- value: z15.string().min(1)
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)
402
423
  }),
403
- z15.object({
404
- op: z15.literal("remove"),
405
- path: z15.enum(personalInformationUserPaths)
424
+ z16.object({
425
+ op: z16.literal("remove"),
426
+ path: z16.enum(personalInformationUserPaths)
406
427
  })
407
428
  ])
408
429
  ).min(1)
@@ -433,6 +454,7 @@ export {
433
454
  getRegistrationOverview,
434
455
  getUserById,
435
456
  getUserPersonalInfoById,
457
+ getUsersPIByIds,
436
458
  personalInformationProfileTypeSchema,
437
459
  personalInformationProfileTypes,
438
460
  personalInformationUserPaths,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vulog/aima-user",
3
- "version": "1.1.76",
3
+ "version": "1.1.77",
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.76",
23
- "@vulog/aima-config": "1.1.76",
24
- "@vulog/aima-core": "1.1.76"
22
+ "@vulog/aima-client": "1.1.77",
23
+ "@vulog/aima-config": "1.1.77",
24
+ "@vulog/aima-core": "1.1.77"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "zod": "^3.24.2"
@@ -0,0 +1,31 @@
1
+ import { Client } from '@vulog/aima-client';
2
+ import { z } from 'zod';
3
+
4
+ import { PersonalInformationUser, PersonalInformationUserType, personalInformationUserTypeSchema } from './types';
5
+
6
+ const argsSchema = z.object({
7
+ ids: z.array(z.string().trim().min(1).uuid()).min(1),
8
+ types: z.array(personalInformationUserTypeSchema).min(1),
9
+ });
10
+
11
+ export const getUsersPIByIds = async (
12
+ client: Client,
13
+ ids: string[],
14
+ types: PersonalInformationUserType[]
15
+ ): Promise<PersonalInformationUser[]> => {
16
+ const result = argsSchema.safeParse({ ids, types });
17
+ if (!result.success) {
18
+ throw new TypeError('Invalid args', {
19
+ cause: result.error.issues,
20
+ });
21
+ }
22
+
23
+ return client
24
+ .post<PersonalInformationUser[]>(
25
+ `/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/pi/list?${result.data.types.map((type) => `types=${type}`).join('&')}`,
26
+ {
27
+ userIds: result.data.ids,
28
+ }
29
+ )
30
+ .then(({ data }) => data);
31
+ };
package/src/index.ts CHANGED
@@ -7,6 +7,7 @@ export * from './getProfilePersonalInfoById';
7
7
  export * from './getRegistrationOverview';
8
8
  export * from './getUserById';
9
9
  export * from './getUserPersonalInfoById';
10
+ export * from './getUsersPIByIds';
10
11
  export * from './label';
11
12
  export * from './setServicesStatus';
12
13
  export * from './types';