comprodls-sdk 2.11.7 → 2.12.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.
- package/.eslintrc +28 -28
- package/.npmignore +5 -0
- package/README.md +371 -371
- package/dist/comprodls-sdk.js +11493 -11301
- package/dist/comprodls-sdk.min.js +18 -18
- package/grunt/publish.js +148 -148
- package/lib/comprodls.js +146 -146
- package/lib/config/index.js +337 -336
- package/lib/helpers/index.js +29 -29
- package/lib/helpers/lib/api/converter.js +119 -119
- package/lib/helpers/lib/api/index.js +120 -120
- package/lib/helpers/lib/api/validations.js +72 -72
- package/lib/helpers/lib/errors.js +129 -129
- package/lib/helpers/lib/utils.js +23 -23
- package/lib/helpers/lib/validator.js +100 -100
- package/lib/open_access/index.js +121 -121
- package/lib/services/activity/activity.js +209 -209
- package/lib/services/activity/attempt.js +431 -431
- package/lib/services/activity/index.js +28 -28
- package/lib/services/analytics/index.js +1555 -1555
- package/lib/services/attempts/index.js +342 -342
- package/lib/services/auth/classProduct.js +37 -37
- package/lib/services/auth/index.js +2541 -2535
- package/lib/services/collab/index.js +468 -468
- package/lib/services/drive/index.js +144 -144
- package/lib/services/integrations/index.js +279 -116
- package/lib/services/invitations/index.js +313 -313
- package/lib/services/lrs/index.js +459 -459
- package/lib/services/product/index.js +267 -267
- package/lib/services/pub/index.js +407 -407
- package/lib/services/push/index.js +187 -187
- package/lib/services/push/pubnubClientWrapper.js +557 -557
- package/lib/services/push/sessionStorage.js +64 -64
- package/lib/services/pushX/index.js +190 -190
- package/lib/services/pushX/pubnubClientWrapper.js +211 -211
- package/lib/services/sisevents/index.js +113 -113
- package/lib/services/spaces/index.js +976 -929
- package/lib/services/superuser/index.js +175 -175
- package/lib/services/workflows/index.js +464 -464
- package/lib/services/xapi/index.js +232 -232
- package/lib/token/index.js +114 -114
- package/lib/token/validations.js +88 -88
- package/package-lock.json +5095 -0
- package/package.json +1 -1
- package/test.js +50 -50
- package/.vscode/launch.json +0 -23
- package/npm-debug.log.189866131 +0 -0
- package/npm-debug.log.712840116 +0 -26
|
@@ -1,144 +1,144 @@
|
|
|
1
|
-
/*************************************************************************
|
|
2
|
-
*
|
|
3
|
-
* COMPRO CONFIDENTIAL
|
|
4
|
-
* __________________
|
|
5
|
-
*
|
|
6
|
-
* [2015] - [2020] Compro Technologies Private Limited
|
|
7
|
-
* All Rights Reserved.
|
|
8
|
-
*
|
|
9
|
-
* NOTICE: All information contained herein is, and remains
|
|
10
|
-
* the property of Compro Technologies Private Limited. The
|
|
11
|
-
* intellectual and technical concepts contained herein are
|
|
12
|
-
* proprietary to Compro Technologies Private Limited and may
|
|
13
|
-
* be covered by U.S. and Foreign Patents, patents in process,
|
|
14
|
-
* and are protected by trade secret or copyright law.
|
|
15
|
-
*
|
|
16
|
-
* Dissemination of this information or reproduction of this material
|
|
17
|
-
* is strictly forbidden unless prior written permission is obtained
|
|
18
|
-
* from Compro Technologies Pvt. Ltd..
|
|
19
|
-
***************************************************************************/
|
|
20
|
-
|
|
21
|
-
/***********************************************************
|
|
22
|
-
* comproDLS SDK drive Adaptor
|
|
23
|
-
* Functions for calling Drive-service API.
|
|
24
|
-
************************************************************/
|
|
25
|
-
|
|
26
|
-
/*********************************
|
|
27
|
-
* Setting Up Module Entry Point
|
|
28
|
-
**********************************/
|
|
29
|
-
|
|
30
|
-
var q = require('q');
|
|
31
|
-
var request = require('superagent');
|
|
32
|
-
|
|
33
|
-
var helpers = require('../../helpers');
|
|
34
|
-
var DLSError = helpers.errors.DLSError;
|
|
35
|
-
|
|
36
|
-
module.exports = documents;
|
|
37
|
-
|
|
38
|
-
/*********************************
|
|
39
|
-
* Public Function definitions
|
|
40
|
-
**********************************/
|
|
41
|
-
function documents() {
|
|
42
|
-
return {
|
|
43
|
-
getAParticularDocument: getAParticularDocument.bind(this),
|
|
44
|
-
getAllDocumentsInAFolder: getAllDocumentsInAFolder.bind(this)
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/*
|
|
49
|
-
options = {
|
|
50
|
-
accountid : 'string', //mandatory
|
|
51
|
-
extuserid : 'string', //mandatory
|
|
52
|
-
documentid : 'string', //mandatory
|
|
53
|
-
folderid: 'string', //mandatory
|
|
54
|
-
}
|
|
55
|
-
*/
|
|
56
|
-
function getAParticularDocument(options) {
|
|
57
|
-
var self = this;
|
|
58
|
-
var dfd = q.defer();
|
|
59
|
-
|
|
60
|
-
if (options && options.accountid && options.extuserid && options.documentid && options.folderid) {
|
|
61
|
-
//Passed all validations, Construct API url
|
|
62
|
-
var url = self.config.DEFAULT_HOSTS.DRIVE + self.config.DRIVE_API_URLS.getAParticularDocument;
|
|
63
|
-
var urlOptions = {
|
|
64
|
-
accountid: options.accountid, extuserid: options.extuserid,
|
|
65
|
-
documentid: options.documentid
|
|
66
|
-
};
|
|
67
|
-
url = helpers.api.constructAPIUrl(url, urlOptions);
|
|
68
|
-
|
|
69
|
-
var params = { folderid: options.folderid };
|
|
70
|
-
//Setup request with URL and Params
|
|
71
|
-
var requestAPI = request.get(url).query(params);
|
|
72
|
-
|
|
73
|
-
if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
74
|
-
|
|
75
|
-
requestAPI.end(function (err, response) {
|
|
76
|
-
if (err) {
|
|
77
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
78
|
-
dfd.reject(err);
|
|
79
|
-
}
|
|
80
|
-
else { dfd.resolve(response.body); }
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
var error = {};
|
|
85
|
-
error.message = error.description = 'Mandatory params - accountid or extuserid or ' +
|
|
86
|
-
'documentid or folderid not found in request options.';
|
|
87
|
-
error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
|
|
88
|
-
dfd.reject(error);
|
|
89
|
-
}
|
|
90
|
-
return dfd.promise;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/*
|
|
94
|
-
options = {
|
|
95
|
-
accountid: 'string', //mandatory
|
|
96
|
-
extuserid: 'string', //mandatory
|
|
97
|
-
folderid: 'string', //mandatory
|
|
98
|
-
classid: 'string',
|
|
99
|
-
productcode: 'string',
|
|
100
|
-
assigned_path_id: 'string',
|
|
101
|
-
item-code: 'string',
|
|
102
|
-
cursor: 'string'
|
|
103
|
-
}
|
|
104
|
-
*/
|
|
105
|
-
function getAllDocumentsInAFolder(options) {
|
|
106
|
-
var self = this;
|
|
107
|
-
var dfd = q.defer();
|
|
108
|
-
|
|
109
|
-
if (options && options.accountid && options.extuserid && options.folderid) {
|
|
110
|
-
//Passed all validations, Construct API url
|
|
111
|
-
var url = self.config.DEFAULT_HOSTS.DRIVE + self.config.DRIVE_API_URLS.getAllDocumentsInAFolder;
|
|
112
|
-
url = helpers.api.constructAPIUrl(url,
|
|
113
|
-
{ accountid: options.accountid, extuserid: options.extuserid });
|
|
114
|
-
|
|
115
|
-
// Contruct parameters
|
|
116
|
-
var params = { folderid: options.folderid };
|
|
117
|
-
if (options.classid) { params.classid = options.classid; }
|
|
118
|
-
if (options.productcode) { params.productcode = options.productcode; }
|
|
119
|
-
if (options.assigned_path_id) { params.assigned_path_id = options.assigned_path_id; }
|
|
120
|
-
if (options['item-code']) { params['item-code'] = options['item-code']; }
|
|
121
|
-
if (options.cursor) { params.cursor = options.cursor; }
|
|
122
|
-
|
|
123
|
-
//Setup request with URL and Params
|
|
124
|
-
var requestAPI = request.get(url).query(params);
|
|
125
|
-
|
|
126
|
-
if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
127
|
-
|
|
128
|
-
requestAPI.end(function (err, response) {
|
|
129
|
-
if (err) {
|
|
130
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
131
|
-
dfd.reject(err);
|
|
132
|
-
}
|
|
133
|
-
else { dfd.resolve(response.body); }
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
var error = {};
|
|
138
|
-
error.message = error.description = 'Mandatory params - accountid or extuserid or folderid ' +
|
|
139
|
-
'not found in request options.';
|
|
140
|
-
error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
|
|
141
|
-
dfd.reject(error);
|
|
142
|
-
}
|
|
143
|
-
return dfd.promise;
|
|
144
|
-
}
|
|
1
|
+
/*************************************************************************
|
|
2
|
+
*
|
|
3
|
+
* COMPRO CONFIDENTIAL
|
|
4
|
+
* __________________
|
|
5
|
+
*
|
|
6
|
+
* [2015] - [2020] Compro Technologies Private Limited
|
|
7
|
+
* All Rights Reserved.
|
|
8
|
+
*
|
|
9
|
+
* NOTICE: All information contained herein is, and remains
|
|
10
|
+
* the property of Compro Technologies Private Limited. The
|
|
11
|
+
* intellectual and technical concepts contained herein are
|
|
12
|
+
* proprietary to Compro Technologies Private Limited and may
|
|
13
|
+
* be covered by U.S. and Foreign Patents, patents in process,
|
|
14
|
+
* and are protected by trade secret or copyright law.
|
|
15
|
+
*
|
|
16
|
+
* Dissemination of this information or reproduction of this material
|
|
17
|
+
* is strictly forbidden unless prior written permission is obtained
|
|
18
|
+
* from Compro Technologies Pvt. Ltd..
|
|
19
|
+
***************************************************************************/
|
|
20
|
+
|
|
21
|
+
/***********************************************************
|
|
22
|
+
* comproDLS SDK drive Adaptor
|
|
23
|
+
* Functions for calling Drive-service API.
|
|
24
|
+
************************************************************/
|
|
25
|
+
|
|
26
|
+
/*********************************
|
|
27
|
+
* Setting Up Module Entry Point
|
|
28
|
+
**********************************/
|
|
29
|
+
|
|
30
|
+
var q = require('q');
|
|
31
|
+
var request = require('superagent');
|
|
32
|
+
|
|
33
|
+
var helpers = require('../../helpers');
|
|
34
|
+
var DLSError = helpers.errors.DLSError;
|
|
35
|
+
|
|
36
|
+
module.exports = documents;
|
|
37
|
+
|
|
38
|
+
/*********************************
|
|
39
|
+
* Public Function definitions
|
|
40
|
+
**********************************/
|
|
41
|
+
function documents() {
|
|
42
|
+
return {
|
|
43
|
+
getAParticularDocument: getAParticularDocument.bind(this),
|
|
44
|
+
getAllDocumentsInAFolder: getAllDocumentsInAFolder.bind(this)
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/*
|
|
49
|
+
options = {
|
|
50
|
+
accountid : 'string', //mandatory
|
|
51
|
+
extuserid : 'string', //mandatory
|
|
52
|
+
documentid : 'string', //mandatory
|
|
53
|
+
folderid: 'string', //mandatory
|
|
54
|
+
}
|
|
55
|
+
*/
|
|
56
|
+
function getAParticularDocument(options) {
|
|
57
|
+
var self = this;
|
|
58
|
+
var dfd = q.defer();
|
|
59
|
+
|
|
60
|
+
if (options && options.accountid && options.extuserid && options.documentid && options.folderid) {
|
|
61
|
+
//Passed all validations, Construct API url
|
|
62
|
+
var url = self.config.DEFAULT_HOSTS.DRIVE + self.config.DRIVE_API_URLS.getAParticularDocument;
|
|
63
|
+
var urlOptions = {
|
|
64
|
+
accountid: options.accountid, extuserid: options.extuserid,
|
|
65
|
+
documentid: options.documentid
|
|
66
|
+
};
|
|
67
|
+
url = helpers.api.constructAPIUrl(url, urlOptions);
|
|
68
|
+
|
|
69
|
+
var params = { folderid: options.folderid };
|
|
70
|
+
//Setup request with URL and Params
|
|
71
|
+
var requestAPI = request.get(url).query(params);
|
|
72
|
+
|
|
73
|
+
if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
74
|
+
|
|
75
|
+
requestAPI.end(function (err, response) {
|
|
76
|
+
if (err) {
|
|
77
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
78
|
+
dfd.reject(err);
|
|
79
|
+
}
|
|
80
|
+
else { dfd.resolve(response.body); }
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
var error = {};
|
|
85
|
+
error.message = error.description = 'Mandatory params - accountid or extuserid or ' +
|
|
86
|
+
'documentid or folderid not found in request options.';
|
|
87
|
+
error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
|
|
88
|
+
dfd.reject(error);
|
|
89
|
+
}
|
|
90
|
+
return dfd.promise;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/*
|
|
94
|
+
options = {
|
|
95
|
+
accountid: 'string', //mandatory
|
|
96
|
+
extuserid: 'string', //mandatory
|
|
97
|
+
folderid: 'string', //mandatory
|
|
98
|
+
classid: 'string',
|
|
99
|
+
productcode: 'string',
|
|
100
|
+
assigned_path_id: 'string',
|
|
101
|
+
item-code: 'string',
|
|
102
|
+
cursor: 'string'
|
|
103
|
+
}
|
|
104
|
+
*/
|
|
105
|
+
function getAllDocumentsInAFolder(options) {
|
|
106
|
+
var self = this;
|
|
107
|
+
var dfd = q.defer();
|
|
108
|
+
|
|
109
|
+
if (options && options.accountid && options.extuserid && options.folderid) {
|
|
110
|
+
//Passed all validations, Construct API url
|
|
111
|
+
var url = self.config.DEFAULT_HOSTS.DRIVE + self.config.DRIVE_API_URLS.getAllDocumentsInAFolder;
|
|
112
|
+
url = helpers.api.constructAPIUrl(url,
|
|
113
|
+
{ accountid: options.accountid, extuserid: options.extuserid });
|
|
114
|
+
|
|
115
|
+
// Contruct parameters
|
|
116
|
+
var params = { folderid: options.folderid };
|
|
117
|
+
if (options.classid) { params.classid = options.classid; }
|
|
118
|
+
if (options.productcode) { params.productcode = options.productcode; }
|
|
119
|
+
if (options.assigned_path_id) { params.assigned_path_id = options.assigned_path_id; }
|
|
120
|
+
if (options['item-code']) { params['item-code'] = options['item-code']; }
|
|
121
|
+
if (options.cursor) { params.cursor = options.cursor; }
|
|
122
|
+
|
|
123
|
+
//Setup request with URL and Params
|
|
124
|
+
var requestAPI = request.get(url).query(params);
|
|
125
|
+
|
|
126
|
+
if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
127
|
+
|
|
128
|
+
requestAPI.end(function (err, response) {
|
|
129
|
+
if (err) {
|
|
130
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
131
|
+
dfd.reject(err);
|
|
132
|
+
}
|
|
133
|
+
else { dfd.resolve(response.body); }
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
var error = {};
|
|
138
|
+
error.message = error.description = 'Mandatory params - accountid or extuserid or folderid ' +
|
|
139
|
+
'not found in request options.';
|
|
140
|
+
error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
|
|
141
|
+
dfd.reject(error);
|
|
142
|
+
}
|
|
143
|
+
return dfd.promise;
|
|
144
|
+
}
|