vrack2-core 1.0.4 → 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 CHANGED
@@ -9,7 +9,21 @@ VRack2 Core
9
9
 
10
10
  --------
11
11
 
12
- ### Последнее обновление 1.0.4
12
+ ### Последнее обновление 1.1.0
13
+
14
+ - Переход компиляции на `es2021` - теперь минимальная версия Node.js ≥ 16
15
+ - Добавлен класс `ReactiveRef` для создания переменных с очень простой реактивностью
16
+ - Добавлен класс `UniversalWorkers` для создания воркеров разных типов и работы с ними
17
+
18
+ ### обновление 1.0.5
19
+ - В Container добавлена ошибка `CTR_IGNORE_SERVICE_AUTORELOAD` её можно использовать, когда не хочется что бы после завершения работы сервиса - сервис автоматически перезапускался
20
+ - В класс `Device` добавлены
21
+ - Свойство `works: boolean = true` - если `false` - устройство перестает принимать и отправлять данные через порты
22
+ - Метод `beforeTerminate(){ return }` - может вызываться перед завершением сервиса (зависит от реализации)
23
+ - Теперь бинд входящего порта осуществляется по другому. Теперь вместо замены `DevicePort.push` ссылка на хендлер складывается в `DevicePort.bind` и уже после этого происходит вызов `DevicePort.bind()` внутри `DevicePort.push`
24
+
25
+
26
+ ### обновление 1.0.4
13
27
 
14
28
  - `BasicType` (класс `Rule`) `require()` deprecated - используем `required()`
15
29
  - **ErrorManager** - Теперь не создаёт ошибку при повторной регистрации с одинаковыми параметрами
@@ -17,11 +31,6 @@ VRack2 Core
17
31
  - isCode(error: any, code: string) - Проверяет является ли ошибка VRack2 Error и соответсвует ли код переданной ошибке (проверяет vShort и vCode)
18
32
  - isError(error: any) - Проверяет - пренадлежит ли объект ошибки CoreError
19
33
 
20
- ### Обновление 1.0.3
21
-
22
- - Теперь порты `DevicePort` имеют ссылки на устройство своего владельца `Device`
23
- - Добавлено свойство meta внутри контейнера для хранения дополнительной информации
24
-
25
34
  **Использовать эту документацию имеет смысл только для более глубокого изучения устройства VRack2 или для создания сервиса независимого от VRack2**
26
35
 
27
36
  -------
package/lib/Bootstrap.js CHANGED
@@ -3,15 +3,6 @@
3
3
  * Copyright © 2024 Boris Bobylev. All rights reserved.
4
4
  * Licensed under the Apache License, Version 2.0
5
5
  */
6
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
7
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
8
- return new (P || (P = Promise))(function (resolve, reject) {
9
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
10
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
11
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
12
- step((generator = generator.apply(thisArg, _arguments || [])).next());
13
- });
14
- };
15
6
  var __importDefault = (this && this.__importDefault) || function (mod) {
16
7
  return (mod && mod.__esModule) ? mod : { "default": mod };
17
8
  };
