@shushed/helpers 0.0.63 → 0.0.65
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 +9 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -791,7 +791,7 @@ function isSubscriptionOptionsPull(opts) {
|
|
|
791
791
|
return "endpointUrl" in opts && opts.endpoinrtUrl === null;
|
|
792
792
|
}
|
|
793
793
|
function isSubscriptionOptionsPush(opts) {
|
|
794
|
-
return "endpointUrl" in opts && opts.endpoinrtUrl
|
|
794
|
+
return "endpointUrl" in opts && !!opts.endpoinrtUrl && opts.endpointUrl.startsWith("https://");
|
|
795
795
|
}
|
|
796
796
|
var PubSubHelper = class extends Runtime {
|
|
797
797
|
constructor(opts, pubSub) {
|
|
@@ -1067,11 +1067,15 @@ var PubSubHelper = class extends Runtime {
|
|
|
1067
1067
|
retryMaxDelay: 360,
|
|
1068
1068
|
ackDeadline: 90
|
|
1069
1069
|
};
|
|
1070
|
-
this.logging.log("updateSubscription called with", subscriptionName, subscription, subscriptionMetaData, inputOpts);
|
|
1070
|
+
this.logging.log("updateSubscription called with", subscriptionName, !!subscription, subscriptionMetaData, inputOpts);
|
|
1071
1071
|
const opts = Object.assign({}, defaultOptions, inputOpts);
|
|
1072
|
-
this.logging.log("updateSubscription final opts", opts
|
|
1072
|
+
this.logging.log("updateSubscription final opts", Object.assign({}, opts, {
|
|
1073
|
+
topic: opts.topic.name,
|
|
1074
|
+
dlqTopic: opts.dlqTopic?.name
|
|
1075
|
+
}));
|
|
1073
1076
|
let nextMetadata = null;
|
|
1074
1077
|
if (isSubscriptionOptionsPush(opts)) {
|
|
1078
|
+
this.logging.log("updateSubscription, subscription is push");
|
|
1075
1079
|
if (opts.endpointUrl !== subscriptionMetaData?.pushConfig?.pushEndpoint || this.serviceAccountEmail !== subscriptionMetaData?.pushConfig.oidcToken?.serviceAccountEmail || process.env.GCLOUD_PROJECT + "/" + this.triggerId !== subscriptionMetaData.pushConfig.oidcToken.audience) {
|
|
1076
1080
|
if (subscriptionMetaData?.pushConfig?.pushEndpoint && subscription) {
|
|
1077
1081
|
this.logging.log("updateSubscription pushConfig changed, push configuration already exists, modifying", {
|
|
@@ -1090,9 +1094,10 @@ var PubSubHelper = class extends Runtime {
|
|
|
1090
1094
|
}
|
|
1091
1095
|
});
|
|
1092
1096
|
} catch (err) {
|
|
1097
|
+
this.logging.error("Invariant: While updating push subscription", err.message, err.stack);
|
|
1093
1098
|
throw new Error("Invariant: While updating push subscription - " + err.message);
|
|
1094
1099
|
}
|
|
1095
|
-
} else {
|
|
1100
|
+
} else if (opts.endpointUrl) {
|
|
1096
1101
|
nextMetadata = nextMetadata || {};
|
|
1097
1102
|
nextMetadata.pushConfig = {
|
|
1098
1103
|
pushEndpoint: opts.endpointUrl,
|