@rayondigital/nest-dapr 0.9.14 → 0.9.16

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.
@@ -49,6 +49,21 @@ let NestActorManager = NestActorManager_1 = class NestActorManager {
49
49
  return instance;
50
50
  });
51
51
  };
52
+ const originalDeactivateActor = ActorManager_1.default.prototype.deactivateActor;
53
+ ActorManager_1.default.prototype.deactivateActor = function (actorId) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ try {
56
+ if (!this.actors.has(actorId.getId())) {
57
+ return;
58
+ }
59
+ yield originalDeactivateActor.bind(this)(actorId);
60
+ }
61
+ catch (error) {
62
+ common_1.Logger.error(`Error deactivating actor ${actorId}`);
63
+ common_1.Logger.error(error);
64
+ }
65
+ });
66
+ };
52
67
  }
53
68
  setupReentrancy() {
54
69
  ActorClientHTTP_1.default.prototype.invoke = function (actorType, actorId, methodName, body, reentrancyId) {
@@ -13,5 +13,5 @@ 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 createStatePropertyInstance;
16
+ private createInstance;
17
17
  }
@@ -59,12 +59,18 @@ class StatefulActor extends dapr_1.AbstractActor {
59
59
  this[property.key] = property.defaultValue;
60
60
  }
61
61
  else {
62
- this[property.key] = this.createStatePropertyInstance(property);
62
+ this[property.key] = this.createInstance(property.type);
63
63
  }
64
64
  }
65
65
  else {
66
66
  if (property.serializable) {
67
- const instance = this.createStatePropertyInstance(property);
67
+ let instance;
68
+ if (typeof property.defaultValue === 'function') {
69
+ instance = property.defaultValue();
70
+ }
71
+ else {
72
+ instance = this.createInstance(property.type);
73
+ }
68
74
  this[property.key] = (_a = instance.fromJSON(rawValue)) !== null && _a !== void 0 ? _a : instance;
69
75
  }
70
76
  else {
@@ -104,18 +110,9 @@ class StatefulActor extends dapr_1.AbstractActor {
104
110
  }
105
111
  });
106
112
  }
107
- createStatePropertyInstance(property) {
113
+ createInstance(type) {
108
114
  try {
109
- if (property.defaultValue !== undefined) {
110
- if (property.defaultValue instanceof Function || typeof property.defaultValue === 'function') {
111
- return property.defaultValue();
112
- }
113
- return property.defaultValue;
114
- }
115
- if (property.type || property.serializable) {
116
- const type = property.type;
117
- return new type();
118
- }
115
+ return new type();
119
116
  }
120
117
  catch (e) {
121
118
  return undefined;
@@ -3,10 +3,10 @@ export interface StateProperty {
3
3
  key: string | symbol;
4
4
  name: string;
5
5
  type: Function | Type<any>;
6
- defaultValue?: (() => any) | Function | Type<any>;
6
+ defaultValue?: any;
7
7
  serializable?: boolean;
8
8
  }
9
9
  export declare function State(options?: {
10
- defaultValue?: (() => any) | Function | Type<any>;
10
+ defaultValue?: any;
11
11
  name?: string;
12
12
  }): PropertyDecorator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rayondigital/nest-dapr",
3
- "version": "0.9.14",
3
+ "version": "0.9.16",
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",