@nestjs/core 10.4.19 → 10.4.20
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.
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A simple barrier to synchronize flow of multiple async operations.
|
|
3
|
+
*/
|
|
4
|
+
export declare class Barrier {
|
|
5
|
+
private currentCount;
|
|
6
|
+
private targetCount;
|
|
7
|
+
private promise;
|
|
8
|
+
private resolve;
|
|
9
|
+
constructor(targetCount: number);
|
|
10
|
+
/**
|
|
11
|
+
* Signal that a participant has reached the barrier.
|
|
12
|
+
*
|
|
13
|
+
* The barrier will be resolved once `targetCount` participants have reached it.
|
|
14
|
+
*/
|
|
15
|
+
signal(): void;
|
|
16
|
+
/**
|
|
17
|
+
* Wait for the barrier to be resolved.
|
|
18
|
+
*
|
|
19
|
+
* @returns A promise that resolves when the barrier is resolved.
|
|
20
|
+
*/
|
|
21
|
+
wait(): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Signal that a participant has reached the barrier and wait for the barrier to be resolved.
|
|
24
|
+
*
|
|
25
|
+
* The barrier will be resolved once `targetCount` participants have reached it.
|
|
26
|
+
*
|
|
27
|
+
* @returns A promise that resolves when the barrier is resolved.
|
|
28
|
+
*/
|
|
29
|
+
signalAndWait(): Promise<void>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Barrier = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* A simple barrier to synchronize flow of multiple async operations.
|
|
6
|
+
*/
|
|
7
|
+
class Barrier {
|
|
8
|
+
constructor(targetCount) {
|
|
9
|
+
this.currentCount = 0;
|
|
10
|
+
this.targetCount = targetCount;
|
|
11
|
+
this.promise = new Promise(resolve => {
|
|
12
|
+
this.resolve = resolve;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Signal that a participant has reached the barrier.
|
|
17
|
+
*
|
|
18
|
+
* The barrier will be resolved once `targetCount` participants have reached it.
|
|
19
|
+
*/
|
|
20
|
+
signal() {
|
|
21
|
+
this.currentCount += 1;
|
|
22
|
+
if (this.currentCount === this.targetCount) {
|
|
23
|
+
this.resolve();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Wait for the barrier to be resolved.
|
|
28
|
+
*
|
|
29
|
+
* @returns A promise that resolves when the barrier is resolved.
|
|
30
|
+
*/
|
|
31
|
+
async wait() {
|
|
32
|
+
return this.promise;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Signal that a participant has reached the barrier and wait for the barrier to be resolved.
|
|
36
|
+
*
|
|
37
|
+
* The barrier will be resolved once `targetCount` participants have reached it.
|
|
38
|
+
*
|
|
39
|
+
* @returns A promise that resolves when the barrier is resolved.
|
|
40
|
+
*/
|
|
41
|
+
async signalAndWait() {
|
|
42
|
+
this.signal();
|
|
43
|
+
return this.wait();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.Barrier = Barrier;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/core",
|
|
3
|
-
"version": "10.4.
|
|
3
|
+
"version": "10.4.20",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@core)",
|
|
5
5
|
"author": "Kamil Mysliwiec",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"uid": "2.0.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@nestjs/common": "10.4.
|
|
39
|
+
"@nestjs/common": "10.4.20"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@nestjs/common": "^10.0.0",
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Type } from '@nestjs/common';
|
|
2
|
+
import { ReplFunction } from '../repl-function';
|
|
3
|
+
import type { ReplFnDefinition } from '../repl.interfaces';
|
|
4
|
+
export declare class GetReplFn extends ReplFunction {
|
|
5
|
+
fnDefinition: ReplFnDefinition;
|
|
6
|
+
action(token: string | symbol | Function | Type<any>): any;
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetReplFn = void 0;
|
|
4
|
+
const repl_function_1 = require("../repl-function");
|
|
5
|
+
class GetReplFn extends repl_function_1.ReplFunction {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.fnDefinition = {
|
|
9
|
+
name: 'get',
|
|
10
|
+
signature: '(token: InjectionToken) => any',
|
|
11
|
+
description: 'Retrieves an instance of either injectable or controller, otherwise, throws exception.',
|
|
12
|
+
aliases: ['$'],
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
action(token) {
|
|
16
|
+
return this.ctx.app.get(token);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.GetReplFn = GetReplFn;
|