comprodls-sdk 2.12.0 → 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 -11471
  5. package/dist/comprodls-sdk.min.js +14 -14
  6. package/grunt/publish.js +148 -148
  7. package/lib/comprodls.js +146 -146
  8. package/lib/config/index.js +337 -337
  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 -2541
  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 -279
  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,187 +1,187 @@
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 PUSH Adaptor
23
- * Functions for calling PUSH.
24
- ************************************************************/
25
-
26
- var EventEmitter = require("events").EventEmitter;
27
- var io = require('socket.io-client');
28
- var q = require('q');
29
-
30
- var helpers = require('../../helpers');
31
- var DLSError = helpers.errors.DLSError;
32
-
33
- /*********************************
34
- * Setting Up Module Entry Point
35
- **********************************/
36
- module.exports = push;
37
-
38
- /*********************************
39
- * Public Function definitions
40
- **********************************/
41
- function push() {
42
- return {
43
- "connect": _connect.bind(this)
44
- };
45
- }
46
-
47
- /*********************************
48
- * Public Function definitions
49
- **********************************/
50
- function _connect(orgId, userId) {
51
- //Reference to comproDLS SDK object, containing the token
52
- var self = this;
53
-
54
- //Initializing promise
55
- var dfd = q.defer();
56
-
57
- //Notification Event Constants
58
- var EVENTS = {
59
- //Events to listen
60
- "CONNECT": "push_connect", // Connection established
61
- "CONNECT_ERROR": "push_error", // Connection established
62
- "USER_NEW": "presence", // First time presence (all online users)
63
- "USER_CHANGED": "presenceupdate", //Presense update (changes only)
64
- "COLLAB_EVENT": "collab", //Collaboration event (Message / Post / Announcement)
65
- "ACTIVITY_EVENT": "activity", //Assessment / Test / Activity event (Timeout)
66
- "JOB_EVENT": "job", //Job status
67
- "SYSTEM_EVENT": "systemevents", // comproDLS System Events
68
- "ERROR": "error", // Custom Error of Push-Service
69
-
70
- //Events to emit
71
- "ACTIVEROOM": "activeroom"
72
-
73
- };
74
-
75
- //Setup connection URL based on AUTH style (token or userid)
76
- var pushConnectionURL;
77
-
78
- if(userId && orgId) {
79
- //All the namespaces on push service should be in lowercase
80
- orgId = orgId.toLowerCase();
81
-
82
- //Directly apply the userid passed to us
83
- pushConnectionURL = self.config.DEFAULT_HOSTS['PUSH'] + '/' + orgId + '?orgid=' + orgId + '&userid=' + userId;
84
- } else {
85
- //Validate the we have a valid AUTH credentials
86
- var err = helpers.validations.isAuthenticated(self.orgId, self.token);
87
- if (err) {
88
- dfd.reject(err);
89
- } else {
90
- pushConnectionURL = self.config.DEFAULT_HOSTS['PUSH'] + '/' + self.orgId.toLowerCase() + '?orgid=' + self.orgId.toLowerCase() + '&token=' + self.token.access_token;
91
- }
92
- }
93
-
94
- if(pushConnectionURL) {
95
-
96
- var socket = io.connect(pushConnectionURL);
97
-
98
- //Setup notifications handler, and return to the caller.
99
- var notifications = new EventEmitter();
100
-
101
- //----------- Handle events to be emitted to Push-Service
102
- notifications.on(EVENTS.ACTIVEROOM, function(activeroomid) {
103
- socket.emit(EVENTS.ACTIVEROOM, activeroomid);
104
- });
105
-
106
- dfd.resolve(notifications);
107
-
108
- socket.on('connect', function(){
109
- //Successfully connected to PUSH service, notify caller, via "notifications" Emiter
110
- var eventContext = {};
111
- notifications.emit(EVENTS.CONNECT, eventContext);
112
- });
113
-
114
- //----------- Handle Connection errors and notify caller, via "notifications" Emiter
115
- socket.on('connect_error', function(errObj){
116
-
117
- var eventContext = {};
118
- eventContext.error = {}
119
- eventContext.error.message ="connect_error"
120
- eventContext.error.description = "Connection Error to PUSH API, URL: " + pushConnectionURL + ", " + JSON.stringify(errObj);
121
-
122
- notifications.emit(EVENTS.CONNECT_ERROR, eventContext)
123
- });
124
-
125
- socket.on('connect_timeout', function(errObj){
126
-
127
- var eventContext = {};
128
- eventContext.error = {}
129
- eventContext.error.message ="connect_timeout"
130
- eventContext.error.description = "Timeout error to PUSH API, URL: " + pushConnectionURL + ", " + JSON.stringify(errObj);
131
-
132
- notifications.emit(EVENTS.CONNECT_ERROR, eventContext)
133
- });
134
-
135
- //----------- Handle comproDLS Push Notifications, send them to the caller via "notifications" Emiter
136
- socket.on('presence', function (presenceMessage) {
137
- var eventContext = presenceMessage;
138
- notifications.emit(EVENTS.USER_NEW, eventContext);
139
- });
140
- socket.on('presenceupdate', function (presenceUpdateMessage) {
141
- var eventContext = presenceUpdateMessage;
142
- notifications.emit(EVENTS.USER_CHANGED, eventContext);
143
- });
144
- socket.on('collab', function (collabMessage) {
145
- var eventContext = collabMessage;
146
- notifications.emit(EVENTS.COLLAB_EVENT, eventContext);
147
- });
148
- socket.on('activity', function (activityMessage) {
149
- var eventContext = activityMessage;
150
- notifications.emit(EVENTS.ACTIVITY_EVENT, eventContext);
151
- });
152
- socket.on('job', function (jobMessage) {
153
- var eventContext = jobMessage;
154
- notifications.emit(EVENTS.JOB_EVENT, eventContext);
155
- });
156
- socket.on('systemevents', function (systemEventMessage) {
157
- var eventContext = systemEventMessage;
158
- notifications.emit(EVENTS.SYSTEM_EVENT, eventContext);
159
- });
160
- socket.on('error', function(err) {
161
- var eventContext;
162
- try {
163
- eventContext = JSON.parse(err);
164
- } catch(Ex) {
165
- eventContext = new Error(err);
166
- }
167
- socket.disconnect();
168
- notifications.emit(EVENTS.ERROR, eventContext);
169
- });
170
- }
171
-
172
- return dfd.promise;
173
- }
174
-
175
- //for reference only
176
- function _setup(orgId, userId) {
177
- var dfd = q.defer();
178
-
179
- pubnubClientWrapper.setup({
180
- orgId: orgId, userId: userId,
181
- pubnub: this.config.DEFAULT_PUBNUB_CREDENTIALS
182
- })
183
- .then(function(pushAdapter) { dfd.resolve(pushAdapter); })
184
- .catch(function(error) { dfd.reject(error); });
185
-
186
- return dfd.promise;
187
- }
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 PUSH Adaptor
23
+ * Functions for calling PUSH.
24
+ ************************************************************/
25
+
26
+ var EventEmitter = require("events").EventEmitter;
27
+ var io = require('socket.io-client');
28
+ var q = require('q');
29
+
30
+ var helpers = require('../../helpers');
31
+ var DLSError = helpers.errors.DLSError;
32
+
33
+ /*********************************
34
+ * Setting Up Module Entry Point
35
+ **********************************/
36
+ module.exports = push;
37
+
38
+ /*********************************
39
+ * Public Function definitions
40
+ **********************************/
41
+ function push() {
42
+ return {
43
+ "connect": _connect.bind(this)
44
+ };
45
+ }
46
+
47
+ /*********************************
48
+ * Public Function definitions
49
+ **********************************/
50
+ function _connect(orgId, userId) {
51
+ //Reference to comproDLS SDK object, containing the token
52
+ var self = this;
53
+
54
+ //Initializing promise
55
+ var dfd = q.defer();
56
+
57
+ //Notification Event Constants
58
+ var EVENTS = {
59
+ //Events to listen
60
+ "CONNECT": "push_connect", // Connection established
61
+ "CONNECT_ERROR": "push_error", // Connection established
62
+ "USER_NEW": "presence", // First time presence (all online users)
63
+ "USER_CHANGED": "presenceupdate", //Presense update (changes only)
64
+ "COLLAB_EVENT": "collab", //Collaboration event (Message / Post / Announcement)
65
+ "ACTIVITY_EVENT": "activity", //Assessment / Test / Activity event (Timeout)
66
+ "JOB_EVENT": "job", //Job status
67
+ "SYSTEM_EVENT": "systemevents", // comproDLS System Events
68
+ "ERROR": "error", // Custom Error of Push-Service
69
+
70
+ //Events to emit
71
+ "ACTIVEROOM": "activeroom"
72
+
73
+ };
74
+
75
+ //Setup connection URL based on AUTH style (token or userid)
76
+ var pushConnectionURL;
77
+
78
+ if(userId && orgId) {
79
+ //All the namespaces on push service should be in lowercase
80
+ orgId = orgId.toLowerCase();
81
+
82
+ //Directly apply the userid passed to us
83
+ pushConnectionURL = self.config.DEFAULT_HOSTS['PUSH'] + '/' + orgId + '?orgid=' + orgId + '&userid=' + userId;
84
+ } else {
85
+ //Validate the we have a valid AUTH credentials
86
+ var err = helpers.validations.isAuthenticated(self.orgId, self.token);
87
+ if (err) {
88
+ dfd.reject(err);
89
+ } else {
90
+ pushConnectionURL = self.config.DEFAULT_HOSTS['PUSH'] + '/' + self.orgId.toLowerCase() + '?orgid=' + self.orgId.toLowerCase() + '&token=' + self.token.access_token;
91
+ }
92
+ }
93
+
94
+ if(pushConnectionURL) {
95
+
96
+ var socket = io.connect(pushConnectionURL);
97
+
98
+ //Setup notifications handler, and return to the caller.
99
+ var notifications = new EventEmitter();
100
+
101
+ //----------- Handle events to be emitted to Push-Service
102
+ notifications.on(EVENTS.ACTIVEROOM, function(activeroomid) {
103
+ socket.emit(EVENTS.ACTIVEROOM, activeroomid);
104
+ });
105
+
106
+ dfd.resolve(notifications);
107
+
108
+ socket.on('connect', function(){
109
+ //Successfully connected to PUSH service, notify caller, via "notifications" Emiter
110
+ var eventContext = {};
111
+ notifications.emit(EVENTS.CONNECT, eventContext);
112
+ });
113
+
114
+ //----------- Handle Connection errors and notify caller, via "notifications" Emiter
115
+ socket.on('connect_error', function(errObj){
116
+
117
+ var eventContext = {};
118
+ eventContext.error = {}
119
+ eventContext.error.message ="connect_error"
120
+ eventContext.error.description = "Connection Error to PUSH API, URL: " + pushConnectionURL + ", " + JSON.stringify(errObj);
121
+
122
+ notifications.emit(EVENTS.CONNECT_ERROR, eventContext)
123
+ });
124
+
125
+ socket.on('connect_timeout', function(errObj){
126
+
127
+ var eventContext = {};
128
+ eventContext.error = {}
129
+ eventContext.error.message ="connect_timeout"
130
+ eventContext.error.description = "Timeout error to PUSH API, URL: " + pushConnectionURL + ", " + JSON.stringify(errObj);
131
+
132
+ notifications.emit(EVENTS.CONNECT_ERROR, eventContext)
133
+ });
134
+
135
+ //----------- Handle comproDLS Push Notifications, send them to the caller via "notifications" Emiter
136
+ socket.on('presence', function (presenceMessage) {
137
+ var eventContext = presenceMessage;
138
+ notifications.emit(EVENTS.USER_NEW, eventContext);
139
+ });
140
+ socket.on('presenceupdate', function (presenceUpdateMessage) {
141
+ var eventContext = presenceUpdateMessage;
142
+ notifications.emit(EVENTS.USER_CHANGED, eventContext);
143
+ });
144
+ socket.on('collab', function (collabMessage) {
145
+ var eventContext = collabMessage;
146
+ notifications.emit(EVENTS.COLLAB_EVENT, eventContext);
147
+ });
148
+ socket.on('activity', function (activityMessage) {
149
+ var eventContext = activityMessage;
150
+ notifications.emit(EVENTS.ACTIVITY_EVENT, eventContext);
151
+ });
152
+ socket.on('job', function (jobMessage) {
153
+ var eventContext = jobMessage;
154
+ notifications.emit(EVENTS.JOB_EVENT, eventContext);
155
+ });
156
+ socket.on('systemevents', function (systemEventMessage) {
157
+ var eventContext = systemEventMessage;
158
+ notifications.emit(EVENTS.SYSTEM_EVENT, eventContext);
159
+ });
160
+ socket.on('error', function(err) {
161
+ var eventContext;
162
+ try {
163
+ eventContext = JSON.parse(err);
164
+ } catch(Ex) {
165
+ eventContext = new Error(err);
166
+ }
167
+ socket.disconnect();
168
+ notifications.emit(EVENTS.ERROR, eventContext);
169
+ });
170
+ }
171
+
172
+ return dfd.promise;
173
+ }
174
+
175
+ //for reference only
176
+ function _setup(orgId, userId) {
177
+ var dfd = q.defer();
178
+
179
+ pubnubClientWrapper.setup({
180
+ orgId: orgId, userId: userId,
181
+ pubnub: this.config.DEFAULT_PUBNUB_CREDENTIALS
182
+ })
183
+ .then(function(pushAdapter) { dfd.resolve(pushAdapter); })
184
+ .catch(function(error) { dfd.reject(error); });
185
+
186
+ return dfd.promise;
187
+ }