@optimiser/common 1.0.246 → 1.0.250
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/aws/awsservices.js
CHANGED
|
@@ -158,7 +158,7 @@ var AwsServices = /** @class */ (function () {
|
|
|
158
158
|
case 2:
|
|
159
159
|
err_1 = _a.sent();
|
|
160
160
|
console.error("Error While Creating Signed Url:", err_1);
|
|
161
|
-
|
|
161
|
+
return [3 /*break*/, 3];
|
|
162
162
|
case 3: return [2 /*return*/];
|
|
163
163
|
}
|
|
164
164
|
});
|
|
@@ -264,6 +264,11 @@ var AwsServices = /** @class */ (function () {
|
|
|
264
264
|
};
|
|
265
265
|
AwsServices.prototype.GeneratePreSignedUrlNotAccelerated = function (params) {
|
|
266
266
|
var region = params.region, bucket = params.bucket, path = params.path, _a = params.expires, expires = _a === void 0 ? 60 : _a, _b = params.acl, acl = _b === void 0 ? 'private' : _b, _c = params.contentType, contentType = _c === void 0 ? 'application/octet-stream' : _c, _d = params.accessKeyId, accessKeyId = _d === void 0 ? this.accessKeyId : _d, _e = params.secretAccessKey, secretAccessKey = _e === void 0 ? this.secretAccessKey : _e;
|
|
267
|
+
// added by Mohan ason 28-01-2022. To overwrite acl variable.
|
|
268
|
+
// acl variable will have public-read OR private value. default is private
|
|
269
|
+
if (params.accessType != '' && params.accessType != undefined && params.accessType != null) {
|
|
270
|
+
acl = params.accessType;
|
|
271
|
+
}
|
|
267
272
|
var S3 = new aws_sdk_1.default.S3({
|
|
268
273
|
accessKeyId: accessKeyId,
|
|
269
274
|
secretAccessKey: secretAccessKey,
|
|
@@ -59,6 +59,42 @@ exports.MemoryDBConnect = void 0;
|
|
|
59
59
|
//var net = require('net');
|
|
60
60
|
var net = __importStar(require("net"));
|
|
61
61
|
var crypto = __importStar(require("crypto"));
|
|
62
|
+
var MessageBuffer = /** @class */ (function () {
|
|
63
|
+
function MessageBuffer(delimiter) {
|
|
64
|
+
this.delimiter = delimiter;
|
|
65
|
+
this.buffer = "";
|
|
66
|
+
}
|
|
67
|
+
MessageBuffer.prototype.isFinished = function () {
|
|
68
|
+
if (this.buffer.length === 0 ||
|
|
69
|
+
this.buffer.indexOf(this.delimiter) === -1) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
return false;
|
|
73
|
+
};
|
|
74
|
+
MessageBuffer.prototype.push = function (data) {
|
|
75
|
+
this.buffer += data;
|
|
76
|
+
};
|
|
77
|
+
MessageBuffer.prototype.getMessage = function () {
|
|
78
|
+
var delimiterIndex = this.buffer.indexOf(this.delimiter);
|
|
79
|
+
if (delimiterIndex !== -1) {
|
|
80
|
+
var message = this.buffer.slice(0, delimiterIndex);
|
|
81
|
+
this.buffer = this.buffer.replace(message + this.delimiter, "");
|
|
82
|
+
return message;
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
};
|
|
86
|
+
MessageBuffer.prototype.handleData = function () {
|
|
87
|
+
/**
|
|
88
|
+
* Try to accumulate the buffer with messages
|
|
89
|
+
*
|
|
90
|
+
* If the server isnt sending delimiters for some reason
|
|
91
|
+
* then nothing will ever come back for these requests
|
|
92
|
+
*/
|
|
93
|
+
var message = this.getMessage();
|
|
94
|
+
return message;
|
|
95
|
+
};
|
|
96
|
+
return MessageBuffer;
|
|
97
|
+
}());
|
|
62
98
|
var MemoryDBConnect = /** @class */ (function () {
|
|
63
99
|
/**
|
|
64
100
|
* @param masterConfig Master Connectivity Object
|
|
@@ -71,6 +107,7 @@ var MemoryDBConnect = /** @class */ (function () {
|
|
|
71
107
|
this.host = "";
|
|
72
108
|
this.isConnected = false;
|
|
73
109
|
this.messages = {};
|
|
110
|
+
this.memBuffObj = new MessageBuffer("##message_response##");
|
|
74
111
|
this.portNo = portNumber;
|
|
75
112
|
this.host = hostName;
|
|
76
113
|
// this.Initialize().then(([error, result]) => {
|
|
@@ -97,12 +134,31 @@ var MemoryDBConnect = /** @class */ (function () {
|
|
|
97
134
|
}
|
|
98
135
|
});
|
|
99
136
|
_this.client.on('data', function (data) {
|
|
137
|
+
console.log("Data from MemServer", (data || "").toString());
|
|
100
138
|
//console.log("")
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
message
|
|
139
|
+
// let message = null;
|
|
140
|
+
try {
|
|
141
|
+
// data = JSON.parse(data);
|
|
142
|
+
// message = this.messages[data.id];
|
|
143
|
+
// if (message) {
|
|
144
|
+
// delete this.messages[data.id];
|
|
145
|
+
// message(data);
|
|
146
|
+
// }
|
|
147
|
+
_this.memBuffObj.push(data);
|
|
148
|
+
while (!_this.memBuffObj.isFinished()) {
|
|
149
|
+
var message = _this.memBuffObj.handleData();
|
|
150
|
+
// console.log(message);
|
|
151
|
+
// console.log(JSON.parse(message))
|
|
152
|
+
if (message) {
|
|
153
|
+
message = JSON.parse(message);
|
|
154
|
+
var messageCallbackFn = _this.messages[message.id];
|
|
155
|
+
delete _this.messages[message.id];
|
|
156
|
+
messageCallbackFn(message);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
console.log("Error in parsing MemServer data", error);
|
|
106
162
|
}
|
|
107
163
|
});
|
|
108
164
|
_this.client.on('close', function () {
|
|
@@ -150,9 +206,9 @@ var MemoryDBConnect = /** @class */ (function () {
|
|
|
150
206
|
resolve([new Error("REQUEST_TIMEDOUT"), undefined]);
|
|
151
207
|
message_1.status = "-1";
|
|
152
208
|
}
|
|
153
|
-
},
|
|
209
|
+
}, 60000);
|
|
154
210
|
if (_this.client && _this.isConnected) {
|
|
155
|
-
_this.client.write(JSON.stringify(message_1));
|
|
211
|
+
_this.client.write(JSON.stringify(message_1) + "##message##");
|
|
156
212
|
}
|
|
157
213
|
else {
|
|
158
214
|
//to avoid again resolve by set timeout
|