@rayondigital/nest-dapr 0.9.64 → 0.9.65
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.
|
@@ -10,6 +10,7 @@ export declare abstract class AbstractActor {
|
|
|
10
10
|
private readonly actorClient;
|
|
11
11
|
private readonly daprStateProvider;
|
|
12
12
|
private readonly actorType;
|
|
13
|
+
private readonly stateName;
|
|
13
14
|
private readonly daprLogger;
|
|
14
15
|
constructor(daprClient: DaprClient, id: ActorId);
|
|
15
16
|
registerActorReminder<_Type>(reminderName: string, dueTime: Temporal.Duration, period?: Temporal.Duration, ttl?: Temporal.Duration, state?: any): Promise<void>;
|
|
@@ -19,13 +19,14 @@ const polyfill_1 = require("@js-temporal/polyfill");
|
|
|
19
19
|
const client_cache_1 = require("./client-cache");
|
|
20
20
|
class AbstractActor {
|
|
21
21
|
constructor(daprClient, id) {
|
|
22
|
+
this.actorType = this.constructor.name;
|
|
23
|
+
this.stateName = this.constructor.name;
|
|
22
24
|
this.daprClient = daprClient;
|
|
23
25
|
this.actorClient = client_cache_1.DaprClientCache.getOrCreateActorClientFromOptions(daprClient.options);
|
|
24
26
|
this.daprLogger = new Logger_1.Logger('Actors', 'AbstractActor', daprClient.options.logger);
|
|
25
27
|
this.id = id;
|
|
26
28
|
this.stateManager = new ActorStateManager_1.default(this);
|
|
27
29
|
this.daprStateProvider = client_cache_1.DaprClientCache.getOrCreateStateProviderFromOptions(daprClient.options);
|
|
28
|
-
this.actorType = this.constructor.name;
|
|
29
30
|
}
|
|
30
31
|
registerActorReminder(reminderName, dueTime, period, ttl, state) {
|
|
31
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -134,7 +135,8 @@ class AbstractActor {
|
|
|
134
135
|
return this.id;
|
|
135
136
|
}
|
|
136
137
|
getActorType() {
|
|
137
|
-
|
|
138
|
+
var _a;
|
|
139
|
+
return (_a = this.stateName) !== null && _a !== void 0 ? _a : this.actorType;
|
|
138
140
|
}
|
|
139
141
|
getId() {
|
|
140
142
|
return this.getActorId().getId();
|
|
@@ -2,5 +2,7 @@ import { Type } from '@nestjs/common';
|
|
|
2
2
|
export interface DaprActorMetadata {
|
|
3
3
|
interfaceType: Type<any> | Function;
|
|
4
4
|
name?: string;
|
|
5
|
+
stateName?: string;
|
|
5
6
|
}
|
|
6
7
|
export declare function DaprActor(options: DaprActorMetadata): ClassDecorator;
|
|
8
|
+
export declare function getActorMetadata(target: Type<any>): DaprActorMetadata;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DaprActor = void 0;
|
|
3
|
+
exports.getActorMetadata = exports.DaprActor = void 0;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
5
|
const constants_1 = require("./constants");
|
|
6
6
|
function DaprActor(options) {
|
|
@@ -8,9 +8,14 @@ function DaprActor(options) {
|
|
|
8
8
|
var _a;
|
|
9
9
|
(0, common_1.SetMetadata)(constants_1.DAPR_ACTOR_METADATA, {
|
|
10
10
|
name: (_a = options.name) !== null && _a !== void 0 ? _a : target.constructor.name,
|
|
11
|
+
stateName: options.stateName,
|
|
11
12
|
interfaceType: options.interfaceType,
|
|
12
13
|
})(target);
|
|
13
14
|
(0, common_1.Injectable)({ scope: common_1.Scope.TRANSIENT })(target);
|
|
14
15
|
};
|
|
15
16
|
}
|
|
16
17
|
exports.DaprActor = DaprActor;
|
|
18
|
+
function getActorMetadata(target) {
|
|
19
|
+
return Reflect.getMetadata(constants_1.DAPR_ACTOR_METADATA, target);
|
|
20
|
+
}
|
|
21
|
+
exports.getActorMetadata = getActorMetadata;
|
package/package.json
CHANGED