comprodls-sdk 2.54.1 → 2.55.0

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.
@@ -505,7 +505,8 @@ exports.INTEGRATIONS_API_URLS = {
505
505
 
506
506
  exports.DRIVE_API_URLS = {
507
507
  getAParticularDocument: '/accounts/{accountid}/users/{extuserid}/documents/{documentid}',
508
- getAllDocumentsInAFolder: '/accounts/{accountid}/users/{extuserid}/documents'
508
+ getAllDocumentsInAFolder: '/accounts/{accountid}/users/{extuserid}/documents',
509
+ documents: '/accounts/{accountid}/users/{userid}/documents/multi'
509
510
  };
510
511
 
511
512
  exports.TAXONOMY_API_URLS = {
@@ -3539,6 +3540,7 @@ function getMyAssignedPathsOfClass(options) {
3539
3540
  var queryParams = { userid: options.userid, classid: options.classid };
3540
3541
  if(options.progress) { queryParams.progress = options.progress; }
3541
3542
  if(options.group) { queryParams.group = options.group; }
3543
+ if(options.expiredView) { queryParams.expiredView = options.expiredView; }
3542
3544
 
3543
3545
  // Setup request with URL and Params
3544
3546
  var requestAPI = request.get(url).query(queryParams);
@@ -3597,6 +3599,7 @@ function getMyParticularAssignedPathOfClass(options) {
3597
3599
  if(options.group) { queryParams.group = options.group; }
3598
3600
  if(options.assignedpathid) { queryParams.assignedpathid = options.assignedpathid; }
3599
3601
  if(options.ext_assignedpathid) {queryParams.ext_assignedpathid = options.ext_assignedpathid;}
3602
+ if(options.expiredView) { queryParams.expiredView = options.expiredView; }
3600
3603
 
3601
3604
  // Setup request with URL and Params
3602
3605
  var requestAPI = request.get(url).query(queryParams);
@@ -9949,19 +9952,28 @@ function getAllDataSyncManagersOfAGroup(options) {
9949
9952
 
9950
9953
  var q = require('q');
9951
9954
  var request = require('superagent');
9955
+ var Agent = require('agentkeepalive');
9952
9956
 
9953
9957
  var helpers = require('../../helpers');
9954
9958
  var DLSError = helpers.errors.DLSError;
9955
9959
 
9956
9960
  module.exports = documents;
9957
9961
 
9962
+ var keepaliveAgent = new Agent({
9963
+ timeout: 60000,
9964
+ freeSocketTimeout: 30000
9965
+ });
9966
+
9958
9967
  /*********************************
9959
9968
  * Public Function definitions
9960
9969
  **********************************/
9961
9970
  function documents() {
9962
9971
  return {
9963
9972
  getAParticularDocument: getAParticularDocument.bind(this),
9964
- getAllDocumentsInAFolder: getAllDocumentsInAFolder.bind(this)
9973
+ getAllDocumentsInAFolder: getAllDocumentsInAFolder.bind(this),
9974
+ createMultipleDocuments: createMultipleDocuments.bind(this),
9975
+ updateMultipleDocuments: updateMultipleDocuments.bind(this),
9976
+ deleteMultipleDocuments: deleteMultipleDocuments.bind(this),
9965
9977
  };
9966
9978
  }
9967
9979
 
@@ -10062,8 +10074,186 @@ function getAllDocumentsInAFolder(options) {
10062
10074
  }
10063
10075
  return dfd.promise;
10064
10076
  }
10077
+
10078
+ /*
10079
+ options = {
10080
+ accountid: 'string', // mandatory
10081
+ extuserid: 'string', // mandatory
10082
+ body: { // mandatory
10083
+ orgid: 'string', // mandatory
10084
+ classid: 'string',
10085
+ productcode: 'string', // mandatory
10086
+ dls_user_id: 'string', // mandatory
10087
+ entities: [ // mandatory (Min length 1)
10088
+ {
10089
+ item_code: 'string',
10090
+ folderid: 'string', // mandatory
10091
+ documentid: 'string', // mandatory
10092
+ tag: 'string',
10093
+ timestamp: <epoch>, // mandatory
10094
+ ttl: <number>, // optional, default - 3 months
10095
+ data: {} // mandatory, state JSON
10096
+ },
10097
+ ...
10098
+ ]
10099
+ }
10100
+ }
10101
+ */
10102
+ function createMultipleDocuments(options) {
10103
+ var self = this;
10104
+ var dfd = q.defer();
10105
+
10106
+ if (options && options.accountid && options.extuserid && options.body) {
10107
+ // Passed all validations, Contruct API url
10108
+
10109
+ var url = self.config.DEFAULT_HOSTS.DRIVE + self.config.DRIVE_API_URLS.documents;
10110
+ url = helpers.api.constructAPIUrl(url, {
10111
+ accountid: options.accountid, userid: options.extuserid
10112
+ });
10113
+
10114
+ // Setup request with URL and Params
10115
+ var requestAPI = request.post(url)
10116
+ .set('Content-Type', 'application/json')
10117
+ .set('Accept', 'application/json')
10118
+ .send(options.body);
10119
+
10120
+ if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
10121
+
10122
+ requestAPI
10123
+ .agent(keepaliveAgent)
10124
+ .end(function(error, response) {
10125
+ if (error) {
10126
+ var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
10127
+ dfd.reject(err);
10128
+ }
10129
+ else { dfd.resolve(response.body); }
10130
+ });
10131
+ } else {
10132
+ var err = {};
10133
+ err.message = err.description = 'Mandatory param - accountid, extuserid or body' +
10134
+ ' not found in request options.';
10135
+ err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
10136
+ dfd.reject(err);
10137
+ }
10138
+ return dfd.promise;
10139
+ }
10140
+
10141
+ /*
10142
+ options = {
10143
+ accountid: 'string', // mandatory
10144
+ extuserid: 'string', // mandatory
10145
+ body: { // mandatory
10146
+ entities: [ // mandatory (Min length 1)
10147
+ {
10148
+ folderid: 'string', // mandatory
10149
+ documentid: 'string', // mandatory
10150
+ timestamp: <epoch>, // mandatory
10151
+ ttl: <number>,
10152
+ data: {}
10153
+ },
10154
+ ...
10155
+ ]
10156
+ }
10157
+ }
10158
+ */
10159
+ function updateMultipleDocuments(options) {
10160
+ // Initializing promise
10161
+ var deferred = q.defer();
10162
+ var self = this;
10163
+ var error = {};
10164
+
10165
+ if (options && options.accountid && options.extuserid && options.body) {
10166
+ // Passed all validations, Contruct API url
10167
+ var url = self.config.DEFAULT_HOSTS.DRIVE + self.config.DRIVE_API_URLS.documents;
10168
+
10169
+ url = helpers.api.constructAPIUrl(url, {
10170
+ accountid: options.accountid, userid: options.extuserid
10171
+ });
10172
+
10173
+ // Setup request with URL and Params
10174
+ var requestAPI = request.put(url)
10175
+ .set('Content-Type', 'application/json')
10176
+ .set('Accept', 'application/json')
10177
+ .send(options.body);
10178
+
10179
+ if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
10180
+
10181
+ requestAPI
10182
+ .agent(keepaliveAgent)
10183
+ .end(function(error, response) {
10184
+ if (error) {
10185
+ error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
10186
+ deferred.reject(error);
10187
+ } else {
10188
+ deferred.resolve(response.body);
10189
+ }
10190
+ });
10191
+ } else {
10192
+ error.message = error.description = 'Mandatory param - accountid, extuserid or body' +
10193
+ ' not found in the request options.';
10194
+ error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
10195
+ deferred.reject(error);
10196
+ }
10197
+
10198
+ return deferred.promise;
10199
+ }
10200
+
10201
+ /*
10202
+ options = {
10203
+ accountid: 'string', // mandatory
10204
+ extuserid: 'string', // mandatory
10205
+ body: { // mandatory
10206
+ entities: [ // mandatory (Min length 1)
10207
+ {
10208
+ folderid: 'string', // mandatory
10209
+ documentid: 'string', // mandatory
10210
+ },
10211
+ ...
10212
+ ]
10213
+ }
10214
+ }
10215
+ */
10216
+ function deleteMultipleDocuments(options) {
10217
+ var self = this;
10218
+ var dfd = q.defer();
10219
+
10220
+ if (options && options.accountid && options.extuserid && options.body) {
10221
+ // Passed all validations, Contruct API url
10222
+ var url = self.config.DEFAULT_HOSTS.DRIVE + self.config.DRIVE_API_URLS.documents;
10223
+ url = helpers.api.constructAPIUrl(url, {
10224
+ accountid: options.accountid, userid: options.extuserid
10225
+ });
10226
+
10227
+ // Setup request with URL and Params
10228
+ var requestAPI = request.delete(url)
10229
+ .set('Content-Type', 'application/json')
10230
+ .set('Accept', 'application/json')
10231
+ .send(options.body);
10232
+
10233
+ if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
10234
+
10235
+ requestAPI
10236
+ .agent(keepaliveAgent)
10237
+ .end(function (error, response) {
10238
+ if (error) {
10239
+ var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
10240
+ dfd.reject(err);
10241
+ }
10242
+ else { dfd.resolve(response.body); }
10243
+ });
10244
+ }
10245
+ else {
10246
+ var err = {};
10247
+ err.message = err.description = 'Mandatory param - accountid, extuserid or body' +
10248
+ ' not found in request options.';
10249
+ err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
10250
+ dfd.reject(err);
10251
+ }
10252
+
10253
+ return dfd.promise;
10254
+ }
10065
10255
 
10066
- },{"../../helpers":3,"q":59,"superagent":89}],21:[function(require,module,exports){
10256
+ },{"../../helpers":3,"agentkeepalive":37,"q":59,"superagent":89}],21:[function(require,module,exports){
10067
10257
  /*************************************************************************
10068
10258
  *
10069
10259
  * COMPRO CONFIDENTIAL