@rayondigital/nest-dapr 0.9.22 → 0.9.24
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.
|
@@ -58,7 +58,6 @@ class ActorProxyBuilder {
|
|
|
58
58
|
}
|
|
59
59
|
callInternalActorMethod(actorTypeClassName, actorId, methodName, args) {
|
|
60
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
console.log('calling internal actor method');
|
|
62
61
|
const actorManager = this.actorRuntimeService.getActorManager(actorTypeClassName);
|
|
63
62
|
const requestBody = JSON.stringify(args);
|
|
64
63
|
return yield actorManager.invoke(actorId, methodName, Buffer.from(requestBody));
|
|
@@ -6,7 +6,6 @@ export declare class NestActorManager {
|
|
|
6
6
|
setup(moduleRef: ModuleRef, options: DaprModuleActorOptions, onActivateFn?: (actorId: ActorId, instance: AbstractActor) => Promise<void>): void;
|
|
7
7
|
setupReentrancy(): void;
|
|
8
8
|
setupCSLWrapper(contextService: DaprContextService, invokeWrapperFn?: (actorId: ActorId, methodName: string, data: any, method: (actorId: ActorId, methodName: string, data: any) => Promise<any>) => Promise<any>): void;
|
|
9
|
-
private runInsideContextIfAvailable;
|
|
10
9
|
private resolveDependencies;
|
|
11
10
|
private static extractContext;
|
|
12
11
|
}
|
|
@@ -126,11 +126,6 @@ let NestActorManager = NestActorManager_1 = class NestActorManager {
|
|
|
126
126
|
});
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
|
-
runInsideContextIfAvailable() {
|
|
130
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
-
return;
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
129
|
resolveDependencies(moduleRef, instance) {
|
|
135
130
|
return __awaiter(this, void 0, void 0, function* () {
|
|
136
131
|
const type = instance.constructor;
|
|
@@ -13,5 +13,6 @@ export declare class StatefulActor extends AbstractActor {
|
|
|
13
13
|
getAllState(): Promise<void>;
|
|
14
14
|
setAllStateFromProperties(): Promise<void>;
|
|
15
15
|
getState<T>(stateName: string, defaultValue?: T): Promise<T | undefined>;
|
|
16
|
+
private createInstanceFromProperty;
|
|
16
17
|
private createInstance;
|
|
17
18
|
}
|
|
@@ -47,7 +47,6 @@ class StatefulActor extends abstract_actor_1.AbstractActor {
|
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
getAllState() {
|
|
50
|
-
var _a;
|
|
51
50
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
51
|
for (const property of this.stateProperties) {
|
|
53
52
|
const rawValue = yield this.getState(property.name);
|
|
@@ -63,15 +62,9 @@ class StatefulActor extends abstract_actor_1.AbstractActor {
|
|
|
63
62
|
}
|
|
64
63
|
}
|
|
65
64
|
else {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
instance = property.defaultValue();
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
instance = this.createInstance(property.type);
|
|
73
|
-
}
|
|
74
|
-
this[property.key] = (_a = instance.fromJSON(rawValue)) !== null && _a !== void 0 ? _a : instance;
|
|
65
|
+
const instance = this.createInstanceFromProperty(property, rawValue);
|
|
66
|
+
if (instance !== undefined) {
|
|
67
|
+
this[property.key] = instance;
|
|
75
68
|
}
|
|
76
69
|
else {
|
|
77
70
|
this[property.key] = rawValue;
|
|
@@ -110,6 +103,47 @@ class StatefulActor extends abstract_actor_1.AbstractActor {
|
|
|
110
103
|
}
|
|
111
104
|
});
|
|
112
105
|
}
|
|
106
|
+
createInstanceFromProperty(property, rawValue) {
|
|
107
|
+
var _a;
|
|
108
|
+
try {
|
|
109
|
+
if (property.serializable) {
|
|
110
|
+
let instance;
|
|
111
|
+
if (typeof property.defaultValue === 'function') {
|
|
112
|
+
instance = property.defaultValue();
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
instance = this.createInstance(property.type);
|
|
116
|
+
}
|
|
117
|
+
if (instance.fromJSON) {
|
|
118
|
+
this[property.key] = (_a = instance.fromJSON(rawValue)) !== null && _a !== void 0 ? _a : instance;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
this[property.key] = instance;
|
|
122
|
+
for (const key of Object.keys(rawValue)) {
|
|
123
|
+
instance[key] = rawValue[key];
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
let instance;
|
|
129
|
+
if (typeof property.defaultValue === 'function') {
|
|
130
|
+
instance = property.defaultValue();
|
|
131
|
+
}
|
|
132
|
+
else if (property.type) {
|
|
133
|
+
instance = this.createInstance(property.type);
|
|
134
|
+
}
|
|
135
|
+
if (instance !== undefined) {
|
|
136
|
+
for (const key of Object.keys(rawValue)) {
|
|
137
|
+
instance[key] = rawValue[key];
|
|
138
|
+
}
|
|
139
|
+
return instance;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
catch (e) {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
113
147
|
createInstance(type) {
|
|
114
148
|
try {
|
|
115
149
|
return new type();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rayondigital/nest-dapr",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.24",
|
|
4
4
|
"description": "Develop NestJs microservices using Dapr pubsub, actors and other bindings",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
"typescript": "^4.7.4"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@dapr/dapr": "^3.2.0"
|
|
48
|
+
"@dapr/dapr": "^3.2.0",
|
|
49
|
+
"async-lock": "^1.4.1"
|
|
49
50
|
},
|
|
50
51
|
"optionalDependencies": {
|
|
51
52
|
"nestjs-cls": "^3.6.0"
|