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.
Files changed (48) hide show
  1. package/.eslintrc +28 -28
  2. package/.npmignore +5 -0
  3. package/README.md +371 -371
  4. package/dist/comprodls-sdk.js +11493 -11301
  5. package/dist/comprodls-sdk.min.js +18 -18
  6. package/grunt/publish.js +148 -148
  7. package/lib/comprodls.js +146 -146
  8. package/lib/config/index.js +337 -336
  9. package/lib/helpers/index.js +29 -29
  10. package/lib/helpers/lib/api/converter.js +119 -119
  11. package/lib/helpers/lib/api/index.js +120 -120
  12. package/lib/helpers/lib/api/validations.js +72 -72
  13. package/lib/helpers/lib/errors.js +129 -129
  14. package/lib/helpers/lib/utils.js +23 -23
  15. package/lib/helpers/lib/validator.js +100 -100
  16. package/lib/open_access/index.js +121 -121
  17. package/lib/services/activity/activity.js +209 -209
  18. package/lib/services/activity/attempt.js +431 -431
  19. package/lib/services/activity/index.js +28 -28
  20. package/lib/services/analytics/index.js +1555 -1555
  21. package/lib/services/attempts/index.js +342 -342
  22. package/lib/services/auth/classProduct.js +37 -37
  23. package/lib/services/auth/index.js +2541 -2535
  24. package/lib/services/collab/index.js +468 -468
  25. package/lib/services/drive/index.js +144 -144
  26. package/lib/services/integrations/index.js +279 -116
  27. package/lib/services/invitations/index.js +313 -313
  28. package/lib/services/lrs/index.js +459 -459
  29. package/lib/services/product/index.js +267 -267
  30. package/lib/services/pub/index.js +407 -407
  31. package/lib/services/push/index.js +187 -187
  32. package/lib/services/push/pubnubClientWrapper.js +557 -557
  33. package/lib/services/push/sessionStorage.js +64 -64
  34. package/lib/services/pushX/index.js +190 -190
  35. package/lib/services/pushX/pubnubClientWrapper.js +211 -211
  36. package/lib/services/sisevents/index.js +113 -113
  37. package/lib/services/spaces/index.js +976 -929
  38. package/lib/services/superuser/index.js +175 -175
  39. package/lib/services/workflows/index.js +464 -464
  40. package/lib/services/xapi/index.js +232 -232
  41. package/lib/token/index.js +114 -114
  42. package/lib/token/validations.js +88 -88
  43. package/package-lock.json +5095 -0
  44. package/package.json +1 -1
  45. package/test.js +50 -50
  46. package/.vscode/launch.json +0 -23
  47. package/npm-debug.log.189866131 +0 -0
  48. package/npm-debug.log.712840116 +0 -26
