@clxmedia/emailhub-client 1.0.4 → 1.0.5

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/client.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { PubSub } from "@google-cloud/pubsub";
1
2
  export declare enum EmailHubPriorityLevel {
2
3
  NORMAL = "normal",
3
4
  BULK = "bulk"
@@ -38,7 +39,6 @@ export interface EmailHubConfig {
38
39
  server?: string;
39
40
  }
40
41
  export declare class EmailHubClient {
41
- private cloudPubSub;
42
42
  private sender;
43
43
  private server;
44
44
  constructor(cfg: EmailHubConfig);
@@ -46,5 +46,6 @@ export declare class EmailHubClient {
46
46
  sendEmail(msg: EmailHubMessage, options?: {
47
47
  priority?: EmailHubPriorityLevel;
48
48
  xMailGuid?: string;
49
+ cloudPubSub?: PubSub;
49
50
  }): Promise<string>;
50
51
  }
package/dist/client.js CHANGED
@@ -29,12 +29,12 @@ class EmailHubClient {
29
29
  }
30
30
  sendEmail(msg, options) {
31
31
  return __awaiter(this, void 0, void 0, function* () {
32
- this.cloudPubSub = null;
32
+ const cloudPubSub = options.cloudPubSub ? options.cloudPubSub : null;
33
33
  const xMailGuid = options && options.xMailGuid ? options.xMailGuid : uuid.v4();
34
34
  msg.CustomID = xMailGuid;
35
35
  const topic = options && options.priority && options.priority === EmailHubPriorityLevel.BULK ? 'send-new-email-bulk' : 'send-new-email';
36
- if (this.cloudPubSub !== null) {
37
- yield this.cloudPubSub.topic(`projects/xperience-prod/topics/${topic}`)
36
+ if (cloudPubSub !== null) {
37
+ yield cloudPubSub.topic(`projects/xperience-prod/topics/${topic}`)
38
38
  .publishMessage({
39
39
  json: { sender_guid: this.sender.guid, sender_secret: this.sender.secret, payload: EmailHubClient.compressMessage(msg) },
40
40
  attributes: { sender_guid: this.sender.guid }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clxmedia/emailhub-client",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "CLXperience EmailHub Client",
5
5
  "author": "Brandon Thompson <brandont@clxmedia.com>",
6
6
  "license": "MIT",