@tramvai/module-common 2.51.1 → 2.56.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/lib/command/commandLineRunner.d.ts +6 -8
- package/lib/command/defaultLines.d.ts +3 -14
- package/lib/index.browser.js +19 -26
- package/lib/index.es.js +19 -26
- package/lib/index.js +19 -27
- package/lib/providers/clientProviders.d.ts +1 -1
- package/package.json +18 -18
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
import type { CommandLineDescription,
|
|
2
|
-
import type {
|
|
1
|
+
import type { CommandLineDescription, CommandLineRunner as Interface, CommandLines } from '@tramvai/core';
|
|
2
|
+
import type { COMMAND_LINE_EXECUTION_END_TOKEN } from '@tramvai/tokens-core-private';
|
|
3
3
|
import type { Container, ExtractDependencyType, Provider } from '@tinkoff/dippy';
|
|
4
4
|
import type { ExecutionContext, EXECUTION_CONTEXT_MANAGER_TOKEN, LOGGER_TOKEN } from '@tramvai/tokens-common';
|
|
5
5
|
type Deps = {
|
|
6
6
|
lines: CommandLines;
|
|
7
7
|
rootDi: Container;
|
|
8
8
|
logger: ExtractDependencyType<typeof LOGGER_TOKEN>;
|
|
9
|
-
metrics: ExtractDependencyType<typeof METRICS_MODULE_TOKEN> | null;
|
|
10
9
|
executionContextManager: ExtractDependencyType<typeof EXECUTION_CONTEXT_MANAGER_TOKEN>;
|
|
10
|
+
executionEndHandlers: ExtractDependencyType<typeof COMMAND_LINE_EXECUTION_END_TOKEN> | null;
|
|
11
11
|
};
|
|
12
|
-
export declare class CommandLineRunner implements
|
|
12
|
+
export declare class CommandLineRunner implements Interface {
|
|
13
13
|
lines: Deps['lines'];
|
|
14
14
|
rootDi: Deps['rootDi'];
|
|
15
15
|
log: ReturnType<Deps['logger']>;
|
|
16
|
-
metrics: Deps['metrics'];
|
|
17
16
|
executionContextManager: Deps['executionContextManager'];
|
|
18
|
-
|
|
17
|
+
executionEndHandlers: Deps['executionEndHandlers'];
|
|
19
18
|
private executionContextByDi;
|
|
20
19
|
private abortControllerByDi;
|
|
21
|
-
constructor({ lines, rootDi, logger,
|
|
20
|
+
constructor({ lines, rootDi, logger, executionContextManager, executionEndHandlers }: Deps);
|
|
22
21
|
run(type: keyof CommandLines, status: keyof CommandLineDescription, providers?: Provider[], customDi?: Container): Promise<Container>;
|
|
23
22
|
resolveExecutionContextFromDi(di: Container): ExecutionContext | null;
|
|
24
23
|
private createLineChain;
|
|
25
24
|
private instanceExecute;
|
|
26
|
-
private createDurationMetric;
|
|
27
25
|
private throwError;
|
|
28
26
|
}
|
|
29
27
|
export {};
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
+
import type { CommandLineDescription } from '@tramvai/core';
|
|
1
2
|
export declare const lines: {
|
|
2
|
-
server:
|
|
3
|
-
|
|
4
|
-
close: import("@tinkoff/dippy").MultiTokenInterface<import("@tramvai/core").Command>[];
|
|
5
|
-
customer: import("@tinkoff/dippy").MultiTokenInterface<import("@tramvai/core").Command>[];
|
|
6
|
-
spa: import("@tinkoff/dippy").MultiTokenInterface<import("@tramvai/core").Command>[];
|
|
7
|
-
afterSpa: import("@tinkoff/dippy").MultiTokenInterface<import("@tramvai/core").Command>[];
|
|
8
|
-
};
|
|
9
|
-
client: {
|
|
10
|
-
init: import("@tinkoff/dippy").MultiTokenInterface<import("@tramvai/core").Command>[];
|
|
11
|
-
close: import("@tinkoff/dippy").MultiTokenInterface<import("@tramvai/core").Command>[];
|
|
12
|
-
customer: import("@tinkoff/dippy").MultiTokenInterface<import("@tramvai/core").Command>[];
|
|
13
|
-
spa: import("@tinkoff/dippy").MultiTokenInterface<import("@tramvai/core").Command>[];
|
|
14
|
-
afterSpa: import("@tinkoff/dippy").MultiTokenInterface<import("@tramvai/core").Command>[];
|
|
15
|
-
};
|
|
3
|
+
server: CommandLineDescription;
|
|
4
|
+
client: CommandLineDescription;
|
|
16
5
|
};
|
package/lib/index.browser.js
CHANGED
|
@@ -19,9 +19,8 @@ import { createEvent, createReducer, convertAction, createDispatcher, devTools,
|
|
|
19
19
|
import { format, parse } from '@tinkoff/url';
|
|
20
20
|
import isEmpty from '@tinkoff/utils/is/empty';
|
|
21
21
|
import values from '@tinkoff/utils/object/values';
|
|
22
|
-
import {
|
|
22
|
+
import { COMMAND_LINE_TIMING_INFO_TOKEN, COMMAND_LINE_EXECUTION_END_TOKEN } from '@tramvai/tokens-core-private';
|
|
23
23
|
import { createChildContainer, provide as provide$1, Scope as Scope$1, createToken as createToken$1 } from '@tinkoff/dippy';
|
|
24
|
-
import noop from '@tinkoff/utils/function/noop';
|
|
25
24
|
import { isSilentError, ConditionFailError, ExecutionAbortError } from '@tinkoff/errors';
|
|
26
25
|
import { PubSub } from '@tinkoff/pubsub';
|
|
27
26
|
import identity from '@tinkoff/utils/function/identity';
|
|
@@ -384,7 +383,6 @@ function createConsumerContext({ di, dispatcherContext, pubsub, store }) {
|
|
|
384
383
|
});
|
|
385
384
|
}
|
|
386
385
|
|
|
387
|
-
const DEFAULT_BUCKETS = [0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 20, 40, 60];
|
|
388
386
|
const resolveDi = (type, status, diContainer, providers) => {
|
|
389
387
|
let di = diContainer;
|
|
390
388
|
if (status === 'customer' && type !== 'client') {
|
|
@@ -398,14 +396,14 @@ const resolveDi = (type, status, diContainer, providers) => {
|
|
|
398
396
|
return di;
|
|
399
397
|
};
|
|
400
398
|
class CommandLineRunner {
|
|
401
|
-
constructor({ lines, rootDi, logger,
|
|
399
|
+
constructor({ lines, rootDi, logger, executionContextManager, executionEndHandlers }) {
|
|
402
400
|
this.executionContextByDi = new WeakMap();
|
|
403
401
|
this.abortControllerByDi = new WeakMap();
|
|
404
402
|
this.lines = lines;
|
|
405
403
|
this.rootDi = rootDi;
|
|
406
404
|
this.log = logger('command:command-line-runner');
|
|
407
|
-
this.metrics = metrics;
|
|
408
405
|
this.executionContextManager = executionContextManager;
|
|
406
|
+
this.executionEndHandlers = executionEndHandlers;
|
|
409
407
|
}
|
|
410
408
|
run(type, status, providers, customDi) {
|
|
411
409
|
const di = customDi !== null && customDi !== void 0 ? customDi : resolveDi(type, status, this.rootDi, providers);
|
|
@@ -415,26 +413,36 @@ class CommandLineRunner {
|
|
|
415
413
|
type,
|
|
416
414
|
status,
|
|
417
415
|
});
|
|
416
|
+
const timingInfo = {};
|
|
417
|
+
di.register({ provide: COMMAND_LINE_TIMING_INFO_TOKEN, useValue: timingInfo });
|
|
418
418
|
return (this.lines[type][status]
|
|
419
419
|
.reduce((chain, line) => {
|
|
420
420
|
return chain.then(() => {
|
|
421
|
-
const
|
|
421
|
+
const lineName = line.toString();
|
|
422
|
+
timingInfo[lineName] = { start: performance.now() };
|
|
422
423
|
// eslint-disable-next-line promise/no-nesting
|
|
423
424
|
return Promise.resolve()
|
|
424
425
|
.then(() => {
|
|
425
|
-
return this.executionContextManager.withContext(rootExecutionContext, `command-line:${
|
|
426
|
+
return this.executionContextManager.withContext(rootExecutionContext, `command-line:${lineName}`, async (executionContext, abortController) => {
|
|
426
427
|
this.executionContextByDi.set(di, executionContext);
|
|
427
428
|
this.abortControllerByDi.set(di, abortController);
|
|
428
429
|
await this.createLineChain(di, line);
|
|
429
430
|
});
|
|
430
431
|
})
|
|
431
|
-
.finally(() =>
|
|
432
|
+
.finally(() => {
|
|
433
|
+
timingInfo[lineName].end = performance.now();
|
|
434
|
+
});
|
|
432
435
|
});
|
|
433
436
|
}, Promise.resolve())
|
|
434
437
|
// После завершения цепочки отдаем context выполнения
|
|
435
438
|
.finally(() => {
|
|
436
439
|
this.executionContextByDi.delete(di);
|
|
437
440
|
this.abortControllerByDi.delete(di);
|
|
441
|
+
if (this.executionEndHandlers) {
|
|
442
|
+
for (const executionEndHandler of this.executionEndHandlers) {
|
|
443
|
+
executionEndHandler(di, type, status, timingInfo);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
438
446
|
})
|
|
439
447
|
.then(() => di));
|
|
440
448
|
}
|
|
@@ -506,21 +514,6 @@ class CommandLineRunner {
|
|
|
506
514
|
this.throwError(err, di);
|
|
507
515
|
});
|
|
508
516
|
}
|
|
509
|
-
createDurationMetric() {
|
|
510
|
-
if (!this.metrics) {
|
|
511
|
-
return noop;
|
|
512
|
-
}
|
|
513
|
-
// Мы должны только один раз создавать инстанс метрики
|
|
514
|
-
if (!this.metricsInstance) {
|
|
515
|
-
this.metricsInstance = this.metrics.histogram({
|
|
516
|
-
name: `command_line_runner_execution_time`,
|
|
517
|
-
help: 'Command line processing duration',
|
|
518
|
-
labelNames: ['line'],
|
|
519
|
-
buckets: DEFAULT_BUCKETS,
|
|
520
|
-
});
|
|
521
|
-
}
|
|
522
|
-
return this.metricsInstance.startTimer();
|
|
523
|
-
}
|
|
524
517
|
// eslint-disable-next-line class-methods-use-this
|
|
525
518
|
throwError(err, di) {
|
|
526
519
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -565,11 +558,11 @@ CommandModule = __decorate([
|
|
|
565
558
|
lines: COMMAND_LINES_TOKEN,
|
|
566
559
|
rootDi: DI_TOKEN,
|
|
567
560
|
logger: LOGGER_TOKEN,
|
|
568
|
-
|
|
569
|
-
|
|
561
|
+
executionContextManager: EXECUTION_CONTEXT_MANAGER_TOKEN,
|
|
562
|
+
executionEndHandlers: {
|
|
563
|
+
token: COMMAND_LINE_EXECUTION_END_TOKEN,
|
|
570
564
|
optional: true,
|
|
571
565
|
},
|
|
572
|
-
executionContextManager: EXECUTION_CONTEXT_MANAGER_TOKEN,
|
|
573
566
|
},
|
|
574
567
|
}),
|
|
575
568
|
provide$1({
|
package/lib/index.es.js
CHANGED
|
@@ -19,9 +19,8 @@ import { FASTIFY_REQUEST } from '@tramvai/tokens-server-private';
|
|
|
19
19
|
import { format, parse } from '@tinkoff/url';
|
|
20
20
|
import isEmpty from '@tinkoff/utils/is/empty';
|
|
21
21
|
import values from '@tinkoff/utils/object/values';
|
|
22
|
-
import {
|
|
22
|
+
import { COMMAND_LINE_TIMING_INFO_TOKEN, COMMAND_LINE_EXECUTION_END_TOKEN } from '@tramvai/tokens-core-private';
|
|
23
23
|
import { createChildContainer, provide as provide$1, Scope as Scope$1, createToken as createToken$1 } from '@tinkoff/dippy';
|
|
24
|
-
import noop from '@tinkoff/utils/function/noop';
|
|
25
24
|
import { isSilentError, ConditionFailError, ExecutionAbortError } from '@tinkoff/errors';
|
|
26
25
|
import { PubSub } from '@tinkoff/pubsub';
|
|
27
26
|
import identity from '@tinkoff/utils/function/identity';
|
|
@@ -377,7 +376,6 @@ function createConsumerContext({ di, dispatcherContext, pubsub, store }) {
|
|
|
377
376
|
});
|
|
378
377
|
}
|
|
379
378
|
|
|
380
|
-
const DEFAULT_BUCKETS = [0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 20, 40, 60];
|
|
381
379
|
const resolveDi = (type, status, diContainer, providers) => {
|
|
382
380
|
let di = diContainer;
|
|
383
381
|
if (status === 'customer' && type !== 'client') {
|
|
@@ -391,14 +389,14 @@ const resolveDi = (type, status, diContainer, providers) => {
|
|
|
391
389
|
return di;
|
|
392
390
|
};
|
|
393
391
|
class CommandLineRunner {
|
|
394
|
-
constructor({ lines, rootDi, logger,
|
|
392
|
+
constructor({ lines, rootDi, logger, executionContextManager, executionEndHandlers }) {
|
|
395
393
|
this.executionContextByDi = new WeakMap();
|
|
396
394
|
this.abortControllerByDi = new WeakMap();
|
|
397
395
|
this.lines = lines;
|
|
398
396
|
this.rootDi = rootDi;
|
|
399
397
|
this.log = logger('command:command-line-runner');
|
|
400
|
-
this.metrics = metrics;
|
|
401
398
|
this.executionContextManager = executionContextManager;
|
|
399
|
+
this.executionEndHandlers = executionEndHandlers;
|
|
402
400
|
}
|
|
403
401
|
run(type, status, providers, customDi) {
|
|
404
402
|
const di = customDi !== null && customDi !== void 0 ? customDi : resolveDi(type, status, this.rootDi, providers);
|
|
@@ -408,26 +406,36 @@ class CommandLineRunner {
|
|
|
408
406
|
type,
|
|
409
407
|
status,
|
|
410
408
|
});
|
|
409
|
+
const timingInfo = {};
|
|
410
|
+
di.register({ provide: COMMAND_LINE_TIMING_INFO_TOKEN, useValue: timingInfo });
|
|
411
411
|
return (this.lines[type][status]
|
|
412
412
|
.reduce((chain, line) => {
|
|
413
413
|
return chain.then(() => {
|
|
414
|
-
const
|
|
414
|
+
const lineName = line.toString();
|
|
415
|
+
timingInfo[lineName] = { start: performance.now() };
|
|
415
416
|
// eslint-disable-next-line promise/no-nesting
|
|
416
417
|
return Promise.resolve()
|
|
417
418
|
.then(() => {
|
|
418
|
-
return this.executionContextManager.withContext(rootExecutionContext, `command-line:${
|
|
419
|
+
return this.executionContextManager.withContext(rootExecutionContext, `command-line:${lineName}`, async (executionContext, abortController) => {
|
|
419
420
|
this.executionContextByDi.set(di, executionContext);
|
|
420
421
|
this.abortControllerByDi.set(di, abortController);
|
|
421
422
|
await this.createLineChain(di, line);
|
|
422
423
|
});
|
|
423
424
|
})
|
|
424
|
-
.finally(() =>
|
|
425
|
+
.finally(() => {
|
|
426
|
+
timingInfo[lineName].end = performance.now();
|
|
427
|
+
});
|
|
425
428
|
});
|
|
426
429
|
}, Promise.resolve())
|
|
427
430
|
// После завершения цепочки отдаем context выполнения
|
|
428
431
|
.finally(() => {
|
|
429
432
|
this.executionContextByDi.delete(di);
|
|
430
433
|
this.abortControllerByDi.delete(di);
|
|
434
|
+
if (this.executionEndHandlers) {
|
|
435
|
+
for (const executionEndHandler of this.executionEndHandlers) {
|
|
436
|
+
executionEndHandler(di, type, status, timingInfo);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
431
439
|
})
|
|
432
440
|
.then(() => di));
|
|
433
441
|
}
|
|
@@ -499,21 +507,6 @@ class CommandLineRunner {
|
|
|
499
507
|
this.throwError(err, di);
|
|
500
508
|
});
|
|
501
509
|
}
|
|
502
|
-
createDurationMetric() {
|
|
503
|
-
if (!this.metrics) {
|
|
504
|
-
return noop;
|
|
505
|
-
}
|
|
506
|
-
// Мы должны только один раз создавать инстанс метрики
|
|
507
|
-
if (!this.metricsInstance) {
|
|
508
|
-
this.metricsInstance = this.metrics.histogram({
|
|
509
|
-
name: `command_line_runner_execution_time`,
|
|
510
|
-
help: 'Command line processing duration',
|
|
511
|
-
labelNames: ['line'],
|
|
512
|
-
buckets: DEFAULT_BUCKETS,
|
|
513
|
-
});
|
|
514
|
-
}
|
|
515
|
-
return this.metricsInstance.startTimer();
|
|
516
|
-
}
|
|
517
510
|
// eslint-disable-next-line class-methods-use-this
|
|
518
511
|
throwError(err, di) {
|
|
519
512
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -558,11 +551,11 @@ CommandModule = __decorate([
|
|
|
558
551
|
lines: COMMAND_LINES_TOKEN,
|
|
559
552
|
rootDi: DI_TOKEN,
|
|
560
553
|
logger: LOGGER_TOKEN,
|
|
561
|
-
|
|
562
|
-
|
|
554
|
+
executionContextManager: EXECUTION_CONTEXT_MANAGER_TOKEN,
|
|
555
|
+
executionEndHandlers: {
|
|
556
|
+
token: COMMAND_LINE_EXECUTION_END_TOKEN,
|
|
563
557
|
optional: true,
|
|
564
558
|
},
|
|
565
|
-
executionContextManager: EXECUTION_CONTEXT_MANAGER_TOKEN,
|
|
566
559
|
},
|
|
567
560
|
}),
|
|
568
561
|
provide$1({
|
package/lib/index.js
CHANGED
|
@@ -21,9 +21,8 @@ var tokensServerPrivate = require('@tramvai/tokens-server-private');
|
|
|
21
21
|
var url = require('@tinkoff/url');
|
|
22
22
|
var isEmpty = require('@tinkoff/utils/is/empty');
|
|
23
23
|
var values = require('@tinkoff/utils/object/values');
|
|
24
|
-
var
|
|
24
|
+
var tokensCorePrivate = require('@tramvai/tokens-core-private');
|
|
25
25
|
var dippy = require('@tinkoff/dippy');
|
|
26
|
-
var noop = require('@tinkoff/utils/function/noop');
|
|
27
26
|
var errors = require('@tinkoff/errors');
|
|
28
27
|
var pubsub = require('@tinkoff/pubsub');
|
|
29
28
|
var identity = require('@tinkoff/utils/function/identity');
|
|
@@ -48,7 +47,6 @@ var pathOr__default = /*#__PURE__*/_interopDefaultLegacy(pathOr);
|
|
|
48
47
|
var flatten__default = /*#__PURE__*/_interopDefaultLegacy(flatten);
|
|
49
48
|
var isEmpty__default = /*#__PURE__*/_interopDefaultLegacy(isEmpty);
|
|
50
49
|
var values__default = /*#__PURE__*/_interopDefaultLegacy(values);
|
|
51
|
-
var noop__default = /*#__PURE__*/_interopDefaultLegacy(noop);
|
|
52
50
|
var identity__default = /*#__PURE__*/_interopDefaultLegacy(identity);
|
|
53
51
|
var objectMap__default = /*#__PURE__*/_interopDefaultLegacy(objectMap);
|
|
54
52
|
var uniq__default = /*#__PURE__*/_interopDefaultLegacy(uniq);
|
|
@@ -396,7 +394,6 @@ function createConsumerContext({ di, dispatcherContext, pubsub, store }) {
|
|
|
396
394
|
});
|
|
397
395
|
}
|
|
398
396
|
|
|
399
|
-
const DEFAULT_BUCKETS = [0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 20, 40, 60];
|
|
400
397
|
const resolveDi = (type, status, diContainer, providers) => {
|
|
401
398
|
let di = diContainer;
|
|
402
399
|
if (status === 'customer' && type !== 'client') {
|
|
@@ -410,14 +407,14 @@ const resolveDi = (type, status, diContainer, providers) => {
|
|
|
410
407
|
return di;
|
|
411
408
|
};
|
|
412
409
|
class CommandLineRunner {
|
|
413
|
-
constructor({ lines, rootDi, logger,
|
|
410
|
+
constructor({ lines, rootDi, logger, executionContextManager, executionEndHandlers }) {
|
|
414
411
|
this.executionContextByDi = new WeakMap();
|
|
415
412
|
this.abortControllerByDi = new WeakMap();
|
|
416
413
|
this.lines = lines;
|
|
417
414
|
this.rootDi = rootDi;
|
|
418
415
|
this.log = logger('command:command-line-runner');
|
|
419
|
-
this.metrics = metrics;
|
|
420
416
|
this.executionContextManager = executionContextManager;
|
|
417
|
+
this.executionEndHandlers = executionEndHandlers;
|
|
421
418
|
}
|
|
422
419
|
run(type, status, providers, customDi) {
|
|
423
420
|
const di = customDi !== null && customDi !== void 0 ? customDi : resolveDi(type, status, this.rootDi, providers);
|
|
@@ -427,26 +424,36 @@ class CommandLineRunner {
|
|
|
427
424
|
type,
|
|
428
425
|
status,
|
|
429
426
|
});
|
|
427
|
+
const timingInfo = {};
|
|
428
|
+
di.register({ provide: tokensCorePrivate.COMMAND_LINE_TIMING_INFO_TOKEN, useValue: timingInfo });
|
|
430
429
|
return (this.lines[type][status]
|
|
431
430
|
.reduce((chain, line) => {
|
|
432
431
|
return chain.then(() => {
|
|
433
|
-
const
|
|
432
|
+
const lineName = line.toString();
|
|
433
|
+
timingInfo[lineName] = { start: performance.now() };
|
|
434
434
|
// eslint-disable-next-line promise/no-nesting
|
|
435
435
|
return Promise.resolve()
|
|
436
436
|
.then(() => {
|
|
437
|
-
return this.executionContextManager.withContext(rootExecutionContext, `command-line:${
|
|
437
|
+
return this.executionContextManager.withContext(rootExecutionContext, `command-line:${lineName}`, async (executionContext, abortController) => {
|
|
438
438
|
this.executionContextByDi.set(di, executionContext);
|
|
439
439
|
this.abortControllerByDi.set(di, abortController);
|
|
440
440
|
await this.createLineChain(di, line);
|
|
441
441
|
});
|
|
442
442
|
})
|
|
443
|
-
.finally(() =>
|
|
443
|
+
.finally(() => {
|
|
444
|
+
timingInfo[lineName].end = performance.now();
|
|
445
|
+
});
|
|
444
446
|
});
|
|
445
447
|
}, Promise.resolve())
|
|
446
448
|
// После завершения цепочки отдаем context выполнения
|
|
447
449
|
.finally(() => {
|
|
448
450
|
this.executionContextByDi.delete(di);
|
|
449
451
|
this.abortControllerByDi.delete(di);
|
|
452
|
+
if (this.executionEndHandlers) {
|
|
453
|
+
for (const executionEndHandler of this.executionEndHandlers) {
|
|
454
|
+
executionEndHandler(di, type, status, timingInfo);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
450
457
|
})
|
|
451
458
|
.then(() => di));
|
|
452
459
|
}
|
|
@@ -518,21 +525,6 @@ class CommandLineRunner {
|
|
|
518
525
|
this.throwError(err, di);
|
|
519
526
|
});
|
|
520
527
|
}
|
|
521
|
-
createDurationMetric() {
|
|
522
|
-
if (!this.metrics) {
|
|
523
|
-
return noop__default["default"];
|
|
524
|
-
}
|
|
525
|
-
// Мы должны только один раз создавать инстанс метрики
|
|
526
|
-
if (!this.metricsInstance) {
|
|
527
|
-
this.metricsInstance = this.metrics.histogram({
|
|
528
|
-
name: `command_line_runner_execution_time`,
|
|
529
|
-
help: 'Command line processing duration',
|
|
530
|
-
labelNames: ['line'],
|
|
531
|
-
buckets: DEFAULT_BUCKETS,
|
|
532
|
-
});
|
|
533
|
-
}
|
|
534
|
-
return this.metricsInstance.startTimer();
|
|
535
|
-
}
|
|
536
528
|
// eslint-disable-next-line class-methods-use-this
|
|
537
529
|
throwError(err, di) {
|
|
538
530
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -577,11 +569,11 @@ exports.CommandModule = tslib.__decorate([
|
|
|
577
569
|
lines: core.COMMAND_LINES_TOKEN,
|
|
578
570
|
rootDi: core.DI_TOKEN,
|
|
579
571
|
logger: tokensCommon.LOGGER_TOKEN,
|
|
580
|
-
|
|
581
|
-
|
|
572
|
+
executionContextManager: tokensCommon.EXECUTION_CONTEXT_MANAGER_TOKEN,
|
|
573
|
+
executionEndHandlers: {
|
|
574
|
+
token: tokensCorePrivate.COMMAND_LINE_EXECUTION_END_TOKEN,
|
|
582
575
|
optional: true,
|
|
583
576
|
},
|
|
584
|
-
executionContextManager: tokensCommon.EXECUTION_CONTEXT_MANAGER_TOKEN,
|
|
585
577
|
},
|
|
586
578
|
}),
|
|
587
579
|
dippy.provide({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const providers: (import("@tramvai/core").Provider<unknown, import("@tinkoff/dippy").BaseTokenInterface<{
|
|
2
2
|
stores: Record<string, any>;
|
|
3
3
|
}>> | import("@tramvai/core").Provider<{
|
|
4
|
-
commandLineRunner: import("@tinkoff/dippy").BaseTokenInterface<import("@tramvai/
|
|
4
|
+
commandLineRunner: import("@tinkoff/dippy").BaseTokenInterface<import("@tramvai/core").CommandLineRunner>;
|
|
5
5
|
}, import("@tinkoff/dippy").MultiTokenInterface<import("@tramvai/core").Command>>)[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-common",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.56.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -33,28 +33,28 @@
|
|
|
33
33
|
"@tinkoff/lru-cache-nano": "^7.8.1",
|
|
34
34
|
"@tinkoff/pubsub": "0.5.5",
|
|
35
35
|
"@tinkoff/url": "0.8.4",
|
|
36
|
-
"@tramvai/experiments": "2.
|
|
37
|
-
"@tramvai/module-cookie": "2.
|
|
38
|
-
"@tramvai/module-environment": "2.
|
|
39
|
-
"@tramvai/module-log": "2.
|
|
40
|
-
"@tramvai/tokens-child-app": "2.
|
|
41
|
-
"@tramvai/tokens-
|
|
42
|
-
"@tramvai/tokens-
|
|
43
|
-
"@tramvai/tokens-
|
|
44
|
-
"@tramvai/
|
|
36
|
+
"@tramvai/experiments": "2.56.0",
|
|
37
|
+
"@tramvai/module-cookie": "2.56.0",
|
|
38
|
+
"@tramvai/module-environment": "2.56.0",
|
|
39
|
+
"@tramvai/module-log": "2.56.0",
|
|
40
|
+
"@tramvai/tokens-child-app": "2.56.0",
|
|
41
|
+
"@tramvai/tokens-core-private": "2.56.0",
|
|
42
|
+
"@tramvai/tokens-common": "2.56.0",
|
|
43
|
+
"@tramvai/tokens-render": "2.56.0",
|
|
44
|
+
"@tramvai/tokens-server-private": "2.56.0",
|
|
45
|
+
"@tramvai/types-actions-state-context": "2.56.0",
|
|
45
46
|
"hoist-non-react-statics": "^3.3.1",
|
|
46
47
|
"node-abort-controller": "^3.0.1"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
49
|
-
"@tinkoff/dippy": "0.8.
|
|
50
|
+
"@tinkoff/dippy": "0.8.10",
|
|
50
51
|
"@tinkoff/utils": "^2.1.2",
|
|
51
|
-
"@tramvai/cli": "2.
|
|
52
|
-
"@tramvai/core": "2.
|
|
53
|
-
"@tramvai/papi": "2.
|
|
54
|
-
"@tramvai/react": "2.
|
|
55
|
-
"@tramvai/state": "2.
|
|
56
|
-
"@tramvai/tokens-
|
|
57
|
-
"@tramvai/tokens-server": "2.51.1",
|
|
52
|
+
"@tramvai/cli": "2.56.0",
|
|
53
|
+
"@tramvai/core": "2.56.0",
|
|
54
|
+
"@tramvai/papi": "2.56.0",
|
|
55
|
+
"@tramvai/react": "2.56.0",
|
|
56
|
+
"@tramvai/state": "2.56.0",
|
|
57
|
+
"@tramvai/tokens-server": "2.56.0",
|
|
58
58
|
"react": ">=16.14.0",
|
|
59
59
|
"tslib": "^2.4.0"
|
|
60
60
|
},
|