@rayondigital/nest-dapr 0.9.5 → 0.9.7
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 +21 -10
- package/dist/dapr.module.d.ts +1 -0
- package/package.json +1 -1
package/dist/dapr.loader.js
CHANGED
|
@@ -49,9 +49,17 @@ let DaprLoader = DaprLoader_1 = class DaprLoader {
|
|
|
49
49
|
onApplicationBootstrap() {
|
|
50
50
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
51
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
if (this.options.disabled) {
|
|
53
|
+
this.logger.log('Dapr server is disabled');
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
52
56
|
(0, nest_actor_manager_1.patchActorManagerForNest)(this.moduleRef, this.options.actorOptions);
|
|
53
57
|
yield this.daprServer.actor.init();
|
|
54
58
|
this.loadDaprHandlers();
|
|
59
|
+
if (this.options.serverPort === '0') {
|
|
60
|
+
this.logger.log('Dapr server will not be started');
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
55
63
|
this.logger.log('Starting Dapr server');
|
|
56
64
|
yield this.daprServer.start();
|
|
57
65
|
this.logger.log('Dapr server started');
|
|
@@ -137,27 +145,30 @@ let DaprLoader = DaprLoader_1 = class DaprLoader {
|
|
|
137
145
|
});
|
|
138
146
|
}
|
|
139
147
|
registerActor(actorType) {
|
|
140
|
-
var _a, _b, _c, _d;
|
|
148
|
+
var _a, _b, _c, _d, _e;
|
|
141
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
142
150
|
if (!actorType)
|
|
143
151
|
return;
|
|
144
152
|
let actorTypeName = (_a = actorType.name) !== null && _a !== void 0 ? _a : actorType.constructor.name;
|
|
145
153
|
const daprActorMetadata = this.daprMetadataAccessor.getDaprActorMetadata(actorType);
|
|
146
154
|
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) {
|
|
155
|
+
if ((_e = this.options.actorOptions) === null || _e === void 0 ? void 0 : _e.typeNamePrefix) {
|
|
148
156
|
actorTypeName = this.options.actorOptions.typeNamePrefix + actorTypeName;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
157
|
+
try {
|
|
158
|
+
const actorManager = ActorRuntime_1.default.getInstanceByDaprClient(this.daprServer.client);
|
|
159
|
+
const managers = actorManager['actorManagers'];
|
|
160
|
+
if (!managers.has(actorTypeName)) {
|
|
161
|
+
managers.set(actorTypeName, new ActorManager_1.default(actorType, this.daprServer.client));
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
catch (err) {
|
|
165
|
+
yield this.daprServer.actor.registerActor(actorType);
|
|
156
166
|
}
|
|
157
167
|
}
|
|
158
|
-
|
|
168
|
+
else {
|
|
159
169
|
yield this.daprServer.actor.registerActor(actorType);
|
|
160
170
|
}
|
|
171
|
+
this.logger.log(`Registering Dapr Actor: ${actorTypeName} of type ${interfaceTypeName !== null && interfaceTypeName !== void 0 ? interfaceTypeName : 'unknown'}`);
|
|
161
172
|
this.daprActorClient.register(actorTypeName, actorType, this.daprServer.client);
|
|
162
173
|
if (daprActorMetadata.interfaceType) {
|
|
163
174
|
this.daprActorClient.registerInterface(actorType, daprActorMetadata.interfaceType, this.daprServer.client);
|
package/dist/dapr.module.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export interface DaprModuleOptions {
|
|
|
9
9
|
clientOptions?: DaprClientOptions;
|
|
10
10
|
onError?: (name: string, topicName: string, error: any) => DaprPubSubStatusEnum;
|
|
11
11
|
actorOptions?: DaprModuleActorOptions;
|
|
12
|
+
disabled?: boolean;
|
|
12
13
|
}
|
|
13
14
|
export interface DaprModuleActorOptions {
|
|
14
15
|
prefix?: string;
|