@vulog/aima-user 1.1.85 → 1.1.86

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
@@ -1,7 +1,7 @@
1
1
  import { Client } from '@vulog/aima-client';
2
2
  import { Service } from '@vulog/aima-config';
3
3
  import { z } from 'zod';
4
- import { PatchAction } from '@vulog/aima-core';
4
+ import { PatchAction, PaginableOptions, PaginableResponse } from '@vulog/aima-core';
5
5
 
6
6
  declare const acceptTAndC: (client: Client, userId: string, cityId: string) => Promise<void>;
7
7
 
@@ -155,6 +155,20 @@ type Entity = {
155
155
  fiscalCode: string | null;
156
156
  services: Service[];
157
157
  };
158
+ type Profile = UserProfile & {
159
+ entity: Entity;
160
+ };
161
+ type UserFull = User & {
162
+ profiles: Profile[];
163
+ };
164
+ type BillingGroup = {
165
+ id: string;
166
+ fleetId: string;
167
+ name: string;
168
+ discount: number;
169
+ overMileageCap: number | null;
170
+ overMileageRate: number | null;
171
+ };
158
172
 
159
173
  type CreateBusinessProfile = {
160
174
  emailConsent: boolean;
@@ -248,4 +262,8 @@ declare const updateUserPersonalInfo: (client: Client, userId: string, actions:
248
262
 
249
263
  declare const getEntity: (client: Client, entityId: string) => Promise<Entity>;
250
264
 
251
- export { type AccountStatus, type Address, 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 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, getEntity, getLabelsForUser, getProfilePersonalInfoById, getRegistrationOverview, getUserById, getUserPersonalInfoById, getUsersPIByIds, personalInformationProfileTypeSchema, personalInformationProfileTypes, personalInformationUserPaths, personalInformationUserTypeSchema, personalInformationUserTypes, removeLabelForUser, setServicesStatus, updateProfilePersonalInfo, updateUser, updateUserPersonalInfo };
265
+ declare const getFleetBillingGroups: (client: Client, options?: PaginableOptions) => Promise<PaginableResponse<BillingGroup>>;
266
+
267
+ declare const getUsersByIds: (client: Client, ids: string[]) => Promise<User[]>;
268
+
269
+ 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 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 };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Client } from '@vulog/aima-client';
2
2
  import { Service } from '@vulog/aima-config';
3
3
  import { z } from 'zod';
4
- import { PatchAction } from '@vulog/aima-core';
4
+ import { PatchAction, PaginableOptions, PaginableResponse } from '@vulog/aima-core';
5
5
 
6
6
  declare const acceptTAndC: (client: Client, userId: string, cityId: string) => Promise<void>;
7
7
 
@@ -155,6 +155,20 @@ type Entity = {
155
155
  fiscalCode: string | null;
156
156
  services: Service[];
157
157
  };
158
+ type Profile = UserProfile & {
159
+ entity: Entity;
160
+ };
161
+ type UserFull = User & {
162
+ profiles: Profile[];
163
+ };
164
+ type BillingGroup = {
165
+ id: string;
166
+ fleetId: string;
167
+ name: string;
168
+ discount: number;
169
+ overMileageCap: number | null;
170
+ overMileageRate: number | null;
171
+ };
158
172
 
