@vulog/aima-user 1.1.85 → 1.1.87

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
 
@@ -27,6 +27,13 @@ type UserAgreement = {
27
27
  };
28
28
  type ProfileType = 'Single' | 'Business';
29
29
  type ProfileStatus = 'PENDING' | 'APPROVED' | 'REJECTED' | 'SUSPENDED' | 'INACTIVE' | 'ARCHIVED' | 'PENDING_REGISTRATION';
30
+ type ServiceStatus = {
31
+ cityId: string;
32
+ id: string;
33
+ name: string;
34
+ status: string;
35
+ visibility: string;
36
+ };
30
37
  type UserProfile = {
31
38
  id: string;
32
39
  rfid?: string;
@@ -37,6 +44,7 @@ type UserProfile = {
37
44
  status: ProfileStatus;
38
45
  type: ProfileType;
39
46
  emailConsent: boolean;
47
+ services: ServiceStatus[];
40
48
  };
41
49
  type ServicesRegistrationList = {
42
50
  approved: string[];
@@ -155,6 +163,20 @@ type Entity = {
155
163
  fiscalCode: string | null;
156
164
  services: Service[];
157
165
  };
166
+ type Profile = UserProfile & {
167
+ entity: Entity;
168
+ };
169
+ type UserFull = User & {
170
+ profiles: Profile[];
171
+ };
172
+ type BillingGroup = {
173
+ id: string;
174
+ fleetId: string;
175
+ name: string;
176
+ discount: number;
177
+ overMileageCap: number | null;
178
+ overMileageRate: number | null;
179
+ };
158
180
 
159
181
  type CreateBusinessProfile = {
160
182
  emailConsent: boolean;
@@ -248,4 +270,8 @@ declare const updateUserPersonalInfo: (client: Client, userId: string, actions:
248
270
 
249
271
  declare const getEntity: (client: Client, entityId: string) => Promise<Entity>;
250
272
 
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 };
273
+ declare const getFleetBillingGroups: (client: Client, options?: PaginableOptions) => Promise<PaginableResponse<BillingGroup>>;
274
+
275
+ declare const getUsersByIds: (client: Client, ids: string[]) => Promise<User[]>;
276
+
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 };
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
 
@@ -27,6 +27,13 @@ type UserAgreement = {
27
27
  };
28
28
  type ProfileType = 'Single' | 'Business';
29
29
  type ProfileStatus = 'PENDING' | 'APPROVED' | 'REJECTED' | 'SUSPENDED' | 'INACTIVE' | 'ARCHIVED' | 'PENDING_REGISTRATION';
30
+ type ServiceStatus = {
31
+ cityId: string;
32
+ id: string;
33
+ name: string;
34
+ status: string;
35
+ visibility: string;
36
+ };
30
37
  type UserProfile = {
31
38
  id: string;
32
39
  rfid?: string;
@@ -37,6 +44,7 @@ type UserProfile = {
37
44
  status: ProfileStatus;
38
45
  type: ProfileType;
39
46
  emailConsent: boolean;
47
+ services: ServiceStatus[];
40
48
  };
41
49
  type ServicesRegistrationList = {
42
50
  approved: string[];
@@ -155,6 +163,20 @@ type Entity = {
155
163
  fiscalCode: string | null;
156
164
  services: Service[];
157
165
  };
166
+ type Profile = UserProfile & {
167
+ entity: Entity;
168
+ };
169
+ type UserFull = User & {
170
+ profiles: Profile[];
171
+ };
172
+ type BillingGroup = {
173
+ id: string;
174
+ fleetId: string;
175
+ name: string;
176
+ discount: number;
177
+ overMileageCap: number | null;
178
+ overMileageRate: number | null;
179
+ };
158
180
 
159
181
  type CreateBusinessProfile = {
160
182
  emailConsent: boolean;
@@ -248,4 +270,8 @@ declare const updateUserPersonalInfo: (client: Client, userId: string, actions:
248
270
 
249
271
  declare const getEntity: (client: Client, entityId: string) => Promise<Entity>;
250
272
 
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 };
273
+ declare const getFleetBillingGroups: (client: Client, options?: PaginableOptions) => Promise<PaginableResponse<BillingGroup>>;
274
+
275
+ declare const getUsersByIds: (client: Client, ids: string[]) => Promise<User[]>;
276
+
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 };
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.87",
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.87",
23
+ "@vulog/aima-config": "1.1.87",
24
+ "@vulog/aima-core": "1.1.87"
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
@@ -32,6 +32,14 @@ export type ProfileStatus =
32
32
  | 'ARCHIVED'
33
33
  | 'PENDING_REGISTRATION';
34
34
 
35
+ export type ServiceStatus = {
36
+ cityId: string;
37
+ id: string;
38
+ name: string;
39
+ status: string;
40
+ visibility: string;
41
+ };
42
+
35
43
  export type UserProfile = {
36
44
  id: string;
37
45
  rfid?: string;
@@ -42,6 +50,7 @@ export type UserProfile = {
42
50
  status: ProfileStatus;
43
51
  type: ProfileType;
44
52
  emailConsent: boolean;
53
+ services: ServiceStatus[];
45
54
  };
46
55
 
47
56
  export type ServicesRegistrationList = {
@@ -235,3 +244,20 @@ export type Entity = {
235
244
  fiscalCode: string | null;
236
245
  services: Service[];
237
246
  };
247
+
248
+ export type Profile = UserProfile & {
249
+ entity: Entity;
250
+ };
251
+
252
+ export type UserFull = User & {
253
+ profiles: Profile[];
254
+ };
255
+
256
+ export type BillingGroup = {
257
+ id: string;
258
+ fleetId: string;
259
+ name: string;
260
+ discount: number;
261
+ overMileageCap: number | null;
262
+ overMileageRate: number | null;
263
+ };