comprodls-sdk 2.33.0 → 2.34.1

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.
@@ -314,6 +314,7 @@ exports.AUTH_API_URLS = {
314
314
  getExtProductAPI: '/accounts/{accountId}/products/{extProductId}',
315
315
  getSpaceDetails: '/accounts/{accountId}/spaces/{spacekey}',
316
316
  updateUserInformation: '/accounts/{accountId}/update-user-information',
317
+ updateUserSpace: '/accounts/{accountid}/ext-users/{extuserid}/spaces/{spacekey}',
317
318
  getInvitationsByEmail: '/accounts/{accountid}/invitations-by-email',
318
319
  generateSpaceCode: '/accounts/{accountid}/space-code/generate',
319
320
  changeSpaceCode: '/accounts/{accountid}/space-code/{spacecode}/change',
@@ -467,7 +468,7 @@ exports.INTEGRATIONS_API_URLS = {
467
468
  auditTrail: '/accounts/{accountId}/audit-trail',
468
469
  customEvents: '/accounts/{accountId}/custom-events',
469
470
  schedules: '/accounts/{accountId}/context/{context}/schedule',
470
- updateSchedule: '/accounts/{accountId}/context/{context}/schedule/{scheduleId}'
471
+ particularSchedule: '/accounts/{accountId}/context/{context}/schedule/{scheduleId}'
471
472
  };
472
473
 
473
474
  exports.DRIVE_API_URLS = {
@@ -4826,22 +4827,14 @@ function getAllClasses(options) {
4826
4827
  /**
4827
4828
  * Add class-tag association specific fields
4828
4829
  */
4829
- if (classEntity.tagid_1) {
4830
- classObj.tagid_1 = classEntity.tagid_1;
4831
- classObj.tagname_1 = classEntity.tagname_1;
4832
- classObj.taglookup_1 = classEntity.taglookup_1;
4833
- }
4834
-
4835
- if (classEntity.tagid_2) {
4836
- classObj.tagid_2 = classEntity.tagid_2;
4837
- classObj.tagname_2 = classEntity.tagname_2;
4838
- classObj.taglookup_2 = classEntity.taglookup_2;
4839
- }
4830
+ for (var tagNum = 1; tagNum <= 10; tagNum++) {
4831
+ var tagid = 'tagid_' + tagNum;
4840
4832
 
4841
- if (classEntity.tagid_3) {
4842
- classObj.tagid_3 = classEntity.tagid_3;
4843
- classObj.tagname_3 = classEntity.tagname_3;
4844
- classObj.taglookup_3 = classEntity.taglookup_3;
4833
+ if (classEntity[tagid]) {
4834
+ classObj[tagid] = classEntity[tagid];
4835
+ classObj['tagname_' + tagNum] = classEntity['tagname_' + tagNum];
4836
+ classObj['taglookup_' + tagNum] = classEntity['taglookup_' + tagNum];
4837
+ }
4845
4838
  }
4846
4839
 
4847
4840
  responseObject.entities.push(classObj);
@@ -7666,6 +7659,7 @@ function getAllDocumentsInAFolder(options) {
7666
7659
 
7667
7660
  var q = require('q');
7668
7661
  var request = require('superagent');
7662
+ var Agent = require('agentkeepalive');
7669
7663
 
7670
7664
  var helpers = require('../../helpers');
7671
7665
  var converter = require('../../helpers/lib/api/converter');
@@ -7677,6 +7671,11 @@ var DLSError = helpers.errors.DLSError;
7677
7671
  **********************************/
7678
7672
  module.exports = integrations;
7679
7673
 
7674
+ var keepaliveAgent = new Agent({
7675
+ timeout: 60000,
7676
+ freeSocketTimeout: 30000
7677
+ });
7678
+
7680
7679
  //Integrations Adaptor Constructor
7681
7680
  function integrations(accountId) {
7682
7681
  this.accountId = accountId;
@@ -7689,7 +7688,8 @@ function integrations(accountId) {
7689
7688
  publishCustomEvents: publishCustomEvents.bind(this),
7690
7689
  createSchedule: createSchedule.bind(this),
7691
7690
  getSchedule: getSchedule.bind(this),
7692
- updateSchedule: updateSchedule.bind(this)
7691
+ updateSchedule: updateSchedule.bind(this),
7692
+ deleteSchedule: deleteSchedule.bind(this)
7693
7693
  };
7694
7694
  }
7695
7695
 
@@ -8108,7 +8108,7 @@ function updateSchedule(options) {
8108
8108
  if (options && options.context && options.accountid && options.scheduleid && options.body &&
8109
8109
  (Object.keys(options.body).length > 0) && options.body.actorid && options.body.category) {
8110
8110
  // Construct API url
8111
- var url = self.config.DEFAULT_HOSTS.INTEGRATION + self.config.INTEGRATIONS_API_URLS.updateSchedule;
8111
+ var url = self.config.DEFAULT_HOSTS.INTEGRATION + self.config.INTEGRATIONS_API_URLS.particularSchedule;
8112
8112
  url = helpers.api.constructAPIUrl(url, { accountId: options.accountid, context: options.context, scheduleId: options.scheduleid });
8113
8113
 
8114
8114
  // Setup request with URL and Params
@@ -8136,8 +8136,59 @@ function updateSchedule(options) {
8136
8136
  }
8137
8137
 
8138
8138
  return deferred.promise;
8139
- }
8140
- },{"../../helpers":3,"../../helpers/lib/api/converter":4,"q":90,"superagent":133}],21:[function(require,module,exports){
8139
+ }
8140
+
8141
+ /*
8142
+ options = {
8143
+ accountid: "string", //mandatory
8144
+ context: "string", //mandatory
8145
+ scheduleid: "string", //mandatory
8146
+ body: {
8147
+ "category": "", //mandatory
8148
+ "actorid": "", //mandatory
8149
+ }
8150
+ }
8151
+ */
8152
+ function deleteSchedule(options) {
8153
+ var deferred = q.defer();
8154
+ // Initializing promise
8155
+ var self = this, err;
8156
+
8157
+ if (options && options.context && options.accountid && options.scheduleid && options.body) {
8158
+ // Construct API url
8159
+ var url = self.config.DEFAULT_HOSTS.INTEGRATION + self.config.INTEGRATIONS_API_URLS.particularSchedule;
8160
+ url = helpers.api.constructAPIUrl(url, { accountId: options.accountid, context: options.context, scheduleId: options.scheduleid });
8161
+
8162
+ // Setup request with URL and Params
8163
+ var requestAPI = request.delete(url)
8164
+ .set('Content-Type', 'application/json')
8165
+ .set('Accept', 'application/json')
8166
+ .send(options.body);
8167
+
8168
+ if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
8169
+
8170
+ requestAPI
8171
+ .agent(keepaliveAgent)
8172
+ .end(function (error, response) {
8173
+ if (error) {
8174
+ err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
8175
+ deferred.reject(err);
8176
+ } else {
8177
+ deferred.resolve(response.body);
8178
+ }
8179
+ });
8180
+ } else {
8181
+ err = {};
8182
+ err.message = err.description = 'Mandatory param - accountid or context or scheduleid or ' +
8183
+ 'body not found in request options.';
8184
+ err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
8185
+ deferred.reject(err);
8186
+ }
8187
+
8188
+ return deferred.promise;
8189
+ }
8190
+
8191
+ },{"../../helpers":3,"../../helpers/lib/api/converter":4,"agentkeepalive":38,"q":90,"superagent":133}],21:[function(require,module,exports){
8141
8192
  /*************************************************************************
8142
8193
  *
8143
8194
  * COMPRO CONFIDENTIAL
@@ -11083,6 +11134,7 @@ function postSISEvent(options) {
11083
11134
 
11084
11135
  var q = require('q');
11085
11136
  var request = require('superagent');
11137
+ var Agent = require('agentkeepalive');
11086
11138
 
11087
11139
  var helpers = require('../../helpers');
11088
11140
 
@@ -11093,6 +11145,11 @@ var DLSError = helpers.errors.DLSError;
11093
11145
  **********************************/
11094
11146
  module.exports = spaces;
11095
11147
 
11148
+ var keepaliveAgent = new Agent({
11149
+ timeout: 60000,
11150
+ freeSocketTimeout: 30000
11151
+ });
11152
+
11096
11153
  //Auth Adaptor Contsructor
11097
11154
  function spaces(accountId) {
11098
11155
  this.accountId = accountId;
@@ -11116,6 +11173,7 @@ function spaces(accountId) {
11116
11173
  getExtProduct: getExtProduct.bind(this),
11117
11174
  getSpaceDetails: getSpaceDetails.bind(this),
11118
11175
  updateUserInformation: updateUserInformation.bind(this),
11176
+ updateUserSpace: updateUserSpace.bind(this),
11119
11177
  getInvitationsByEmail: getInvitationsByEmail.bind(this),
11120
11178
  updateInstituteTitle: updateInstituteTitle.bind(this)
11121
11179
  };
@@ -12070,6 +12128,53 @@ function updateUserInformation(options) {
12070
12128
  return dfd.promise;
12071
12129
  }
12072
12130
 
12131
+ /**
12132
+ * This function is used to update the visibility (hide/unhide) a particular user-space of a user.
12133
+ * @param {*extuserid, *spacekey, *body: { *visibility }} options
12134
+ * @returns {promise}
12135
+ */
12136
+ function updateUserSpace(options) {
12137
+ var self = this;
12138
+
12139
+ // Initializing promise
12140
+ var deferred = q.defer();
12141
+ var error;
12142
+
12143
+ // Validate request input.
12144
+ if (options && options.extuserid && options.spacekey && options.body) {
12145
+ // Passed all validations, Contruct API url
12146
+ var url = self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.updateUserSpace;
12147
+ url = helpers.api.constructAPIUrl(url, { accountid : self.accountId, extuserid: options.extuserid, spacekey: options.spacekey });
12148
+
12149
+ // Setup request with URL and Params
12150
+ var requestAPI = request.put(url)
12151
+ .set('Content-Type', 'application/json')
12152
+ .set('Accept', 'application/json')
12153
+ .send(options.body);
12154
+
12155
+ // Add 'trace_id' to the request headers.
12156
+ if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
12157
+
12158
+ requestAPI
12159
+ .agent(keepaliveAgent)
12160
+ .end(function(err, response) {
12161
+ if (err) {
12162
+ error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
12163
+ deferred.reject(error);
12164
+ } else {
12165
+ deferred.resolve(response.body);
12166
+ }
12167
+ });
12168
+ } else {
12169
+ var err = {};
12170
+ err.message = err.description = 'Missing mandatory params: \'extuserid\' or \'spacekey\' or \'body\' not found in the request options.';
12171
+ error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
12172
+ deferred.reject(error);
12173
+ }
12174
+
12175
+ return deferred.promise;
12176
+ }
12177
+
12073
12178
  /* options = {
12074
12179
  "email": "string", // required
12075
12180
  "status " : "string", // optional
@@ -12155,7 +12260,7 @@ function updateInstituteTitle(options){
12155
12260
  return dfd.promise;
12156
12261
  }
12157
12262
 
12158
- },{"../../helpers":3,"q":90,"superagent":133}],31:[function(require,module,exports){
12263
+ },{"../../helpers":3,"agentkeepalive":38,"q":90,"superagent":133}],31:[function(require,module,exports){
12159
12264
  /*************************************************************************
12160
12265
  *
12161
12266
  * COMPRO CONFIDENTIAL