@vulog/aima-config 1.2.30 → 1.2.32

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.cjs ADDED
@@ -0,0 +1,75 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let zod = require("zod");
3
+ //#region src/getCities.ts
4
+ const getCities = async (client) => {
5
+ return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/cities`).then(({ data }) => data.filter((city) => city.fleetId === client.clientOptions.fleetId).map(({ fleetId, ...city }) => city));
6
+ };
7
+ const getCitiesAllFranchises = async (client) => {
8
+ return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/cities`).then(({ data }) => data);
9
+ };
10
+ //#endregion
11
+ //#region src/getServices.ts
12
+ const getServices = async (client) => {
13
+ return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/services`).then(({ data }) => data.filter((service) => service.fleetId === client.clientOptions.fleetId).map(({ fleetId, ...service }) => service));
14
+ };
15
+ const getServicesAllFranchises = async (client) => {
16
+ return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/services`).then(({ data }) => data);
17
+ };
18
+ //#endregion
19
+ //#region src/getFleetConf.ts
20
+ const getFleetConf = async (client) => {
21
+ return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/conf`).then(({ data }) => data);
22
+ };
23
+ //#endregion
24
+ //#region src/label.ts
25
+ const getLabels = async (client) => {
26
+ return client.get(`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/labels`).then(({ data }) => data.content);
27
+ };
28
+ const schemaData = zod.z.object({ name: zod.z.string().nonempty() });
29
+ const addLabel = async (client, name) => {
30
+ const result = schemaData.safeParse({ name });
31
+ if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
32
+ await client.post(`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/labels`, { name });
33
+ };
34
+ const schemaRemove = zod.z.object({
35
+ labelId: zod.z.number().positive(),
36
+ cascade: zod.z.boolean().optional()
37
+ });
38
+ const removeLabel = async (client, labelId, cascade = false) => {
39
+ const result = schemaRemove.safeParse({
40
+ labelId,
41
+ cascade
42
+ });
43
+ if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
44
+ await client.delete(`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/labels/${labelId}?cascade=${cascade}`);
45
+ };
46
+ //#endregion
47
+ //#region src/getPaymentParameters.ts
48
+ const schema = zod.z.object({
49
+ serviceId: zod.z.string().uuid().optional(),
50
+ modelId: zod.z.string().optional(),
51
+ strict: zod.z.enum(["true", "false"]).optional()
52
+ });
53
+ const getPaymentParameters = async (client, serviceId, modelId, strict) => {
54
+ const validated = schema.safeParse({
55
+ serviceId,
56
+ modelId
57
+ });
58
+ if (!validated.success) throw new TypeError("Invalid parameters", { cause: validated.error.issues });
59
+ const url = `/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/payment/parameters?${new URLSearchParams({
60
+ ...serviceId ? { serviceId } : {},
61
+ ...modelId ? { modelId } : {},
62
+ ...strict ? { strict } : {}
63
+ }).toString()}`;
64
+ return client.get(url).then(({ data }) => data);
65
+ };
66
+ //#endregion
67
+ exports.addLabel = addLabel;
68
+ exports.getCities = getCities;
69
+ exports.getCitiesAllFranchises = getCitiesAllFranchises;
70
+ exports.getFleetConf = getFleetConf;
71
+ exports.getLabels = getLabels;
72
+ exports.getPaymentParameters = getPaymentParameters;
73
+ exports.getServices = getServices;
74
+ exports.getServicesAllFranchises = getServicesAllFranchises;
75
+ exports.removeLabel = removeLabel;
@@ -0,0 +1,84 @@
1
+ import { Client } from "@vulog/aima-client";
2
+
3
+ //#region src/types.d.ts
4
+ type City = {
5
+ id: string;
6
+ name: string;
7
+ locale: string;
8
+ imagesUrl: string;
9
+ tokenIconsUrl?: string;
10
+ lat: number;
11
+ lon: number;
12
+ zoomLevel: number;
13
+ radius: number;
14
+ termsOfUseUrl: string;
15
+ termsOfUseUpdateDatetime: string;
16
+ faqUrl: string;
17
+ contactPhoneNumber: string;
18
+ agreementsDate: string;
19
+ timeZone: string;
20
+ distanceUnit: string;
21
+ contactUrl: string;
22
+ services: string[];
23
+ zoneId: string;
24
+ [key: string]: any;
25
+ };
26
+ type Service = {
27
+ id: string;
28
+ name: string;
29
+ status: 'ACTIVE' | 'DISABLED';
30
+ type: 'FREE_FLOATING' | 'FREE_FLOATING_STRICT' | 'SERVICE_TRIP' | 'BOOKING' | 'ROUND_TRIP_BOOKING' | 'BY_PASS_FREE_FLOATING' | 'BY_PASS_ROUND_TRIP_BOOKING' | 'SUBSCRIPTION' | 'SCHEDULED_BOOKING_STATION';
31
+ cityId: string;
32
+ zones: string[];
33
+ vehicles: string[];
34
+ stations: string[];
35
+ pois: string[];
36
+ [key: string]: any;
37
+ };
38
+ type PaymentParameters = {
39
+ id: string;
40
+ referenceId: string;
41
+ scope: 'RENTAL';
42
+ flow: 'MANDATORY';
43
+ amountType: 'FIXED' | 'PERCENTAGE';
44
+ amountValue: null | number;
45
+ fleetId: string;
46
+ providePreferredPaymentMethodPspReferences: boolean;
47
+ serviceId?: string;
48
+ modelIds?: string[];
49
+ };
50
+ //#endregion
51
+ //#region src/getCities.d.ts
52
+ declare const getCities: (client: Client) => Promise<City[]>;
53
+ declare const getCitiesAllFranchises: (client: Client) => Promise<(City & {
54
+ fleetId: string;
55
+ })[]>;
56
+ //#endregion
57
+ //#region src/getServices.d.ts
58
+ declare const getServices: (client: Client) => Promise<Service[]>;
59
+ declare const getServicesAllFranchises: (client: Client) => Promise<(Service & {
60
+ fleetId: string;
61
+ })[]>;
62
+ //#endregion
63
+ //#region src/getFleetConf.d.ts
64
+ type FleetConf = {
65
+ triggerSubscriptionPaymentInHours: number;
66
+ timeZone: string;
67
+ [key: string]: any;
68
+ };
69
+ declare const getFleetConf: (client: Client) => Promise<FleetConf>;
70
+ //#endregion
71
+ //#region src/label.d.ts
72
+ type Label = {
73
+ id: number;
74
+ name: string;
75
+ createDate: string;
76
+ };
77
+ declare const getLabels: (client: Client) => Promise<Label[]>;
78
+ declare const addLabel: (client: Client, name: string) => Promise<void>;
79
+ declare const removeLabel: (client: Client, labelId: number, cascade?: boolean) => Promise<void>;
80
+ //#endregion
81
+ //#region src/getPaymentParameters.d.ts
82
+ declare const getPaymentParameters: (client: Client, serviceId?: string, modelId?: string, strict?: string) => Promise<PaymentParameters[] | null>;
83
+ //#endregion
84
+ export { City, FleetConf, Label, PaymentParameters, Service, addLabel, getCities, getCitiesAllFranchises, getFleetConf, getLabels, getPaymentParameters, getServices, getServicesAllFranchises, removeLabel };
package/dist/index.d.mts CHANGED
@@ -1,78 +1,84 @@
1
- import { Client } from '@vulog/aima-client';
1
+ import { Client } from "@vulog/aima-client";
2
2
 
3
+ //#region src/types.d.ts
3
4
  type City = {
4
- id: string;
5
- name: string;
6
- locale: string;
7
- imagesUrl: string;
8
- tokenIconsUrl?: string;
9
- lat: number;
10
- lon: number;
11
- zoomLevel: number;
12
- radius: number;
13
- termsOfUseUrl: string;
14
- termsOfUseUpdateDatetime: string;
15
- faqUrl: string;
16
- contactPhoneNumber: string;
17
- agreementsDate: string;
18
- timeZone: string;
19
- distanceUnit: string;
20
- contactUrl: string;
21
- services: string[];
22
- zoneId: string;
23
- [key: string]: any;
5
+ id: string;
6
+ name: string;
7
+ locale: string;
8
+ imagesUrl: string;
9
+ tokenIconsUrl?: string;
10
+ lat: number;
11
+ lon: number;
12
+ zoomLevel: number;
13
+ radius: number;
14
+ termsOfUseUrl: string;
15
+ termsOfUseUpdateDatetime: string;
16
+ faqUrl: string;
17
+ contactPhoneNumber: string;
18
+ agreementsDate: string;
19
+ timeZone: string;
20
+ distanceUnit: string;
21
+ contactUrl: string;
22
+ services: string[];
23
+ zoneId: string;
24
+ [key: string]: any;
24
25
  };
25
26
  type Service = {
26
- id: string;
27
- name: string;
28
- status: 'ACTIVE' | 'DISABLED';
29
- type: 'FREE_FLOATING' | 'FREE_FLOATING_STRICT' | 'SERVICE_TRIP' | 'BOOKING' | 'ROUND_TRIP_BOOKING' | 'BY_PASS_FREE_FLOATING' | 'BY_PASS_ROUND_TRIP_BOOKING' | 'SUBSCRIPTION' | 'SCHEDULED_BOOKING_STATION';
30
- cityId: string;
31
- zones: string[];
32
- vehicles: string[];
33
- stations: string[];
34
- pois: string[];
35
- [key: string]: any;
27
+ id: string;
28
+ name: string;
29
+ status: 'ACTIVE' | 'DISABLED';
30
+ type: 'FREE_FLOATING' | 'FREE_FLOATING_STRICT' | 'SERVICE_TRIP' | 'BOOKING' | 'ROUND_TRIP_BOOKING' | 'BY_PASS_FREE_FLOATING' | 'BY_PASS_ROUND_TRIP_BOOKING' | 'SUBSCRIPTION' | 'SCHEDULED_BOOKING_STATION';
31
+ cityId: string;
32
+ zones: string[];
33
+ vehicles: string[];
34
+ stations: string[];
35
+ pois: string[];
36
+ [key: string]: any;
36
37
  };
37
38
  type PaymentParameters = {
38
- id: string;
39
- referenceId: string;
40
- scope: 'RENTAL';
41
- flow: 'MANDATORY';
42
- amountType: 'FIXED' | 'PERCENTAGE';
43
- amountValue: null | number;
44
- fleetId: string;
45
- providePreferredPaymentMethodPspReferences: boolean;
46
- serviceId?: string;
47
- modelIds?: string[];
39
+ id: string;
40
+ referenceId: string;
41
+ scope: 'RENTAL';
42
+ flow: 'MANDATORY';
43
+ amountType: 'FIXED' | 'PERCENTAGE';
44
+ amountValue: null | number;
45
+ fleetId: string;
46
+ providePreferredPaymentMethodPspReferences: boolean;
47
+ serviceId?: string;
48
+ modelIds?: string[];
48
49
  };
49
-
50
+ //#endregion
51
+ //#region src/getCities.d.ts
50
52
  declare const getCities: (client: Client) => Promise<City[]>;
51
53
  declare const getCitiesAllFranchises: (client: Client) => Promise<(City & {
52
- fleetId: string;
54
+ fleetId: string;
53
55
  })[]>;
54
-
56
+ //#endregion
57
+ //#region src/getServices.d.ts
55
58
  declare const getServices: (client: Client) => Promise<Service[]>;
56
59
  declare const getServicesAllFranchises: (client: Client) => Promise<(Service & {
57
- fleetId: string;
60
+ fleetId: string;
58
61
  })[]>;
59
-
62
+ //#endregion
63
+ //#region src/getFleetConf.d.ts
60
64
  type FleetConf = {
61
- triggerSubscriptionPaymentInHours: number;
62
- timeZone: string;
63
- [key: string]: any;
65
+ triggerSubscriptionPaymentInHours: number;
66
+ timeZone: string;
67
+ [key: string]: any;
64
68
  };
65
69
  declare const getFleetConf: (client: Client) => Promise<FleetConf>;
66
-
70
+ //#endregion
71
+ //#region src/label.d.ts
67
72
  type Label = {
68
- id: number;
69
- name: string;
70
- createDate: string;
73
+ id: number;
74
+ name: string;
75
+ createDate: string;
71
76
  };
72
77
  declare const getLabels: (client: Client) => Promise<Label[]>;
73
78
  declare const addLabel: (client: Client, name: string) => Promise<void>;
74
79
  declare const removeLabel: (client: Client, labelId: number, cascade?: boolean) => Promise<void>;
75
-
80
+ //#endregion
81
+ //#region src/getPaymentParameters.d.ts
76
82
  declare const getPaymentParameters: (client: Client, serviceId?: string, modelId?: string, strict?: string) => Promise<PaymentParameters[] | null>;
77
-
78
- export { type City, type FleetConf, type Label, type PaymentParameters, type Service, addLabel, getCities, getCitiesAllFranchises, getFleetConf, getLabels, getPaymentParameters, getServices, getServicesAllFranchises, removeLabel };
83
+ //#endregion
84
+ export { City, FleetConf, Label, PaymentParameters, Service, addLabel, getCities, getCitiesAllFranchises, getFleetConf, getLabels, getPaymentParameters, getServices, getServicesAllFranchises, removeLabel };
package/dist/index.mjs CHANGED
@@ -1,90 +1,66 @@
1
- // src/getCities.ts
2
- var getCities = async (client) => {
3
- return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/cities`).then(
4
- ({ data }) => data.filter((city) => city.fleetId === client.clientOptions.fleetId).map(({ fleetId, ...city }) => city)
5
- );
1
+ import { z } from "zod";
2
+ //#region src/getCities.ts
3
+ const getCities = async (client) => {
4
+ return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/cities`).then(({ data }) => data.filter((city) => city.fleetId === client.clientOptions.fleetId).map(({ fleetId, ...city }) => city));
6
5
  };
7
- var getCitiesAllFranchises = async (client) => {
8
- return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/cities`).then(({ data }) => data);
6
+ const getCitiesAllFranchises = async (client) => {
7
+ return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/cities`).then(({ data }) => data);
9
8
  };
10
-
11
- // src/getServices.ts
12
- var getServices = async (client) => {
13
- return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/services`).then(
14
- ({ data }) => data.filter((service) => service.fleetId === client.clientOptions.fleetId).map(({ fleetId, ...service }) => service)
15
- );
9
+ //#endregion
10
+ //#region src/getServices.ts
11
+ const getServices = async (client) => {
12
+ return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/services`).then(({ data }) => data.filter((service) => service.fleetId === client.clientOptions.fleetId).map(({ fleetId, ...service }) => service));
16
13
  };
17
- var getServicesAllFranchises = async (client) => {
18
- return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/services`).then(({ data }) => data);
14
+ const getServicesAllFranchises = async (client) => {
15
+ return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/services`).then(({ data }) => data);
19
16
  };
20
-
21
- // src/getFleetConf.ts
22
- var getFleetConf = async (client) => {
23
- return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/conf`).then(({ data }) => data);
17
+ //#endregion
18
+ //#region src/getFleetConf.ts
19
+ const getFleetConf = async (client) => {
20
+ return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/conf`).then(({ data }) => data);
24
21
  };
25
-
26
- // src/label.ts
27
- import { z } from "zod";
28
- var getLabels = async (client) => {
29
- return client.get(`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/labels`).then(({ data }) => data.content);
22
+ //#endregion
23
+ //#region src/label.ts
24
+ const getLabels = async (client) => {
25
+ return client.get(`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/labels`).then(({ data }) => data.content);
30
26
  };
31
- var schemaData = z.object({
32
- name: z.string().nonempty()
33
- });
34
- var addLabel = async (client, name) => {
35
- const result = schemaData.safeParse({ name });
36
- if (!result.success) {
37
- throw new TypeError("Invalid args", {
38
- cause: result.error.issues
39
- });
40
- }
41
- await client.post(`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/labels`, {
42
- name
43
- });
27
+ const schemaData = z.object({ name: z.string().nonempty() });
28
+ const addLabel = async (client, name) => {
29
+ const result = schemaData.safeParse({ name });
30
+ if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
31
+ await client.post(`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/labels`, { name });
44
32
  };
45
- var schemaRemove = z.object({
46
- labelId: z.number().positive(),
47
- cascade: z.boolean().optional()
33
+ const schemaRemove = z.object({
34
+ labelId: z.number().positive(),
35
+ cascade: z.boolean().optional()
48
36
  });
49
- var removeLabel = async (client, labelId, cascade = false) => {
50
- const result = schemaRemove.safeParse({ labelId, cascade });
51
- if (!result.success) {
52
- throw new TypeError("Invalid args", {
53
- cause: result.error.issues
54
- });
55
- }
56
- await client.delete(`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/labels/${labelId}?cascade=${cascade}`);
37
+ const removeLabel = async (client, labelId, cascade = false) => {
38
+ const result = schemaRemove.safeParse({
39
+ labelId,
40
+ cascade
41
+ });
42
+ if (!result.success) throw new TypeError("Invalid args", { cause: result.error.issues });
43
+ await client.delete(`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/labels/${labelId}?cascade=${cascade}`);
57
44
  };
58
-
59
- // src/getPaymentParameters.ts
60
- import { z as z2 } from "zod";
61
- var schema = z2.object({
62
- serviceId: z2.string().uuid().optional(),
63
- modelId: z2.string().optional(),
64
- strict: z2.enum(["true", "false"]).optional()
45
+ //#endregion
46
+ //#region src/getPaymentParameters.ts
47
+ const schema = z.object({
48
+ serviceId: z.string().uuid().optional(),
49
+ modelId: z.string().optional(),
50
+ strict: z.enum(["true", "false"]).optional()
65
51
  });
66
- var getPaymentParameters = async (client, serviceId, modelId, strict) => {
67
- const validated = schema.safeParse({ serviceId, modelId });
68
- if (!validated.success) {
69
- throw new TypeError("Invalid parameters", {
70
- cause: validated.error.issues
71
- });
72
- }
73
- const url = `/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/payment/parameters?${new URLSearchParams({
74
- ...serviceId ? { serviceId } : {},
75
- ...modelId ? { modelId } : {},
76
- ...strict ? { strict } : {}
77
- }).toString()}`;
78
- return client.get(url).then(({ data }) => data);
79
- };
80
- export {
81
- addLabel,
82
- getCities,
83
- getCitiesAllFranchises,
84
- getFleetConf,
85
- getLabels,
86
- getPaymentParameters,
87
- getServices,
88
- getServicesAllFranchises,
89
- removeLabel
52
+ const getPaymentParameters = async (client, serviceId, modelId, strict) => {
53
+ const validated = schema.safeParse({
54
+ serviceId,
55
+ modelId
56
+ });
57
+ if (!validated.success) throw new TypeError("Invalid parameters", { cause: validated.error.issues });
58
+ const url = `/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/payment/parameters?${new URLSearchParams({
59
+ ...serviceId ? { serviceId } : {},
60
+ ...modelId ? { modelId } : {},
61
+ ...strict ? { strict } : {}
62
+ }).toString()}`;
63
+ return client.get(url).then(({ data }) => data);
90
64
  };
65
+ //#endregion
66
+ export { addLabel, getCities, getCitiesAllFranchises, getFleetConf, getLabels, getPaymentParameters, getServices, getServicesAllFranchises, removeLabel };
package/package.json CHANGED
@@ -1,12 +1,25 @@
1
1
  {
2
2
  "name": "@vulog/aima-config",
3
- "version": "1.2.30",
4
- "main": "dist/index.js",
3
+ "type": "module",
4
+ "version": "1.2.32",
5
+ "main": "dist/index.cjs",
5
6
  "module": "dist/index.mjs",
6
- "types": "dist/index.d.ts",
7
+ "types": "dist/index.d.cts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./dist/index.d.mts",
12
+ "default": "./dist/index.mjs"
13
+ },
14
+ "require": {
15
+ "types": "./dist/index.d.cts",
16
+ "default": "./dist/index.cjs"
17
+ }
18
+ }
19
+ },
7
20
  "scripts": {
8
- "build": "tsup",
9
- "dev": "tsup --watch",
21
+ "build": "tsdown",
22
+ "dev": "tsdown --watch",
10
23
  "test": "vitest run",
11
24
  "test:watch": "vitest",
12
25
  "lint": "eslint src/**/* --ext .ts"
@@ -19,8 +32,8 @@
19
32
  "author": "Vulog",
20
33
  "license": "MIT",
21
34
  "dependencies": {
22
- "@vulog/aima-client": "1.2.30",
23
- "@vulog/aima-core": "1.2.30"
35
+ "@vulog/aima-client": "1.2.32",
36
+ "@vulog/aima-core": "1.2.32"
24
37
  },
25
38
  "peerDependencies": {
26
39
  "zod": "^3.25.76"
@@ -1,4 +1,4 @@
1
- import { defineConfig } from 'tsup';
1
+ import { defineConfig } from 'tsdown';
2
2
 
3
3
  export default defineConfig({
4
4
  entry: ['src/index.ts'],
package/dist/index.d.ts DELETED
@@ -1,78 +0,0 @@
1
- import { Client } from '@vulog/aima-client';
2
-
3
- type City = {
4
- id: string;
5
- name: string;
6
- locale: string;
7
- imagesUrl: string;
8
- tokenIconsUrl?: string;
9
- lat: number;
10
- lon: number;
11
- zoomLevel: number;
12
- radius: number;
13
- termsOfUseUrl: string;
14
- termsOfUseUpdateDatetime: string;
15
- faqUrl: string;
16
- contactPhoneNumber: string;
17
- agreementsDate: string;
18
- timeZone: string;
19
- distanceUnit: string;
20
- contactUrl: string;
21
- services: string[];
22
- zoneId: string;
23
- [key: string]: any;
24
- };
25
- type Service = {
26
- id: string;
27
- name: string;
28
- status: 'ACTIVE' | 'DISABLED';
29
- type: 'FREE_FLOATING' | 'FREE_FLOATING_STRICT' | 'SERVICE_TRIP' | 'BOOKING' | 'ROUND_TRIP_BOOKING' | 'BY_PASS_FREE_FLOATING' | 'BY_PASS_ROUND_TRIP_BOOKING' | 'SUBSCRIPTION' | 'SCHEDULED_BOOKING_STATION';
30
- cityId: string;
31
- zones: string[];
32
- vehicles: string[];
33
- stations: string[];
34
- pois: string[];
35
- [key: string]: any;
36
- };
37
- type PaymentParameters = {
38
- id: string;
39
- referenceId: string;
40
- scope: 'RENTAL';
41
- flow: 'MANDATORY';
42
- amountType: 'FIXED' | 'PERCENTAGE';
43
- amountValue: null | number;
44
- fleetId: string;
45
- providePreferredPaymentMethodPspReferences: boolean;
46
- serviceId?: string;
47
- modelIds?: string[];
48
- };
49
-
50
- declare const getCities: (client: Client) => Promise<City[]>;
51
- declare const getCitiesAllFranchises: (client: Client) => Promise<(City & {
52
- fleetId: string;
53
- })[]>;
54
-
55
- declare const getServices: (client: Client) => Promise<Service[]>;
56
- declare const getServicesAllFranchises: (client: Client) => Promise<(Service & {
57
- fleetId: string;
58
- })[]>;
59
-
60
- type FleetConf = {
61
- triggerSubscriptionPaymentInHours: number;
62
- timeZone: string;
63
- [key: string]: any;
64
- };
65
- declare const getFleetConf: (client: Client) => Promise<FleetConf>;
66
-
67
- type Label = {
68
- id: number;
69
- name: string;
70
- createDate: string;
71
- };
72
- declare const getLabels: (client: Client) => Promise<Label[]>;
73
- declare const addLabel: (client: Client, name: string) => Promise<void>;
74
- declare const removeLabel: (client: Client, labelId: number, cascade?: boolean) => Promise<void>;
75
-
76
- declare const getPaymentParameters: (client: Client, serviceId?: string, modelId?: string, strict?: string) => Promise<PaymentParameters[] | null>;
77
-
78
- export { type City, type FleetConf, type Label, type PaymentParameters, type Service, addLabel, getCities, getCitiesAllFranchises, getFleetConf, getLabels, getPaymentParameters, getServices, getServicesAllFranchises, removeLabel };
package/dist/index.js DELETED
@@ -1,125 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- addLabel: () => addLabel,
24
- getCities: () => getCities,
25
- getCitiesAllFranchises: () => getCitiesAllFranchises,
26
- getFleetConf: () => getFleetConf,
27
- getLabels: () => getLabels,
28
- getPaymentParameters: () => getPaymentParameters,
29
- getServices: () => getServices,
30
- getServicesAllFranchises: () => getServicesAllFranchises,
31
- removeLabel: () => removeLabel
32
- });
33
- module.exports = __toCommonJS(index_exports);
34
-
35
- // src/getCities.ts
36
- var getCities = async (client) => {
37
- return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/cities`).then(
38
- ({ data }) => data.filter((city) => city.fleetId === client.clientOptions.fleetId).map(({ fleetId, ...city }) => city)
39
- );
40
- };
41
- var getCitiesAllFranchises = async (client) => {
42
- return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/cities`).then(({ data }) => data);
43
- };
44
-
45
- // src/getServices.ts
46
- var getServices = async (client) => {
47
- return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/services`).then(
48
- ({ data }) => data.filter((service) => service.fleetId === client.clientOptions.fleetId).map(({ fleetId, ...service }) => service)
49
- );
50
- };
51
- var getServicesAllFranchises = async (client) => {
52
- return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/services`).then(({ data }) => data);
53
- };
54
-
55
- // src/getFleetConf.ts
56
- var getFleetConf = async (client) => {
57
- return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/conf`).then(({ data }) => data);
58
- };
59
-
60
- // src/label.ts
61
- var import_zod = require("zod");
62
- var getLabels = async (client) => {
63
- return client.get(`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/labels`).then(({ data }) => data.content);
64
- };
65
- var schemaData = import_zod.z.object({
66
- name: import_zod.z.string().nonempty()
67
- });
68
- var addLabel = async (client, name) => {
69
- const result = schemaData.safeParse({ name });
70
- if (!result.success) {
71
- throw new TypeError("Invalid args", {
72
- cause: result.error.issues
73
- });
74
- }
75
- await client.post(`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/labels`, {
76
- name
77
- });
78
- };
79
- var schemaRemove = import_zod.z.object({
80
- labelId: import_zod.z.number().positive(),
81
- cascade: import_zod.z.boolean().optional()
82
- });
83
- var removeLabel = async (client, labelId, cascade = false) => {
84
- const result = schemaRemove.safeParse({ labelId, cascade });
85
- if (!result.success) {
86
- throw new TypeError("Invalid args", {
87
- cause: result.error.issues
88
- });
89
- }
90
- await client.delete(`boapi/proxy/user/fleets/${client.clientOptions.fleetId}/labels/${labelId}?cascade=${cascade}`);
91
- };
92
-
93
- // src/getPaymentParameters.ts
94
- var import_zod2 = require("zod");
95
- var schema = import_zod2.z.object({
96
- serviceId: import_zod2.z.string().uuid().optional(),
97
- modelId: import_zod2.z.string().optional(),
98
- strict: import_zod2.z.enum(["true", "false"]).optional()
99
- });
100
- var getPaymentParameters = async (client, serviceId, modelId, strict) => {
101
- const validated = schema.safeParse({ serviceId, modelId });
102
- if (!validated.success) {
103
- throw new TypeError("Invalid parameters", {
104
- cause: validated.error.issues
105
- });
106
- }
107
- const url = `/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/payment/parameters?${new URLSearchParams({
108
- ...serviceId ? { serviceId } : {},
109
- ...modelId ? { modelId } : {},
110
- ...strict ? { strict } : {}
111
- }).toString()}`;
112
- return client.get(url).then(({ data }) => data);
113
- };
114
- // Annotate the CommonJS export names for ESM import in node:
115
- 0 && (module.exports = {
116
- addLabel,
117
- getCities,
118
- getCitiesAllFranchises,
119
- getFleetConf,
120
- getLabels,
121
- getPaymentParameters,
122
- getServices,
123
- getServicesAllFranchises,
124
- removeLabel
125
- });
File without changes