@vulog/aima-config 1.0.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/.eslintrc.js +112 -0
- package/README.md +19 -0
- package/dist/index.d.mts +41 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.js +45 -0
- package/dist/index.mjs +17 -0
- package/package.json +41 -0
- package/src/getCities.ts +38 -0
- package/src/getServices.ts +37 -0
- package/src/index.ts +4 -0
- package/tsconfig.json +16 -0
- package/tsup.config.ts +8 -0
- package/vitest.config.ts +8 -0
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
parser: '@typescript-eslint/parser',
|
|
3
|
+
parserOptions: {
|
|
4
|
+
// Indicates the location of the TypeScript configuration file
|
|
5
|
+
project: 'tsconfig.json',
|
|
6
|
+
// Sets the root directory for the TypeScript configuration
|
|
7
|
+
tsconfigRootDir: __dirname,
|
|
8
|
+
// Specifies the version of ECMAScript syntax to be used
|
|
9
|
+
ecmaVersion: 'latest',
|
|
10
|
+
// Indicates the type of source code (script or module)
|
|
11
|
+
sourceType: 'module',
|
|
12
|
+
},
|
|
13
|
+
plugins: ['@typescript-eslint', 'prettier', 'import'],
|
|
14
|
+
extends: [
|
|
15
|
+
'airbnb-base',
|
|
16
|
+
'airbnb-typescript/base',
|
|
17
|
+
'plugin:@typescript-eslint/recommended',
|
|
18
|
+
'prettier',
|
|
19
|
+
'plugin:prettier/recommended',
|
|
20
|
+
],
|
|
21
|
+
root: true,
|
|
22
|
+
env: {
|
|
23
|
+
es6: true,
|
|
24
|
+
node: true,
|
|
25
|
+
},
|
|
26
|
+
ignorePatterns: [
|
|
27
|
+
'/dist/**/*', // Ignore built files.
|
|
28
|
+
'.eslintrc.js',
|
|
29
|
+
'**/*.test.ts',
|
|
30
|
+
],
|
|
31
|
+
rules: {
|
|
32
|
+
// Configures the Prettier integration with ESLint
|
|
33
|
+
'prettier/prettier': ['error', { endOfLine: 'auto' }],
|
|
34
|
+
// Disables the rule requiring an 'I' prefix for interfaces
|
|
35
|
+
'@typescript-eslint/interface-name-prefix': 'off',
|
|
36
|
+
// Configures the naming conventions for various code constructs
|
|
37
|
+
'@typescript-eslint/naming-convention': [
|
|
38
|
+
// ... various naming convention configurations ...
|
|
39
|
+
'error',
|
|
40
|
+
// Allows any naming format for destructured variables
|
|
41
|
+
{
|
|
42
|
+
selector: 'variable',
|
|
43
|
+
modifiers: ['destructured'],
|
|
44
|
+
format: null,
|
|
45
|
+
},
|
|
46
|
+
// Requires strict camelCase for function names
|
|
47
|
+
{
|
|
48
|
+
selector: 'function',
|
|
49
|
+
format: ['strictCamelCase'],
|
|
50
|
+
},
|
|
51
|
+
// Requires boolean variables to have one of the specified prefixes
|
|
52
|
+
{
|
|
53
|
+
selector: 'variable',
|
|
54
|
+
format: null,
|
|
55
|
+
types: ['boolean'],
|
|
56
|
+
prefix: ['is', 'should', 'has', 'can', 'did', 'will'],
|
|
57
|
+
},
|
|
58
|
+
// Requires enum names to have a strict PascalCase format
|
|
59
|
+
{
|
|
60
|
+
selector: 'enum',
|
|
61
|
+
format: ['StrictPascalCase'],
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
'import/extensions': 'off',
|
|
65
|
+
// Disables the rule requiring explicit return types for functions
|
|
66
|
+
'@typescript-eslint/explicit-function-return-type': 'off',
|
|
67
|
+
// Disables the rule requiring explicit boundary types for modules
|
|
68
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
69
|
+
// Disables the rule prohibiting the use of 'any' type
|
|
70
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
71
|
+
// Disables the rule detecting unused variables
|
|
72
|
+
'no-unused-vars': 0,
|
|
73
|
+
// Disables the rule disallowing named exports used as a default export
|
|
74
|
+
'import/no-named-as-default': 0,
|
|
75
|
+
// Configures the order and formatting of import statements
|
|
76
|
+
'import/order': [
|
|
77
|
+
// ... import order configuration ...
|
|
78
|
+
'error',
|
|
79
|
+
{
|
|
80
|
+
// Configure the alphabetization settings
|
|
81
|
+
alphabetize: {
|
|
82
|
+
// Enforce ascending alphabetical order
|
|
83
|
+
order: 'asc',
|
|
84
|
+
// Do not ignore the case while sorting
|
|
85
|
+
caseInsensitive: false,
|
|
86
|
+
},
|
|
87
|
+
// Enforce newlines between different groups and inside groups of imports
|
|
88
|
+
'newlines-between': 'always-and-inside-groups',
|
|
89
|
+
// Warn when there is an import statement that is not part of any group
|
|
90
|
+
warnOnUnassignedImports: true,
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
// Configures the rule detecting extraneous dependencies
|
|
94
|
+
'import/no-extraneous-dependencies': [
|
|
95
|
+
// ... extraneous dependencies configuration ...
|
|
96
|
+
'error',
|
|
97
|
+
{
|
|
98
|
+
// Specify the file patterns where devDependencies imports are allowed
|
|
99
|
+
devDependencies: [
|
|
100
|
+
// Allow devDependencies imports in test and spec files
|
|
101
|
+
'**/*.test.{ts,js}',
|
|
102
|
+
'**/*.spec.{ts,js}',
|
|
103
|
+
// Allow devDependencies imports in the 'test' folder
|
|
104
|
+
'./test/**.{ts,js}',
|
|
105
|
+
// Allow devDependencies imports in the 'scripts' folder
|
|
106
|
+
'./scripts/**/*.{ts,js}',
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
'import/prefer-default-export': 'off',
|
|
111
|
+
},
|
|
112
|
+
};
|
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @vulog/aima-config
|
|
2
|
+
|
|
3
|
+
```bash
|
|
4
|
+
npm i @vulog/aima-client @vulog/aima-core @vulog/aima-config
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
```javascript
|
|
8
|
+
import { getClient } from '@vulog/aima-client';
|
|
9
|
+
import { getBookingRequests } from '@vulog/aima-config';
|
|
10
|
+
|
|
11
|
+
const client = getClient({
|
|
12
|
+
apiKey: '...',
|
|
13
|
+
baseUrl: '...',
|
|
14
|
+
clientId: '...',
|
|
15
|
+
clientSecret: '...',
|
|
16
|
+
fleetId: '...',
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
```
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
declare const getCities: (client: Client) => Promise<City[]>;
|
|
26
|
+
|
|
27
|
+
type Service = {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
status: 'ACTIVE' | 'DISABLED';
|
|
31
|
+
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';
|
|
32
|
+
cityId: string;
|
|
33
|
+
zones: string[];
|
|
34
|
+
vehicles: string[];
|
|
35
|
+
stations: string[];
|
|
36
|
+
pois: string[];
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
};
|
|
39
|
+
declare const getServices: (client: Client) => Promise<Service[]>;
|
|
40
|
+
|
|
41
|
+
export { type City, type Service, getCities, getServices };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
declare const getCities: (client: Client) => Promise<City[]>;
|
|
26
|
+
|
|
27
|
+
type Service = {
|
|
28
|
+
id: string;
|
|
29
|
+
name: string;
|
|
30
|
+
status: 'ACTIVE' | 'DISABLED';
|
|
31
|
+
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';
|
|
32
|
+
cityId: string;
|
|
33
|
+
zones: string[];
|
|
34
|
+
vehicles: string[];
|
|
35
|
+
stations: string[];
|
|
36
|
+
pois: string[];
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
};
|
|
39
|
+
declare const getServices: (client: Client) => Promise<Service[]>;
|
|
40
|
+
|
|
41
|
+
export { type City, type Service, getCities, getServices };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
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 src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
getCities: () => getCities,
|
|
24
|
+
getServices: () => getServices
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(src_exports);
|
|
27
|
+
|
|
28
|
+
// src/getCities.ts
|
|
29
|
+
var getCities = async (client) => {
|
|
30
|
+
return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/cities`).then(
|
|
31
|
+
({ data }) => data.filter((city) => city.fleetId === client.clientOptions.fleetId).map(({ fleetId, ...city }) => city)
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// src/getServices.ts
|
|
36
|
+
var getServices = async (client) => {
|
|
37
|
+
return client.get(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/services`).then(
|
|
38
|
+
({ data }) => data.filter((city) => city.fleetId === client.clientOptions.fleetId).map(({ fleetId, ...service }) => service)
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
getCities,
|
|
44
|
+
getServices
|
|
45
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
);
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// src/getServices.ts
|
|
9
|
+
var getServices = async (client) => {
|
|
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)
|
|
12
|
+
);
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
getCities,
|
|
16
|
+
getServices
|
|
17
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vulog/aima-config",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"module": "dist/index.mjs",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsup",
|
|
9
|
+
"dev": "tsup --watch",
|
|
10
|
+
"test": "vitest run",
|
|
11
|
+
"test:watch": "vitest"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"AIMA",
|
|
15
|
+
"VULOG",
|
|
16
|
+
"CONFIG"
|
|
17
|
+
],
|
|
18
|
+
"author": "Vulog",
|
|
19
|
+
"license": "ISC",
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/lodash": "^4.17.12",
|
|
22
|
+
"@types/node": "^22.7.9",
|
|
23
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
24
|
+
"eslint-config-airbnb-typescript": "^18.0.0",
|
|
25
|
+
"eslint-config-prettier": "^9.1.0",
|
|
26
|
+
"eslint-plugin-import": "^2.31.0",
|
|
27
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
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"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@vulog/aima-client": "^1.0.0",
|
|
36
|
+
"@vulog/aima-core": "^1.0.0",
|
|
37
|
+
"lodash": "^4.17.21",
|
|
38
|
+
"zod": "^3.23.8"
|
|
39
|
+
},
|
|
40
|
+
"description": ""
|
|
41
|
+
}
|
package/src/getCities.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Client } from '@vulog/aima-client';
|
|
2
|
+
|
|
3
|
+
export 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
|
+
|
|
26
|
+
export const getCities = async (client: Client): Promise<City[]> => {
|
|
27
|
+
return client
|
|
28
|
+
.get<
|
|
29
|
+
(City & {
|
|
30
|
+
fleetId: string;
|
|
31
|
+
})[]
|
|
32
|
+
>(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/cities`)
|
|
33
|
+
.then(({ data }) =>
|
|
34
|
+
data
|
|
35
|
+
.filter((city) => city.fleetId === client.clientOptions.fleetId)
|
|
36
|
+
.map(({ fleetId, ...city }) => city as City)
|
|
37
|
+
);
|
|
38
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Client } from '@vulog/aima-client';
|
|
2
|
+
|
|
3
|
+
export type Service = {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
status: 'ACTIVE' | 'DISABLED';
|
|
7
|
+
type:
|
|
8
|
+
| 'FREE_FLOATING'
|
|
9
|
+
| 'FREE_FLOATING_STRICT'
|
|
10
|
+
| 'SERVICE_TRIP'
|
|
11
|
+
| 'BOOKING'
|
|
12
|
+
| 'ROUND_TRIP_BOOKING'
|
|
13
|
+
| 'BY_PASS_FREE_FLOATING'
|
|
14
|
+
| 'BY_PASS_ROUND_TRIP_BOOKING'
|
|
15
|
+
| 'SUBSCRIPTION'
|
|
16
|
+
| 'SCHEDULED_BOOKING_STATION';
|
|
17
|
+
cityId: string;
|
|
18
|
+
zones: string[];
|
|
19
|
+
vehicles: string[];
|
|
20
|
+
stations: string[];
|
|
21
|
+
pois: string[];
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const getServices = async (client: Client): Promise<Service[]> => {
|
|
26
|
+
return client
|
|
27
|
+
.get<
|
|
28
|
+
(Service & {
|
|
29
|
+
fleetId: string;
|
|
30
|
+
})[]
|
|
31
|
+
>(`/boapi/proxy/user/fleets/${client.clientOptions.fleetId}/services`)
|
|
32
|
+
.then(({ data }) =>
|
|
33
|
+
data
|
|
34
|
+
.filter((city) => city.fleetId === client.clientOptions.fleetId)
|
|
35
|
+
.map(({ fleetId, ...service }) => service as Service)
|
|
36
|
+
);
|
|
37
|
+
};
|
package/src/index.ts
ADDED
package/tsconfig.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": ["src"],
|
|
3
|
+
"exclude": ["**/*.test.ts"],
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"module": "esnext",
|
|
6
|
+
"target": "esnext",
|
|
7
|
+
"lib": ["esnext"],
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"moduleResolution": "node",
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"esModuleInterop": true,
|
|
13
|
+
"outDir": "dist",
|
|
14
|
+
"rootDir": "src"
|
|
15
|
+
}
|
|
16
|
+
}
|
package/tsup.config.ts
ADDED