@vulog/aima-config 1.0.1 → 1.1.1

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.js CHANGED
@@ -36,7 +36,7 @@ var getCities = async (client) => {
36
36
  // src/getServices.ts
37
37
  var getServices = async (client) => {
38
38
  return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/services`).then(
39
- ({ data }) => data.filter((city) => city.fleetId === client.clientOptions.fleetId).map(({ fleetId, ...service }) => service)
39
+ ({ data }) => data.filter((service) => service.fleetId === client.clientOptions.fleetId).map(({ fleetId, ...service }) => service)
40
40
  );
41
41
  };
42
42
 
package/dist/index.mjs CHANGED
@@ -8,7 +8,7 @@ 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((city) => city.fleetId === client.clientOptions.fleetId).map(({ fleetId, ...service }) => service)
11
+ ({ data }) => data.filter((service) => service.fleetId === client.clientOptions.fleetId).map(({ fleetId, ...service }) => service)
12
12
  );
13
13
  };
14
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vulog/aima-config",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
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/lodash": "^4.17.12",
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.3.3",
30
- "tsup": "^8.3.0",
31
- "typescript": "^5.6.3",
32
- "vitest": "^2.1.3"
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,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
+ });
@@ -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((city) => city.fleetId === client.clientOptions.fleetId)
34
+ .filter((service) => service.fleetId === client.clientOptions.fleetId)
35
35
  .map(({ fleetId, ...service }) => service as Service)
36
36
  );
37
37
  };