159
173
  type CreateBusinessProfile = {
160
174
  emailConsent: boolean;
@@ -248,4 +262,8 @@ declare const updateUserPersonalInfo: (client: Client, userId: string, actions:
248
262
 
249
263
  declare const getEntity: (client: Client, entityId: string) => Promise<Entity>;
250
264
 
251
- export { type AccountStatus, type Address, 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 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, getEntity, getLabelsForUser, getProfilePersonalInfoById, getRegistrationOverview, getUserById, getUserPersonalInfoById, getUsersPIByIds, personalInformationProfileTypeSchema, personalInformationProfileTypes, personalInformationUserPaths, personalInformationUserTypeSchema, personalInformationUserTypes, removeLabelForUser, setServicesStatus, updateProfilePersonalInfo, updateUser, updateUserPersonalInfo };
265
+ declare const getFleetBillingGroups: (client: Client, options?: PaginableOptions) => Promise<PaginableResponse<BillingGroup>>;
266
+
267
+ declare const getUsersByIds: (client: Client, ids: string[]) => Promise<User[]>;
268
+
269
+ 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 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 };
package/dist/index.js CHANGED
@@ -28,11 +28,13 @@ __export(index_exports, {
28
28
  createUser: () => createUser,
29
29
  findUser: () => findUser,
30
30
  getEntity: () => getEntity,
31
+ getFleetBillingGroups: () => getFleetBillingGroups,
31
32
  getLabelsForUser: () => getLabelsForUser,
32
33
  getProfilePersonalInfoById: () => getProfilePersonalInfoById,
33
34
  getRegistrationOverview: () => getRegistrationOverview,
34
35
  getUserById: () => getUserById,
35
36
  getUserPersonalInfoById: () => getUserPersonalInfoById,
37
+ getUsersByIds: () => getUsersByIds,
36
38
  getUsersPIByIds: () => getUsersPIByIds,
37
39
  personalInformationProfileTypeSchema: () => personalInformationProfileTypeSchema,
38
40
  personalInformationProfileTypes: () => personalInformationProfileTypes,
@@ -503,6 +505,50 @@ var getEntity = async (client, entityId) => {
503
505
  const entity = await client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/entities/${entityId}`).then(({ data }) => data);
504
506
  return entity;
505
507
  };
508
+
509
+ // src/getFleetBillingGroups.ts
510
+ var import_aima_core = require("@vulog/aima-core");
511
+ var import_zod18 = require("zod");
512
+ var getFleetBillingGroups = async (client, options) => {
513
+ const argsSchema5 = import_zod18.z.object({
514
+ ids: import_zod18.z.array(import_zod18.z.string().trim().min(1).uuid()).min(1)
515
+ });
516
+ const PaginableOptionsSchema = (0, import_aima_core.createPaginableOptionsSchema)(argsSchema5).default({});
517
+ const resultOptions = PaginableOptionsSchema.safeParse(options);
518
+ if (!resultOptions.success) {
519
+ throw new TypeError("Invalid options", {
520
+ cause: resultOptions.error.issues
521
+ });
522
+ }
523
+ const finalOptions = resultOptions.data;
524
+ const searchParams = new URLSearchParams();
525
+ searchParams.append("page", finalOptions.page.toString());
526
+ searchParams.append("pageSize", finalOptions.pageSize.toString());
527
+ return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/billingGroup?${searchParams.toString()}`).then(({ data, headers }) => {
528
+ return {
529
+ data,
530
+ page: headers.number,
531
+ pageSize: headers.size,
532
+ total: headers.totalelements,
533
+ totalPages: headers.totalpages
534
+ };
535
+ });
536
+ };
537
+
538
+ // src/getUsersByIds.ts
539
+ var import_zod19 = require("zod");
540
+ var argsSchema4 = import_zod19.z.object({
541
+ ids: import_zod19.z.array(import_zod19.z.string().trim().min(1).uuid()).min(1)
542
+ });
543
+ var getUsersByIds = async (client, ids) => {
544
+ const result = argsSchema4.safeParse({ ids });
545
+ if (!result.success) {
546
+ throw new TypeError("Invalid args", {
547
+ cause: result.error.issues
548
+ });
549
+ }
550
+ return client.post(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/list`, result.data.ids).then(({ data }) => data);
551
+ };
506
552
  // Annotate the CommonJS export names for ESM import in node:
507
553
  0 && (module.exports = {
508
554
  acceptTAndC,
@@ -513,11 +559,13 @@ var getEntity = async (client, entityId) => {
513
559
  createUser,
514
560
  findUser,
515
561
  getEntity,
562
+ getFleetBillingGroups,
516
563
  getLabelsForUser,
517
564
  getProfilePersonalInfoById,
518
565
  getRegistrationOverview,
519
566
  getUserById,
520
567
  getUserPersonalInfoById,
568
+ getUsersByIds,
521
569
  getUsersPIByIds,
522
570
  personalInformationProfileTypeSchema,
523
571
  personalInformationProfileTypes,
package/dist/index.mjs CHANGED
@@ -454,6 +454,50 @@ var getEntity = async (client, entityId) => {
454
454
  const entity = await client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/entities/${entityId}`).then(({ data }) => data);
455
455
  return entity;
456
456
  };
457
+
458
+ // src/getFleetBillingGroups.ts
459
+ import { createPaginableOptionsSchema } from "@vulog/aima-core";
460
+ import { z as z18 } from "zod";
461
+ var getFleetBillingGroups = async (client, options) => {
462
+ const argsSchema5 = z18.object({
463
+ ids: z18.array(z18.string().trim().min(1).uuid()).min(1)
464
+ });
465
+ const PaginableOptionsSchema = createPaginableOptionsSchema(argsSchema5).default({});
466
+ const resultOptions = PaginableOptionsSchema.safeParse(options);
467
+ if (!resultOptions.success) {
468
+ throw new TypeError("Invalid options", {
469
+ cause: resultOptions.error.issues
470
+ });
471
+ }
472
+ const finalOptions = resultOptions.data;
473
+ const searchParams = new URLSearchParams();
474
+ searchParams.append("page", finalOptions.page.toString());
475
+ searchParams.append("pageSize", finalOptions.pageSize.toString());
476
+ return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/billingGroup?${searchParams.toString()}`).then(({ data, headers }) => {
477
+ return {
478
+ data,
479
+ page: headers.number,
480
+ pageSize: headers.size,
481
+ total: headers.totalelements,
482
+ totalPages: headers.totalpages
483
+ };
484
+ });
485
+ };
486
+
487
+ // src/getUsersByIds.ts
488
+ import { z as z19 } from "zod";
489
+ var argsSchema4 = z19.object({
490
+ ids: z19.array(z19.string().trim().min(1).uuid()).min(1)
491
+ });
492
+ var getUsersByIds = async (client, ids) => {
493
+ const result = argsSchema4.safeParse({ ids });
494
+ if (!result.success) {
495
+ throw new TypeError("Invalid args", {
496
+ cause: result.error.issues
497
+ });
498
+ }
499
+ return client.post(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/list`, result.data.ids).then(({ data }) => data);
500
+ };
457
501
  export {
458
502
  acceptTAndC,
459
503
  accountStatus,
@@ -463,11 +507,13 @@ export {
463
507
  createUser,
464
508
  findUser,
465
509
  getEntity,
510
+ getFleetBillingGroups,
466
511
  getLabelsForUser,
467
512
  getProfilePersonalInfoById,
468
513
  getRegistrationOverview,
469
514
  getUserById,
470
515
  getUserPersonalInfoById,
516
+ getUsersByIds,
471
517
  getUsersPIByIds,
472
518
  personalInformationProfileTypeSchema,
473
519
  personalInformationProfileTypes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vulog/aima-user",
3
- "version": "1.1.85",
3
+ "version": "1.1.86",
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.85",
23
- "@vulog/aima-config": "1.1.85",
24
- "@vulog/aima-core": "1.1.85"
22
+ "@vulog/aima-client": "1.1.86",
23
+ "@vulog/aima-config": "1.1.86",
24
+ "@vulog/aima-core": "1.1.86"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "zod": "^3.25.76"
@@ -0,0 +1,43 @@
1
+ import { Client } from '@vulog/aima-client';
2
+ import { createPaginableOptionsSchema, PaginableOptions, PaginableResponse } from '@vulog/aima-core';
3
+ import { z } from 'zod';
4
+
5
+ import { BillingGroup } from './types';
6
+
7
+ export const getFleetBillingGroups = async (
8
+ client: Client,
9
+ options?: PaginableOptions
10
+ ): Promise<PaginableResponse<BillingGroup>> => {
11
+ const argsSchema = z.object({
12
+ ids: z.array(z.string().trim().min(1).uuid()).min(1),
13
+ });
14
+
15
+ const PaginableOptionsSchema = createPaginableOptionsSchema(argsSchema).default({});
16
+
17
+ const resultOptions = PaginableOptionsSchema.safeParse(options);
18
+ if (!resultOptions.success) {
19
+ throw new TypeError('Invalid options', {
20
+ cause: resultOptions.error.issues,
21
+ });
22
+ }
23
+
24
+ const finalOptions = resultOptions.data;
25
+
26
+ const searchParams = new URLSearchParams();
27
+ searchParams.append('page', finalOptions.page!.toString());
28
+ searchParams.append('pageSize', finalOptions.pageSize!.toString());
29
+
30
+ return client
31
+ .get<
32
+ BillingGroup[]
33
+ >(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/billingGroup?${searchParams.toString()}`)
34
+ .then(({ data, headers }) => {
35
+ return {
36
+ data,
37
+ page: headers.number,
38
+ pageSize: headers.size,
39
+ total: headers.totalelements,
40
+ totalPages: headers.totalpages,
41
+ };
42
+ });
43
+ };
@@ -0,0 +1,21 @@
1
+ import { Client } from '@vulog/aima-client';
2
+ import { z } from 'zod';
3
+
4
+ import { User } from './types';
5
+
6
+ const argsSchema = z.object({
7
+ ids: z.array(z.string().trim().min(1).uuid()).min(1),
8
+ });
9
+
10
+ export const getUsersByIds = async (client: Client, ids: string[]): Promise<User[]> => {
11
+ const result = argsSchema.safeParse({ ids });
12
+ if (!result.success) {
13
+ throw new TypeError('Invalid args', {
14
+ cause: result.error.issues,
15
+ });
16
+ }
17
+
18
+ return client
19
+ .post<User[]>(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/users/list`, result.data.ids)
20
+ .then(({ data }) => data);
21
+ };
package/src/index.ts CHANGED
@@ -15,3 +15,5 @@ export * from './updateProfilePersonalInfo';
15
15
  export * from './updateUser';
16
16
  export * from './updateUserPersonalInfo';
17
17
  export * from './getEntity';
18
+ export * from './getFleetBillingGroups';
19
+ export * from './getUsersByIds';
package/src/types.ts CHANGED
@@ -235,3 +235,20 @@ export type Entity = {
235
235
  fiscalCode: string | null;
236
236
  services: Service[];
237
237
  };
238
+
239
+ export type Profile = UserProfile & {
240
+ entity: Entity;
241
+ };
242
+
243
+ export type UserFull = User & {
244
+ profiles: Profile[];
245
+ };
246
+
247
+ export type BillingGroup = {
248
+ id: string;
249
+ fleetId: string;
250
+ name: string;
251
+ discount: number;
252
+ overMileageCap: number | null;
253
+ overMileageRate: number | null;
254
+ };