comprodls-sdk 2.116.0 → 2.120.0-security
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/comprodls-sdk.js
CHANGED
|
@@ -468,7 +468,8 @@ exports.INTEGRATIONS_API_URLS = {
|
|
|
468
468
|
auditTrail: '/accounts/{accountId}/audit-trail',
|
|
469
469
|
customEvents: '/accounts/{accountId}/custom-events',
|
|
470
470
|
schedules: '/accounts/{accountId}/context/{context}/schedule',
|
|
471
|
-
particularSchedule: '/accounts/{accountId}/context/{context}/schedule/{scheduleId}'
|
|
471
|
+
particularSchedule: '/accounts/{accountId}/context/{context}/schedule/{scheduleId}',
|
|
472
|
+
bridgeToRabbitMQ: '/events/bridge-to-rabbitmq'
|
|
472
473
|
};
|
|
473
474
|
|
|
474
475
|
exports.DRIVE_API_URLS = {
|
|
@@ -8399,7 +8400,8 @@ function integrations(accountId) {
|
|
|
8399
8400
|
createSchedule: createSchedule.bind(this),
|
|
8400
8401
|
getSchedule: getSchedule.bind(this),
|
|
8401
8402
|
updateSchedule: updateSchedule.bind(this),
|
|
8402
|
-
deleteSchedule: deleteSchedule.bind(this)
|
|
8403
|
+
deleteSchedule: deleteSchedule.bind(this),
|
|
8404
|
+
publishEventsToRabbitMQ: publishEventsToRabbitMQ.bind(this)
|
|
8403
8405
|
};
|
|
8404
8406
|
}
|
|
8405
8407
|
|
|
@@ -8825,6 +8827,50 @@ function deleteSchedule(options) {
|
|
|
8825
8827
|
|
|
8826
8828
|
return deferred.promise;
|
|
8827
8829
|
}
|
|
8830
|
+
|
|
8831
|
+
/**
|
|
8832
|
+
* Wiki Link for SDK params
|
|
8833
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/22_Integrations-Adapter#publisheventstorabbitmqparams
|
|
8834
|
+
*/
|
|
8835
|
+
function publishEventsToRabbitMQ(options) {
|
|
8836
|
+
var self = this;
|
|
8837
|
+
console.log('Publishing events to RabbitMQ with options in the publishEventsToRabbitMQ function:', JSON.stringify(options, null, 2));
|
|
8838
|
+
|
|
8839
|
+
return new Promise(function (resolve, reject) {
|
|
8840
|
+
if (options && options.route && options.route.exchange && options.route.routingKey &&
|
|
8841
|
+
options.data && options.data.context) {
|
|
8842
|
+
// Construct API url
|
|
8843
|
+
var url = self.config.DEFAULT_HOSTS.INTEGRATION +
|
|
8844
|
+
self.config.INTEGRATIONS_API_URLS.bridgeToRabbitMQ;
|
|
8845
|
+
|
|
8846
|
+
var body = {
|
|
8847
|
+
route: options.route,
|
|
8848
|
+
data: options.data
|
|
8849
|
+
};
|
|
8850
|
+
|
|
8851
|
+
// Setup request with URL and Params
|
|
8852
|
+
var requestAPI = request.post(url)
|
|
8853
|
+
.set('Content-Type', 'application/json')
|
|
8854
|
+
.set('Accept', 'application/json')
|
|
8855
|
+
.send(body);
|
|
8856
|
+
|
|
8857
|
+
if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
8858
|
+
|
|
8859
|
+
requestAPI.end(function (error, response) {
|
|
8860
|
+
if (error) {
|
|
8861
|
+
reject(new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error));
|
|
8862
|
+
} else {
|
|
8863
|
+
resolve(response.body);
|
|
8864
|
+
}
|
|
8865
|
+
});
|
|
8866
|
+
} else {
|
|
8867
|
+
var err = {};
|
|
8868
|
+
err.message = err.description = 'Mandatory params - route(exchange or routingKey) or ' +
|
|
8869
|
+
'data(context) not found in request options.';
|
|
8870
|
+
reject(new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err));
|
|
8871
|
+
}
|
|
8872
|
+
});
|
|
8873
|
+
}
|
|
8828
8874
|
|
|
8829
8875
|
},{"../../helpers":3,"../../helpers/lib/api/converter":4,"agentkeepalive":31,"q":36,"superagent":39}],17:[function(require,module,exports){
|
|
8830
8876
|
/*************************************************************************
|