@vulog/aima-config 1.0.0 → 1.1.0
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/README.md +4 -1
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +8 -1
- package/dist/index.mjs +7 -1
- package/package.json +9 -10
- package/src/getFleetConf.ts +12 -0
- package/src/getServices.test.ts +33 -0
- package/src/getServices.ts +1 -1
- package/src/index.ts +2 -0
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ npm i @vulog/aima-client @vulog/aima-core @vulog/aima-config
|
|
|
6
6
|
|
|
7
7
|
```javascript
|
|
8
8
|
import { getClient } from '@vulog/aima-client';
|
|
9
|
-
import {
|
|
9
|
+
import { getCities, getServices } from '@vulog/aima-config';
|
|
10
10
|
|
|
11
11
|
const client = getClient({
|
|
12
12
|
apiKey: '...',
|
|
@@ -16,4 +16,7 @@ const client = getClient({
|
|
|
16
16
|
fleetId: '...',
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
+
const cities = await getCities(client);
|
|
20
|
+
const services = await getServices(client);
|
|
21
|
+
|
|
19
22
|
```
|
package/dist/index.d.mts
CHANGED
|
@@ -38,4 +38,10 @@ type Service = {
|
|
|
38
38
|
};
|
|
39
39
|
declare const getServices: (client: Client) => Promise<Service[]>;
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
type FleetConf = {
|
|
42
|
+
triggerSubscriptionPaymentInHours: number;
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
};
|
|
45
|
+
declare const getFleetConf: (client: Client) => Promise<FleetConf>;
|
|
46
|
+
|
|
47
|
+
export { type City, type FleetConf, type Service, getCities, getFleetConf, getServices };
|
package/dist/index.d.ts
CHANGED
|
@@ -38,4 +38,10 @@ type Service = {
|
|
|
38
38
|
};
|
|
39
39
|
declare const getServices: (client: Client) => Promise<Service[]>;
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
type FleetConf = {
|
|
42
|
+
triggerSubscriptionPaymentInHours: number;
|
|
43
|
+
[key: string]: any;
|
|
44
|
+
};
|
|
45
|
+
declare const getFleetConf: (client: Client) => Promise<FleetConf>;
|
|
46
|
+
|
|
47
|
+
export { type City, type FleetConf, type Service, getCities, getFleetConf, getServices };
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var src_exports = {};
|
|
22
22
|
__export(src_exports, {
|
|
23
23
|
getCities: () => getCities,
|
|
24
|
+
getFleetConf: () => getFleetConf,
|
|
24
25
|
getServices: () => getServices
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -35,11 +36,17 @@ var getCities = async (client) => {
|
|
|
35
36
|
// src/getServices.ts
|
|
36
37
|
var getServices = async (client) => {
|
|
37
38
|
return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/services`).then(
|
|
38
|
-
({ data }) => data.filter((
|
|
39
|
+
({ data }) => data.filter((service) => service.fleetId === client.clientOptions.fleetId).map(({ fleetId, ...service }) => service)
|
|
39
40
|
);
|
|
40
41
|
};
|
|
42
|
+
|
|
43
|
+
// src/getFleetConf.ts
|
|
44
|
+
var getFleetConf = async (client) => {
|
|
45
|
+
return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/conf`).then(({ data }) => data);
|
|
46
|
+
};
|
|
41
47
|
// Annotate the CommonJS export names for ESM import in node:
|
|
42
48
|
0 && (module.exports = {
|
|
43
49
|
getCities,
|
|
50
|
+
getFleetConf,
|
|
44
51
|
getServices
|
|
45
52
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -8,10 +8,16 @@ var getCities = async (client) => {
|
|
|
8
8
|
// src/getServices.ts
|
|
9
9
|
var getServices = async (client) => {
|
|
10
10
|
return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/services`).then(
|
|
11
|
-
({ data }) => data.filter((
|
|
11
|
+
({ data }) => data.filter((service) => service.fleetId === client.clientOptions.fleetId).map(({ fleetId, ...service }) => service)
|
|
12
12
|
);
|
|
13
13
|
};
|
|
14
|
+
|
|
15
|
+
// src/getFleetConf.ts
|
|
16
|
+
var getFleetConf = async (client) => {
|
|
17
|
+
return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/conf`).then(({ data }) => data);
|
|
18
|
+
};
|
|
14
19
|
export {
|
|
15
20
|
getCities,
|
|
21
|
+
getFleetConf,
|
|
16
22
|
getServices
|
|
17
23
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vulog/aima-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"build": "tsup",
|
|
9
9
|
"dev": "tsup --watch",
|
|
10
10
|
"test": "vitest run",
|
|
11
|
-
"test:watch": "vitest"
|
|
11
|
+
"test:watch": "vitest",
|
|
12
|
+
"lint": "eslint src/**/* --ext .ts"
|
|
12
13
|
},
|
|
13
14
|
"keywords": [
|
|
14
15
|
"AIMA",
|
|
@@ -18,24 +19,22 @@
|
|
|
18
19
|
"author": "Vulog",
|
|
19
20
|
"license": "ISC",
|
|
20
21
|
"devDependencies": {
|
|
21
|
-
"@types/
|
|
22
|
-
"@types/node": "^22.7.9",
|
|
22
|
+
"@types/node": "^22.10.1",
|
|
23
23
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
24
24
|
"eslint-config-airbnb-typescript": "^18.0.0",
|
|
25
25
|
"eslint-config-prettier": "^9.1.0",
|
|
26
26
|
"eslint-plugin-import": "^2.31.0",
|
|
27
27
|
"eslint-plugin-prettier": "^5.2.1",
|
|
28
28
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
29
|
-
"prettier": "^3.
|
|
30
|
-
"tsup": "^8.3.
|
|
31
|
-
"typescript": "^5.
|
|
32
|
-
"vitest": "^2.1.
|
|
29
|
+
"prettier": "^3.4.1",
|
|
30
|
+
"tsup": "^8.3.5",
|
|
31
|
+
"typescript": "^5.7.2",
|
|
32
|
+
"vitest": "^2.1.8"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@vulog/aima-client": "^1.0.0",
|
|
36
36
|
"@vulog/aima-core": "^1.0.0",
|
|
37
|
-
"lodash": "^4.17.21",
|
|
38
37
|
"zod": "^3.23.8"
|
|
39
38
|
},
|
|
40
39
|
"description": ""
|
|
41
|
-
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Client } from '@vulog/aima-client';
|
|
2
|
+
|
|
3
|
+
export type FleetConf = {
|
|
4
|
+
triggerSubscriptionPaymentInHours: number;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const getFleetConf = async (client: Client): Promise<FleetConf> => {
|
|
9
|
+
return client
|
|
10
|
+
.get<FleetConf>(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/conf`)
|
|
11
|
+
.then(({ data }) => data);
|
|
12
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { describe, test, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
2
|
+
import { Client } from '@vulog/aima-client';
|
|
3
|
+
import { getServices } from './getServices';
|
|
4
|
+
|
|
5
|
+
describe('getServices', () => {
|
|
6
|
+
const getMock = vi.fn();
|
|
7
|
+
const client = {
|
|
8
|
+
get: getMock,
|
|
9
|
+
clientOptions: {
|
|
10
|
+
fleetId: 'FLEET_ID',
|
|
11
|
+
},
|
|
12
|
+
} as unknown as Client;
|
|
13
|
+
|
|
14
|
+
test('Call OK', async () => {
|
|
15
|
+
const services = [
|
|
16
|
+
{
|
|
17
|
+
id: 'SERVICE_ID',
|
|
18
|
+
name: 'SERVICE_NAME',
|
|
19
|
+
fleetId: 'FLEET_ID',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: 'SERVICE_ID2',
|
|
23
|
+
name: 'SERVICE_NAME2',
|
|
24
|
+
fleetId: 'FLEET_ID2',
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
getMock.mockResolvedValue({ data: services });
|
|
28
|
+
|
|
29
|
+
const result = await getServices(client);
|
|
30
|
+
expect(result.length).toEqual(1);
|
|
31
|
+
expect(result[0].id).toEqual('SERVICE_ID');
|
|
32
|
+
});
|
|
33
|
+
});
|
package/src/getServices.ts
CHANGED
|
@@ -31,7 +31,7 @@ export const getServices = async (client: Client): Promise<Service[]> => {
|
|
|
31
31
|
>(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/services`)
|
|
32
32
|
.then(({ data }) =>
|
|
33
33
|
data
|
|
34
|
-
.filter((
|
|
34
|
+
.filter((service) => service.fleetId === client.clientOptions.fleetId)
|
|
35
35
|
.map(({ fleetId, ...service }) => service as Service)
|
|
36
36
|
);
|
|
37
37
|
};
|
package/src/index.ts
CHANGED
|
@@ -2,3 +2,5 @@ export { getCities } from './getCities';
|
|
|
2
2
|
export type { City } from './getCities';
|
|
3
3
|
export { getServices } from './getServices';
|
|
4
4
|
export type { Service } from './getServices';
|
|
5
|
+
export { getFleetConf } from './getFleetConf';
|
|
6
|
+
export type { FleetConf } from './getFleetConf';
|