@vulog/aima-pricing 1.2.30 → 1.2.31

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,16 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let zod = require("zod");
3
+ //#region src/getPricingById.ts
4
+ const getPricingById = async (client, id) => {
5
+ const result = zod.z.string().trim().min(1).uuid().safeParse(id);
6
+ if (!result.success) throw new TypeError("Invalid id", { cause: result.error.issues });
7
+ return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/pricing/${id}`).then(({ data }) => data);
8
+ };
9
+ //#endregion
10
+ //#region src/getPricingByParameter.ts
11
+ const getPricingByParameter = async (client, pricingParameters) => {
12
+ return client.post(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/pricing`, pricingParameters).then(({ data }) => data);
13
+ };
14
+ //#endregion
15
+ exports.getPricingById = getPricingById;
16
+ exports.getPricingByParameter = getPricingByParameter;
@@ -0,0 +1,64 @@
1
+ import { Client } from "@vulog/aima-client";
2
+
3
+ //#region src/types.d.ts
4
+ type PricingTaxRate = {
5
+ taxRate: number;
6
+ taxName?: string;
7
+ [key: string]: any;
8
+ };
9
+ type PricingPlan = {
10
+ distanceIncluded: number;
11
+ unit: string;
12
+ pricePerUnit: number;
13
+ durationInMonths: number;
14
+ name: string;
15
+ pricePerUnitExceedingAllowance: number;
16
+ ratePerUnit: number;
17
+ rollingContract: boolean;
18
+ [key: string]: any;
19
+ };
20
+ type PricingParameters = {
21
+ modelId: number;
22
+ serviceId: string;
23
+ vehicleId: string;
24
+ planId: string;
25
+ };
26
+ type Pricing = {
27
+ pricingId: string;
28
+ pricingParameters?: Partial<PricingParameters>;
29
+ taxRates?: PricingTaxRate[];
30
+ plans?: PricingPlan[];
31
+ taxIncluded: boolean;
32
+ [key: string]: any;
33
+ };
34
+ type PricingJsonConfig = {
35
+ isTaxIncluded: boolean;
36
+ } | {
37
+ taxRates: PricingTaxRate[];
38
+ } | {
39
+ PricingParameters: Partial<PricingParameters>;
40
+ } | {
41
+ plans: PricingPlan[];
42
+ } | {
43
+ [key: string]: any;
44
+ };
45
+ type PricingResponse = {
46
+ enable: boolean;
47
+ fleetId: string;
48
+ id: string;
49
+ updateDate: string;
50
+ userId: string;
51
+ version: number;
52
+ jsonSegment: {
53
+ jsonConfig: PricingJsonConfig[];
54
+ [key: string]: any;
55
+ };
56
+ };
57
+ //#endregion
58
+ //#region src/getPricingById.d.ts
59
+ declare const getPricingById: (client: Client, id: string) => Promise<Pricing>;
60
+ //#endregion
61
+ //#region src/getPricingByParameter.d.ts
62
+ declare const getPricingByParameter: (client: Client, pricingParameters?: Partial<PricingParameters>) => Promise<PricingResponse>;
63
+ //#endregion
64
+ export { Pricing, PricingJsonConfig, PricingParameters, PricingPlan, PricingResponse, PricingTaxRate, getPricingById, getPricingByParameter };
package/dist/index.d.mts CHANGED
@@ -1,61 +1,64 @@
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 PricingTaxRate = {
4
- taxRate: number;
5
- taxName?: string;
6
- [key: string]: any;
5
+ taxRate: number;
6
+ taxName?: string;
7
+ [key: string]: any;
7
8
  };
8
9
  type PricingPlan = {
9
- distanceIncluded: number;
10
- unit: string;
11
- pricePerUnit: number;
12
- durationInMonths: number;
13
- name: string;
14
- pricePerUnitExceedingAllowance: number;
15
- ratePerUnit: number;
16
- rollingContract: boolean;
17
- [key: string]: any;
10
+ distanceIncluded: number;
11
+ unit: string;
12
+ pricePerUnit: number;
13
+ durationInMonths: number;
14
+ name: string;
15
+ pricePerUnitExceedingAllowance: number;
16
+ ratePerUnit: number;
17
+ rollingContract: boolean;
18
+ [key: string]: any;
18
19
  };
