@autofleet/node-common 2.0.1 → 4.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/.nvmrc +1 -0
- package/README.md +4 -48
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +21 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +40 -29
- package/src/consts/index.test.ts +26 -0
- package/{consts/index.js → src/consts/index.ts} +2 -2
- package/src/index.test.ts +18 -0
- package/src/index.ts +6 -0
- package/src/router/index.test.ts +149 -0
- package/src/router/index.ts +45 -0
- package/tsconfig.json +15 -0
- package/tsup.config.ts +13 -0
- package/vitest.config.ts +14 -0
- package/.jest.config.js +0 -8
- package/delorean-client/index.js +0 -52
- package/delorean-client/index.test.js +0 -105
- package/index.js +0 -17
- package/logger/example.js +0 -5
- package/logger/index.js +0 -114
- package/logger/index.test.js +0 -54
- package/network/index.js +0 -105
- package/network/index.test.js +0 -69
- package/queue/index.js +0 -107
- package/router/index.js +0 -45
- package/settings/example.js +0 -30
- package/settings/index.js +0 -107
- package/settings/index.test.js +0 -168
- package/settings/map.js +0 -426
package/settings/index.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
const EventEmitter = require('events');
|
|
2
|
-
const NodeCache = require('node-cache');
|
|
3
|
-
const Network = require('../network');
|
|
4
|
-
const Logger = require('../logger');
|
|
5
|
-
// const keysMap = require('./map');
|
|
6
|
-
|
|
7
|
-
const util = require('util');
|
|
8
|
-
|
|
9
|
-
const nextTick = util.promisify(process.nextTick);
|
|
10
|
-
|
|
11
|
-
const logger = Logger();
|
|
12
|
-
require('dotenv').config();
|
|
13
|
-
|
|
14
|
-
const fiveMinutes = 60 * 5;
|
|
15
|
-
const waitingToNetwork = 'waitingToNetwork';
|
|
16
|
-
|
|
17
|
-
const findUrl = serviceUrl => serviceUrl ||
|
|
18
|
-
(process.env.SETTING_MS_SERVICE_HOST && process.env.SETTING_MS_SERVICE_HOST.length > 0 ? `http://${process.env.SETTING_MS_SERVICE_HOST}/` : undefined) ||
|
|
19
|
-
(process.env.NODE_ENV !== 'test' ? 'http://setting-ms.autofleet.io/' : 'http://localhost:9999/');
|
|
20
|
-
|
|
21
|
-
class SettingsManager {
|
|
22
|
-
static get NEVER_DEFAULT_VALUE() {
|
|
23
|
-
return 'NEVER_DEFAULT_VALUE';
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
static readNetworkValue(networkValue, defaultValue) {
|
|
27
|
-
const returnValue = typeof networkValue !== 'undefined' ? networkValue : defaultValue;
|
|
28
|
-
|
|
29
|
-
if (returnValue === SettingsManager.NEVER_DEFAULT_VALUE) {
|
|
30
|
-
throw new Error('Cannot find value from network or cache, default value is set to never');
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return returnValue;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
constructor({ serviceUrl, ttl = fiveMinutes } = {}) {
|
|
37
|
-
const localServiceUrl = findUrl(serviceUrl);
|
|
38
|
-
|
|
39
|
-
this.NEVER_DEFAULT_VALUE = SettingsManager.NEVER_DEFAULT_VALUE;
|
|
40
|
-
this.ttl = ttl;
|
|
41
|
-
this.settingsCache = new NodeCache();
|
|
42
|
-
this.networkEvents = new EventEmitter();
|
|
43
|
-
this.network = new Network({
|
|
44
|
-
serviceUrl: localServiceUrl,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async get(key, defaultValue, labels = [], { timeout = 1000 } = {}) {
|
|
49
|
-
if (typeof defaultValue === 'undefined') {
|
|
50
|
-
throw new Error('Can\'t get a key without defaultValue');
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const cacheKey = `${key}_${JSON.stringify(labels)}`;
|
|
54
|
-
const cacheValue = this.settingsCache.get(cacheKey);
|
|
55
|
-
if (cacheValue !== undefined) {
|
|
56
|
-
if (waitingToNetwork === cacheValue) {
|
|
57
|
-
await nextTick();
|
|
58
|
-
return new Promise((resolve) => {
|
|
59
|
-
this.networkEvents.once(cacheKey, (networkValue) => {
|
|
60
|
-
resolve(SettingsManager.readNetworkValue(networkValue, defaultValue));
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
return cacheValue;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (process.env.NODE_ENV === 'test') {
|
|
68
|
-
return defaultValue;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
let networkValue;
|
|
72
|
-
try {
|
|
73
|
-
this.settingsCache.set(cacheKey, waitingToNetwork, this.ttl);
|
|
74
|
-
const networkReponse = await this.network.get(`/api/v1/settings/get-setting/${key}`, {
|
|
75
|
-
params: {
|
|
76
|
-
labels,
|
|
77
|
-
},
|
|
78
|
-
timeout,
|
|
79
|
-
});
|
|
80
|
-
networkValue = networkReponse.data.value;
|
|
81
|
-
} catch (error) {
|
|
82
|
-
logger.error('Cant get setting from network');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
this.networkEvents.emit(cacheKey, networkValue);
|
|
86
|
-
let returnValue;
|
|
87
|
-
try {
|
|
88
|
-
returnValue = SettingsManager.readNetworkValue(networkValue, defaultValue);
|
|
89
|
-
} catch (e) {
|
|
90
|
-
this.settingsCache.del(cacheKey);
|
|
91
|
-
throw e;
|
|
92
|
-
}
|
|
93
|
-
this.settingsCache.set(cacheKey, returnValue, this.ttl);
|
|
94
|
-
return returnValue;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
setLocal(key, labels, value) {
|
|
98
|
-
const cacheKey = `${key}_${JSON.stringify(labels)}`;
|
|
99
|
-
this.settingsCache.set(cacheKey, value, this.ttl);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
flush() {
|
|
103
|
-
return this.settingsCache.flushAll();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
module.exports = SettingsManager;
|
package/settings/index.test.js
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
const nock = require('nock');
|
|
2
|
-
const Settings = require('./index');
|
|
3
|
-
|
|
4
|
-
process.env.NODE_ENV = 'node-common-test';
|
|
5
|
-
|
|
6
|
-
const serviceUrl = 'localhost:8085';
|
|
7
|
-
|
|
8
|
-
const mockSetting = (key, value, labels, response = 200) => nock(`http://${serviceUrl}/`)
|
|
9
|
-
.get(`/api/v1/settings/get-setting/${key}`)
|
|
10
|
-
.query(labels ? { labels } : undefined)
|
|
11
|
-
.reply(response, { value });
|
|
12
|
-
|
|
13
|
-
describe('Settings', () => {
|
|
14
|
-
it('Throws exeption if there is no defualt value', async () => {
|
|
15
|
-
const settings = new Settings({
|
|
16
|
-
serviceUrl: `http://${serviceUrl}/`,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
expect(settings.get('key1'))
|
|
20
|
-
.rejects.toEqual(new Error('Can\'t get a key without defaultValue'));
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('Can get 0 as default value', async () => {
|
|
24
|
-
const settings = new Settings({
|
|
25
|
-
serviceUrl: `http://${serviceUrl}/`,
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
expect(await settings.get('key1', 0)).toBe(0);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('Can get false as default value', async () => {
|
|
32
|
-
const settings = new Settings({
|
|
33
|
-
serviceUrl: `http://${serviceUrl}/`,
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
expect(await settings.get('key1', false)).toBe(false);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('Uses env.SETTING_MS_SERVICE_HOST as service host if no one defined', async () => {
|
|
40
|
-
const m = mockSetting('key1', 'value1');
|
|
41
|
-
process.env.SETTING_MS_SERVICE_HOST = serviceUrl;
|
|
42
|
-
const settings = new Settings();
|
|
43
|
-
|
|
44
|
-
const value = await settings.get('key1', 'dv');
|
|
45
|
-
expect(value).toEqual('value1');
|
|
46
|
-
expect(m.isDone()).toBeTruthy();
|
|
47
|
-
process.env.SETTING_MS_SERVICE_HOST = '';
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('Get a key from server', async () => {
|
|
51
|
-
const m = mockSetting('key1', 'value1');
|
|
52
|
-
const settings = new Settings({
|
|
53
|
-
serviceUrl: `http://${serviceUrl}/`,
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
const value = await settings.get('key1', 'dv');
|
|
57
|
-
expect(value).toEqual('value1');
|
|
58
|
-
expect(m.isDone()).toBeTruthy();
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('Cache from server', async () => {
|
|
62
|
-
const m = mockSetting('key1', 'value1');
|
|
63
|
-
const settings = new Settings({
|
|
64
|
-
serviceUrl: `http://${serviceUrl}/`,
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
const value = await settings.get('key1', 'dv');
|
|
68
|
-
expect(value).toEqual('value1');
|
|
69
|
-
expect(m.isDone()).toBeTruthy();
|
|
70
|
-
|
|
71
|
-
const value2 = await settings.get('key1', 'dv');
|
|
72
|
-
expect(value2).toEqual('value1');
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
it('Use only one request for similar keys', async () => {
|
|
77
|
-
const m = mockSetting('key1EM', 'value1EM');
|
|
78
|
-
const settings = new Settings({
|
|
79
|
-
serviceUrl: `http://${serviceUrl}/`,
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
const [value, value2] = await Promise.all([
|
|
83
|
-
settings.get('key1EM', 'dv'),
|
|
84
|
-
settings.get('key1EM', 'dv'),
|
|
85
|
-
]);
|
|
86
|
-
expect(value).toEqual('value1EM');
|
|
87
|
-
expect(m.isDone()).toBeTruthy();
|
|
88
|
-
|
|
89
|
-
expect(value2).toEqual('value1EM');
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('Finds with labels', async () => {
|
|
93
|
-
const m = mockSetting('key1', 'value1', [{ fleetId: 'uuid' }]);
|
|
94
|
-
const settings = new Settings({
|
|
95
|
-
serviceUrl: `http://${serviceUrl}/`,
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
const value = await settings.get('key1', 'dv', [{ fleetId: 'uuid' }]);
|
|
99
|
-
expect(value).toEqual('value1');
|
|
100
|
-
expect(m.isDone()).toBeTruthy();
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it('Returns default value when network error', async () => {
|
|
104
|
-
const settings = new Settings({
|
|
105
|
-
serviceUrl: `http://${serviceUrl}/`,
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
const value = await settings.get('key1', 'dv', [{ fleetId: 'uuid' }]);
|
|
109
|
-
expect(value).toEqual('dv');
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it('Throws an error if network error and no default value', async () => {
|
|
113
|
-
const settings = new Settings({
|
|
114
|
-
serviceUrl: `http://${serviceUrl}/`,
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
const f = () => settings.get('key1', settings.NEVER_DEFAULT_VALUE, [{ fleetId: 'uuid' }]);
|
|
118
|
-
expect(f())
|
|
119
|
-
.rejects.toEqual(new Error('Cannot find value from network or cache, default value is set to never'));
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it('Throws an error if network error and no default value and success the next time', async (done) => {
|
|
123
|
-
const settings = new Settings({
|
|
124
|
-
serviceUrl: `http://${serviceUrl}/`,
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
const f = () => settings.get('key1', settings.NEVER_DEFAULT_VALUE);
|
|
128
|
-
expect(f())
|
|
129
|
-
.rejects.toEqual(new Error('Cannot find value from network or cache, default value is set to never'));
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
setTimeout(async () => {
|
|
133
|
-
const m = mockSetting('key1', 'value1');
|
|
134
|
-
expect(await settings.get('key1', settings.NEVER_DEFAULT_VALUE)).toEqual('value1');
|
|
135
|
-
expect(m.isDone());
|
|
136
|
-
done();
|
|
137
|
-
}, 100);
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
it('Values can be flushed', async () => {
|
|
141
|
-
const m1 = mockSetting('key1', 'value1');
|
|
142
|
-
const settings = new Settings({
|
|
143
|
-
serviceUrl: `http://${serviceUrl}/`,
|
|
144
|
-
});
|
|
145
|
-
settings.flush();
|
|
146
|
-
|
|
147
|
-
const value = await settings.get('key1', 'dv');
|
|
148
|
-
expect(value).toEqual('value1');
|
|
149
|
-
expect(m1.isDone()).toBeTruthy();
|
|
150
|
-
|
|
151
|
-
settings.flush();
|
|
152
|
-
const m2 = mockSetting('key1', 'value2');
|
|
153
|
-
|
|
154
|
-
const value2 = await settings.get('key1', 'dv');
|
|
155
|
-
expect(value2).toEqual('value2');
|
|
156
|
-
expect(m2.isDone()).toBeTruthy();
|
|
157
|
-
});
|
|
158
|
-
it('when NODE_ENV === test return the default value', async () => {
|
|
159
|
-
process.env.NODE_ENV = 'test';
|
|
160
|
-
const settings = new Settings({
|
|
161
|
-
serviceUrl: `http://${serviceUrl}/`,
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
const value = await settings.get('key1', 'dv');
|
|
165
|
-
expect(value).toEqual('dv');
|
|
166
|
-
process.env.NODE_ENV = 'node-common-test';
|
|
167
|
-
});
|
|
168
|
-
});
|
package/settings/map.js
DELETED
|
@@ -1,426 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
MAP_PROVIDER: {
|
|
3
|
-
name: 'Map provider',
|
|
4
|
-
description: 'The map provider',
|
|
5
|
-
type: 'string',
|
|
6
|
-
defaultValue: 'osrm',
|
|
7
|
-
context: 'maps',
|
|
8
|
-
},
|
|
9
|
-
H3_LEVEL: {
|
|
10
|
-
name: 'H3 level',
|
|
11
|
-
description: '',
|
|
12
|
-
type: 'number',
|
|
13
|
-
defaultValue: 8,
|
|
14
|
-
context: 'maps',
|
|
15
|
-
},
|
|
16
|
-
DEMAND_PREDICTION_MODEL: {
|
|
17
|
-
name: 'Demand prediction model',
|
|
18
|
-
description: 'Some des',
|
|
19
|
-
type: 'string',
|
|
20
|
-
defaultValue: '@london',
|
|
21
|
-
context: 'demand prediction',
|
|
22
|
-
},
|
|
23
|
-
MIN_SHIFT_TIME_FOR_INFLEET_HOURS: {
|
|
24
|
-
name: 'Minimum shift time for infleet',
|
|
25
|
-
description: 'Minimum left time on shift in hours for infleet',
|
|
26
|
-
type: 'number',
|
|
27
|
-
defaultValue: 0,
|
|
28
|
-
context: 'indefleet',
|
|
29
|
-
},
|
|
30
|
-
FLEETING_INFLEET_THRESHOLD: {
|
|
31
|
-
name: 'Infleet threshold',
|
|
32
|
-
description: 'Minimum vehicles for start infleet',
|
|
33
|
-
type: 'number',
|
|
34
|
-
defaultValue: 0,
|
|
35
|
-
context: 'indefleet',
|
|
36
|
-
},
|
|
37
|
-
FLEETING_DEFLEET_THRESHOLD: {
|
|
38
|
-
name: 'Defleet threshold',
|
|
39
|
-
description: 'Minimum vehicles for start defleet',
|
|
40
|
-
type: 'number',
|
|
41
|
-
defaultValue: 0,
|
|
42
|
-
context: 'indefleet',
|
|
43
|
-
},
|
|
44
|
-
INDEFLEET_WEIGHTED_AVG_WEIGHTS: {
|
|
45
|
-
name: 'INDEFLEET_WEIGHTED_AVG_WEIGHTS',
|
|
46
|
-
description: '',
|
|
47
|
-
type: 'json',
|
|
48
|
-
defaultValue: '[1, 1, 1, 1]',
|
|
49
|
-
context: 'indefleet',
|
|
50
|
-
},
|
|
51
|
-
FLEETING_CORRELATION_COEFFICIENT: { // ?
|
|
52
|
-
name: 'Indefleet HRPV',
|
|
53
|
-
description: '',
|
|
54
|
-
type: 'number',
|
|
55
|
-
defaultValue: 4,
|
|
56
|
-
context: 'indefleet',
|
|
57
|
-
},
|
|
58
|
-
INDEFLEET_STRATEGY_NAME: {
|
|
59
|
-
name: 'Indefleet Strategy Name',
|
|
60
|
-
description: 'The name of the strategy to compute the desired state',
|
|
61
|
-
type: 'string',
|
|
62
|
-
defaultValue: 'max',
|
|
63
|
-
context: 'indefleet',
|
|
64
|
-
},
|
|
65
|
-
FLEETING_ENABLE: {
|
|
66
|
-
name: 'Enable fleeting (in-de-fleet)',
|
|
67
|
-
description: 'If true it will enable fleeting every 5 min',
|
|
68
|
-
type: 'boolean',
|
|
69
|
-
defaultValue: 'true',
|
|
70
|
-
context: 'indefleet',
|
|
71
|
-
},
|
|
72
|
-
// FLEETING_DEMAND_CALCULATION_TIME_MARGIN_MINUTES ??
|
|
73
|
-
// FLEETING_DEMAND_CALCULATION_INTERVAL, FLEETING_DEMAND_CALCULATION_INTERVALS ??
|
|
74
|
-
ALLOW_STOP_POINT_OUTSIDE_TERRITORY: {
|
|
75
|
-
name: 'Allow stop points outside territory',
|
|
76
|
-
description: '',
|
|
77
|
-
type: 'string',
|
|
78
|
-
defaultValue: 'all',
|
|
79
|
-
enum: ['all', 'none', 'first', 'last'],
|
|
80
|
-
context: 'matching',
|
|
81
|
-
},
|
|
82
|
-
VEHICLE_SEARCH_RADIUS: {
|
|
83
|
-
name: 'Matching search radius',
|
|
84
|
-
description: 'The meters for searching vehicles on matching',
|
|
85
|
-
type: 'number',
|
|
86
|
-
defaultValue: 15000,
|
|
87
|
-
context: 'matching',
|
|
88
|
-
},
|
|
89
|
-
VAAS_PLACEMENT_STRATEGY_NAME: {
|
|
90
|
-
name: 'VaaS Placement Strategy',
|
|
91
|
-
description: 'VaaS Placement Strategy Name',
|
|
92
|
-
type: 'string',
|
|
93
|
-
string: 'min-fleet-cost',
|
|
94
|
-
context: 'placement',
|
|
95
|
-
},
|
|
96
|
-
MATCHING_MINIMUM_PAID_RATIO: {
|
|
97
|
-
name: 'Matching min paid/unpaid air distance',
|
|
98
|
-
description: 'The ratio between paid to unpaid air distance - pre filter',
|
|
99
|
-
type: 'number',
|
|
100
|
-
defaultValue: 0.1,
|
|
101
|
-
context: 'matching',
|
|
102
|
-
},
|
|
103
|
-
ETA_MAX: {
|
|
104
|
-
name: 'Maximum time to pickup',
|
|
105
|
-
description: 'The maximum allowed time to pickup in matching',
|
|
106
|
-
type: 'number',
|
|
107
|
-
defaultValue: 15,
|
|
108
|
-
context: 'matching',
|
|
109
|
-
},
|
|
110
|
-
MIN_RANGE_FOR_MATCHING: {
|
|
111
|
-
name: 'Minimum fuel range for matching',
|
|
112
|
-
description: 'The minimum im meters fuel range for vehicle to taking part in matching',
|
|
113
|
-
type: 'number',
|
|
114
|
-
defaultValue: 10000,
|
|
115
|
-
context: 'matching',
|
|
116
|
-
},
|
|
117
|
-
FLEET_SCORE_WEIGHT: {
|
|
118
|
-
name: 'Fleet score weight',
|
|
119
|
-
description: 'The fleet score weight 0-1',
|
|
120
|
-
type: 'number',
|
|
121
|
-
defaultValue: 0.5,
|
|
122
|
-
context: 'matching',
|
|
123
|
-
},
|
|
124
|
-
UNPAID_MAX: { // ?
|
|
125
|
-
name: 'unpaid max',
|
|
126
|
-
description: '',
|
|
127
|
-
type: 'number',
|
|
128
|
-
defaultValue: 20,
|
|
129
|
-
context: 'matching',
|
|
130
|
-
},
|
|
131
|
-
ETA_MIN: { // ?
|
|
132
|
-
name: 'ETA min',
|
|
133
|
-
description: '',
|
|
134
|
-
type: 'number',
|
|
135
|
-
defaultValue: 5,
|
|
136
|
-
context: 'matching',
|
|
137
|
-
},
|
|
138
|
-
VEHICLE_REROUTE_INTERVAL_SECONDS: {
|
|
139
|
-
name: 'Reroute interval',
|
|
140
|
-
description: 'Vehicles reroute interval in seconds',
|
|
141
|
-
type: 'number',
|
|
142
|
-
defaultValue: 0,
|
|
143
|
-
context: 'route',
|
|
144
|
-
},
|
|
145
|
-
CS_PLACEMENT_AMOUNT_OF_INTERVALS_TO_PREDICT: {
|
|
146
|
-
name: 'Amount of intervals to predict for cs placement',
|
|
147
|
-
description: 'Amount of intervals to predict for cs placement',
|
|
148
|
-
type: 'number',
|
|
149
|
-
defaultValue: 0,
|
|
150
|
-
context: 'placement',
|
|
151
|
-
},
|
|
152
|
-
NUMBER_OF_TASKS_CLUSTERS_PER_PLACEMENTS: {
|
|
153
|
-
name: 'Number of clusters for driver tasks',
|
|
154
|
-
description: 'Will be max by the number of movements',
|
|
155
|
-
type: 'number',
|
|
156
|
-
defaultValue: 5,
|
|
157
|
-
context: 'placement',
|
|
158
|
-
},
|
|
159
|
-
VAAS_PLACEMENT_VEHICLE_RIDE_RATIO: {
|
|
160
|
-
name: 'VAAS placement vehicle - ride ratio',
|
|
161
|
-
description: 'The ratio between vehicle and ride for RAAS placement',
|
|
162
|
-
type: 'number',
|
|
163
|
-
defaultValue: 1,
|
|
164
|
-
context: 'placement',
|
|
165
|
-
},
|
|
166
|
-
MAXIMUM_MOVEMENTS_PER_RAAS_PLACEMENT: {
|
|
167
|
-
name: 'Max movements for carsharing placement',
|
|
168
|
-
description: 'A number from 1 - infinity, -1 means no limit',
|
|
169
|
-
type: 'number',
|
|
170
|
-
defaultValue: -1,
|
|
171
|
-
context: 'placement',
|
|
172
|
-
},
|
|
173
|
-
LOOK_FOR_ADDRESS: {
|
|
174
|
-
name: 'Should fill missing addresses',
|
|
175
|
-
description: 'If true request from map provider geocode for the stop point',
|
|
176
|
-
type: 'boolean',
|
|
177
|
-
defaultValue: false,
|
|
178
|
-
context: 'route',
|
|
179
|
-
},
|
|
180
|
-
METERS_FOR_CALC_NEW_ROUTE: {
|
|
181
|
-
name: 'Meters for re-calculation route',
|
|
182
|
-
description: 'The distance im meters to recalc the route',
|
|
183
|
-
type: 'number',
|
|
184
|
-
defaultValue: 20,
|
|
185
|
-
context: 'route',
|
|
186
|
-
},
|
|
187
|
-
MIN_RANGE_TO_FUEL_METERS: {
|
|
188
|
-
name: 'Fuel threshold',
|
|
189
|
-
description: 'The vehicle range in meters to get fuel',
|
|
190
|
-
type: 'number',
|
|
191
|
-
defaultValue: 50000,
|
|
192
|
-
context: 'fuel',
|
|
193
|
-
},
|
|
194
|
-
MIN_TO_ELECTRIC_FUEL: {
|
|
195
|
-
name: 'Maximum time for electric fuel',
|
|
196
|
-
description: '',
|
|
197
|
-
type: 'number',
|
|
198
|
-
defaultValue: 15,
|
|
199
|
-
context: 'fuel',
|
|
200
|
-
},
|
|
201
|
-
DRIVER_MAX_MIN_TO_FUEL: {
|
|
202
|
-
name: 'Maximum time for fuel',
|
|
203
|
-
description: 'The maximum time in minutes for driver done with fuel',
|
|
204
|
-
type: 'number',
|
|
205
|
-
defaultValue: 15,
|
|
206
|
-
context: 'fuel',
|
|
207
|
-
},
|
|
208
|
-
// TODO: MAPPING_S2_LEVEL?
|
|
209
|
-
PLACEMENT_INTERVAL: { // TODO: per fleet + there is also PLACEMENT_INTERVAL_MIN WTF?!
|
|
210
|
-
name: 'Placement interval',
|
|
211
|
-
description: '',
|
|
212
|
-
type: 'number',
|
|
213
|
-
defaultValue: 30,
|
|
214
|
-
context: 'placement',
|
|
215
|
-
},
|
|
216
|
-
PLACEMENT_CORRELATION_COEFFICIENT: { // TODO: per fleet
|
|
217
|
-
name: 'HRPV',
|
|
218
|
-
description: 'PLACEMENT_CORRELATION_COEFFICIENT',
|
|
219
|
-
type: 'number',
|
|
220
|
-
defaultValue: 1,
|
|
221
|
-
context: 'placement',
|
|
222
|
-
},
|
|
223
|
-
PLACEMENT_POSITIVE_THRESHOLD: { // TODO: per fleet
|
|
224
|
-
name: 'Placement positive threshold',
|
|
225
|
-
description: 'PLACEMENT_POSITIVE_THRESHOLD',
|
|
226
|
-
type: 'number',
|
|
227
|
-
defaultValue: 1.1,
|
|
228
|
-
context: 'placement',
|
|
229
|
-
},
|
|
230
|
-
PLACEMENT_NEGATIVE_THRESHOLD: { // TODO: per fleet
|
|
231
|
-
name: 'Placement negative threshold',
|
|
232
|
-
description: 'PLACEMENT_NEGATIVE_THRESHOLD',
|
|
233
|
-
type: 'number',
|
|
234
|
-
defaultValue: 0.9,
|
|
235
|
-
context: 'placement',
|
|
236
|
-
},
|
|
237
|
-
ENABLE_PLACEMENT: { // TODO: per fleet
|
|
238
|
-
name: 'Enable Placement',
|
|
239
|
-
description: 'Should placement be enabled for the fleet',
|
|
240
|
-
type: 'boolean',
|
|
241
|
-
defaultValue: true,
|
|
242
|
-
context: 'placement',
|
|
243
|
-
},
|
|
244
|
-
PLACEMENT_STRATEGY_NAME: { // TODO: per fleet
|
|
245
|
-
name: 'Placement Strategy Name',
|
|
246
|
-
description: 'The name of the strategy to compute the placement of vehicles',
|
|
247
|
-
type: 'string',
|
|
248
|
-
defaultValue: 'min-fleet-dist-to-fill-close-max-demand-tiles',
|
|
249
|
-
context: 'placement',
|
|
250
|
-
},
|
|
251
|
-
CS_CRON_TIME: {
|
|
252
|
-
name: 'Car Sharing Cron',
|
|
253
|
-
description: 'Car sharing placement interval cron setting',
|
|
254
|
-
type: 'string',
|
|
255
|
-
defaultValue: '0 */12 * * *',
|
|
256
|
-
context: 'placement',
|
|
257
|
-
},
|
|
258
|
-
DRIVER_MAX_MINUTES_TO_COME_BACK: {
|
|
259
|
-
name: 'Parking threshold',
|
|
260
|
-
description: 'Minuets before the end of the shift for vehicles to get parking',
|
|
261
|
-
type: 'number',
|
|
262
|
-
defaultValue: 40,
|
|
263
|
-
context: 'shifts',
|
|
264
|
-
},
|
|
265
|
-
EMERGENCY_NUMBER: {
|
|
266
|
-
name: 'Minimum shift time for infleet',
|
|
267
|
-
description: 'Minimum left time on shift in hours for infleet',
|
|
268
|
-
type: 'string',
|
|
269
|
-
defaultValue: '972525893052',
|
|
270
|
-
context: 'operation',
|
|
271
|
-
},
|
|
272
|
-
REFRESH_TOKEN_DRIVER_EXPIRES_IN_ZEITMS_FORMAT: {
|
|
273
|
-
name: 'Driver refresh token expires',
|
|
274
|
-
description: 'The driver token expires in Zeitms format',
|
|
275
|
-
type: 'string',
|
|
276
|
-
defaultValue: '1y',
|
|
277
|
-
context: 'security',
|
|
278
|
-
},
|
|
279
|
-
CANCEL_BREAK_MILLI: {
|
|
280
|
-
name: 'Cancel break mili', // TODO: grave time
|
|
281
|
-
description: '',
|
|
282
|
-
type: 'number',
|
|
283
|
-
defaultValue: 30 * 1000,
|
|
284
|
-
context: 'operation',
|
|
285
|
-
},
|
|
286
|
-
MAX_BREAK_TIME_MILLI: {
|
|
287
|
-
name: 'Max break time',
|
|
288
|
-
description: 'The duration of break in miliseconds',
|
|
289
|
-
type: 'number',
|
|
290
|
-
defaultValue: 10 * 60 * 1000,
|
|
291
|
-
context: 'operation',
|
|
292
|
-
},
|
|
293
|
-
MAX_BREAKS_PER_SHIFT: {
|
|
294
|
-
name: 'Maximum breaks per shift',
|
|
295
|
-
description: 'The number of breaks that driver can take during shift',
|
|
296
|
-
type: 'number',
|
|
297
|
-
defaultValue: 5,
|
|
298
|
-
context: 'operation',
|
|
299
|
-
},
|
|
300
|
-
MIN_TIME_BETWEEN_BREAKS_MILLI: {
|
|
301
|
-
name: 'Minimum time between breaks',
|
|
302
|
-
description: 'The minimum time in miliseconds for taking another break',
|
|
303
|
-
type: 'number',
|
|
304
|
-
defaultValue: 60 * 60 * 1000,
|
|
305
|
-
context: 'operation',
|
|
306
|
-
},
|
|
307
|
-
REFUEl_ELECTRIC_BEFORE_PARKING_METERS: {
|
|
308
|
-
name: 'Refuel instead of parking in defleet threshold ',
|
|
309
|
-
description: 'Minimum range in meters',
|
|
310
|
-
type: 'number',
|
|
311
|
-
defaultValue: 100000,
|
|
312
|
-
context: 'pit-stop',
|
|
313
|
-
},
|
|
314
|
-
MAXIMUN_RIDES_PER_TILE_ON_MAP: {
|
|
315
|
-
name: 'Maximum rides per tile on CC map',
|
|
316
|
-
description: '',
|
|
317
|
-
type: 'number',
|
|
318
|
-
defaultValue: 15,
|
|
319
|
-
context: 'operation',
|
|
320
|
-
},
|
|
321
|
-
DRIVER_APP_SP_VALIDATION_POPUP_DISTANCE: {
|
|
322
|
-
name: 'Distance for pop done in stop point validation',
|
|
323
|
-
description: 'Driver app - distance (km) from stop point for pop validation',
|
|
324
|
-
type: 'number',
|
|
325
|
-
defaultValue: 0.7,
|
|
326
|
-
context: 'operation',
|
|
327
|
-
},
|
|
328
|
-
FLEETING_ACTIVATION_EXPIERY_HOURS: { // TODO: there is also ACTIVATION_EXPIERY WTF?!
|
|
329
|
-
name: 'Activation expiery hours',
|
|
330
|
-
description: 'Hours from start to activate until the activation will cancel',
|
|
331
|
-
type: 'number',
|
|
332
|
-
defaultValue: 2,
|
|
333
|
-
context: 'operation',
|
|
334
|
-
},
|
|
335
|
-
DEMAND_GATEWAY_SECRET: {
|
|
336
|
-
name: 'Demand gateway secret',
|
|
337
|
-
description: '',
|
|
338
|
-
type: 'string',
|
|
339
|
-
defaultValue: 1234,
|
|
340
|
-
context: 'security',
|
|
341
|
-
},
|
|
342
|
-
REFRESH_TOKEN_EXPIRES_IN_ZEITMS_FORMAT: { // TODO: per fleet
|
|
343
|
-
name: 'Fleet user token expires in zeitms foramt',
|
|
344
|
-
description: '',
|
|
345
|
-
type: 'string',
|
|
346
|
-
defaultValue: '90d',
|
|
347
|
-
context: 'security',
|
|
348
|
-
},
|
|
349
|
-
CC_MIN_TO_RESET_WRONG_PASSWORD_COUNTER: { // TODO: per fleet
|
|
350
|
-
name: 'Minutes to reset wrong password in CC',
|
|
351
|
-
description: '',
|
|
352
|
-
type: 'number',
|
|
353
|
-
defaultValue: 30,
|
|
354
|
-
context: 'security',
|
|
355
|
-
},
|
|
356
|
-
CC_WRONG_PASSWORD_ATTEMPTS: { // TODO: per fleet
|
|
357
|
-
name: 'Wrong password attempts in CC',
|
|
358
|
-
description: '',
|
|
359
|
-
type: 'number',
|
|
360
|
-
defaultValue: 5,
|
|
361
|
-
context: 'security',
|
|
362
|
-
},
|
|
363
|
-
MAXIMUM_RADIUS_FOR_STOP_POINT_UPDATE: {
|
|
364
|
-
name: 'Maximum radius for stoppoint update',
|
|
365
|
-
description: 'The maximum radius (in meters) that a stop point can be updated to',
|
|
366
|
-
type: 'number',
|
|
367
|
-
defaultValue: 1000,
|
|
368
|
-
context: 'operation',
|
|
369
|
-
},
|
|
370
|
-
DEMAND_PREDICTION_UTC_TIMEFRAMES: {
|
|
371
|
-
name: 'Demand prediction time frames',
|
|
372
|
-
description: 'Demand prediction time frames for fleet',
|
|
373
|
-
type: 'json',
|
|
374
|
-
defaultValue: '["00:00","01:00","02:00","03:00","04:00","05:00","06:00","07:00","08:00","09:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00","22:00","23:00"]',
|
|
375
|
-
context: 'demand prediction',
|
|
376
|
-
},
|
|
377
|
-
UPDATE_STOP_POINTS_DISTANCE_THRESHOLD: {
|
|
378
|
-
name: 'Maximum distance between original and updated stop points of a ride',
|
|
379
|
-
description: 'Threshold in kilimeters for limiting the distance between the original ride stop points and the updated ones',
|
|
380
|
-
type: 'number',
|
|
381
|
-
defaultValue: 500,
|
|
382
|
-
context: 'matching',
|
|
383
|
-
},
|
|
384
|
-
LOGIN_VERIFICATION_SMS_TEXT: {
|
|
385
|
-
name: 'Verification SMS text',
|
|
386
|
-
description: 'Verification text for driver app login',
|
|
387
|
-
type: 'string',
|
|
388
|
-
defaultValue: 'Your Autofleet code is',
|
|
389
|
-
context: 'driver app',
|
|
390
|
-
},
|
|
391
|
-
VEHICLE_LOCK_TIME_FOR_OFFER: {
|
|
392
|
-
name: 'Offer lock time',
|
|
393
|
-
description: 'Time in seconds to lock vehicle for offer',
|
|
394
|
-
type: 'number',
|
|
395
|
-
defaultValue: 180,
|
|
396
|
-
context: 'ride',
|
|
397
|
-
},
|
|
398
|
-
CURRENCY: {
|
|
399
|
-
name: 'Currency of ride price and fees',
|
|
400
|
-
description: 'Currency to calculate the ride price and fees, should be in 3 letter symbol',
|
|
401
|
-
type: 'string',
|
|
402
|
-
defaultValue: 'GBP',
|
|
403
|
-
context: 'ride',
|
|
404
|
-
},
|
|
405
|
-
BUFFER: {
|
|
406
|
-
name: 'Buffer around a polygon of a route',
|
|
407
|
-
description: 'The buffer around a polygon of a route to calculate tiled from',
|
|
408
|
-
type: 'number',
|
|
409
|
-
defaultValue: 1,
|
|
410
|
-
context: 'matching',
|
|
411
|
-
},
|
|
412
|
-
'matching.pooling.maxDrift': {
|
|
413
|
-
name: 'Max drift for pooling matching',
|
|
414
|
-
description: '',
|
|
415
|
-
type: 'number',
|
|
416
|
-
defaultValue: 6,
|
|
417
|
-
context: 'matching',
|
|
418
|
-
},
|
|
419
|
-
'matching.pooling.maxEta': {
|
|
420
|
-
name: 'Max eta for pooling matching',
|
|
421
|
-
description: '',
|
|
422
|
-
type: 'number',
|
|
423
|
-
defaultValue: 15,
|
|
424
|
-
context: 'matching',
|
|
425
|
-
},
|
|
426
|
-
};
|