@shushed/helpers 0.0.198-v2-20251110152641 → 0.0.198-v2-20251110171602
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.
|
@@ -90,14 +90,14 @@ class PubSubHelper extends runtime_1.default {
|
|
|
90
90
|
const batch = batches[i];
|
|
91
91
|
const results = await Promise.allSettled(batch.map((x) => topic.publishMessage({
|
|
92
92
|
data: Buffer.from(JSON.stringify(x)),
|
|
93
|
-
attributes: options.attributesGenerator ? Object.assign({}, attributes, options.attributesGenerator(x)) : attributes
|
|
93
|
+
attributes: Object.fromEntries(Object.entries(options.attributesGenerator ? Object.assign({}, attributes, options.attributesGenerator(x)) : attributes).filter(([_, v]) => v !== undefined && v !== null).map(([k, v]) => [k, `${v}`]))
|
|
94
94
|
})));
|
|
95
95
|
for (const result of results) {
|
|
96
96
|
if (result.status === 'fulfilled') {
|
|
97
97
|
messageIds.push(result.value);
|
|
98
98
|
}
|
|
99
99
|
else {
|
|
100
|
-
messageIds.push(result.reason);
|
|
100
|
+
messageIds.push(result.reason instanceof Error ? result.reason : new Error(result.reason));
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
if (i !== batches.length - 1) {
|
|
@@ -58,7 +58,7 @@ declare class PubSubHelper extends Runtime {
|
|
|
58
58
|
topicName: string;
|
|
59
59
|
sourceSystem: string;
|
|
60
60
|
attributesGenerator?: (payload: any) => Record<string, string>;
|
|
61
|
-
}, payloads: Array<MessageBody>): Promise<Array<string |
|
|
61
|
+
}, payloads: Array<MessageBody>): Promise<Array<string | Error>>;
|
|
62
62
|
createOrUpdate(opts: {
|
|
63
63
|
topicName: string;
|
|
64
64
|
subscriptionName?: string;
|