sim-node-lib 0.0.11 → 0.0.14
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 +10 -7
- package/dist/google-pub-sub.js +13 -13
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/dist/google-pub-sub.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare class PubSubModel {
|
|
|
4
4
|
readonly value: object;
|
|
5
5
|
readonly action: string;
|
|
6
6
|
readonly table: string;
|
|
7
|
-
constructor(value: object, action: PubSubActionEnum, table:
|
|
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
|
-
protected handlerAction(
|
|
23
|
-
protected insert():
|
|
24
|
-
protected update():
|
|
25
|
-
protected remove():
|
|
21
|
+
protected _pubsubValueModel: PubSubModel;
|
|
22
|
+
protected handlerAction(): boolean;
|
|
23
|
+
protected insert(): boolean;
|
|
24
|
+
protected update(): boolean;
|
|
25
|
+
protected remove(): boolean;
|
|
26
26
|
protected buildData(): Object;
|
|
27
27
|
}
|
|
28
28
|
export declare enum PubSubActionEnum {
|
|
@@ -30,3 +30,6 @@ export declare enum PubSubActionEnum {
|
|
|
30
30
|
update = "update",
|
|
31
31
|
remove = "remove"
|
|
32
32
|
}
|
|
33
|
+
export declare enum PubSubTableEnum {
|
|
34
|
+
documentoDigital = "documentoDigital"
|
|
35
|
+
}
|
package/dist/google-pub-sub.js
CHANGED
|
@@ -14,7 +14,7 @@ class PubSubModel {
|
|
|
14
14
|
constructor(value, action, table) {
|
|
15
15
|
this.value = value;
|
|
16
16
|
this.action = action.toString();
|
|
17
|
-
this.table = table;
|
|
17
|
+
this.table = table.toString();
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
exports.PubSubModel = PubSubModel;
|
|
@@ -33,6 +33,7 @@ class GooglePubSubSubscription {
|
|
|
33
33
|
catch (error) {
|
|
34
34
|
console.error(error);
|
|
35
35
|
eventEmitter.emit('error', error);
|
|
36
|
+
message.ack();
|
|
36
37
|
}
|
|
37
38
|
});
|
|
38
39
|
// Receive callbacks for errors on the subscription
|
|
@@ -66,23 +67,18 @@ class GooglePubSubPublish {
|
|
|
66
67
|
exports.GooglePubSubPublish = GooglePubSubPublish;
|
|
67
68
|
class PubSubHandelerAction {
|
|
68
69
|
constructor(pubsubModel) {
|
|
69
|
-
this._pubsubValueModel = pubsubModel
|
|
70
|
-
this.handlerAction(pubsubModel.action);
|
|
70
|
+
this._pubsubValueModel = pubsubModel;
|
|
71
71
|
}
|
|
72
|
-
handlerAction(
|
|
73
|
-
switch (action) {
|
|
72
|
+
handlerAction() {
|
|
73
|
+
switch (this._pubsubValueModel.action) {
|
|
74
74
|
case 'insert':
|
|
75
|
-
this.insert();
|
|
76
|
-
break;
|
|
75
|
+
return this.insert();
|
|
77
76
|
case 'update':
|
|
78
|
-
this.update();
|
|
79
|
-
break;
|
|
77
|
+
return this.update();
|
|
80
78
|
case 'delete':
|
|
81
|
-
this.remove();
|
|
82
|
-
break;
|
|
79
|
+
return this.remove();
|
|
83
80
|
default:
|
|
84
|
-
|
|
85
|
-
//throw new Error('PubSub handler action not implemented.')
|
|
81
|
+
throw new Error('PubSub handler action not implemented.');
|
|
86
82
|
}
|
|
87
83
|
}
|
|
88
84
|
insert() {
|
|
@@ -105,3 +101,7 @@ var PubSubActionEnum;
|
|
|
105
101
|
PubSubActionEnum["update"] = "update";
|
|
106
102
|
PubSubActionEnum["remove"] = "remove";
|
|
107
103
|
})(PubSubActionEnum = exports.PubSubActionEnum || (exports.PubSubActionEnum = {}));
|
|
104
|
+
var PubSubTableEnum;
|
|
105
|
+
(function (PubSubTableEnum) {
|
|
106
|
+
PubSubTableEnum["documentoDigital"] = "documentoDigital";
|
|
107
|
+
})(PubSubTableEnum = exports.PubSubTableEnum || (exports.PubSubTableEnum = {}));
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { sayHello, sayGoodbye } from "./hello-world";
|
|
2
|
-
export { GooglePubSubSubscription, GooglePubSubPublish } from "./google-pub-sub";
|
|
2
|
+
export { GooglePubSubSubscription, GooglePubSubPublish, PubSubHandelerAction } from "./google-pub-sub";
|
package/dist/index.js
CHANGED
|
@@ -6,3 +6,4 @@ exports.sayGoodbye = hello_world_1.sayGoodbye;
|
|
|
6
6
|
var google_pub_sub_1 = require("./google-pub-sub");
|
|
7
7
|
exports.GooglePubSubSubscription = google_pub_sub_1.GooglePubSubSubscription;
|
|
8
8
|
exports.GooglePubSubPublish = google_pub_sub_1.GooglePubSubPublish;
|
|
9
|
+
exports.PubSubHandelerAction = google_pub_sub_1.PubSubHandelerAction;
|