sim-node-lib 0.4.104 → 0.4.106

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.
@@ -2,7 +2,7 @@ import { PubSubActionEnum } from '../Enums/PubSubActionEnum';
2
2
  import { PubSubApiEnum } from '../Enums/PubSubApiEnum';
3
3
  import { PubSubTableEnum } from '../Enums/PubSubTableEnum';
4
4
  export declare class GooglePubSubPublish {
5
+ private topicName;
5
6
  constructor(topicName: string);
6
- private _topicName;
7
- createMessages(message: object, action: PubSubActionEnum, table: PubSubTableEnum, api?: PubSubApiEnum): Promise<void>;
7
+ createMessages(message: object, action: PubSubActionEnum, table: PubSubTableEnum, api?: PubSubApiEnum, ignorarOrganizacoes?: string[]): Promise<void>;
8
8
  }
@@ -14,15 +14,19 @@ const pubsub_1 = require("@google-cloud/pubsub");
14
14
  const PubSubModel_1 = require("../Models/PubSubModel");
15
15
  class GooglePubSubPublish {
16
16
  constructor(topicName) {
17
- this._topicName = topicName;
17
+ this.topicName = topicName;
18
18
  }
19
- createMessages(message, action, table, api) {
19
+ createMessages(message, action, table, api, ignorarOrganizacoes = []) {
20
20
  return __awaiter(this, void 0, void 0, function* () {
21
+ const uuidOrg = message === null || message === void 0 ? void 0 : message.uuidOrganizacao;
22
+ if (uuidOrg && ignorarOrganizacoes.includes(uuidOrg)) {
23
+ console.info(`[PubSub] Ignorando evento para organização: ${uuidOrg} no tópico ${this.topicName}`);
24
+ return;
25
+ }
21
26
  const pubSubClient = new pubsub_1.PubSub();
22
27
  const send = new PubSubModel_1.PubSubModel(message, action, table, api);
23
- const topic = pubSubClient.topic(this._topicName);
24
- const dataSend = JSON.stringify(send);
25
- const data = Buffer.from(dataSend);
28
+ const topic = pubSubClient.topic(this.topicName);
29
+ const data = Buffer.from(JSON.stringify(send));
26
30
  yield topic.publishMessage({ data });
27
31
  });
28
32
  }
@@ -12,5 +12,6 @@ export declare enum PubSubApiEnum {
12
12
  venda = "venda",
13
13
  automateHub = "automate_hub",
14
14
  orquestrador = "orquestrador",
15
- paddock = "paddock"
15
+ paddock = "paddock",
16
+ simlog = "simlog"
16
17
  }
@@ -17,4 +17,5 @@ var PubSubApiEnum;
17
17
  PubSubApiEnum["automateHub"] = "automate_hub";
18
18
  PubSubApiEnum["orquestrador"] = "orquestrador";
19
19
  PubSubApiEnum["paddock"] = "paddock";
20
+ PubSubApiEnum["simlog"] = "simlog";
20
21
  })(PubSubApiEnum = exports.PubSubApiEnum || (exports.PubSubApiEnum = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sim-node-lib",
3
- "version": "0.4.104",
3
+ "version": "0.4.106",
4
4
  "description": "Library from SIMLabs",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",