@rayondigital/nest-dapr 0.9.39 → 0.9.40

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.
@@ -85,7 +85,7 @@ let DaprPubSubClient = DaprPubSubClient_1 = class DaprPubSubClient {
85
85
  }));
86
86
  }
87
87
  publishBulkDirectly(messages) {
88
- var _a;
88
+ var _a, _b;
89
89
  return __awaiter(this, void 0, void 0, function* () {
90
90
  if (messages.length === 1) {
91
91
  const message = messages[0];
@@ -111,6 +111,7 @@ let DaprPubSubClient = DaprPubSubClient_1 = class DaprPubSubClient {
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
113
  if (response.failedMessages) {
114
+ const error = (_b = response.failedMessages[0].error) !== null && _b !== void 0 ? _b : new Error('Unable to publish message');
114
115
  const failedMessages = response.failedMessages.map((m, i) => {
115
116
  var _a;
116
117
  const messageId = this.getMessageId(m.message.event, m.message.entryID);
@@ -123,7 +124,7 @@ let DaprPubSubClient = DaprPubSubClient_1 = class DaprPubSubClient {
123
124
  contentType: (_a = m.message.contentType) !== null && _a !== void 0 ? _a : contentType,
124
125
  };
125
126
  });
126
- yield this.handleError(failedMessages, response.failedMessages[0].error);
127
+ yield this.handleError(failedMessages, error);
127
128
  }
128
129
  }
129
130
  catch (error) {
@@ -152,7 +153,7 @@ let DaprPubSubClient = DaprPubSubClient_1 = class DaprPubSubClient {
152
153
  setTimeout(() => __awaiter(this, void 0, void 0, function* () {
153
154
  try {
154
155
  const response = yield this.daprClient.pubsub.publish(name, topic, payload, options);
155
- if (response.error) {
156
+ if (response === null || response === void 0 ? void 0 : response.error) {
156
157
  throw response.error;
157
158
  }
158
159
  }
@@ -163,7 +164,7 @@ let DaprPubSubClient = DaprPubSubClient_1 = class DaprPubSubClient {
163
164
  return;
164
165
  }
165
166
  const response = yield this.daprClient.pubsub.publish(name, topic, payload, options);
166
- if (response.error) {
167
+ if (response === null || response === void 0 ? void 0 : response.error) {
167
168
  throw response.error;
168
169
  }
169
170
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rayondigital/nest-dapr",
3
- "version": "0.9.39",
3
+ "version": "0.9.40",
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",