@shushed/helpers 0.0.198-v2-20251107140212 → 0.0.198-v2-20251110084509
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.
|
@@ -550,6 +550,7 @@ class EnvEngine extends runtime_1.default {
|
|
|
550
550
|
error429Threshold: 0.30,
|
|
551
551
|
pauseOnErrorThresholdExceededSeconds: 60 * 10,
|
|
552
552
|
pauseOnError429ThresholdExceededSeconds: 60 * 10,
|
|
553
|
+
pauseBeforeProcessingMessagesSeconds: 0,
|
|
553
554
|
maxOutstandingMessages: 5,
|
|
554
555
|
ackDeadline: 10,
|
|
555
556
|
retryMinDelay: 60,
|
|
@@ -68,26 +68,19 @@ class PubSubHelper extends runtime_1.default {
|
|
|
68
68
|
};
|
|
69
69
|
return message;
|
|
70
70
|
}
|
|
71
|
-
async publish(options,
|
|
71
|
+
async publish(options, payloads) {
|
|
72
72
|
if (!pubSubPublishTopics[options.topicName]) {
|
|
73
73
|
pubSubPublishTopics[options.topicName] = this.pubSub.topic(options.topicName, {
|
|
74
74
|
batching: {
|
|
75
|
-
maxMessages:
|
|
76
|
-
maxMilliseconds:
|
|
75
|
+
maxMessages: 10,
|
|
76
|
+
maxMilliseconds: 15
|
|
77
77
|
},
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
const topic = pubSubPublishTopics[options.topicName];
|
|
81
|
-
|
|
82
|
-
if (!Array.isArray(payload)) {
|
|
83
|
-
normPayloads = [payload];
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
normPayloads = payload;
|
|
87
|
-
}
|
|
88
|
-
const batches = normPayloads.length > 5 ? (0, lodash_chunk_1.default)(normPayloads, 10) : [normPayloads];
|
|
81
|
+
const batches = payloads.length > 5 ? (0, lodash_chunk_1.default)(payloads, 10) : [payloads];
|
|
89
82
|
const attributes = {
|
|
90
|
-
...
|
|
83
|
+
...options.extraAttributes,
|
|
91
84
|
source_system: options.sourceSystem,
|
|
92
85
|
target_system: options.targetSystem,
|
|
93
86
|
buildship_id: this.systemEnvName + '-' + this.workflowId + '-' + this.triggerId,
|
|
@@ -244,7 +237,9 @@ class PubSubHelper extends runtime_1.default {
|
|
|
244
237
|
const metadata = {
|
|
245
238
|
labels: {
|
|
246
239
|
'bs-envname': this.systemEnvName.toLowerCase(),
|
|
247
|
-
'env': this.envName.toLowerCase()
|
|
240
|
+
'env': this.envName.toLowerCase(),
|
|
241
|
+
'bs-is-deadletter': topicName.indexOf('.dlq') > -1 ? '1' : '0',
|
|
242
|
+
'respectful-nudge': '1'
|
|
248
243
|
}
|
|
249
244
|
};
|
|
250
245
|
if (topic && !process.env.PUBSUB_EMULATOR_HOST) {
|
|
@@ -339,9 +334,10 @@ class PubSubHelper extends runtime_1.default {
|
|
|
339
334
|
'env': this.envName.toLowerCase(),
|
|
340
335
|
'bs-workflowid': this.workflowId.toLowerCase(),
|
|
341
336
|
'bs-envname': this.systemEnvName.toLowerCase(),
|
|
342
|
-
'bs-is-deadletter': subscriptionName.indexOf('
|
|
337
|
+
'bs-is-deadletter': subscriptionName.indexOf('.dlq') > -1 ? '1' : '0',
|
|
343
338
|
'bs-bigquery-tableid': isSubscriptionBigQuery(opts) && opts.tableId ? opts.tableId.replace(/\./g, '-').toLowerCase() : '',
|
|
344
|
-
'bs-is-bigquery': isSubscriptionBigQuery(opts) && opts.tableId ? '
|
|
339
|
+
'bs-is-bigquery': isSubscriptionBigQuery(opts) && opts.tableId ? '1' : '0',
|
|
340
|
+
'respectful-nudge': '1'
|
|
345
341
|
};
|
|
346
342
|
const simLabels = Object.assign({}, subscriptionMetaData?.labels || {}, proposedLabels);
|
|
347
343
|
if (!(0, lodash_isequal_1.default)(simLabels, subscriptionMetaData?.labels)) {
|
|
@@ -22,15 +22,7 @@ export type ReceivedMessage = Message & {
|
|
|
22
22
|
body: any;
|
|
23
23
|
bodyTxt: string;
|
|
24
24
|
};
|
|
25
|
-
type
|
|
26
|
-
type AtLeastOne<T, Keys extends keyof T = keyof T> = Partial<T> & {
|
|
27
|
-
[K in Keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, never>>;
|
|
28
|
-
}[Keys];
|
|
29
|
-
type MessageBody = {
|
|
30
|
-
[K in LastModifiedKeys]?: Date | string;
|
|
31
|
-
} & {
|
|
32
|
-
[key: string]: any;
|
|
33
|
-
};
|
|
25
|
+
type MessageBody = Record<string, any>;
|
|
34
26
|
type SubscriptionOptionsPull = {
|
|
35
27
|
topic: Topic;
|
|
36
28
|
exactlyOnceDelivery?: boolean;
|
|
@@ -66,12 +58,7 @@ declare class PubSubHelper extends Runtime {
|
|
|
66
58
|
topicName: string;
|
|
67
59
|
sourceSystem: string;
|
|
68
60
|
attributesGenerator?: (payload: any) => Record<string, string>;
|
|
69
|
-
},
|
|
70
|
-
publish(options: Partial<Message> & {
|
|
71
|
-
topicName: string;
|
|
72
|
-
sourceSystem: string;
|
|
73
|
-
attributesGenerator?: (payload: any) => Record<string, string>;
|
|
74
|
-
}, payload: AtLeastOne<MessageBody, LastModifiedKeys>): Promise<Array<string | null>>;
|
|
61
|
+
}, payloads: Array<MessageBody>): Promise<Array<string | null>>;
|
|
75
62
|
createOrUpdate(opts: {
|
|
76
63
|
topicName: string;
|
|
77
64
|
subscriptionName?: string;
|
|
@@ -241,6 +241,7 @@ export type RNConfiguration = {
|
|
|
241
241
|
error429Threshold: number;
|
|
242
242
|
pauseOnError429ThresholdExceededSeconds: number;
|
|
243
243
|
pauseOnErrorThresholdExceededSeconds: number;
|
|
244
|
+
pauseBeforeProcessingMessagesSeconds: number;
|
|
244
245
|
maxOutstandingMessages: number;
|
|
245
246
|
ackDeadline: number;
|
|
246
247
|
tableName: string;
|