comprodls-sdk 2.90.3-development → 2.92.0-thor
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/README.md +1 -137
- package/dist/comprodls-sdk.js +2834 -6201
- package/dist/comprodls-sdk.min.js +1 -1
- package/lib/comprodls.js +39 -57
- package/lib/config/index.js +173 -198
- package/lib/helpers/index.js +3 -2
- package/lib/helpers/lib/api/converter.js +1 -2
- package/lib/helpers/lib/api/index.js +19 -94
- package/lib/helpers/lib/errors.js +75 -80
- package/lib/helpers/lib/requestLayer.js +154 -0
- package/lib/helpers/lib/validator.js +65 -52
- package/lib/open_access/index.js +48 -53
- package/lib/services/analytics/index.js +286 -1014
- package/lib/services/attempts/index.js +38 -88
- package/lib/services/auth/index.js +324 -806
- package/lib/services/authextn/index.js +85 -247
- package/lib/services/datasyncmanager/index.js +10 -45
- package/lib/services/drive/index.js +20 -83
- package/lib/services/integrations/index.js +51 -126
- package/lib/services/invitations/index.js +20 -61
- package/lib/services/product/index.js +82 -85
- package/lib/services/pub/index.js +167 -235
- package/lib/services/pushX/index.js +195 -142
- package/lib/services/pushX/pubnubClientWrapper.js +399 -172
- package/lib/services/rules/index.js +14 -67
- package/lib/services/spaces/index.js +141 -318
- package/lib/services/spacesextn/index.js +44 -20
- package/lib/services/superuser/index.js +21 -36
- package/lib/services/taxonomy/index.js +27 -57
- package/lib/services/workflows/index.js +38 -97
- package/lib/services/xapi/index.js +7 -168
- package/lib/token/index.js +73 -67
- package/lib/token/validations.js +45 -48
- package/package.json +2 -3
- package/lib/helpers/lib/api/validations.js +0 -73
- package/lib/helpers/lib/utils.js +0 -24
- package/lib/services/activity/activity.js +0 -209
- package/lib/services/activity/attempt.js +0 -431
- package/lib/services/activity/index.js +0 -28
- package/lib/services/auth/classProduct.js +0 -37
- package/lib/services/collab/index.js +0 -468
- package/test.js +0 -38
|
@@ -23,10 +23,6 @@
|
|
|
23
23
|
* Functions for calling xAPI.
|
|
24
24
|
************************************************************/
|
|
25
25
|
|
|
26
|
-
/*********************************
|
|
27
|
-
* Setting Up Module Entry Point
|
|
28
|
-
**********************************/
|
|
29
|
-
|
|
30
26
|
var q = require('q');
|
|
31
27
|
var request = require('superagent');
|
|
32
28
|
|
|
@@ -42,74 +38,13 @@ function xapi(accountId) {
|
|
|
42
38
|
this.accountId = accountId;
|
|
43
39
|
return {
|
|
44
40
|
postStatement: postStatements.bind(this),
|
|
45
|
-
postExternalStatements: postExternalStatements.bind(this)
|
|
46
|
-
resetUserProductProgress: resetUserProductProgress.bind(this)
|
|
41
|
+
postExternalStatements: postExternalStatements.bind(this)
|
|
47
42
|
};
|
|
48
43
|
}
|
|
49
44
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
uuid: 'string', // userid of user posting statement / 'me'
|
|
54
|
-
group: 'string' // (optional)
|
|
55
|
-
},
|
|
56
|
-
product: { // optional
|
|
57
|
-
code: 'string',
|
|
58
|
-
title: 'string' // (optional)
|
|
59
|
-
ext-item: boolean // (optional, all items in entities will be treated as external items, hence no progress JSON update for them)
|
|
60
|
-
},
|
|
61
|
-
classid: 'string', // (optional) Specify if posting via class,
|
|
62
|
-
space_key: 'string'// (optional)
|
|
63
|
-
|
|
64
|
-
entities: [{
|
|
65
|
-
assigned_path_id: 'string' //optional, assigned-path of a class
|
|
66
|
-
timestamp: 0,
|
|
67
|
-
verb: 'string', // [redo | evaluated | launched | interacted | completed | answered | attempted | scored | submitted']
|
|
68
|
-
//('redo' verb can only be sent by teacher, admin and superadmin )
|
|
69
|
-
model: 'string', // (optional) model hierarchy of resource if available
|
|
70
|
-
item-code: 'string', // item-code of resource(optional)
|
|
71
|
-
user_data: {
|
|
72
|
-
documentid: 'string',
|
|
73
|
-
folderid: 'string',
|
|
74
|
-
action: 'create/update/delete',
|
|
75
|
-
type: 'string',
|
|
76
|
-
payload: 'string'
|
|
77
|
-
},
|
|
78
|
-
timespent: 0, // (optional)
|
|
79
|
-
activity_status: 'string', // (optional) ['in_process', 'timed_out', 'completed']
|
|
80
|
-
result: { // (optional)
|
|
81
|
-
response: {
|
|
82
|
-
audioPath: 'string',
|
|
83
|
-
text: 'string',
|
|
84
|
-
link: [
|
|
85
|
-
{
|
|
86
|
-
url: 'string',
|
|
87
|
-
title: 'string',
|
|
88
|
-
description: 'string'
|
|
89
|
-
}
|
|
90
|
-
],
|
|
91
|
-
attribs: {}
|
|
92
|
-
},
|
|
93
|
-
score: { // optional
|
|
94
|
-
min: 0,
|
|
95
|
-
scaled: 0,
|
|
96
|
-
max: 0,
|
|
97
|
-
raw: 0
|
|
98
|
-
},
|
|
99
|
-
comment: 'string', // optional
|
|
100
|
-
questions: [{ // optional
|
|
101
|
-
question-code: 'string',
|
|
102
|
-
status-progress: 'string', // [not_attempted | in_progress]
|
|
103
|
-
status-evaluation: 'string' // [not_applicable | partially_correct | correct | incorrect]
|
|
104
|
-
}]
|
|
105
|
-
},
|
|
106
|
-
link-statementid: 'string' // required in case of verb = evaluated
|
|
107
|
-
}],
|
|
108
|
-
platform: {
|
|
109
|
-
ua: 'string',
|
|
110
|
-
sessionid: 'string'
|
|
111
|
-
}
|
|
112
|
-
};
|
|
45
|
+
/**
|
|
46
|
+
* Wiki Link for SDK params
|
|
47
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/08_XAPI-Adapter#poststatementsparams
|
|
113
48
|
*/
|
|
114
49
|
function postStatements(options) {
|
|
115
50
|
var self = this;
|
|
@@ -149,64 +84,9 @@ function postStatements(options) {
|
|
|
149
84
|
return dfd.promise;
|
|
150
85
|
}
|
|
151
86
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
ext_user_id: 'string', // (optional) who triggered the action - EXTERNAL_SYSTEM in case of verb = evaluated_external
|
|
156
|
-
uuid: 'string' // who triggered the action - EXTERNAL_SYSTEM in case of verb = evaluated_external
|
|
157
|
-
},
|
|
158
|
-
product: {
|
|
159
|
-
code: 'string',
|
|
160
|
-
title: 'string' // (optional)
|
|
161
|
-
ext-item: boolean // (optional, all items in entities will be treated as external items, hence no progress JSON update for them)
|
|
162
|
-
},
|
|
163
|
-
student_userid: "string", // (optional when verb = submitted_external) ON whom is the action taking place
|
|
164
|
-
student_ext_user_id: "string", // (optional when verb = submitted_external) ON whom is the action taking place
|
|
165
|
-
classid: 'string', // (optional) Specify if posting via class
|
|
166
|
-
space_key: 'string', // (optional)
|
|
167
|
-
platform: {
|
|
168
|
-
ua: "string"
|
|
169
|
-
},
|
|
170
|
-
group: { // (optional)
|
|
171
|
-
id: "string"
|
|
172
|
-
}
|
|
173
|
-
entities: [{
|
|
174
|
-
assigned_path_id: 'string' //(optional) assigned-path of a class
|
|
175
|
-
timestamp: 0,
|
|
176
|
-
verb: 'string', // [evaluated_external, submitted_external]
|
|
177
|
-
model: 'string', // (optional) model hierarchy of resource if available
|
|
178
|
-
item-code: 'string', // item-code of resource
|
|
179
|
-
timespent: 0, // (optional)
|
|
180
|
-
part: integer, // (mandatory only for verb = evaluated_external)
|
|
181
|
-
submission_order: integer, // [1, 2, 3]
|
|
182
|
-
result: { // (optional)
|
|
183
|
-
"response": {
|
|
184
|
-
"text": "string",
|
|
185
|
-
"audioPath": "string",
|
|
186
|
-
"link": [
|
|
187
|
-
{
|
|
188
|
-
"url": "string",
|
|
189
|
-
"title": "string",
|
|
190
|
-
"description": "string"
|
|
191
|
-
}
|
|
192
|
-
]
|
|
193
|
-
},
|
|
194
|
-
"score": {
|
|
195
|
-
"min": 0,
|
|
196
|
-
"scaled": 0,
|
|
197
|
-
"max": 0,
|
|
198
|
-
"raw": 0
|
|
199
|
-
},
|
|
200
|
-
"comment": "string", // (optional)
|
|
201
|
-
"ext_data": "string", // (optional)
|
|
202
|
-
questions: [{ // (optional)
|
|
203
|
-
question-code: 'string',
|
|
204
|
-
status-progress: 'string', // [not_attempted | in_progress]
|
|
205
|
-
status-evaluation: 'string' // [not_applicable | partially_correct | correct | incorrect]
|
|
206
|
-
}]
|
|
207
|
-
}
|
|
208
|
-
}]
|
|
209
|
-
}
|
|
87
|
+
/**
|
|
88
|
+
* Wiki Link for SDK params
|
|
89
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/08_XAPI-Adapter#postexternalstatementsparams
|
|
210
90
|
*/
|
|
211
91
|
function postExternalStatements(options) {
|
|
212
92
|
var self = this;
|
|
@@ -232,44 +112,3 @@ function postExternalStatements(options) {
|
|
|
232
112
|
});
|
|
233
113
|
return dfd.promise;
|
|
234
114
|
}
|
|
235
|
-
|
|
236
|
-
/*options = {
|
|
237
|
-
userid: 'string',
|
|
238
|
-
productcode: 'string',
|
|
239
|
-
actorid: 'string'
|
|
240
|
-
}*/
|
|
241
|
-
function resetUserProductProgress(options) {
|
|
242
|
-
var self = this;
|
|
243
|
-
// Initializing promise
|
|
244
|
-
var dfd = q.defer();
|
|
245
|
-
var err = {};
|
|
246
|
-
if(options && options.userid && options.productcode && options.actorid) {
|
|
247
|
-
|
|
248
|
-
// Passed all validations, Contruct API url
|
|
249
|
-
var url = self.config.DEFAULT_HOSTS.XAPI + self.config.XAPI_API_URLS.resetUserProductProgress;
|
|
250
|
-
url = helpers.api.constructAPIUrl(url, { accountId : self.accountId });
|
|
251
|
-
|
|
252
|
-
// Setup request with URL and Params
|
|
253
|
-
var requestAPI = request.delete(url)
|
|
254
|
-
.set('Content-Type', 'application/json')
|
|
255
|
-
.set('Accept', 'application/json')
|
|
256
|
-
.send(options);
|
|
257
|
-
|
|
258
|
-
if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
259
|
-
|
|
260
|
-
requestAPI.end(function(error, response) {
|
|
261
|
-
if(error) {
|
|
262
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
263
|
-
dfd.reject(err);
|
|
264
|
-
}
|
|
265
|
-
else { dfd.resolve(response.body); }
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
else {
|
|
269
|
-
err.message = err.description = 'userid, productcode or actorid not found in request options.';
|
|
270
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
271
|
-
dfd.reject(err);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
return dfd.promise;
|
|
275
|
-
}
|
package/lib/token/index.js
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* is strictly forbidden unless prior written permission is obtained
|
|
18
18
|
* from Compro Technologies Pvt. Ltd..
|
|
19
19
|
***************************************************************************/
|
|
20
|
+
|
|
20
21
|
/***********************************************************
|
|
21
22
|
* comproDLS SDK Token Manager Module
|
|
22
23
|
* Provides Token managements functions for the SDK
|
|
@@ -28,87 +29,92 @@ var helpers = require('../helpers');
|
|
|
28
29
|
var DLSError = helpers.errors.DLSError;
|
|
29
30
|
var validations = require('./validations');
|
|
30
31
|
|
|
31
|
-
/*************************************
|
|
32
|
-
* Setting up Exports/Public functions
|
|
33
|
-
*************************************/
|
|
34
32
|
exports.authWithExtUser = authWithExtUser;
|
|
35
33
|
exports.authWithToken = authWithToken;
|
|
36
34
|
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Wiki Link for SDK params
|
|
38
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/02_Authentication-and-Tokens#authwithextuser
|
|
39
|
+
*/
|
|
37
40
|
function authWithExtUser(organizationId, options) {
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
var self = this;
|
|
42
|
+
var dfd = q.defer();
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
//Validation
|
|
45
|
+
var err = validations.validateAuthWithExtUser(organizationId, options);
|
|
46
|
+
if (err) {
|
|
47
|
+
dfd.reject(err);
|
|
48
|
+
} else {
|
|
49
|
+
//Passed all Validations, Setup the GET TOKEN API URL.
|
|
50
|
+
var url = this.config.DEFAULT_HOSTS['AUTH'] + this.config.AUTH_API_URLS.getExtUserTokenAPI;
|
|
51
|
+
url = helpers.api.constructAPIUrl(url, {'orgId' : organizationId});
|
|
49
52
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
//Setup Credentials
|
|
54
|
+
var params = {
|
|
55
|
+
'ext_user_id': options.ext_user_id
|
|
56
|
+
};
|
|
57
|
+
//Call the comproDLS GET TOKEN API
|
|
58
|
+
request.post(url).send(params).end(function(err, response) {
|
|
59
|
+
if (err) {
|
|
60
|
+
//API Error, Construct Standard SDK error response
|
|
61
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
62
|
+
dfd.reject(err);
|
|
63
|
+
} else {
|
|
64
|
+
//Success, Extract the Token & Other useful information
|
|
65
|
+
var token = {
|
|
66
|
+
'access_token': response.body.access_token
|
|
67
|
+
};
|
|
68
|
+
var user = response.body.user;
|
|
69
|
+
var responseObj = {
|
|
70
|
+
'token': token,
|
|
71
|
+
'user': user,
|
|
72
|
+
'metrics': response.body.metrics
|
|
53
73
|
};
|
|
54
|
-
//Call the comproDLS GET TOKEN API
|
|
55
|
-
request.post(url).send(params).end(function(err, response) {
|
|
56
|
-
if (err) {
|
|
57
|
-
//API Error, Construct Standard SDK error response
|
|
58
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
59
|
-
dfd.reject(err);
|
|
60
|
-
} else {
|
|
61
|
-
|
|
62
|
-
//Success, Extract the Token & Other useful information
|
|
63
|
-
var token = {
|
|
64
|
-
'access_token': response.body.access_token
|
|
65
|
-
};
|
|
66
|
-
var user = response.body.user;
|
|
67
|
-
var responseObj = {
|
|
68
|
-
'token': token,
|
|
69
|
-
'user': user,
|
|
70
|
-
'metrics': response.body.metrics
|
|
71
|
-
}
|
|
72
74
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
//Setting token and organisationid in comproDLS instance
|
|
76
|
+
self.token = token;
|
|
77
|
+
self.orgId = user.org.id;
|
|
76
78
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
dfd.resolve(responseObj);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return dfd.promise;
|
|
82
84
|
};
|
|
83
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Wiki Link for SDK params
|
|
88
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/02_Authentication-and-Tokens#authwithtoken
|
|
89
|
+
*/
|
|
84
90
|
function authWithToken(organizationId, token, options) {
|
|
85
|
-
|
|
86
|
-
|
|
91
|
+
var self = this;
|
|
92
|
+
var dfd = q.defer();
|
|
87
93
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
94
|
+
//Validation
|
|
95
|
+
var err = validations.authWithToken(organizationId, token ,options);
|
|
96
|
+
if (err) {
|
|
97
|
+
dfd.reject(err);
|
|
98
|
+
} else {
|
|
93
99
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
100
|
+
//Setting token and organisationid in comproDLS instance
|
|
101
|
+
self.token = token;
|
|
102
|
+
self.orgId = organizationId;
|
|
97
103
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
104
|
+
if (options && options.getuserdetails) {
|
|
105
|
+
self.Auth().getUserProfile().then(function(response) {
|
|
106
|
+
var responseObj = {
|
|
107
|
+
'token': self.token,
|
|
108
|
+
'user': response
|
|
109
|
+
};
|
|
110
|
+
dfd.resolve(responseObj);
|
|
111
|
+
}, function(err) {
|
|
112
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
113
|
+
dfd.reject(err);
|
|
114
|
+
});
|
|
115
|
+
} else {
|
|
116
|
+
dfd.resolve(self.token);
|
|
112
117
|
}
|
|
113
|
-
|
|
118
|
+
}
|
|
119
|
+
return dfd.promise;
|
|
114
120
|
};
|
package/lib/token/validations.js
CHANGED
|
@@ -17,15 +17,13 @@
|
|
|
17
17
|
* is strictly forbidden unless prior written permission is obtained
|
|
18
18
|
* from Compro Technologies Pvt. Ltd..
|
|
19
19
|
***************************************************************************/
|
|
20
|
+
|
|
20
21
|
/***********************************************************
|
|
21
22
|
* comproDLS Token Module Validations
|
|
22
23
|
* This module contains validations for token manager module.
|
|
23
24
|
************************************************************/
|
|
24
25
|
var validate = require('../helpers').validations.validate;
|
|
25
26
|
|
|
26
|
-
/****************************************************
|
|
27
|
-
* Setting up Exports/Public variables
|
|
28
|
-
*****************************************************/
|
|
29
27
|
exports.authWithToken = validateAuthWithToken;
|
|
30
28
|
exports.validateAuthWithExtUser = validateAuthWithExtUser;
|
|
31
29
|
|
|
@@ -33,56 +31,55 @@ exports.validateAuthWithExtUser = validateAuthWithExtUser;
|
|
|
33
31
|
* Public Function definitions
|
|
34
32
|
**********************************/
|
|
35
33
|
function validateAuthWithToken(organizationId, token ,options) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
var validate_options = {
|
|
35
|
+
'organization': organizationId,
|
|
36
|
+
'token': token,
|
|
37
|
+
'options': options
|
|
38
|
+
};
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
40
|
+
var validate_constraints = {
|
|
41
|
+
'organization': {
|
|
42
|
+
'isString': true,
|
|
43
|
+
'presence': true
|
|
44
|
+
},
|
|
45
|
+
'token': {
|
|
46
|
+
'isObject': true,
|
|
47
|
+
'presence': true,
|
|
48
|
+
'contains': ['access_token']
|
|
49
|
+
},
|
|
50
|
+
'token.access_token': {
|
|
51
|
+
'isString': true,
|
|
52
|
+
'presence': true
|
|
53
|
+
},
|
|
54
|
+
'options': {
|
|
55
|
+
'isObject': true
|
|
56
|
+
}
|
|
57
|
+
};
|
|
60
58
|
|
|
61
|
-
|
|
59
|
+
return validate(validate_options, validate_constraints);
|
|
62
60
|
};
|
|
63
61
|
|
|
64
62
|
function validateAuthWithExtUser(organizationId, options) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
var validate_options = {
|
|
64
|
+
'organization': organizationId,
|
|
65
|
+
'options': options
|
|
66
|
+
};
|
|
69
67
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
68
|
+
var validate_constraints = {
|
|
69
|
+
'organization': {
|
|
70
|
+
'isString': true,
|
|
71
|
+
'presence': true
|
|
72
|
+
},
|
|
73
|
+
'options': {
|
|
74
|
+
'isObject': true,
|
|
75
|
+
'presence': true,
|
|
76
|
+
'contains': ['ext_user_id']
|
|
77
|
+
},
|
|
78
|
+
'options.ext_user_id': {
|
|
79
|
+
'isString': true,
|
|
80
|
+
'presence': true
|
|
81
|
+
}
|
|
82
|
+
};
|
|
85
83
|
|
|
86
|
-
|
|
84
|
+
return validate(validate_options, validate_constraints);
|
|
87
85
|
};
|
|
88
|
-
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "comprodls-sdk",
|
|
3
3
|
"description": "comproDLS SDK for JavaScript",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.92.0-thor",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Compro Technologies Private Limited",
|
|
7
7
|
"url": "http://www.comprotechnologies.com/"
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"agentkeepalive": "4.2.0",
|
|
16
|
-
"extend": "3.0.2",
|
|
17
16
|
"pubnub": "7.5.0",
|
|
18
17
|
"q": "~1.4.1",
|
|
19
18
|
"string-template": "^1.0.0",
|
|
@@ -24,7 +23,7 @@
|
|
|
24
23
|
"grunt": "^0.4.5",
|
|
25
24
|
"grunt-browserify": "^4.0.1",
|
|
26
25
|
"grunt-contrib-clean": "^1.0.0",
|
|
27
|
-
"grunt-contrib-uglify": "
|
|
26
|
+
"grunt-contrib-uglify": "4.0.1",
|
|
28
27
|
"semver": "^5.1.0",
|
|
29
28
|
"shelljs": "^0.6.0"
|
|
30
29
|
}
|
|
@@ -1,73 +0,0 @@
|
|
|
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
|
-
* comproDLS APIS Module Validations
|
|
22
|
-
* This module contains validations for APIS module.
|
|
23
|
-
************************************************************/
|
|
24
|
-
var validate = require('../validator').validate;
|
|
25
|
-
|
|
26
|
-
/****************************************************
|
|
27
|
-
* Setting up Exports/Public variables
|
|
28
|
-
*****************************************************/
|
|
29
|
-
exports.genericAPICaller = validateGenericAPICaller;
|
|
30
|
-
|
|
31
|
-
/*********************************
|
|
32
|
-
* Public Function definitions
|
|
33
|
-
**********************************/
|
|
34
|
-
function validateGenericAPICaller(apiName, method, url, params) {
|
|
35
|
-
var validate_options = {
|
|
36
|
-
'apiName': apiName,
|
|
37
|
-
'method': method,
|
|
38
|
-
'url': url,
|
|
39
|
-
'params':params
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
var validate_constraints = {
|
|
43
|
-
"apiName" : {
|
|
44
|
-
"isString" : true,
|
|
45
|
-
"presence" : true,
|
|
46
|
-
"inclusion": {
|
|
47
|
-
"within" : ["AUTH" , "PRODUCT" , "COLLAB" , "ANALYTICS" , "ACTIVITY" , "XAPI"],
|
|
48
|
-
"message": "^Enter a valid API Name"
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
"method" : {
|
|
52
|
-
"isString" : true,
|
|
53
|
-
"presence" : true,
|
|
54
|
-
"inclusion": {
|
|
55
|
-
"within" : ["GET" , "POST" , "PUT" , "DELETE"],
|
|
56
|
-
"message": "^Enter a valid HTTP method"
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
"url" : {
|
|
60
|
-
"isString" : true,
|
|
61
|
-
"presence" : true,
|
|
62
|
-
"format": {
|
|
63
|
-
"pattern": "^/.*$",
|
|
64
|
-
"message": "^Url should start with a /"
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
"params" : {
|
|
68
|
-
"isObject" : true
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
return validate(validate_options, validate_constraints);
|
|
73
|
-
};
|
package/lib/helpers/lib/utils.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
* comproDLS SDK Util Module
|
|
22
|
-
* This module provides Utility functions for SDK
|
|
23
|
-
************************************************************/
|
|
24
|
-
exports.isBrowser = typeof window !== "undefined";
|