@shushed/helpers 0.0.73 → 0.0.74

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.d.ts CHANGED
@@ -28830,6 +28830,7 @@ declare class EnvEngine extends Runtime {
28830
28830
  type Message = {
28831
28831
  buildshipId: string;
28832
28832
  exportableToBigQuery: boolean;
28833
+ subscriptionName?: string;
28833
28834
  body: any;
28834
28835
  sourceSystem: string;
28835
28836
  targetSystem: string;
@@ -28863,6 +28864,7 @@ declare class PubSubHelper extends Runtime {
28863
28864
  topicName: string;
28864
28865
  sourceSystem: string;
28865
28866
  }, payload: AtLeastOne<MessageBody, LastModifiedKeys>, orgMessage?: Message): Promise<string[]>;
28867
+ getSubscriptionName(topicName: string): string;
28866
28868
  createOrUpdate(opts: {
28867
28869
  topicName: string;
28868
28870
  createDeadLetterQueues: boolean;
package/dist/index.js CHANGED
@@ -810,16 +810,17 @@ var PubSubHelper = class extends Runtime {
810
810
  throw new Error("Could not parse the message body. Original body: " + rawMessageText + " . Error: " + err.message);
811
811
  }
812
812
  const message = {
813
- sourceSystem: rawMessage.attributes?.source_system || "unknown",
814
- targetSystem: rawMessage.attributes?.target_system || "*",
815
- processStartedAt: parseDateOrDefault(rawMessage.attributes?.process_started_at),
813
+ sourceSystem: rawMessage.message?.attributes?.source_system || "unknown",
814
+ targetSystem: rawMessage.message?.attributes?.target_system || "*",
815
+ processStartedAt: parseDateOrDefault(rawMessage.message?.attributes?.process_started_at),
816
816
  recordModifiedAt: parseDateOrDefault(getEventTime(messageBody, rawMessage.attributes?.record_modified_at)),
817
- originalPublishTime: parseDateOrDefault(rawMessage.attributes?.original_publish_time, parseDateOrDefault(rawMessage.publish_time)),
817
+ originalPublishTime: parseDateOrDefault(rawMessage.message?.attributes?.original_publish_time, parseDateOrDefault(rawMessage.message?.publish_time)),
818
818
  buildshipId: rawMessage.attributes?.buildship_id || "unknown",
819
- publishTime: parseDateOrDefault(rawMessage.publish_time),
819
+ publishTime: parseDateOrDefault(rawMessage.message?.publish_time),
820
820
  body: messageBody,
821
- exportableToBigQuery: !!rawMessage.attributes?.bigquery,
822
- extraAttributes: (0, import_lodash2.default)(rawMessage.attributes || {}, ["source_system", "target_system", "process_started_at", "record_modified_at", "original_publish_time", "buildship_id", "publish_time", "bigquery"])
821
+ exportableToBigQuery: !!rawMessage.message?.attributes?.bigquery,
822
+ extraAttributes: (0, import_lodash2.default)(rawMessage.message?.attributes || {}, ["source_system", "target_system", "process_started_at", "record_modified_at", "original_publish_time", "buildship_id", "publish_time", "bigquery"]),
823
+ subscriptionName: rawMessage.subscription.split("/").pop()
823
824
  };
824
825
  return message;
825
826
  }
@@ -867,6 +868,10 @@ var PubSubHelper = class extends Runtime {
867
868
  throw err;
868
869
  });
869
870
  }
871
+ getSubscriptionName(topicName) {
872
+ const infraPrefix = topicName.indexOf("---") !== -1 ? topicName : `${this.envName}---${topicName}`;
873
+ return `${infraPrefix}-${shortHash(this.triggerId)}`;
874
+ }
870
875
  async createOrUpdate(opts) {
871
876
  this.logging.log("createOrUpdate called with", opts);
872
877
  const [topics] = await this.pubSub.getTopics();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shushed/helpers",
3
- "version": "0.0.73",
3
+ "version": "0.0.74",
4
4
  "author": "",
5
5
  "license": "UNLICENSED",
6
6
  "description": "",