@rayondigital/nest-dapr 0.9.5 → 0.9.6
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/dist/dapr.loader.js +13 -10
- package/package.json +1 -1
package/dist/dapr.loader.js
CHANGED
|
@@ -137,27 +137,30 @@ let DaprLoader = DaprLoader_1 = class DaprLoader {
|
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
registerActor(actorType) {
|
|
140
|
-
var _a, _b, _c, _d;
|
|
140
|
+
var _a, _b, _c, _d, _e;
|
|
141
141
|
return __awaiter(this, void 0, void 0, function* () {
|
|
142
142
|
if (!actorType)
|
|
143
143
|
return;
|
|
144
144
|
let actorTypeName = (_a = actorType.name) !== null && _a !== void 0 ? _a : actorType.constructor.name;
|
|
145
145
|
const daprActorMetadata = this.daprMetadataAccessor.getDaprActorMetadata(actorType);
|
|
146
146
|
const interfaceTypeName = (_c = (_b = daprActorMetadata === null || daprActorMetadata === void 0 ? void 0 : daprActorMetadata.interfaceType) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : (_d = daprActorMetadata === null || daprActorMetadata === void 0 ? void 0 : daprActorMetadata.interfaceType) === null || _d === void 0 ? void 0 : _d.constructor.name;
|
|
147
|
-
if (this.options.actorOptions.typeNamePrefix) {
|
|
147
|
+
if ((_e = this.options.actorOptions) === null || _e === void 0 ? void 0 : _e.typeNamePrefix) {
|
|
148
148
|
actorTypeName = this.options.actorOptions.typeNamePrefix + actorTypeName;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
149
|
+
try {
|
|
150
|
+
const actorManager = ActorRuntime_1.default.getInstanceByDaprClient(this.daprServer.client);
|
|
151
|
+
const managers = actorManager['actorManagers'];
|
|
152
|
+
if (!managers.has(actorTypeName)) {
|
|
153
|
+
managers.set(actorTypeName, new ActorManager_1.default(actorType, this.daprServer.client));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
catch (err) {
|
|
157
|
+
yield this.daprServer.actor.registerActor(actorType);
|
|
156
158
|
}
|
|
157
159
|
}
|
|
158
|
-
|
|
160
|
+
else {
|
|
159
161
|
yield this.daprServer.actor.registerActor(actorType);
|
|
160
162
|
}
|
|
163
|
+
this.logger.log(`Registering Dapr Actor: ${actorTypeName} of type ${interfaceTypeName !== null && interfaceTypeName !== void 0 ? interfaceTypeName : 'unknown'}`);
|
|
161
164
|
this.daprActorClient.register(actorTypeName, actorType, this.daprServer.client);
|
|
162
165
|
if (daprActorMetadata.interfaceType) {
|
|
163
166
|
this.daprActorClient.registerInterface(actorType, daprActorMetadata.interfaceType, this.daprServer.client);
|