@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 +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +76 -53
- package/dist/index.mjs +75 -53
- package/package.json +4 -4
- package/src/getUsersPIByIds.ts +31 -0
- package/src/index.ts +1 -0
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/
|
|
303
|
+
// src/getUsersPIByIds.ts
|
|
303
304
|
var import_zod11 = require("zod");
|
|
304
|
-
var
|
|
305
|
-
|
|
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 =
|
|
308
|
-
userId:
|
|
309
|
-
labelId:
|
|
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
|
|
366
|
+
var import_zod13 = require("zod");
|
|
345
367
|
var registrationStatus = ["APPROVED", "INCOMPLETE", "PENDING", "REJECTED", "SUSPENDED", "UNREGISTERED"];
|
|
346
|
-
var schema4 =
|
|
347
|
-
disableEmailNotification:
|
|
348
|
-
operatorProfileId:
|
|
349
|
-
actions:
|
|
350
|
-
|
|
351
|
-
reasonForChange:
|
|
352
|
-
serviceId:
|
|
353
|
-
status:
|
|
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 =
|
|
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
|
|
399
|
+
var import_zod14 = require("zod");
|
|
378
400
|
var paths = ["/phoneNumber", "/email"];
|
|
379
|
-
var schema5 =
|
|
380
|
-
userId:
|
|
381
|
-
profileId:
|
|
382
|
-
actions:
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
op:
|
|
386
|
-
path:
|
|
387
|
-
value:
|
|
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
|
-
|
|
390
|
-
op:
|
|
391
|
-
path:
|
|
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
|
|
416
|
-
var schema6 =
|
|
417
|
-
id:
|
|
418
|
-
user:
|
|
419
|
-
locale:
|
|
420
|
-
accountStatus:
|
|
421
|
-
dataPrivacyConsent:
|
|
422
|
-
marketingConsent:
|
|
423
|
-
surveyConsent:
|
|
424
|
-
shareDataConsent:
|
|
425
|
-
profilingConsent:
|
|
426
|
-
membershipNumber:
|
|
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
|
|
441
|
-
var schema7 =
|
|
442
|
-
userId:
|
|
443
|
-
actions:
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
op:
|
|
447
|
-
path:
|
|
448
|
-
value:
|
|
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
|
-
|
|
451
|
-
op:
|
|
452
|
-
path:
|
|
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/
|
|
255
|
+
// src/getUsersPIByIds.ts
|
|
256
256
|
import { z as z11 } from "zod";
|
|
257
|
-
var
|
|
258
|
-
|
|
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 =
|
|
261
|
-
userId:
|
|
262
|
-
labelId:
|
|
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
|
|
318
|
+
import { z as z13 } from "zod";
|
|
298
319
|
var registrationStatus = ["APPROVED", "INCOMPLETE", "PENDING", "REJECTED", "SUSPENDED", "UNREGISTERED"];
|
|
299
|
-
var schema4 =
|
|
300
|
-
disableEmailNotification:
|
|
301
|
-
operatorProfileId:
|
|
302
|
-
actions:
|
|
303
|
-
|
|
304
|
-
reasonForChange:
|
|
305
|
-
serviceId:
|
|
306
|
-
status:
|
|
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 =
|
|
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
|
|
351
|
+
import { z as z14 } from "zod";
|
|
331
352
|
var paths = ["/phoneNumber", "/email"];
|
|
332
|
-
var schema5 =
|
|
333
|
-
userId:
|
|
334
|
-
profileId:
|
|
335
|
-
actions:
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
op:
|
|
339
|
-
path:
|
|
340
|
-
value:
|
|
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
|
-
|
|
343
|
-
op:
|
|
344
|
-
path:
|
|
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
|
|
369
|
-
var schema6 =
|
|
370
|
-
id:
|
|
371
|
-
user:
|
|
372
|
-
locale:
|
|
373
|
-
accountStatus:
|
|
374
|
-
dataPrivacyConsent:
|
|
375
|
-
marketingConsent:
|
|
376
|
-
surveyConsent:
|
|
377
|
-
shareDataConsent:
|
|
378
|
-
profilingConsent:
|
|
379
|
-
membershipNumber:
|
|
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
|
|
394
|
-
var schema7 =
|
|
395
|
-
userId:
|
|
396
|
-
actions:
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
op:
|
|
400
|
-
path:
|
|
401
|
-
value:
|
|
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
|
-
|
|
404
|
-
op:
|
|
405
|
-
path:
|
|
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.
|
|
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.
|
|
23
|
-
"@vulog/aima-config": "1.1.
|
|
24
|
-
"@vulog/aima-core": "1.1.
|
|
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';
|