@rayondigital/nest-dapr 0.9.36 → 0.9.38

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.
@@ -108,7 +108,20 @@ let DaprPubSubClient = DaprPubSubClient_1 = class DaprPubSubClient {
108
108
  }
109
109
  try {
110
110
  const contentType = (_a = messages[0].contentType) !== null && _a !== void 0 ? _a : 'application/json';
111
- yield this.daprClient.pubsub.publishBulk(name, topic, messages.map((m) => m.payload), producerId ? { metadata: { partitionKey: producerId }, contentType } : undefined);
111
+ const response = yield this.daprClient.pubsub.publishBulk(name, topic, messages.map((m) => m.payload), producerId ? { metadata: { partitionKey: producerId }, contentType } : undefined);
112
+ if (response.failedMessages) {
113
+ const failedMessages = response.failedMessages.map((m, i) => {
114
+ var _a;
115
+ return {
116
+ name,
117
+ topic,
118
+ payload: m.message.event,
119
+ metadata: m.message.metadata,
120
+ contentType: (_a = m.message.contentType) !== null && _a !== void 0 ? _a : contentType,
121
+ };
122
+ });
123
+ yield this.handleError(failedMessages, response.failedMessages[0].error);
124
+ }
112
125
  }
113
126
  catch (error) {
114
127
  yield this.handleError(messages, error);
@@ -134,11 +147,22 @@ let DaprPubSubClient = DaprPubSubClient_1 = class DaprPubSubClient {
134
147
  }
135
148
  if (fireAndForget) {
136
149
  setTimeout(() => __awaiter(this, void 0, void 0, function* () {
137
- yield this.daprClient.pubsub.publish(name, topic, payload, options);
150
+ try {
151
+ const response = yield this.daprClient.pubsub.publish(name, topic, payload, options);
152
+ if (response.error) {
153
+ throw response.error;
154
+ }
155
+ }
156
+ catch (error) {
157
+ yield this.handleError([{ producerId, name, topic, payload, metadata }], error);
158
+ }
138
159
  }));
139
160
  return;
140
161
  }
141
- yield this.daprClient.pubsub.publish(name, topic, payload, options);
162
+ const response = yield this.daprClient.pubsub.publish(name, topic, payload, options);
163
+ if (response.error) {
164
+ throw response.error;
165
+ }
142
166
  }
143
167
  catch (error) {
144
168
  yield this.handleError([{ producerId, name, topic, payload, metadata }], error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rayondigital/nest-dapr",
3
- "version": "0.9.36",
3
+ "version": "0.9.38",
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",