@rayondigital/nest-dapr 0.9.19 → 0.9.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.
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import ActorManager from '@dapr/dapr/actors/runtime/ActorManager';
|
|
2
2
|
import ActorRuntime from '@dapr/dapr/actors/runtime/ActorRuntime';
|
|
3
|
+
import { Type } from '@nestjs/common';
|
|
4
|
+
import { DaprActorClient } from './dapr-actor-client.service';
|
|
3
5
|
export declare class ActorRuntimeService {
|
|
6
|
+
private readonly actorClient;
|
|
7
|
+
constructor(actorClient: DaprActorClient);
|
|
4
8
|
getRuntime(): ActorRuntime;
|
|
5
9
|
getActorManager<TActorInterface>(actorTypeName: string): ActorManager<TActorInterface>;
|
|
6
10
|
getAllActors(): Map<string, any>;
|
|
7
11
|
getActors<TActorInterface>(actorTypeName: string): Map<string, TActorInterface>;
|
|
8
|
-
getActor<TActorInterface>(
|
|
9
|
-
|
|
12
|
+
getActor<TActorInterface>(actorType: Type<TActorInterface> | Function, actorId: string): TActorInterface;
|
|
13
|
+
getActorByTypeName<TActorInterface>(actorTypeName: string, actorId: string): TActorInterface;
|
|
14
|
+
hasActor<TActorInterface>(actorType: Type<TActorInterface> | Function, actorId: string): boolean;
|
|
15
|
+
hasActorByTypeName(actorTypeName: string, actorId: string): boolean;
|
|
10
16
|
invoke<TActorInterface, TResult>(actorTypeName: string, actorId: string, methodName: string, payload: any): Promise<TResult>;
|
|
11
17
|
removeInstance(actorTypeName: string, actorId: string): Promise<boolean>;
|
|
12
18
|
}
|
|
@@ -5,6 +5,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
8
11
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9
12
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
10
13
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -22,7 +25,11 @@ exports.ActorRuntimeService = void 0;
|
|
|
22
25
|
const dapr_1 = require("@dapr/dapr");
|
|
23
26
|
const ActorRuntime_1 = __importDefault(require("@dapr/dapr/actors/runtime/ActorRuntime"));
|
|
24
27
|
const common_1 = require("@nestjs/common");
|
|
28
|
+
const dapr_actor_client_service_1 = require("./dapr-actor-client.service");
|
|
25
29
|
let ActorRuntimeService = class ActorRuntimeService {
|
|
30
|
+
constructor(actorClient) {
|
|
31
|
+
this.actorClient = actorClient;
|
|
32
|
+
}
|
|
26
33
|
getRuntime() {
|
|
27
34
|
return ActorRuntime_1.default['instance'];
|
|
28
35
|
}
|
|
@@ -47,11 +54,23 @@ let ActorRuntimeService = class ActorRuntimeService {
|
|
|
47
54
|
const manager = this.getActorManager(actorTypeName);
|
|
48
55
|
return manager.actors;
|
|
49
56
|
}
|
|
50
|
-
getActor(
|
|
57
|
+
getActor(actorType, actorId) {
|
|
58
|
+
var _a;
|
|
59
|
+
const typeName = (_a = actorType.name) !== null && _a !== void 0 ? _a : actorType.constructor.name;
|
|
60
|
+
const actorTypeName = this.actorClient.getActorTypeName(typeName);
|
|
61
|
+
return this.getActorByTypeName(actorTypeName, actorId);
|
|
62
|
+
}
|
|
63
|
+
getActorByTypeName(actorTypeName, actorId) {
|
|
51
64
|
const manager = this.getActorManager(actorTypeName);
|
|
52
65
|
return manager.actors.get(actorId);
|
|
53
66
|
}
|
|
54
|
-
hasActor(
|
|
67
|
+
hasActor(actorType, actorId) {
|
|
68
|
+
var _a;
|
|
69
|
+
const typeName = (_a = actorType.name) !== null && _a !== void 0 ? _a : actorType.constructor.name;
|
|
70
|
+
const actorTypeName = this.actorClient.getActorTypeName(typeName);
|
|
71
|
+
return this.hasActorByTypeName(actorTypeName, actorId);
|
|
72
|
+
}
|
|
73
|
+
hasActorByTypeName(actorTypeName, actorId) {
|
|
55
74
|
const manager = this.getActorManager(actorTypeName);
|
|
56
75
|
return manager.actors.has(actorId);
|
|
57
76
|
}
|
|
@@ -70,6 +89,7 @@ let ActorRuntimeService = class ActorRuntimeService {
|
|
|
70
89
|
}
|
|
71
90
|
};
|
|
72
91
|
ActorRuntimeService = __decorate([
|
|
73
|
-
(0, common_1.Injectable)()
|
|
92
|
+
(0, common_1.Injectable)(),
|
|
93
|
+
__metadata("design:paramtypes", [dapr_actor_client_service_1.DaprActorClient])
|
|
74
94
|
], ActorRuntimeService);
|
|
75
95
|
exports.ActorRuntimeService = ActorRuntimeService;
|
package/package.json
CHANGED