@shushed/helpers 0.0.64 → 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.
Files changed (2) hide show
  1. package/dist/index.js +3 -2
  2. 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 !== null;
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) {
@@ -1075,6 +1075,7 @@ var PubSubHelper = class extends Runtime {
1075
1075
  }));
1076
1076
  let nextMetadata = null;
1077
1077
  if (isSubscriptionOptionsPush(opts)) {
1078
+ this.logging.log("updateSubscription, subscription is push");
1078
1079
  if (opts.endpointUrl !== subscriptionMetaData?.pushConfig?.pushEndpoint || this.serviceAccountEmail !== subscriptionMetaData?.pushConfig.oidcToken?.serviceAccountEmail || process.env.GCLOUD_PROJECT + "/" + this.triggerId !== subscriptionMetaData.pushConfig.oidcToken.audience) {
1079
1080
  if (subscriptionMetaData?.pushConfig?.pushEndpoint && subscription) {
1080
1081
  this.logging.log("updateSubscription pushConfig changed, push configuration already exists, modifying", {
@@ -1096,7 +1097,7 @@ var PubSubHelper = class extends Runtime {
1096
1097
  this.logging.error("Invariant: While updating push subscription", err.message, err.stack);
1097
1098
  throw new Error("Invariant: While updating push subscription - " + err.message);
1098
1099
  }
1099
- } else {
1100
+ } else if (opts.endpointUrl) {
1100
1101
  nextMetadata = nextMetadata || {};
1101
1102
  nextMetadata.pushConfig = {
1102
1103
  pushEndpoint: opts.endpointUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shushed/helpers",
3
- "version": "0.0.64",
3
+ "version": "0.0.65",
4
4
  "author": "",
5
5
  "license": "UNLICENSED",
6
6
  "description": "",