19
20
  type PricingParameters = {
20
- modelId: number;
21
- serviceId: string;
22
- vehicleId: string;
23
- planId: string;
21
+ modelId: number;
22
+ serviceId: string;
23
+ vehicleId: string;
24
+ planId: string;
24
25
  };
25
26
  type Pricing = {
26
- pricingId: string;
27
- pricingParameters?: Partial<PricingParameters>;
28
- taxRates?: PricingTaxRate[];
29
- plans?: PricingPlan[];
30
- taxIncluded: boolean;
31
- [key: string]: any;
27
+ pricingId: string;
28
+ pricingParameters?: Partial<PricingParameters>;
29
+ taxRates?: PricingTaxRate[];
30
+ plans?: PricingPlan[];
31
+ taxIncluded: boolean;
32
+ [key: string]: any;
32
33
  };
33
34
  type PricingJsonConfig = {
34
- isTaxIncluded: boolean;
35
+ isTaxIncluded: boolean;
35
36
  } | {
36
- taxRates: PricingTaxRate[];
37
+ taxRates: PricingTaxRate[];
37
38
  } | {
38
- PricingParameters: Partial<PricingParameters>;
39
+ PricingParameters: Partial<PricingParameters>;
39
40
  } | {
40
- plans: PricingPlan[];
41
+ plans: PricingPlan[];
41
42
  } | {
42
- [key: string]: any;
43
+ [key: string]: any;
43
44
  };
44
45
  type PricingResponse = {
45
- enable: boolean;
46
- fleetId: string;
47
- id: string;
48
- updateDate: string;
49
- userId: string;
50
- version: number;
51
- jsonSegment: {
52
- jsonConfig: PricingJsonConfig[];
53
- [key: string]: any;
54
- };
46
+ enable: boolean;
47
+ fleetId: string;
48
+ id: string;
49
+ updateDate: string;
50
+ userId: string;
51
+ version: number;
52
+ jsonSegment: {
53
+ jsonConfig: PricingJsonConfig[];
54
+ [key: string]: any;
55
+ };
55
56
  };
56
-
57
+ //#endregion
58
+ //#region src/getPricingById.d.ts
57
59
  declare const getPricingById: (client: Client, id: string) => Promise<Pricing>;
58
-
60
+ //#endregion
61
+ //#region src/getPricingByParameter.d.ts
59
62
  declare const getPricingByParameter: (client: Client, pricingParameters?: Partial<PricingParameters>) => Promise<PricingResponse>;
60
-
61
- export { type Pricing, type PricingJsonConfig, type PricingParameters, type PricingPlan, type PricingResponse, type PricingTaxRate, getPricingById, getPricingByParameter };
63
+ //#endregion
64
+ export { Pricing, PricingJsonConfig, PricingParameters, PricingPlan, PricingResponse, PricingTaxRate, getPricingById, getPricingByParameter };
package/dist/index.mjs CHANGED
@@ -1,20 +1,14 @@
1
- // src/getPricingById.ts
2
1
  import { z } from "zod";
3
- var getPricingById = async (client, id) => {
4
- const result = z.string().trim().min(1).uuid().safeParse(id);
5
- if (!result.success) {
6
- throw new TypeError("Invalid id", {
7
- cause: result.error.issues
8
- });
9
- }
10
- return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/pricing/${id}`).then(({ data }) => data);
2
+ //#region src/getPricingById.ts
3
+ const getPricingById = async (client, id) => {
4
+ const result = z.string().trim().min(1).uuid().safeParse(id);
5
+ if (!result.success) throw new TypeError("Invalid id", { cause: result.error.issues });
6
+ return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/pricing/${id}`).then(({ data }) => data);
11
7
  };
