comprodls-sdk 2.43.0 → 2.44.0
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/dist/comprodls-sdk.js +6159 -15091
- package/dist/comprodls-sdk.min.js +19 -22
- package/lib/comprodls.js +0 -4
- package/lib/config/index.js +0 -5
- package/package.json +3 -5
- package/lib/services/push/index.js +0 -187
- package/lib/services/push/pubnubClientWrapper.js +0 -557
- package/lib/services/push/sessionStorage.js +0 -64
- package/lib/services/sisevents/index.js +0 -113
package/lib/comprodls.js
CHANGED
|
@@ -31,10 +31,8 @@ var collab = require('./services/collab');
|
|
|
31
31
|
var product = require('./services/product');
|
|
32
32
|
var xapi = require('./services/xapi');
|
|
33
33
|
var attempts = require('./services/attempts');
|
|
34
|
-
var push = require('./services/push');
|
|
35
34
|
var pushX = require('./services/pushX');
|
|
36
35
|
var pub = require('./services/pub');
|
|
37
|
-
var sisevents = require('./services/sisevents');
|
|
38
36
|
var lrs = require('./services/lrs');
|
|
39
37
|
var spaces = require('./services/spaces');
|
|
40
38
|
var config = require('./config');
|
|
@@ -138,9 +136,7 @@ comproDLS.prototype.Collab = collab;
|
|
|
138
136
|
comproDLS.prototype.Product = product;
|
|
139
137
|
comproDLS.prototype.Xapi = xapi;
|
|
140
138
|
comproDLS.prototype.Attempts = attempts;
|
|
141
|
-
comproDLS.prototype.Push = push;
|
|
142
139
|
comproDLS.prototype.Pub = pub;
|
|
143
|
-
comproDLS.prototype.SISEvents = sisevents;
|
|
144
140
|
comproDLS.prototype.LRS = lrs;
|
|
145
141
|
comproDLS.prototype.PushX = pushX;
|
|
146
142
|
comproDLS.prototype.Spaces = spaces;
|
package/lib/config/index.js
CHANGED
|
@@ -283,11 +283,6 @@ exports.ANALYTICS_API_URLS = {
|
|
|
283
283
|
getClassCustomComponentUserSubmission: '/{orgId}/class/custom-component/class-record/evaluations'
|
|
284
284
|
};
|
|
285
285
|
|
|
286
|
-
exports.SISEVENTS_API_URLS = {
|
|
287
|
-
postSingleSISEvent: '/{orgId}/events',
|
|
288
|
-
postMultiSISEvent: '/{orgId}/events/multi'
|
|
289
|
-
};
|
|
290
|
-
|
|
291
286
|
exports.COLLAB_API_URLS = {
|
|
292
287
|
postsInClassAPI: '/{orgId}/post/classes/{classId}',
|
|
293
288
|
postsInProductAPI: '/{orgId}/post/products/{productId}',
|
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.44.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Compro Technologies Private Limited",
|
|
7
7
|
"url": "http://www.comprotechnologies.com/"
|
|
@@ -13,14 +13,12 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"agentkeepalive": "4.2.0",
|
|
16
|
-
"extend": "
|
|
16
|
+
"extend": "3.0.2",
|
|
17
17
|
"pubnub": "7.0.1",
|
|
18
18
|
"q": "~1.4.1",
|
|
19
|
-
"socket.io-client": "1.4.5",
|
|
20
19
|
"string-template": "^1.0.0",
|
|
21
|
-
"superagent": "
|
|
20
|
+
"superagent": "2.0.0",
|
|
22
21
|
"tincanjs": "^0.50.0",
|
|
23
|
-
"underscore": "1.8.3",
|
|
24
22
|
"validate.js": "^0.9.0"
|
|
25
23
|
},
|
|
26
24
|
"devDependencies": {
|
|
@@ -1,187 +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
|
-
/***********************************************************
|
|
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
|
-
}
|