@shushed/helpers 0.0.56 → 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 -10
- 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;
|
|
@@ -1037,7 +1038,6 @@ var PubSubHelper = class extends Runtime {
|
|
|
1037
1038
|
serviceAccountEmail: this.serviceAccountEmail,
|
|
1038
1039
|
useTableSchema: false
|
|
1039
1040
|
};
|
|
1040
|
-
nextMetadata.filter = `attributes:bigquery`;
|
|
1041
1041
|
} else {
|
|
1042
1042
|
nextMetadata = nextMetadata || {};
|
|
1043
1043
|
nextMetadata.bigqueryConfig = null;
|
|
@@ -1102,11 +1102,12 @@ var PubSubHelper = class extends Runtime {
|
|
|
1102
1102
|
async isRunning(topicName) {
|
|
1103
1103
|
const [topics] = await this.pubSub.getTopics();
|
|
1104
1104
|
const mainTopic = topics.find((x) => this.getNameFromFullyQualifiedName(x.name) === topicName);
|
|
1105
|
+
const infraPrefix = topicName.indexOf("---") !== -1 ? topicName : `${this.envName}---${topicName}`;
|
|
1105
1106
|
let mainTopicSubscriptions = null;
|
|
1106
1107
|
if (mainTopic) {
|
|
1107
1108
|
[mainTopicSubscriptions] = await mainTopic.getSubscriptions();
|
|
1108
1109
|
}
|
|
1109
|
-
const mainSubscriptionName = `${
|
|
1110
|
+
const mainSubscriptionName = `${infraPrefix}-${shortHash(this.triggerId)}`;
|
|
1110
1111
|
const mainSubscription = mainTopicSubscriptions?.find((x) => this.getNameFromFullyQualifiedName(x.name) === mainSubscriptionName) || null;
|
|
1111
1112
|
const [metadata] = await mainSubscription?.getMetadata() || [null];
|
|
1112
1113
|
return {
|
|
@@ -1117,11 +1118,12 @@ var PubSubHelper = class extends Runtime {
|
|
|
1117
1118
|
async pause(topicName) {
|
|
1118
1119
|
const [topics] = await this.pubSub.getTopics();
|
|
1119
1120
|
const mainTopic = topics.find((x) => this.getNameFromFullyQualifiedName(x.name) === topicName);
|
|
1121
|
+
const infraPrefix = topicName.indexOf("---") !== -1 ? topicName : `${this.envName}---${topicName}`;
|
|
1120
1122
|
let mainTopicSubscriptions = null;
|
|
1121
1123
|
if (mainTopic) {
|
|
1122
1124
|
[mainTopicSubscriptions] = await mainTopic.getSubscriptions();
|
|
1123
1125
|
}
|
|
1124
|
-
const mainSubscriptionName = `${
|
|
1126
|
+
const mainSubscriptionName = `${infraPrefix}-${shortHash(this.triggerId)}`;
|
|
1125
1127
|
const mainSubscription = mainTopicSubscriptions?.find((x) => this.getNameFromFullyQualifiedName(x.name) === mainSubscriptionName) || null;
|
|
1126
1128
|
if (mainSubscription) {
|
|
1127
1129
|
await mainSubscription.setMetadata({
|
|
@@ -1138,11 +1140,12 @@ var PubSubHelper = class extends Runtime {
|
|
|
1138
1140
|
async resume(topicName) {
|
|
1139
1141
|
const [topics] = await this.pubSub.getTopics();
|
|
1140
1142
|
const mainTopic = topics.find((x) => this.getNameFromFullyQualifiedName(x.name) === topicName);
|
|
1143
|
+
const infraPrefix = topicName.indexOf("---") !== -1 ? topicName : `${this.envName}---${topicName}`;
|
|
1141
1144
|
let mainTopicSubscriptions = null;
|
|
1142
1145
|
if (mainTopic) {
|
|
1143
1146
|
[mainTopicSubscriptions] = await mainTopic.getSubscriptions();
|
|
1144
1147
|
}
|
|
1145
|
-
const mainSubscriptionName = `${
|
|
1148
|
+
const mainSubscriptionName = `${infraPrefix}-${shortHash(this.triggerId)}`;
|
|
1146
1149
|
const mainSubscription = mainTopicSubscriptions?.find((x) => this.getNameFromFullyQualifiedName(x.name) === mainSubscriptionName) || null;
|
|
1147
1150
|
if (mainSubscription) {
|
|
1148
1151
|
await mainSubscription.setMetadata({
|