12
-
13
- // src/getPricingByParameter.ts
14
- var getPricingByParameter = async (client, pricingParameters) => {
15
- return client.post(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/pricing`, pricingParameters).then(({ data }) => data);
16
- };
17
- export {
18
- getPricingById,
19
- getPricingByParameter
8
+ //#endregion
9
+ //#region src/getPricingByParameter.ts
10
+ const getPricingByParameter = async (client, pricingParameters) => {
11
+ return client.post(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/pricing`, pricingParameters).then(({ data }) => data);
20
12
  };
13
+ //#endregion
14
+ export { getPricingById, getPricingByParameter };
package/package.json CHANGED
@@ -1,12 +1,25 @@
1
1
  {
2
2
  "name": "@vulog/aima-pricing",
3
- "version": "1.2.30",
4
- "main": "dist/index.js",
3
+ "type": "module",
4
+ "version": "1.2.31",
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.31",
36
+ "@vulog/aima-core": "1.2.31"
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,61 +0,0 @@
1
- import { Client } from '@vulog/aima-client';
2
-
3
- type PricingTaxRate = {
4
- taxRate: number;
5
- taxName?: string;
6
- [key: string]: any;
7
- };
8
- type PricingPlan = {
9
- distanceIncluded: number;
10
- unit: string;
11
- pricePerUnit: number;
12
- durationInMonths: number;
13
- name: string;
14
- pricePerUnitExceedingAllowance: number;
15
- ratePerUnit: number;
16
- rollingContract: boolean;
17
- [key: string]: any;
18
- };
19
- type PricingParameters = {
20
- modelId: number;
21
- serviceId: string;
22
- vehicleId: string;
23
- planId: string;
24
- };
25
- type Pricing = {
26
- pricingId: string;
27
- pricingParameters?: Partial<PricingParameters>;
28
- taxRates?: PricingTaxRate[];
29
- plans?: PricingPlan[];
30
- taxIncluded: boolean;
31
- [key: string]: any;
32
- };
33
- type PricingJsonConfig = {
34
- isTaxIncluded: boolean;
35
- } | {
36
- taxRates: PricingTaxRate[];
37
- } | {
38
- PricingParameters: Partial<PricingParameters>;
39
- } | {
40
- plans: PricingPlan[];
41
- } | {
42
- [key: string]: any;
43
- };
44
- type PricingResponse = {
45
- enable: boolean;
46
- fleetId: string;
47
- id: string;
48
- updateDate: string;
49
- userId: string;
50
- version: number;
51
- jsonSegment: {
52
- jsonConfig: PricingJsonConfig[];
53
- [key: string]: any;
54
- };
55
- };
56
-
57
- declare const getPricingById: (client: Client, id: string) => Promise<Pricing>;
58
-
59
- declare const getPricingByParameter: (client: Client, pricingParameters?: Partial<PricingParameters>) => Promise<PricingResponse>;
60
-
61
- export { type Pricing, type PricingJsonConfig, type PricingParameters, type PricingPlan, type PricingResponse, type PricingTaxRate, getPricingById, getPricingByParameter };
package/dist/index.js DELETED
@@ -1,48 +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
- getPricingById: () => getPricingById,
24
- getPricingByParameter: () => getPricingByParameter
25
- });
26
- module.exports = __toCommonJS(index_exports);
27
-
28
- // src/getPricingById.ts
29
- var import_zod = require("zod");
30
- var getPricingById = async (client, id) => {
31
- const result = import_zod.z.string().trim().min(1).uuid().safeParse(id);
32
- if (!result.success) {
33
- throw new TypeError("Invalid id", {
34
- cause: result.error.issues
35
- });
36
- }
37
- return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/pricing/${id}`).then(({ data }) => data);
38
- };
39
-
40
- // src/getPricingByParameter.ts
41
- var getPricingByParameter = async (client, pricingParameters) => {
42
- return client.post(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/pricing`, pricingParameters).then(({ data }) => data);
43
- };
44
- // Annotate the CommonJS export names for ESM import in node:
45
- 0 && (module.exports = {
46
- getPricingById,
47
- getPricingByParameter
48
- });
File without changes