@@ -65,21 +56,19 @@ class Bootstrap {
65
56
  *
66
57
  * @param Container Container for which loading is performed
67
58
  */
68
- loadBootList(Container) {
69
- return __awaiter(this, void 0, void 0, function* () {
70
- for (const cn in this.config) {
71
- const conf = this.config[cn];
72
- const ExClass = yield ImportManager_1.default.importClass(conf.path);
73
- this.loaded[cn] = new ExClass(cn, ImportManager_1.default.importClassName(conf.path), Container, conf.options);
74
- if (!(this.loaded[cn] instanceof BootClass_1.default)) {
75
- throw _1.ErrorManager.make('BTSP_INSTANCE_OF_INCORRECT', { path: conf.path });
76
- }
59
+ async loadBootList(Container) {
60
+ for (const cn in this.config) {
61
+ const conf = this.config[cn];
62
+ const ExClass = await ImportManager_1.default.importClass(conf.path);
63
+ this.loaded[cn] = new ExClass(cn, ImportManager_1.default.importClassName(conf.path), Container, conf.options);
64
+ if (!(this.loaded[cn] instanceof BootClass_1.default)) {
65
+ throw _1.ErrorManager.make('BTSP_INSTANCE_OF_INCORRECT', { path: conf.path });
77
66
  }
78
- for (const bc in this.loaded)
79
- this.loaded[bc].process();
80
- for (const bc in this.loaded)
81
- yield this.loaded[bc].processPromise();
82
- });
67
+ }
68
+ for (const bc in this.loaded)
69
+ this.loaded[bc].process();
70
+ for (const bc in this.loaded)
71
+ await this.loaded[bc].processPromise();
83
72
  }
84
73
  /**
85
74
  * Getting an initialized class
package/lib/Container.js CHANGED
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -85,6 +76,7 @@ ErrorManager_1.default.register('Container', 'XR1K10R0OOUC', 'CTR_INCOMPATIBLE_P
85
76
  });
86
77
  ErrorManager_1.default.register('Container', 'MmVoDOQwaYkx', 'CTR_INCORRECT_BOOSTRAP', 'The required DeviceManager class is not specified correctly', {});
87
78
  ErrorManager_1.default.register('Container', 'e090R0MLyb7y', 'CTR_CONF_EXTENDS_PROBLEM', 'Problem with extending service configuration.', {});
79
+ ErrorManager_1.default.register('Container', 'LYC0VA1AWYKU', 'CTR_IGNORE_SERVICE_AUTORELOAD', 'Error that ignores service restart flag', {});
88
80
  /**
89
81
  * Service Load Class. It loads all devices in the list,
90
82
  * establishes connections between them, and performs device startup.
@@ -124,11 +116,9 @@ class Container extends events_1.default {
124
116
  /**
125
117
  * Run container
126
118
  */
127
- run() {
128
- return __awaiter(this, void 0, void 0, function* () {
129
- yield this.init();
130
- yield this.runProcess();
131
- });
119
+ async run() {
120
+ await this.init();
121
+ await this.runProcess();
132
122
  }
133
123
  /**
134
124
  * Extends service from config file
@@ -172,87 +162,83 @@ class Container extends events_1.default {
172
162
  *
173
163
  * @see structure
174
164
  */
175
- init() {
176
- return __awaiter(this, void 0, void 0, function* () {
177
- if (this.inited)
178
- return;
179
- this.inited = true;
180
- this.emit('configure');
181
- try {
182
- this.fillConfFile();
165
+ async init() {
166
+ if (this.inited)
167
+ return;
168
+ this.inited = true;
169
+ this.emit('configure');
170
+ try {
171
+ this.fillConfFile();
172
+ }
173
+ catch (err) {
174
+ if (err instanceof Error) {
175
+ const ner = ErrorManager_1.default.make('CTR_CONF_EXTENDS_PROBLEM', {}).setTrace(err).add(err);
176
+ throw ner;
183
177
  }
184
- catch (err) {
185
- if (err instanceof Error) {
186
- const ner = ErrorManager_1.default.make('CTR_CONF_EXTENDS_PROBLEM', {}).setTrace(err).add(err);
187
- throw ner;
188
- }
189
- throw err;
178
+ throw err;
179
+ }
180
+ this.emit('beforeInit');
181
+ this.emit('init');
182
+ for (const device of this.service.devices) {
183
+ try {
184
+ this.emit('initDevice', device);
185
+ await this.initDevice(device);
190
186
  }
191
- this.emit('beforeInit');
192
- this.emit('init');
193
- for (const device of this.service.devices) {
194
- try {
195
- this.emit('initDevice', device);
196
- yield this.initDevice(device);
197
- }
198
- catch (error) {
199
- const ner = ErrorManager_1.default.make('CTR_ERROR_INIT_DEVICE', { deviceConfig: device });
200
- ner.add(error);
201
- throw ner;
202
- }
187
+ catch (error) {
188
+ const ner = ErrorManager_1.default.make('CTR_ERROR_INIT_DEVICE', { deviceConfig: device });
189
+ ner.add(error);
190
+ throw ner;
203
191
  }
204
- this.emit('afterInit');
205
- this.emit('beforeConnections');
206
- this.emit('connections');
207
- for (const device of this.service.devices) {
208
- if (!device.connections)
209
- continue;
210
- for (const conn of device.connections) {
211
- this.emit('connection', conn);
212
- this.initConnection(conn);
213
- }
192
+ }
193
+ this.emit('afterInit');
194
+ this.emit('beforeConnections');
195
+ this.emit('connections');
196
+ for (const device of this.service.devices) {
197
+ if (!device.connections)
198
+ continue;
199
+ for (const conn of device.connections) {
200
+ this.emit('connection', conn);
201
+ this.initConnection(conn);
214
202
  }
215
- if (Array.isArray(this.service.connections)) {
216
- for (const conn of this.service.connections) {
217
- this.initConnection(conn);
218
- }
203
+ }
204
+ if (Array.isArray(this.service.connections)) {
205
+ for (const conn of this.service.connections) {
206
+ this.initConnection(conn);
219
207
  }
220
- this.emit('afterConnections');
221
- });
208
+ }
209
+ this.emit('afterConnections');
222
210
  }
223
211
  /**
224
212
  * Run process & processPromise of all devices
225
213
  */
226
- runProcess() {
227
- return __awaiter(this, void 0, void 0, function* () {
228
- if (this.runned)
229
- return;
230
- this.runned = true;
231
- this.emit('beforeProcess');
232
- for (const key in this.devices) {
233
- try {
234
- this.emit('process', key);
235
- this.devices[key].process();
236
- }
237
- catch (error) {
238
- throw ErrorManager_1.default.make('CTR_DEVICE_PROCESS_EXCEPTION', { device: key }).add(error);
239
- }
214
+ async runProcess() {
215
+ if (this.runned)
216
+ return;
217
+ this.runned = true;
218
+ this.emit('beforeProcess');
219
+ for (const key in this.devices) {
220
+ try {
221
+ this.emit('process', key);
222
+ this.devices[key].process();
240
223
  }
241
- this.emit('afterProcess');
242
- this.emit('beforeProcessPromise');
243
- for (const key in this.devices) {
244
- try {
245
- this.emit('processPromise', key);
246
- yield this.devices[key].processPromise();
247
- }
248
- catch (error) {
249
- throw ErrorManager_1.default.make('CTR_DEVICE_PROCESS_PROMISE_EXCEPTION', { device: key }).add(error);
250
- }
224
+ catch (error) {
225
+ throw ErrorManager_1.default.make('CTR_DEVICE_PROCESS_EXCEPTION', { device: key }).add(error);
226
+ }
227
+ }
228
+ this.emit('afterProcess');
229
+ this.emit('beforeProcessPromise');
230
+ for (const key in this.devices) {
231
+ try {
232
+ this.emit('processPromise', key);
233
+ await this.devices[key].processPromise();
234
+ }
235
+ catch (error) {
236
+ throw ErrorManager_1.default.make('CTR_DEVICE_PROCESS_PROMISE_EXCEPTION', { device: key }).add(error);
251
237
  }
252
- this.emit('afterProcessPromise');
253
- this.emit('beforeLoaded');
254
- this.emit('loaded');
255
- });
238
+ }
239
+ this.emit('afterProcessPromise');
240
+ this.emit('beforeLoaded');
241
+ this.emit('loaded');
256
242
  }
257
243
  /**
258
244
  * Check device action and run him
@@ -261,29 +247,25 @@ class Container extends events_1.default {
261
247
  * @param action Device action (as 'action.name')
262
248
  * @param data Data for action
263
249
  */
264
- deviceAction(device, action, data) {
265
- return __awaiter(this, void 0, void 0, function* () {
266
- if (!this.deviceActions[device])
267
- throw ErrorManager_1.default.make('CTR_DEVICE_NF', { device });
268
- const deviceClass = this.devices[device];
269
- const deviceActions = this.deviceActions[device];
270
- const method = ImportManager_1.default.camelize('action.' + action);
271
- if (!deviceActions[action])
272
- throw ErrorManager_1.default.make('CTR_DEVICE_ACTION_NF', { device, action, method });
273
- if (!deviceClass[method])
274
- throw ErrorManager_1.default.make('CTR_DEVICE_ACTION_HANDLER_NF', { device, action });
275
- const actionExport = deviceActions[action].exportRaw();
276
- Validator_1.default.validate(actionExport.requirements, data);
277
- return yield deviceClass[method](data);
278
- });
250
+ async deviceAction(device, action, data) {
251
+ if (!this.deviceActions[device])
252
+ throw ErrorManager_1.default.make('CTR_DEVICE_NF', { device });
253
+ const deviceClass = this.devices[device];
254
+ const deviceActions = this.deviceActions[device];
255
+ const method = ImportManager_1.default.camelize('action.' + action);
256
+ if (!deviceActions[action])
257
+ throw ErrorManager_1.default.make('CTR_DEVICE_ACTION_NF', { device, action, method });
258
+ if (!deviceClass[method])
259
+ throw ErrorManager_1.default.make('CTR_DEVICE_ACTION_HANDLER_NF', { device, action });
260
+ const actionExport = deviceActions[action].exportRaw();
261
+ Validator_1.default.validate(actionExport.requirements, data);
262
+ return await deviceClass[method](data);
279
263
  }
280
264
  /**
281
265
  * Return structure
282
266
  */
283
- getStructure() {
284
- return __awaiter(this, void 0, void 0, function* () {
285
- return this.structure;
286
- });
267
+ async getStructure() {
268
+ return this.structure;
287
269
  }
288
270
  /**
289
271
  * Init one device
@@ -296,102 +278,101 @@ class Container extends events_1.default {
296
278
  * 6. make device inputs ports
297
279
  * 7. make device outputs ports
298
280
  **/
299
- initDevice(dconf) {
300
- return __awaiter(this, void 0, void 0, function* () {
301
- const DM = this.Bootstrap.getBootClass('DeviceManager', DeviceManager_1.default);
302
- const cs = yield DM.get(dconf.type);
303
- //
304
- if (dconf.id === undefined || !dconf.id || typeof dconf.id !== 'string' || !Utility_1.default.isDeviceName(dconf.id)) {
305
- throw ErrorManager_1.default.make('CTR_INCORRECT_DEVICE_ID');
306
- }
307
- // Device id is dublicated
308
- if (dconf.id in this.devices)
309
- throw ErrorManager_1.default.make('CTR_DEVICE_DUBLICATE');
310
- // Create device
311
- const dev = new cs(dconf.id, dconf.type, this);
312
- this.devices[dconf.id] = dev;
313
- // Fill options
314
- for (const key in dconf.options)
315
- dev.options[key] = dconf.options[key];
316
- // try prepare options
317
- try {
318
- dev.prepareOptions();
319
- }
320
- catch (error) {
321
- let message = '';
322
- if (error instanceof Error)
323
- message = error.toString();
324
- const ner = ErrorManager_1.default.make('CTR_ERROR_PREPARE_OPTIONS', { message });
325
- if (error instanceof CoreError_1.default)
326
- ner.add(error);
327
- throw ner;
328
- }
329
- const rules = dev.checkOptions();
330
- // Validating
331
- Validator_1.default.validate(rules, dev.options);
332
- /** create structure */
333
- this.structure[dconf.id] = {
334
- id: dconf.id,
335
- type: dconf.type,
336
- actions: {},
337
- outputs: {},
338
- inputs: {},
339
- ports: [],
340
- settings: {},
341
- metrics: {},
342
- };
343
- dev.preProcess();
344
- // Check actions
345
- this.deviceActions[dev.id] = dev.actions();
346
- for (const action in this.deviceActions[dev.id]) {
347
- const method = ImportManager_1.default.camelize('action.' + action);
348
- if (!(method in dev))
349
- throw ErrorManager_1.default.make('CTR_DEVICE_ACTION_NF', { action, method });
350
- // add structure device action
351
- this.structure[dconf.id].actions[action] = this.deviceActions[dev.id][action].export();
352
- }
353
- this.structure[dconf.id].settings = dev.settings();
354
- // Make Metrics
355
- this.deviceMetrics[dev.id] = dev.metrics();
356
- for (const metric in this.deviceMetrics[dev.id]) {
357
- const raw = this.deviceMetrics[dev.id][metric].export();
358
- const nEvent = { device: dev.id, data: metric, trace: raw };
359
- this.emit('device.register.metric', nEvent);
360
- this.structure[dconf.id].metrics[metric] = raw;
361
- }
362
- // make inputPorts
363
- const iPorts = dev.inputs();
364
- for (const key in iPorts) {
365
- const exp = iPorts[key].export();
366
- const pList = this.getPortList(key, exp);
367
- for (const subkey in pList) {
368
- this.checkPortName(subkey);
369
- const handler = ImportManager_1.default.camelize('input.' + subkey);
370
- this.checkInputHandler(subkey, handler, dev);
371
- const ndp = new DevicePort_1.default(subkey, pList[subkey], dev);
372
- dev.ports.input[subkey] = ndp;
373
- // add structure device input ports
374
- this.structure[dconf.id].inputs[subkey] = [];
375
- this.structure[dconf.id].ports.push(Object.assign({ port: subkey, direct: 'input' }, pList[subkey]));
376
- if (handler in dev)
377
- ndp.push = dev[handler].bind(dev);
378
- }
281
+ async initDevice(dconf) {
282
+ const DM = this.Bootstrap.getBootClass('DeviceManager', DeviceManager_1.default);
283
+ const cs = await DM.get(dconf.type);
284
+ //
285
+ if (dconf.id === undefined || !dconf.id || typeof dconf.id !== 'string' || !Utility_1.default.isDeviceName(dconf.id)) {
286
+ throw ErrorManager_1.default.make('CTR_INCORRECT_DEVICE_ID');
287
+ }
288
+ // Device id is dublicated
289
+ if (dconf.id in this.devices)
290
+ throw ErrorManager_1.default.make('CTR_DEVICE_DUBLICATE');
291
+ // Create device
292
+ const dev = new cs(dconf.id, dconf.type, this);
293
+ this.devices[dconf.id] = dev;
294
+ // Fill options
295
+ for (const key in dconf.options)
296
+ dev.options[key] = dconf.options[key];
297
+ // try prepare options
298
+ try {
299
+ dev.prepareOptions();
300
+ }
301
+ catch (error) {
302
+ let message = '';
303
+ if (error instanceof Error)
304
+ message = error.toString();
305
+ const ner = ErrorManager_1.default.make('CTR_ERROR_PREPARE_OPTIONS', { message });
306
+ if (error instanceof CoreError_1.default)
307
+ ner.add(error);
308
+ throw ner;
309
+ }
310
+ const rules = dev.checkOptions();
311
+ // Validating
312
+ Validator_1.default.validate(rules, dev.options);
313
+ /** create structure */
314
+ this.structure[dconf.id] = {
315
+ id: dconf.id,
316
+ type: dconf.type,
317
+ actions: {},
318
+ outputs: {},
319
+ inputs: {},
320
+ ports: [],
321
+ settings: {},
322
+ metrics: {},
323
+ };
324
+ dev.preProcess();
325
+ // Check actions
326
+ this.deviceActions[dev.id] = dev.actions();
327
+ for (const action in this.deviceActions[dev.id]) {
328
+ const method = ImportManager_1.default.camelize('action.' + action);
329
+ if (!(method in dev))
330
+ throw ErrorManager_1.default.make('CTR_DEVICE_ACTION_NF', { action, method });
331
+ // add structure device action
332
+ this.structure[dconf.id].actions[action] = this.deviceActions[dev.id][action].export();
333
+ }
334
+ this.structure[dconf.id].settings = dev.settings();
335
+ // Make Metrics
336
+ this.deviceMetrics[dev.id] = dev.metrics();
337
+ for (const metric in this.deviceMetrics[dev.id]) {
338
+ const raw = this.deviceMetrics[dev.id][metric].export();
339
+ const nEvent = { device: dev.id, data: metric, trace: raw };
340
+ this.emit('device.register.metric', nEvent);
341
+ this.structure[dconf.id].metrics[metric] = raw;
342
+ }
343
+ // make inputPorts
344
+ const iPorts = dev.inputs();
345
+ for (const key in iPorts) {
346
+ const exp = iPorts[key].export();
347
+ const pList = this.getPortList(key, exp);
348
+ for (const subkey in pList) {
349
+ this.checkPortName(subkey);
350
+ const handler = ImportManager_1.default.camelize('input.' + subkey);
351
+ this.checkInputHandler(subkey, handler, dev);
352
+ const ndp = new DevicePort_1.default(subkey, pList[subkey], dev);
353
+ dev.ports.input[subkey] = ndp;
354
+ // add structure device input ports
355
+ this.structure[dconf.id].inputs[subkey] = [];
356
+ this.structure[dconf.id].ports.push(Object.assign({ port: subkey, direct: 'input' }, pList[subkey]));
357
+ // биндимся а не заменяем push для контроля внутри push
358
+ if (handler in dev)
359
+ ndp.bind = dev[handler].bind(dev);
379
360
  }
380
- // make output ports
381
- const oPorts = dev.outputs();
382
- for (const key in oPorts) {
383
- const exp = oPorts[key].export();
384
- const pList = this.getPortList(key, exp);
385
- for (const subkey in pList) {
386
- this.checkPortName(subkey);
387
- const ndp = new DevicePort_1.default(subkey, pList[subkey], dev);
388
- dev.ports.output[subkey] = ndp;
389
- // add structure device output ports
390
- this.structure[dconf.id].outputs[subkey] = [];
391
- this.structure[dconf.id].ports.push(Object.assign({ port: subkey, direct: 'output' }, pList[subkey]));
392
- }
361
+ }
362
+ // make output ports
363
+ const oPorts = dev.outputs();
364
+ for (const key in oPorts) {
365
+ const exp = oPorts[key].export();
366
+ const pList = this.getPortList(key, exp);
367
+ for (const subkey in pList) {
368
+ this.checkPortName(subkey);
369
+ const ndp = new DevicePort_1.default(subkey, pList[subkey], dev);
370
+ dev.ports.output[subkey] = ndp;
371
+ // add structure device output ports
372
+ this.structure[dconf.id].outputs[subkey] = [];
373
+ this.structure[dconf.id].ports.push(Object.assign({ port: subkey, direct: 'output' }, pList[subkey]));
393
374
  }
394
- });
375
+ }
395
376
  }
396
377
  /**
397
378
  * Check device input handler
@@ -445,7 +426,6 @@ class Container extends events_1.default {
445
426
  * @return Connection object
446
427
  */
447
428
  toConnection(con) {
448
- var _a, _b;
449
429
  const act = con.split('->');
450
430
  if (act.length !== 2)
451
431
  throw ErrorManager_1.default.make('CTR_CONNECTION_INCORRECT', { connection: con, error: "Syntax connection error, syntax have -> beetwen device" });
@@ -455,9 +435,9 @@ class Container extends events_1.default {
455
435
  throw ErrorManager_1.default.make('CTR_CONNECTION_INCORRECT', { connection: con, error: "Syntax connection error, syntax have more 3 actets on side" });
456
436
  if (outputDeviceActs.length < 2 || inputDeviceActs.length < 2)
457
437
  throw ErrorManager_1.default.make('CTR_CONNECTION_INCORRECT', { connection: con, error: "Syntax connection error, syntax have less 2 actets on side" });
458
- let outputDevice = (_a = outputDeviceActs.shift()) === null || _a === void 0 ? void 0 : _a.trim();
438
+ let outputDevice = outputDeviceActs.shift()?.trim();
459
439
  const outputPort = outputDeviceActs.join('.').trim();
460
- let inputDevice = (_b = inputDeviceActs.shift()) === null || _b === void 0 ? void 0 : _b.trim();
440
+ let inputDevice = inputDeviceActs.shift()?.trim();
461
441
  const inputPort = inputDeviceActs.join('.').trim();
462
442
  if (outputDevice === undefined)
463
443
  outputDevice = '';