@shushed/helpers 0.0.57 → 0.0.58
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.
- package/dist/index.js +13 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -792,15 +792,16 @@ var PubSubHelper = class extends Runtime {
|
|
|
792
792
|
}
|
|
793
793
|
async createOrUpdate(opts) {
|
|
794
794
|
const [topics] = await this.pubSub.getTopics();
|
|
795
|
-
const
|
|
796
|
-
const
|
|
795
|
+
const infraPrefix = opts.topicName.indexOf("---") !== -1 ? opts.topicName : `${this.envName}---${opts.topicName}`;
|
|
796
|
+
const mainDlqTopicName = `${infraPrefix}-${shortHash(this.triggerId)}-dlq`;
|
|
797
|
+
const tableDlqTopicName = `${infraPrefix}-${shortHash(this.triggerId)}-bq-dlq`;
|
|
797
798
|
let mainTopic = topics.find((x) => this.getNameFromFullyQualifiedName(x.name) === opts.topicName);
|
|
798
799
|
let mainDlqTopic = topics.find((x) => this.getNameFromFullyQualifiedName(x.name) === mainDlqTopicName);
|
|
799
800
|
let tableDlqTopic = topics.find((x) => this.getNameFromFullyQualifiedName(x.name) === tableDlqTopicName);
|
|
800
|
-
const mainSubscriptionName = `${
|
|
801
|
-
const mainDlqSubscriptionName = `${
|
|
802
|
-
const tableSubscriptionName = `${
|
|
803
|
-
const tableDlqSubscriptionName = `${
|
|
801
|
+
const mainSubscriptionName = `${infraPrefix}-${shortHash(this.triggerId)}`;
|
|
802
|
+
const mainDlqSubscriptionName = `${infraPrefix}-${shortHash(this.triggerId)}-dlq`;
|
|
803
|
+
const tableSubscriptionName = `${infraPrefix}-${shortHash(this.triggerId)}-bq`;
|
|
804
|
+
const tableDlqSubscriptionName = `${infraPrefix}-${shortHash(this.triggerId)}-bq-dlq`;
|
|
804
805
|
let mainTopicSubscriptions = null;
|
|
805
806
|
let mainDlqTopicSubscriptions = null;
|
|
806
807
|
let tableDlqTopicSubscriptions = null;
|
|
@@ -1101,11 +1102,12 @@ var PubSubHelper = class extends Runtime {
|
|
|
1101
1102
|
async isRunning(topicName) {
|
|
1102
1103
|
const [topics] = await this.pubSub.getTopics();
|
|
1103
1104
|
const mainTopic = topics.find((x) => this.getNameFromFullyQualifiedName(x.name) === topicName);
|
|
1105
|
+
const infraPrefix = topicName.indexOf("---") !== -1 ? topicName : `${this.envName}---${topicName}`;
|
|
1104
1106
|
let mainTopicSubscriptions = null;
|
|
1105
1107
|
if (mainTopic) {
|
|
1106
1108
|
[mainTopicSubscriptions] = await mainTopic.getSubscriptions();
|
|
1107
1109
|
}
|
|
1108
|
-
const mainSubscriptionName = `${
|
|
1110
|
+
const mainSubscriptionName = `${infraPrefix}-${shortHash(this.triggerId)}`;
|
|
1109
1111
|
const mainSubscription = mainTopicSubscriptions?.find((x) => this.getNameFromFullyQualifiedName(x.name) === mainSubscriptionName) || null;
|
|
1110
1112
|
const [metadata] = await mainSubscription?.getMetadata() || [null];
|
|
1111
1113
|
return {
|
|
@@ -1116,11 +1118,12 @@ var PubSubHelper = class extends Runtime {
|
|
|
1116
1118
|
async pause(topicName) {
|
|
1117
1119
|
const [topics] = await this.pubSub.getTopics();
|
|
1118
1120
|
const mainTopic = topics.find((x) => this.getNameFromFullyQualifiedName(x.name) === topicName);
|
|
1121
|
+
const infraPrefix = topicName.indexOf("---") !== -1 ? topicName : `${this.envName}---${topicName}`;
|
|
1119
1122
|
let mainTopicSubscriptions = null;
|
|
1120
1123
|
if (mainTopic) {
|
|
1121
1124
|
[mainTopicSubscriptions] = await mainTopic.getSubscriptions();
|
|
1122
1125
|
}
|
|
1123
|
-
const mainSubscriptionName = `${
|
|
1126
|
+
const mainSubscriptionName = `${infraPrefix}-${shortHash(this.triggerId)}`;
|
|
1124
1127
|
const mainSubscription = mainTopicSubscriptions?.find((x) => this.getNameFromFullyQualifiedName(x.name) === mainSubscriptionName) || null;
|
|
1125
1128
|
if (mainSubscription) {
|
|
1126
1129
|
await mainSubscription.setMetadata({
|
|
@@ -1137,11 +1140,12 @@ var PubSubHelper = class extends Runtime {
|
|
|
1137
1140
|
async resume(topicName) {
|
|
1138
1141
|
const [topics] = await this.pubSub.getTopics();
|
|
1139
1142
|
const mainTopic = topics.find((x) => this.getNameFromFullyQualifiedName(x.name) === topicName);
|
|
1143
|
+
const infraPrefix = topicName.indexOf("---") !== -1 ? topicName : `${this.envName}---${topicName}`;
|
|
1140
1144
|
let mainTopicSubscriptions = null;
|
|
1141
1145
|
if (mainTopic) {
|
|
1142
1146
|
[mainTopicSubscriptions] = await mainTopic.getSubscriptions();
|
|
1143
1147
|
}
|
|
1144
|
-
const mainSubscriptionName = `${
|
|
1148
|
+
const mainSubscriptionName = `${infraPrefix}-${shortHash(this.triggerId)}`;
|
|
1145
1149
|
const mainSubscription = mainTopicSubscriptions?.find((x) => this.getNameFromFullyQualifiedName(x.name) === mainSubscriptionName) || null;
|
|
1146
1150
|
if (mainSubscription) {
|
|
1147
1151
|
await mainSubscription.setMetadata({
|