comprodls-sdk 2.89.0 → 2.90.3-development
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 +306 -731
- package/dist/comprodls-sdk.min.js +1 -1
- package/lib/config/index.js +3 -5
- package/lib/helpers/lib/errors.js +1 -1
- package/lib/services/auth/index.js +2 -178
- package/lib/services/authextn/index.js +111 -49
- package/lib/services/product/index.js +4 -12
- package/lib/services/pub/index.js +5 -12
- package/lib/services/pushX/index.js +128 -185
- package/lib/services/pushX/pubnubClientWrapper.js +3 -230
- package/lib/services/spaces/index.js +0 -5
- package/lib/services/spacesextn/index.js +1 -45
- package/lib/services/workflows/index.js +2 -4
- package/lib/services/xapi/index.js +43 -1
- package/package.json +2 -2
- package/test.js +38 -0
|
@@ -524,7 +524,6 @@ function provisionBulkSpaces(options) {
|
|
|
524
524
|
* *startdate: <epoch>,
|
|
525
525
|
* *enddate: <epoch>,
|
|
526
526
|
* description: 'string',
|
|
527
|
-
* ext_class_title : 'string',
|
|
528
527
|
* ext_data: {},
|
|
529
528
|
* limits: {
|
|
530
529
|
* *los: 0,
|
|
@@ -538,7 +537,6 @@ function provisionBulkSpaces(options) {
|
|
|
538
537
|
* clone_settings: {
|
|
539
538
|
* *src_ext_classid: 'string',
|
|
540
539
|
* products: boolean,
|
|
541
|
-
* bundles: boolean,
|
|
542
540
|
* assigned_paths: boolean,
|
|
543
541
|
* ext_assigned_path_id_rule: 'string' //enum: ['SRC_ID']
|
|
544
542
|
* advanced: {
|
|
@@ -552,9 +550,6 @@ function provisionBulkSpaces(options) {
|
|
|
552
550
|
* ],
|
|
553
551
|
* products: [
|
|
554
552
|
* { *productcode: 'string' },
|
|
555
|
-
* ],
|
|
556
|
-
* bundles: [
|
|
557
|
-
* { *bundlecode: 'string' },
|
|
558
553
|
* ]
|
|
559
554
|
* }
|
|
560
555
|
* }
|
|
@@ -44,8 +44,7 @@ var keepaliveAgent = new Agent({
|
|
|
44
44
|
function spacesextn(accountId) {
|
|
45
45
|
this.accountId = accountId;
|
|
46
46
|
return {
|
|
47
|
-
entitleBulkUsersToProducts: entitleBulkUsersToProducts.bind(this)
|
|
48
|
-
setupUser: setupUser.bind(this)
|
|
47
|
+
entitleBulkUsersToProducts: entitleBulkUsersToProducts.bind(this)
|
|
49
48
|
};
|
|
50
49
|
}
|
|
51
50
|
|
|
@@ -106,46 +105,3 @@ function entitleBulkUsersToProducts(options) {
|
|
|
106
105
|
return dfd.promise;
|
|
107
106
|
}
|
|
108
107
|
|
|
109
|
-
/**
|
|
110
|
-
* @param {
|
|
111
|
-
* *ext_user_id: "string",
|
|
112
|
-
* *workflow_type: "string",
|
|
113
|
-
* *<workflow_type>: {}
|
|
114
|
-
* } options
|
|
115
|
-
*/
|
|
116
|
-
function setupUser(options) {
|
|
117
|
-
var self = this;
|
|
118
|
-
//Initializing promise
|
|
119
|
-
var deferred = q.defer();
|
|
120
|
-
|
|
121
|
-
if (options && options.ext_user_id && options.workflow_type) {
|
|
122
|
-
//Passed all validations, Contruct API url
|
|
123
|
-
var url = self.config.DEFAULT_HOSTS.AUTHEXTN + self.config.AUTHEXTN_API_URLS.setupUser;
|
|
124
|
-
url = helpers.api.constructAPIUrl(url, { accountId: self.accountId });
|
|
125
|
-
|
|
126
|
-
var requestAPI = request.post(url)
|
|
127
|
-
.set('Content-Type', 'application/json')
|
|
128
|
-
.set('Accept', 'application/json')
|
|
129
|
-
.send(options);
|
|
130
|
-
|
|
131
|
-
if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
132
|
-
|
|
133
|
-
requestAPI
|
|
134
|
-
.agent(keepaliveAgent)
|
|
135
|
-
.end(function(err, res) {
|
|
136
|
-
if (err) {
|
|
137
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
138
|
-
deferred.reject(err);
|
|
139
|
-
} else {
|
|
140
|
-
deferred.resolve(res.body);
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
} else {
|
|
144
|
-
var err = {};
|
|
145
|
-
err.message = err.description = 'Mandatory field \'ext_user_id\' or \'workflow_type\' not found '+
|
|
146
|
-
'in the request options.';
|
|
147
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
148
|
-
deferred.reject(err);
|
|
149
|
-
}
|
|
150
|
-
return deferred.promise;
|
|
151
|
-
}
|
|
@@ -59,7 +59,6 @@ function workflows(accountId) {
|
|
|
59
59
|
"address": {
|
|
60
60
|
"city": "string",
|
|
61
61
|
"country": "string",
|
|
62
|
-
"line1": "string",
|
|
63
62
|
"street1": "string",
|
|
64
63
|
"street2": "string",
|
|
65
64
|
"street3": "string",
|
|
@@ -415,7 +414,6 @@ function completeAWorkflow(options) {
|
|
|
415
414
|
"address": {
|
|
416
415
|
"city": "string",
|
|
417
416
|
"country": "string",
|
|
418
|
-
"line1": "string",
|
|
419
417
|
"street1": "string",
|
|
420
418
|
"street2": "string",
|
|
421
419
|
"street3": "string",
|
|
@@ -425,7 +423,7 @@ function completeAWorkflow(options) {
|
|
|
425
423
|
"display_name": "string",
|
|
426
424
|
"school_key": "string"
|
|
427
425
|
}
|
|
428
|
-
}
|
|
426
|
+
}
|
|
429
427
|
}
|
|
430
428
|
*/
|
|
431
429
|
function updateWorkflowRequest(options) {
|
|
@@ -464,4 +462,4 @@ function updateWorkflowRequest(options) {
|
|
|
464
462
|
dfd.reject(err);
|
|
465
463
|
}
|
|
466
464
|
return dfd.promise;
|
|
467
|
-
}
|
|
465
|
+
}
|
|
@@ -42,7 +42,8 @@ function xapi(accountId) {
|
|
|
42
42
|
this.accountId = accountId;
|
|
43
43
|
return {
|
|
44
44
|
postStatement: postStatements.bind(this),
|
|
45
|
-
postExternalStatements: postExternalStatements.bind(this)
|
|
45
|
+
postExternalStatements: postExternalStatements.bind(this),
|
|
46
|
+
resetUserProductProgress: resetUserProductProgress.bind(this)
|
|
46
47
|
};
|
|
47
48
|
}
|
|
48
49
|
|
|
@@ -231,3 +232,44 @@ function postExternalStatements(options) {
|
|
|
231
232
|
});
|
|
232
233
|
return dfd.promise;
|
|
233
234
|
}
|
|
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/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.90.3-development",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Compro Technologies Private Limited",
|
|
7
7
|
"url": "http://www.comprotechnologies.com/"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"grunt": "^0.4.5",
|
|
25
25
|
"grunt-browserify": "^4.0.1",
|
|
26
26
|
"grunt-contrib-clean": "^1.0.0",
|
|
27
|
-
"grunt-contrib-uglify": "
|
|
27
|
+
"grunt-contrib-uglify": "^0.11.1",
|
|
28
28
|
"semver": "^5.1.0",
|
|
29
29
|
"shelljs": "^0.6.0"
|
|
30
30
|
}
|
package/test.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
var orgId = 'dev1';
|
|
3
|
+
|
|
4
|
+
var ComproDLS = require('../comprodls-sdk-js/lib/comprodls.js').init('DEVELOPMENT','GLOBAL');
|
|
5
|
+
|
|
6
|
+
var accountId = 'compro';
|
|
7
|
+
var tokenObj = {
|
|
8
|
+
// "access_token": "71a2d361-16b4-40b4-9a73-2499f808d7fe",
|
|
9
|
+
//"access_token" : "YWMtb2nasMuyEemJvL3ph9UnmAAAAW0KQNb1ziRGuAkJ_n6LweFX9KOhYaSQeKg~~5d5cf9be-cb5d-11e6-a329-0e34ffe5d91e", //student //YWMtw4m3tmsMEem5x6kSLL2ajAAAAWqQ3dJz4CkidQEwcm1LDszgrThOUuDLCkA~~5d5cf9be-cb5d-11e6-a329-0e34ffe5d91e
|
|
10
|
+
// "access_token" : "YWMtQAfQGHfCEemdBmGZgYqIcgAAAWrkJ96wsnysSc8M5ilW1ZI1jOeLo226vn8~~5d5cf9be-cb5d-11e6-a329-0e34ffe5d91e", //admin
|
|
11
|
+
// "expires_in": 604800,
|
|
12
|
+
// "refresh_token": "c002d2710236789e3f36d0b8670a07b684f44b4a43e9c4a322260c11390d37826a889053c876df0dc3ae49f4701cc27bdc42d77b62ec3735eaaf9ea35cc433f208aeb1d7003eddf38ec9ab418e40caa2fefb9fda6454a3b98daf9d911db4a4e8ca285a2dfbb395b7"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var self = this;
|
|
17
|
+
var Adapter = ComproDLS.AuthExtn(accountId);
|
|
18
|
+
|
|
19
|
+
var Options = {
|
|
20
|
+
"ext_user_id": "11jan_07",
|
|
21
|
+
"workflow_type": "org_entitlement",
|
|
22
|
+
"org_entitlement": {
|
|
23
|
+
"productcode": "evolve_l1",
|
|
24
|
+
"orgid": "dev1",
|
|
25
|
+
"dls_user_id": "71a2d361-16b4-40b4-9a73-2499f808d7fe",
|
|
26
|
+
"ext_role": "student"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
Adapter.setupUser(Options)
|
|
31
|
+
.then(function (res) {
|
|
32
|
+
console.log("^^^^^^^^^^^^^", res);
|
|
33
|
+
})
|
|
34
|
+
.catch(function (err) {
|
|
35
|
+
console.log("ERR CATCG", err);
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
|