sim-node-lib 0.0.53 → 0.0.56
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.
|
@@ -4,7 +4,7 @@ exports.PubSubTableEnum = void 0;
|
|
|
4
4
|
var PubSubTableEnum;
|
|
5
5
|
(function (PubSubTableEnum) {
|
|
6
6
|
PubSubTableEnum["agrupador"] = "agrupador";
|
|
7
|
-
PubSubTableEnum["autosystem_plate"] = "
|
|
7
|
+
PubSubTableEnum["autosystem_plate"] = "autosystem-pessoa_frota";
|
|
8
8
|
PubSubTableEnum["bandeira"] = "bandeira";
|
|
9
9
|
PubSubTableEnum["cargo"] = "cargo";
|
|
10
10
|
PubSubTableEnum["cliente"] = "cliente";
|
|
@@ -7,4 +7,6 @@ export declare class AxiosService {
|
|
|
7
7
|
post(params?: object, data?: object): Promise<AxiosResponse<any, any>>;
|
|
8
8
|
put(params?: object, data?: object): Promise<AxiosResponse<any, any>>;
|
|
9
9
|
delete(params?: object, data?: object): Promise<AxiosResponse<any, any>>;
|
|
10
|
+
byPass(method: Method, params?: object, data?: object): Promise<AxiosResponse<any, any>>;
|
|
10
11
|
}
|
|
12
|
+
export declare type Method = 'get' | 'GET' | 'delete' | 'DELETE' | 'head' | 'HEAD' | 'options' | 'OPTIONS' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'purge' | 'PURGE' | 'link' | 'LINK' | 'unlink' | 'UNLINK';
|
|
@@ -95,5 +95,16 @@ class AxiosService {
|
|
|
95
95
|
});
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
|
+
byPass(method, params, data) {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
let content = {
|
|
101
|
+
method: method,
|
|
102
|
+
headers: headers,
|
|
103
|
+
params: params ? params : undefined,
|
|
104
|
+
data: data ? data : undefined,
|
|
105
|
+
};
|
|
106
|
+
return yield (0, axios_1.default)(this.url, content);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
98
109
|
}
|
|
99
110
|
exports.AxiosService = AxiosService;
|
package/dist/google-pub-sub.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { EventEmitter } from 'events';
|
|
3
3
|
export declare class PubSubModel {
|
|
4
|
-
readonly value:
|
|
5
|
-
readonly action:
|
|
6
|
-
readonly table:
|
|
7
|
-
constructor(value: object, action: PubSubActionEnum, table:
|
|
4
|
+
readonly value: any;
|
|
5
|
+
readonly action: PubSubActionEnum;
|
|
6
|
+
readonly table: PubSubTableEnum;
|
|
7
|
+
constructor(value: object, action: PubSubActionEnum, table: PubSubTableEnum);
|
|
8
8
|
}
|
|
9
9
|
export declare class GooglePubSubSubscription {
|
|
10
10
|
constructor(subscriptionName: string);
|
|
@@ -14,15 +14,15 @@ export declare class GooglePubSubSubscription {
|
|
|
14
14
|
export declare class GooglePubSubPublish {
|
|
15
15
|
constructor(topicName: string);
|
|
16
16
|
private _topicName;
|
|
17
|
-
createMessages(message: object, action: PubSubActionEnum, table:
|
|
17
|
+
createMessages(message: object, action: PubSubActionEnum, table: PubSubTableEnum): Promise<void>;
|
|
18
18
|
}
|
|
19
19
|
export declare abstract class PubSubHandelerAction {
|
|
20
20
|
constructor(pubsubModel: PubSubModel);
|
|
21
|
-
protected _pubsubValueModel:
|
|
22
|
-
|
|
23
|
-
protected insert():
|
|
24
|
-
protected update():
|
|
25
|
-
protected remove():
|
|
21
|
+
protected _pubsubValueModel: PubSubModel;
|
|
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 {
|
|
@@ -30,3 +30,30 @@ export declare enum PubSubActionEnum {
|
|
|
30
30
|
update = "update",
|
|
31
31
|
remove = "remove"
|
|
32
32
|
}
|
|
33
|
+
export declare enum PubSubTableEnum {
|
|
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
|
|
59
|
+
}
|
package/dist/google-pub-sub.js
CHANGED
|
@@ -13,7 +13,7 @@ const pubsub_1 = require("@google-cloud/pubsub");
|
|
|
13
13
|
class PubSubModel {
|
|
14
14
|
constructor(value, action, table) {
|
|
15
15
|
this.value = value;
|
|
16
|
-
this.action = action
|
|
16
|
+
this.action = action;
|
|
17
17
|
this.table = table;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -25,20 +25,13 @@ 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, message]);
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
console.error(error);
|
|
35
|
-
throw Error(error);
|
|
36
|
-
}
|
|
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]);
|
|
37
31
|
});
|
|
38
|
-
// Receive callbacks for errors on the subscription
|
|
39
32
|
this._subscription.on('error', (error) => {
|
|
40
33
|
console.error('Received error:', error);
|
|
41
|
-
|
|
34
|
+
eventEmitter.emit('error', error);
|
|
42
35
|
});
|
|
43
36
|
});
|
|
44
37
|
}
|
|
@@ -52,13 +45,9 @@ class GooglePubSubPublish {
|
|
|
52
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
46
|
const pubSubClient = new pubsub_1.PubSub();
|
|
54
47
|
const send = new PubSubModel(message, action, table);
|
|
55
|
-
// Creates a new topic
|
|
56
48
|
const topic = pubSubClient.topic(this._topicName);
|
|
57
|
-
console.log(`Topic ${topic.name} created.`);
|
|
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
|
}
|
|
@@ -66,24 +55,21 @@ class GooglePubSubPublish {
|
|
|
66
55
|
exports.GooglePubSubPublish = GooglePubSubPublish;
|
|
67
56
|
class PubSubHandelerAction {
|
|
68
57
|
constructor(pubsubModel) {
|
|
69
|
-
this._pubsubValueModel = pubsubModel
|
|
70
|
-
this.handlerAction(pubsubModel.action);
|
|
58
|
+
this._pubsubValueModel = pubsubModel;
|
|
71
59
|
}
|
|
72
|
-
handlerAction(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
//throw new Error('PubSub handler action not implemented.')
|
|
86
|
-
}
|
|
60
|
+
handlerAction() {
|
|
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
|
+
});
|
|
87
73
|
}
|
|
88
74
|
insert() {
|
|
89
75
|
throw new Error('Method insert PubSub handler action not implemented.');
|
|
@@ -105,3 +91,31 @@ var PubSubActionEnum;
|
|
|
105
91
|
PubSubActionEnum["update"] = "update";
|
|
106
92
|
PubSubActionEnum["remove"] = "remove";
|
|
107
93
|
})(PubSubActionEnum = exports.PubSubActionEnum || (exports.PubSubActionEnum = {}));
|
|
94
|
+
var PubSubTableEnum;
|
|
95
|
+
(function (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";
|
|
121
|
+
})(PubSubTableEnum = exports.PubSubTableEnum || (exports.PubSubTableEnum = {}));
|