comprodls-sdk 2.90.2 → 2.91.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 +2917 -6291
- package/dist/comprodls-sdk.min.js +1 -1
- package/lib/comprodls.js +39 -57
- package/lib/config/index.js +172 -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 +106 -289
- 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
package/lib/open_access/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 Open Access Manager Module
|
|
22
23
|
* Provides Open Access functions for the SDK
|
|
@@ -26,13 +27,12 @@ var request = require('superagent');
|
|
|
26
27
|
var helpers = require('../helpers');
|
|
27
28
|
var DLSError = helpers.errors.DLSError;
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
*
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
/**
|
|
31
|
+
* These functions need to be moved to the corresponding adapter
|
|
32
|
+
* They were created here since these functions requires the orgid but not token,
|
|
33
|
+
* But the initialiation function required both token and orgid to be initialized,
|
|
34
|
+
* Now we have improved the initialization function for orgid.
|
|
35
|
+
*/
|
|
36
36
|
exports.getClassEnrolmentsStat = getClassEnrolmentsStat;
|
|
37
37
|
exports.getSingleInvitation = getSingleInvitation;
|
|
38
38
|
|
|
@@ -41,11 +41,9 @@ exports.getSingleInvitation = getSingleInvitation;
|
|
|
41
41
|
**********************************/
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
|
|
47
|
-
* }
|
|
48
|
-
**/
|
|
44
|
+
* Wiki Link for SDK params
|
|
45
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/17_Open-Access-SDK-Functions#getclassenrolmentsstatorganizationid-options
|
|
46
|
+
*/
|
|
49
47
|
function getClassEnrolmentsStat(organizationId, options) {
|
|
50
48
|
var self = this;
|
|
51
49
|
//Initializing promise
|
|
@@ -76,46 +74,43 @@ function getClassEnrolmentsStat(organizationId, options) {
|
|
|
76
74
|
return dfd.promise;
|
|
77
75
|
}
|
|
78
76
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
};
|
|
84
|
-
*/
|
|
77
|
+
/**
|
|
78
|
+
* Wiki Link for SDK params
|
|
79
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/17_Open-Access-SDK-Functions#getsingleinvitationorganizationid-params
|
|
80
|
+
*/
|
|
85
81
|
function getSingleInvitation(organizationId, options) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
// Setup request with URL and Params
|
|
100
|
-
var requestAPI = request.get(url).query(queryParam);
|
|
101
|
-
if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
102
|
-
|
|
103
|
-
requestAPI.end(function (error, response) {
|
|
104
|
-
if (error) {
|
|
105
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
106
|
-
dfd.reject(err);
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
dfd.resolve(response.body);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
err.message = err.description = 'organizationId or context_id or context '+
|
|
115
|
-
'or invitationid not found in request options.';
|
|
116
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
117
|
-
dfd.reject(err);
|
|
118
|
-
}
|
|
119
|
-
return dfd.promise;
|
|
120
|
-
}
|
|
82
|
+
var self = this;
|
|
83
|
+
var err = {};
|
|
84
|
+
// Initializing promise
|
|
85
|
+
var dfd = q.defer();
|
|
86
|
+
if (organizationId && options && options.context_id && options.context &&
|
|
87
|
+
options.invitationid) {
|
|
88
|
+
// Passed all validations, Contruct API url
|
|
89
|
+
var url = self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.getSingleInvitation;
|
|
90
|
+
//Contruct path parameters
|
|
91
|
+
url = helpers.api.constructAPIUrl(url,
|
|
92
|
+
{ orgId: organizationId, invitationId: options.invitationid });
|
|
93
|
+
var queryParam = { context: options.context, context_id: options.context_id };
|
|
121
94
|
|
|
95
|
+
// Setup request with URL and Params
|
|
96
|
+
var requestAPI = request.get(url).query(queryParam);
|
|
97
|
+
if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
98
|
+
|
|
99
|
+
requestAPI.end(function (error, response) {
|
|
100
|
+
if (error) {
|
|
101
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
102
|
+
dfd.reject(err);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
dfd.resolve(response.body);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
err.message = err.description = 'organizationId or context_id or context '+
|
|
111
|
+
'or invitationid not found in request options.';
|
|
112
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
113
|
+
dfd.reject(err);
|
|
114
|
+
}
|
|
115
|
+
return dfd.promise;
|
|
116
|
+
}
|