@rayondigital/nest-dapr 0.9.41 → 0.9.43

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.
@@ -35,6 +35,9 @@ class ActorProxyBuilder {
35
35
  }
36
36
  }
37
37
  build(actorId, actorTypeName) {
38
+ if (!actorId) {
39
+ throw new Error('Actor id must be provided');
40
+ }
38
41
  const actorTypeClassName = actorTypeName !== null && actorTypeName !== void 0 ? actorTypeName : this.actorTypeClass.name;
39
42
  const handler = {
40
43
  get: (_target, propKey, _receiver) => {
@@ -65,6 +68,9 @@ class ActorProxyBuilder {
65
68
  }
66
69
  callExternalActorMethod(actorTypeClassName, actorId, methodName, args) {
67
70
  return __awaiter(this, void 0, void 0, function* () {
71
+ if (!actorId) {
72
+ throw new Error('Actor id must be provided');
73
+ }
68
74
  const originalBody = args.length > 0 ? args : null;
69
75
  const body = yield this.prepareBody(this.daprContextService, args, originalBody);
70
76
  const correlationId = this.daprContextService.getCorrelationId(true);
@@ -54,6 +54,9 @@ let DaprActorClient = class DaprActorClient {
54
54
  }
55
55
  getActorId(actorId) {
56
56
  var _a;
57
+ if (!actorId) {
58
+ throw new Error('Actor id must be provided');
59
+ }
57
60
  if (this.prefix) {
58
61
  return new dapr_1.ActorId(`${this.prefix}${(_a = this.delimiter) !== null && _a !== void 0 ? _a : '-'}${actorId}`);
59
62
  }
@@ -61,6 +64,9 @@ let DaprActorClient = class DaprActorClient {
61
64
  }
62
65
  getActor(actorType, actorId) {
63
66
  var _a;
67
+ if (!actorId) {
68
+ throw new Error('Actor id must be provided');
69
+ }
64
70
  const typeName = (_a = actorType.name) !== null && _a !== void 0 ? _a : actorType.constructor.name;
65
71
  const actorTypeName = this.getActorTypeName(typeName);
66
72
  if (!actorTypeName) {
@@ -74,6 +80,9 @@ let DaprActorClient = class DaprActorClient {
74
80
  return actorClient.build(fullActorId, actorTypeName);
75
81
  }
76
82
  getActorByTypeName(actorTypeName, actorId) {
83
+ if (!actorId) {
84
+ throw new Error('Actor id must be provided');
85
+ }
77
86
  if (this.interfaceToActorTypeNames.has(actorTypeName)) {
78
87
  actorTypeName = this.interfaceToActorTypeNames.get(actorTypeName);
79
88
  }
@@ -1,4 +1,5 @@
1
1
  export declare const DAPR_BINDING_METADATA = "DAPR_BINDING_METADATA";
2
2
  export declare const DAPR_PUBSUB_METADATA = "DAPR_PUBSUB_METADATA";
3
+ export declare const DAPR_ACTOR_PUBSUB_METADATA = "DAPR_PUBSUB_METADATA";
3
4
  export declare const DAPR_ACTOR_METADATA = "DAPR_ACTOR_METADATA";
4
5
  export declare const DAPR_ACTOR_STATE_METADATA = "DAPR_ACTOR_STATE_METADATA";
package/dist/constants.js CHANGED
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DAPR_ACTOR_STATE_METADATA = exports.DAPR_ACTOR_METADATA = exports.DAPR_PUBSUB_METADATA = exports.DAPR_BINDING_METADATA = void 0;
3
+ exports.DAPR_ACTOR_STATE_METADATA = exports.DAPR_ACTOR_METADATA = exports.DAPR_ACTOR_PUBSUB_METADATA = exports.DAPR_PUBSUB_METADATA = exports.DAPR_BINDING_METADATA = void 0;
4
4
  exports.DAPR_BINDING_METADATA = 'DAPR_BINDING_METADATA';
5
5
  exports.DAPR_PUBSUB_METADATA = 'DAPR_PUBSUB_METADATA';
6
+ exports.DAPR_ACTOR_PUBSUB_METADATA = 'DAPR_PUBSUB_METADATA';
6
7
  exports.DAPR_ACTOR_METADATA = 'DAPR_ACTOR_METADATA';
7
8
  exports.DAPR_ACTOR_STATE_METADATA = 'DAPR_ACTOR_STATE_METADATA';
@@ -110,7 +110,7 @@ let DaprPubSubClient = DaprPubSubClient_1 = class DaprPubSubClient {
110
110
  try {
111
111
  const contentType = (_a = messages[0].contentType) !== null && _a !== void 0 ? _a : 'application/json';
112
112
  const response = yield this.daprClient.pubsub.publishBulk(name, topic, messages.map((m) => m.payload), producerId ? { metadata: { partitionKey: producerId }, contentType } : undefined);
113
- if (response.failedMessages) {
113
+ if (response !== undefined && response.failedMessages && response.failedMessages.length > 0) {
114
114
  const error = (_c = (_b = response.failedMessages[0]) === null || _b === void 0 ? void 0 : _b.error) !== null && _c !== void 0 ? _c : new Error('Unable to publish message');
115
115
  const failedMessages = response.failedMessages.map((m, i) => {
116
116
  var _a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rayondigital/nest-dapr",
3
- "version": "0.9.41",
3
+ "version": "0.9.43",
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",