@@ -1,114 +1,114 @@
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 Token Manager Module
22
- * Provides Token managements functions for the SDK
23
- ************************************************************/
24
- var request = require('superagent');
25
- var q = require('q');
26
-
27
- var helpers = require('../helpers');
28
- var DLSError = helpers.errors.DLSError;
29
- var validations = require('./validations');
30
-
31
- /*************************************
32
- * Setting up Exports/Public functions
33
- *************************************/
34
- exports.authWithExtUser = authWithExtUser;
35
- exports.authWithToken = authWithToken;
36
-
37
- function authWithExtUser(organizationId, options) {
38
- var self = this;
39
- var dfd = q.defer();
40
-
41
- //Validation
42
- var err = validations.validateAuthWithExtUser(organizationId, options);
43
- if (err) {
44
- dfd.reject(err);
45
- } else {
46
- //Passed all Validations, Setup the GET TOKEN API URL.
47
- var url = this.config.DEFAULT_HOSTS['AUTH'] + this.config.AUTH_API_URLS.getExtUserTokenAPI;
48
- url = helpers.api.constructAPIUrl(url, {"orgId" : organizationId});
49
-
50
- //Setup Credentials
51
- var params = {
52
- "ext_user_id": options.ext_user_id
53
- };
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
-
73
- //Setting token and organisationid in comproDLS instance
74
- self.token = token;
75
- self.orgId = user.org.id;
76
-
77
- dfd.resolve(responseObj);
78
- }
79
- });
80
- }
81
- return dfd.promise;
82
- };
83
-
84
- function authWithToken(organizationId, token, options) {
85
- var self = this;
86
- var dfd = q.defer();
87
-
88
- //Validation
89
- var err = validations.authWithToken(organizationId, token ,options);
90
- if (err) {
91
- dfd.reject(err);
92
- } else {
93
-
94
- //Setting token and organisationid in comproDLS instance
95
- self.token = token;
96
- self.orgId = organizationId;
97
-
98
- if (options && options.getuserdetails) {
99
- self.Auth().getUserProfile().then(function(response) {
100
- var responseObj = {
101
- 'token': self.token,
102
- 'user': response
103
- }
104
- dfd.resolve(responseObj);
105
- }, function(err) {
106
- err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
107
- dfd.reject(err);
108
- });
109
- } else {
110
- dfd.resolve(self.token);
111
- }
112
- }
113
- return dfd.promise;
114
- };
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 Token Manager Module
22
+ * Provides Token managements functions for the SDK
23
+ ************************************************************/
24
+ var request = require('superagent');
25
+ var q = require('q');
26
+
27
+ var helpers = require('../helpers');
28
+ var DLSError = helpers.errors.DLSError;
29
+ var validations = require('./validations');
30
+
31
+ /*************************************
32
+ * Setting up Exports/Public functions
33
+ *************************************/
34
+ exports.authWithExtUser = authWithExtUser;
35
+ exports.authWithToken = authWithToken;
36
+
37
+ function authWithExtUser(organizationId, options) {
38
+ var self = this;
39
+ var dfd = q.defer();
40
+
41
+ //Validation
42
+ var err = validations.validateAuthWithExtUser(organizationId, options);
43
+ if (err) {
44
+ dfd.reject(err);
45
+ } else {
46
+ //Passed all Validations, Setup the GET TOKEN API URL.
47
+ var url = this.config.DEFAULT_HOSTS['AUTH'] + this.config.AUTH_API_URLS.getExtUserTokenAPI;
48
+ url = helpers.api.constructAPIUrl(url, {"orgId" : organizationId});
49
+
50
+ //Setup Credentials
51
+ var params = {
52
+ "ext_user_id": options.ext_user_id
53
+ };
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
+
73
+ //Setting token and organisationid in comproDLS instance
74
+ self.token = token;
75
+ self.orgId = user.org.id;
76
+
77
+ dfd.resolve(responseObj);
78
+ }
79
+ });
80
+ }
81
+ return dfd.promise;
82
+ };
83
+
84
+ function authWithToken(organizationId, token, options) {
85
+ var self = this;
86
+ var dfd = q.defer();
87
+
88
+ //Validation
89
+ var err = validations.authWithToken(organizationId, token ,options);
90
+ if (err) {
91
+ dfd.reject(err);
92
+ } else {
93
+
94
+ //Setting token and organisationid in comproDLS instance
95
+ self.token = token;
96
+ self.orgId = organizationId;
97
+
98
+ if (options && options.getuserdetails) {
99
+ self.Auth().getUserProfile().then(function(response) {
100
+ var responseObj = {
101
+ 'token': self.token,
102
+ 'user': response
103
+ }
104
+ dfd.resolve(responseObj);
105
+ }, function(err) {
106
+ err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
107
+ dfd.reject(err);
108
+ });
109
+ } else {
110
+ dfd.resolve(self.token);
111
+ }
112
+ }
113
+ return dfd.promise;
114
+ };
@@ -1,88 +1,88 @@
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 Token Module Validations
22
- * This module contains validations for token manager module.
23
- ************************************************************/
24
- var validate = require('../helpers').validations.validate;
25
-
26
- /****************************************************
27
- * Setting up Exports/Public variables
28
- *****************************************************/
29
- exports.authWithToken = validateAuthWithToken;
30
- exports.validateAuthWithExtUser = validateAuthWithExtUser;
31
-
32
- /*********************************
33
- * Public Function definitions
34
- **********************************/
35
- function validateAuthWithToken(organizationId, token ,options) {
36
- var validate_options = {
37
- 'organization': organizationId,
38
- 'token': token,
39
- 'options': options
40
- };
41
-
42
- var validate_constraints = {
43
- "organization": {
44
- "isString": true,
45
- "presence": true
46
- },
47
- "token": {
48
- "isObject": true,
49
- "presence": true,
50
- "contains": ["access_token"]
51
- },
52
- "token.access_token": {
53
- "isString": true,
54
- "presence": true
55
- },
56
- "options": {
57
- "isObject": true
58
- }
59
- };
60
-
61
- return validate(validate_options, validate_constraints);
62
- };
63
-
64
- function validateAuthWithExtUser(organizationId, options) {
65
- var validate_options = {
66
- 'organization': organizationId,
67
- 'options': options
68
- };
69
-
70
- var validate_constraints = {
71
- "organization": {
72
- "isString": true,
73
- "presence": true
74
- },
75
- "options": {
76
- "isObject": true,
77
- "presence": true,
78
- "contains": ["ext_user_id"]
79
- },
80
- "options.ext_user_id": {
81
- "isString": true,
82
- "presence": true
83
- }
84
- };
85
-
86
- return validate(validate_options, validate_constraints);
87
- };
88
-
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 Token Module Validations
22
+ * This module contains validations for token manager module.
23
+ ************************************************************/
24
+ var validate = require('../helpers').validations.validate;
25
+
26
+ /****************************************************
27
+ * Setting up Exports/Public variables
28
+ *****************************************************/
29
+ exports.authWithToken = validateAuthWithToken;
30
+ exports.validateAuthWithExtUser = validateAuthWithExtUser;
31
+
32
+ /*********************************
33
+ * Public Function definitions
34
+ **********************************/
35
+ function validateAuthWithToken(organizationId, token ,options) {
36
+ var validate_options = {
37
+ 'organization': organizationId,
38
+ 'token': token,
39
+ 'options': options
40
+ };
41
+
42
+ var validate_constraints = {
43
+ "organization": {
44
+ "isString": true,
45
+ "presence": true
46
+ },
47
+ "token": {
48
+ "isObject": true,
49
+ "presence": true,
50
+ "contains": ["access_token"]
51
+ },
52
+ "token.access_token": {
53
+ "isString": true,
54
+ "presence": true
55
+ },
56
+ "options": {
57
+ "isObject": true
58
+ }
59
+ };
60
+
61
+ return validate(validate_options, validate_constraints);
62
+ };
63
+
64
+ function validateAuthWithExtUser(organizationId, options) {
65
+ var validate_options = {
66
+ 'organization': organizationId,
67
+ 'options': options
68
+ };
69
+
70
+ var validate_constraints = {
71
+ "organization": {
72
+ "isString": true,
73
+ "presence": true
74
+ },
75
+ "options": {
76
+ "isObject": true,
77
+ "presence": true,
78
+ "contains": ["ext_user_id"]
79
+ },
80
+ "options.ext_user_id": {
81
+ "isString": true,
82
+ "presence": true
83
+ }
84
+ };
85
+
86
+ return validate(validate_options, validate_constraints);
87
+ };
88
+