sim-node-lib 0.0.18 → 0.0.21
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/google-pub-sub.d.ts +29 -5
- package/dist/google-pub-sub.js +40 -25
- package/package.json +1 -1
package/dist/google-pub-sub.d.ts
CHANGED
|
@@ -19,10 +19,10 @@ export declare class GooglePubSubPublish {
|
|
|
19
19
|
export declare abstract class PubSubHandelerAction {
|
|
20
20
|
constructor(pubsubModel: PubSubModel);
|
|
21
21
|
protected _pubsubValueModel: PubSubModel;
|
|
22
|
-
handlerAction(): boolean
|
|
23
|
-
protected insert(): boolean
|
|
24
|
-
protected update(): boolean
|
|
25
|
-
protected remove(): boolean
|
|
22
|
+
handlerAction(): Promise<boolean>;
|
|
23
|
+
protected insert(): Promise<boolean>;
|
|
24
|
+
protected update(): Promise<boolean>;
|
|
25
|
+
protected remove(): Promise<boolean>;
|
|
26
26
|
protected buildData(): Object;
|
|
27
27
|
}
|
|
28
28
|
export declare enum PubSubActionEnum {
|
|
@@ -31,5 +31,29 @@ export declare enum PubSubActionEnum {
|
|
|
31
31
|
remove = "remove"
|
|
32
32
|
}
|
|
33
33
|
export declare enum PubSubTableEnum {
|
|
34
|
-
|
|
34
|
+
bandeira = 0,
|
|
35
|
+
cliente = 1,
|
|
36
|
+
clienteEndereco = 2,
|
|
37
|
+
clientePendente = 3,
|
|
38
|
+
configuracao = 4,
|
|
39
|
+
empresa = 5,
|
|
40
|
+
empresaHorario = 6,
|
|
41
|
+
empresaServico = 7,
|
|
42
|
+
grupoDesconto = 8,
|
|
43
|
+
grupoDescontoLimite = 9,
|
|
44
|
+
grupoEmpresa = 10,
|
|
45
|
+
item = 11,
|
|
46
|
+
itemTag = 12,
|
|
47
|
+
promocao = 13,
|
|
48
|
+
promocaoEmpresa = 14,
|
|
49
|
+
promocaoGrupoDesconto = 15,
|
|
50
|
+
promocaoItem = 16,
|
|
51
|
+
promocaoRecorrencia = 17,
|
|
52
|
+
promocaoTag = 18,
|
|
53
|
+
servico = 19,
|
|
54
|
+
tag = 20,
|
|
55
|
+
voucherDesconto = 21,
|
|
56
|
+
voucherDescontoLote = 22,
|
|
57
|
+
voucherMigracao = 23,
|
|
58
|
+
voucherMigracaoLote = 24
|
|
35
59
|
}
|
package/dist/google-pub-sub.js
CHANGED
|
@@ -25,18 +25,10 @@ class GooglePubSubSubscription {
|
|
|
25
25
|
listenMessages(eventEmitter) {
|
|
26
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
27
|
this._subscription.on('message', (message) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
eventEmitter.emit('event', pubSubModel);
|
|
32
|
-
message.ack();
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
console.error(error);
|
|
36
|
-
eventEmitter.emit('error', error);
|
|
37
|
-
}
|
|
28
|
+
const data = JSON.parse(message.data.toString());
|
|
29
|
+
const pubSubModel = new PubSubModel(data.value, data.action, data.table);
|
|
30
|
+
eventEmitter.emit('event', [pubSubModel, message]);
|
|
38
31
|
});
|
|
39
|
-
// Receive callbacks for errors on the subscription
|
|
40
32
|
this._subscription.on('error', (error) => {
|
|
41
33
|
console.error('Received error:', error);
|
|
42
34
|
eventEmitter.emit('error', error);
|
|
@@ -53,12 +45,9 @@ class GooglePubSubPublish {
|
|
|
53
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
54
46
|
const pubSubClient = new pubsub_1.PubSub();
|
|
55
47
|
const send = new PubSubModel(message, action, table);
|
|
56
|
-
// Creates a new topic
|
|
57
48
|
const topic = pubSubClient.topic(this._topicName);
|
|
58
49
|
const dataSend = JSON.stringify(send);
|
|
59
|
-
//Create message
|
|
60
50
|
const data = Buffer.from(dataSend);
|
|
61
|
-
// Send a message to the topic
|
|
62
51
|
yield topic.publishMessage({ data });
|
|
63
52
|
});
|
|
64
53
|
}
|
|
@@ -69,16 +58,18 @@ class PubSubHandelerAction {
|
|
|
69
58
|
this._pubsubValueModel = pubsubModel;
|
|
70
59
|
}
|
|
71
60
|
handlerAction() {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
switch (this._pubsubValueModel.action) {
|
|
63
|
+
case 'insert':
|
|
64
|
+
return yield this.insert();
|
|
65
|
+
case 'update':
|
|
66
|
+
return yield this.update();
|
|
67
|
+
case 'remove':
|
|
68
|
+
return yield this.remove();
|
|
69
|
+
default:
|
|
70
|
+
throw new Error('PubSub handler action not implemented.');
|
|
71
|
+
}
|
|
72
|
+
});
|
|
82
73
|
}
|
|
83
74
|
insert() {
|
|
84
75
|
throw new Error('Method insert PubSub handler action not implemented.');
|
|
@@ -102,5 +93,29 @@ var PubSubActionEnum;
|
|
|
102
93
|
})(PubSubActionEnum = exports.PubSubActionEnum || (exports.PubSubActionEnum = {}));
|
|
103
94
|
var PubSubTableEnum;
|
|
104
95
|
(function (PubSubTableEnum) {
|
|
105
|
-
PubSubTableEnum["
|
|
96
|
+
PubSubTableEnum[PubSubTableEnum["bandeira"] = 0] = "bandeira";
|
|
97
|
+
PubSubTableEnum[PubSubTableEnum["cliente"] = 1] = "cliente";
|
|
98
|
+
PubSubTableEnum[PubSubTableEnum["clienteEndereco"] = 2] = "clienteEndereco";
|
|
99
|
+
PubSubTableEnum[PubSubTableEnum["clientePendente"] = 3] = "clientePendente";
|
|
100
|
+
PubSubTableEnum[PubSubTableEnum["configuracao"] = 4] = "configuracao";
|
|
101
|
+
PubSubTableEnum[PubSubTableEnum["empresa"] = 5] = "empresa";
|
|
102
|
+
PubSubTableEnum[PubSubTableEnum["empresaHorario"] = 6] = "empresaHorario";
|
|
103
|
+
PubSubTableEnum[PubSubTableEnum["empresaServico"] = 7] = "empresaServico";
|
|
104
|
+
PubSubTableEnum[PubSubTableEnum["grupoDesconto"] = 8] = "grupoDesconto";
|
|
105
|
+
PubSubTableEnum[PubSubTableEnum["grupoDescontoLimite"] = 9] = "grupoDescontoLimite";
|
|
106
|
+
PubSubTableEnum[PubSubTableEnum["grupoEmpresa"] = 10] = "grupoEmpresa";
|
|
107
|
+
PubSubTableEnum[PubSubTableEnum["item"] = 11] = "item";
|
|
108
|
+
PubSubTableEnum[PubSubTableEnum["itemTag"] = 12] = "itemTag";
|
|
109
|
+
PubSubTableEnum[PubSubTableEnum["promocao"] = 13] = "promocao";
|
|
110
|
+
PubSubTableEnum[PubSubTableEnum["promocaoEmpresa"] = 14] = "promocaoEmpresa";
|
|
111
|
+
PubSubTableEnum[PubSubTableEnum["promocaoGrupoDesconto"] = 15] = "promocaoGrupoDesconto";
|
|
112
|
+
PubSubTableEnum[PubSubTableEnum["promocaoItem"] = 16] = "promocaoItem";
|
|
113
|
+
PubSubTableEnum[PubSubTableEnum["promocaoRecorrencia"] = 17] = "promocaoRecorrencia";
|
|
114
|
+
PubSubTableEnum[PubSubTableEnum["promocaoTag"] = 18] = "promocaoTag";
|
|
115
|
+
PubSubTableEnum[PubSubTableEnum["servico"] = 19] = "servico";
|
|
116
|
+
PubSubTableEnum[PubSubTableEnum["tag"] = 20] = "tag";
|
|
117
|
+
PubSubTableEnum[PubSubTableEnum["voucherDesconto"] = 21] = "voucherDesconto";
|
|
118
|
+
PubSubTableEnum[PubSubTableEnum["voucherDescontoLote"] = 22] = "voucherDescontoLote";
|
|
119
|
+
PubSubTableEnum[PubSubTableEnum["voucherMigracao"] = 23] = "voucherMigracao";
|
|
120
|
+
PubSubTableEnum[PubSubTableEnum["voucherMigracaoLote"] = 24] = "voucherMigracaoLote";
|
|
106
121
|
})(PubSubTableEnum = exports.PubSubTableEnum || (exports.PubSubTableEnum = {}));
|