comprodls-sdk 2.111.0-thor.1 → 2.113.0-thor.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.
- package/dist/comprodls-sdk.js +191 -42
- package/dist/comprodls-sdk.min.js +1 -1
- package/lib/config/index.js +7 -2
- package/lib/services/analytics/index.js +83 -1
- package/lib/services/auth/index.js +28 -33
- package/lib/services/integrations/index.js +39 -1
- package/lib/services/xapi/index.js +31 -1
- package/package.json +1 -1
package/dist/comprodls-sdk.js
CHANGED
|
@@ -416,7 +416,11 @@ exports.ANALYTICS_API_URLS = {
|
|
|
416
416
|
getClassCustomComponentUserSubmission: '/{orgId}/class/custom-component/class-record/evaluations',
|
|
417
417
|
|
|
418
418
|
//CrossProductAggregation Related APIs
|
|
419
|
-
getCrossProductAggregation: '/{orgId}/class/cross-product-aggregation'
|
|
419
|
+
getCrossProductAggregation: '/{orgId}/class/cross-product-aggregation',
|
|
420
|
+
|
|
421
|
+
// MAP Aggregation Related APIs
|
|
422
|
+
getStudentAggregation: '/{orgId}/student/aggregation',
|
|
423
|
+
getTeacherAggregation: '/{orgId}/teacher/aggregation'
|
|
420
424
|
};
|
|
421
425
|
|
|
422
426
|
exports.PRODUCT_API_URLS = {
|
|
@@ -470,7 +474,8 @@ exports.INTEGRATIONS_API_URLS = {
|
|
|
470
474
|
auditTrail: '/accounts/{accountId}/audit-trail',
|
|
471
475
|
customEvents: '/accounts/{accountId}/custom-events',
|
|
472
476
|
schedules: '/accounts/{accountId}/context/{context}/schedule',
|
|
473
|
-
particularSchedule: '/accounts/{accountId}/context/{context}/schedule/{scheduleId}'
|
|
477
|
+
particularSchedule: '/accounts/{accountId}/context/{context}/schedule/{scheduleId}',
|
|
478
|
+
lifecycleEvents: '/accounts/{accountId}/lifecycle-events'
|
|
474
479
|
};
|
|
475
480
|
|
|
476
481
|
exports.DRIVE_API_URLS = {
|
|
@@ -1327,6 +1332,7 @@ var q = require('q');
|
|
|
1327
1332
|
var request = require('superagent');
|
|
1328
1333
|
var Agent = require('agentkeepalive');
|
|
1329
1334
|
|
|
1335
|
+
var requestLayer = require('../../helpers/lib/requestLayer');
|
|
1330
1336
|
var helpers = require('../../helpers');
|
|
1331
1337
|
var DLSError = helpers.errors.DLSError;
|
|
1332
1338
|
|
|
@@ -1373,7 +1379,11 @@ function analytics() {
|
|
|
1373
1379
|
getClassCustomComponentUserSubmission: getClassCustomComponentUserSubmission.bind(this),
|
|
1374
1380
|
|
|
1375
1381
|
//CrossProductAggregation Related APIs
|
|
1376
|
-
getCrossProductAggregation: getCrossProductAggregation.bind(this)
|
|
1382
|
+
getCrossProductAggregation: getCrossProductAggregation.bind(this),
|
|
1383
|
+
|
|
1384
|
+
//MAP Aggregation Related APIs
|
|
1385
|
+
getStudentAggregation: getStudentAggregation.bind(this),
|
|
1386
|
+
getTeacherAggregation: getTeacherAggregation.bind(this)
|
|
1377
1387
|
};
|
|
1378
1388
|
}
|
|
1379
1389
|
|
|
@@ -2663,8 +2673,85 @@ function getCrossProductAggregation(options) {
|
|
|
2663
2673
|
}
|
|
2664
2674
|
return dfd.promise;
|
|
2665
2675
|
}
|
|
2676
|
+
|
|
2677
|
+
/**
|
|
2678
|
+
* Wiki Link for SDK params
|
|
2679
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/06_ANALYTICS-Adapter#getstudentaggregationparams
|
|
2680
|
+
*/
|
|
2681
|
+
function getStudentAggregation(options) {
|
|
2682
|
+
var self = this;
|
|
2683
|
+
|
|
2684
|
+
let err = {};
|
|
2685
|
+
|
|
2686
|
+
// Validations
|
|
2687
|
+
if(!(options && options.studentid && options.courseid)) {
|
|
2688
|
+
err.message = err.description = 'Mandatory params: studentid/courseid' +
|
|
2689
|
+
' not found in request options.';
|
|
2690
|
+
return Promise.reject(new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err));
|
|
2691
|
+
} else {
|
|
2692
|
+
// Passed all validations, Constructing URL
|
|
2693
|
+
var url = self.config.DEFAULT_HOSTS.ANALYTICS +
|
|
2694
|
+
self.config.ANALYTICS_API_URLS.getStudentAggregation;
|
|
2695
|
+
url = helpers.api.constructAPIUrl(url, { orgId: self.orgId });
|
|
2696
|
+
|
|
2697
|
+
// Setup Query Params
|
|
2698
|
+
var queryParams = { courseId: options.courseid, studentId: options.studentid };
|
|
2699
|
+
|
|
2700
|
+
// Prepare request parameters & execute request
|
|
2701
|
+
let reqOptions = {
|
|
2702
|
+
params: queryParams,
|
|
2703
|
+
headers: { traceid: self.traceid, token: self.token }
|
|
2704
|
+
};
|
|
2705
|
+
return requestLayer.get(url, reqOptions)
|
|
2706
|
+
.then(function (response) {
|
|
2707
|
+
return response.body;
|
|
2708
|
+
})
|
|
2709
|
+
.catch(function (err) {
|
|
2710
|
+
throw new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
2711
|
+
});
|
|
2712
|
+
}
|
|
2713
|
+
|
|
2714
|
+
}
|
|
2715
|
+
|
|
2716
|
+
/**
|
|
2717
|
+
* Wiki Link for SDK params
|
|
2718
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/06_ANALYTICS-Adapter#getteacheraggregationparams
|
|
2719
|
+
*/
|
|
2720
|
+
function getTeacherAggregation(options) {
|
|
2721
|
+
var self = this;
|
|
2722
|
+
|
|
2723
|
+
let err = {};
|
|
2724
|
+
|
|
2725
|
+
// Validations
|
|
2726
|
+
if(!(options && options.teacherid)) {
|
|
2727
|
+
err.message = err.description = 'Mandatory params: teacherid not found in request options.';
|
|
2728
|
+
return Promise.reject(new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err));
|
|
2729
|
+
} else {
|
|
2730
|
+
// Passed all validations, Constructing URL
|
|
2731
|
+
var url = self.config.DEFAULT_HOSTS.ANALYTICS +
|
|
2732
|
+
self.config.ANALYTICS_API_URLS.getTeacherAggregation;
|
|
2733
|
+
url = helpers.api.constructAPIUrl(url, { orgId: self.orgId });
|
|
2734
|
+
|
|
2735
|
+
// Setup Query Params
|
|
2736
|
+
var queryParams = { teacherId: options.teacherid, studentId: options.studentid };
|
|
2737
|
+
|
|
2738
|
+
// Prepare request parameters & execute request
|
|
2739
|
+
let reqOptions = {
|
|
2740
|
+
params: queryParams,
|
|
2741
|
+
headers: { traceid: self.traceid, token: self.token }
|
|
2742
|
+
};
|
|
2743
|
+
return requestLayer.get(url, reqOptions)
|
|
2744
|
+
.then(function (response) {
|
|
2745
|
+
return response.body;
|
|
2746
|
+
})
|
|
2747
|
+
.catch(function (err) {
|
|
2748
|
+
throw new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
2749
|
+
});
|
|
2750
|
+
}
|
|
2751
|
+
|
|
2752
|
+
}
|
|
2666
2753
|
|
|
2667
|
-
},{"../../helpers":3,"agentkeepalive":31,"q":36,"superagent":39}],11:[function(require,module,exports){
|
|
2754
|
+
},{"../../helpers":3,"../../helpers/lib/requestLayer":7,"agentkeepalive":31,"q":36,"superagent":39}],11:[function(require,module,exports){
|
|
2668
2755
|
/*************************************************************************
|
|
2669
2756
|
*
|
|
2670
2757
|
* COMPRO CONFIDENTIAL
|
|
@@ -3087,6 +3174,7 @@ var Agent = require('agentkeepalive');
|
|
|
3087
3174
|
|
|
3088
3175
|
var helpers = require('../../helpers');
|
|
3089
3176
|
var converter = require('../../helpers/lib/api/converter');
|
|
3177
|
+
var requestLayer = require('../../helpers/lib/requestLayer');
|
|
3090
3178
|
|
|
3091
3179
|
var DLSError = helpers.errors.DLSError;
|
|
3092
3180
|
|
|
@@ -3234,43 +3322,37 @@ function getUserProfile(options) {
|
|
|
3234
3322
|
*/
|
|
3235
3323
|
function deleteUserProfile(options) {
|
|
3236
3324
|
var self = this;
|
|
3237
|
-
var dfd = q.defer();
|
|
3238
|
-
|
|
3239
|
-
// Validations
|
|
3240
|
-
var err = helpers.validations.isAuthenticated(self.orgId, self.token);
|
|
3241
|
-
if(err) { dfd.reject(err); }
|
|
3242
|
-
else {
|
|
3243
|
-
if (options.userid) {
|
|
3244
|
-
var userid = options.userid;
|
|
3245
3325
|
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3326
|
+
// Authenticate token
|
|
3327
|
+
var error = helpers.validations.isAuthenticatedV2(self.orgId, self.token);
|
|
3328
|
+
if (error) {
|
|
3329
|
+
return Promise.reject(error);
|
|
3330
|
+
}
|
|
3331
|
+
// Validate userid
|
|
3332
|
+
if (!(options && options.userid)) {
|
|
3333
|
+
var err = {};
|
|
3334
|
+
err.message = err.description = 'Mandatory parameter userid not found in request options.';
|
|
3335
|
+
return Promise.reject(new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err));
|
|
3336
|
+
}
|
|
3254
3337
|
|
|
3255
|
-
// Setup token in Authorization header
|
|
3256
|
-
requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
|
|
3257
3338
|
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
} else {
|
|
3267
|
-
err = {};
|
|
3268
|
-
err.message = err.description = 'Mandatory parameter userid not found in request options.';
|
|
3269
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
3270
|
-
dfd.reject(err);
|
|
3271
|
-
}
|
|
3339
|
+
// Construct API URL
|
|
3340
|
+
var url = helpers.api.constructAPIUrl(
|
|
3341
|
+
self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.userInfoAPI,
|
|
3342
|
+
{ orgId: self.orgId, userId: options.userid }
|
|
3343
|
+
);
|
|
3344
|
+
var reqOptions = {
|
|
3345
|
+
params: options,
|
|
3346
|
+
headers: { traceid: self.traceid, token: self.token }
|
|
3272
3347
|
}
|
|
3273
|
-
|
|
3348
|
+
// Prepare request
|
|
3349
|
+
return requestLayer.delete(url, reqOptions)
|
|
3350
|
+
.then(function (response) {
|
|
3351
|
+
return response.body;
|
|
3352
|
+
})
|
|
3353
|
+
.catch(function (err) {
|
|
3354
|
+
throw new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
3355
|
+
});
|
|
3274
3356
|
}
|
|
3275
3357
|
|
|
3276
3358
|
/**
|
|
@@ -6765,7 +6847,7 @@ function getAllCustomComponents(options) {
|
|
|
6765
6847
|
return deferred.promise;
|
|
6766
6848
|
}
|
|
6767
6849
|
|
|
6768
|
-
},{"../../helpers":3,"../../helpers/lib/api/converter":4,"agentkeepalive":31,"q":36,"superagent":39}],13:[function(require,module,exports){
|
|
6850
|
+
},{"../../helpers":3,"../../helpers/lib/api/converter":4,"../../helpers/lib/requestLayer":7,"agentkeepalive":31,"q":36,"superagent":39}],13:[function(require,module,exports){
|
|
6769
6851
|
/*************************************************************************
|
|
6770
6852
|
*
|
|
6771
6853
|
* COMPRO CONFIDENTIAL
|
|
@@ -8378,6 +8460,7 @@ var q = require('q');
|
|
|
8378
8460
|
var request = require('superagent');
|
|
8379
8461
|
var Agent = require('agentkeepalive');
|
|
8380
8462
|
|
|
8463
|
+
var requestLayer = require('../../helpers/lib/requestLayer');
|
|
8381
8464
|
var helpers = require('../../helpers');
|
|
8382
8465
|
var converter = require('../../helpers/lib/api/converter');
|
|
8383
8466
|
|
|
@@ -8403,7 +8486,8 @@ function integrations(accountId) {
|
|
|
8403
8486
|
createSchedule: createSchedule.bind(this),
|
|
8404
8487
|
getSchedule: getSchedule.bind(this),
|
|
8405
8488
|
updateSchedule: updateSchedule.bind(this),
|
|
8406
|
-
deleteSchedule: deleteSchedule.bind(this)
|
|
8489
|
+
deleteSchedule: deleteSchedule.bind(this),
|
|
8490
|
+
publishLifecycleEvent: publishLifecycleEvent.bind(this)
|
|
8407
8491
|
};
|
|
8408
8492
|
}
|
|
8409
8493
|
|
|
@@ -8829,8 +8913,44 @@ function deleteSchedule(options) {
|
|
|
8829
8913
|
|
|
8830
8914
|
return deferred.promise;
|
|
8831
8915
|
}
|
|
8916
|
+
|
|
8917
|
+
/**
|
|
8918
|
+
* Wiki Link for SDK params
|
|
8919
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/22_Integrations-Adapter#publishlifecycleeventparams
|
|
8920
|
+
*/
|
|
8921
|
+
function publishLifecycleEvent(options) {
|
|
8922
|
+
let self = this;
|
|
8923
|
+
|
|
8924
|
+
// Validate productcode
|
|
8925
|
+
if (!(options && options.category && options.action && options.timestamp &&
|
|
8926
|
+
options.data && options.ext_actor_id)) {
|
|
8927
|
+
let err = {};
|
|
8928
|
+
err.message = err.description = 'Mandatory params: category/action/timestamp' +
|
|
8929
|
+
'/data/ext_actor_id not found in request options.';
|
|
8930
|
+
return Promise.reject(new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err));
|
|
8931
|
+
}
|
|
8932
|
+
|
|
8933
|
+
// Construct API URL
|
|
8934
|
+
let url = helpers.api.constructAPIUrl(
|
|
8935
|
+
self.config.DEFAULT_HOSTS.INTEGRATION + self.config.INTEGRATIONS_API_URLS.lifecycleEvents,
|
|
8936
|
+
{ accountId: self.accountId }
|
|
8937
|
+
);
|
|
8938
|
+
|
|
8939
|
+
// Prepare request parameters & execute request
|
|
8940
|
+
let reqOptions = {
|
|
8941
|
+
params: options,
|
|
8942
|
+
headers: { traceid: self.traceid }
|
|
8943
|
+
};
|
|
8944
|
+
return requestLayer.post(url, reqOptions)
|
|
8945
|
+
.then(function (response) {
|
|
8946
|
+
return response.body;
|
|
8947
|
+
})
|
|
8948
|
+
.catch(function (err) {
|
|
8949
|
+
throw new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
8950
|
+
});
|
|
8951
|
+
}
|
|
8832
8952
|
|
|
8833
|
-
},{"../../helpers":3,"../../helpers/lib/api/converter":4,"agentkeepalive":31,"q":36,"superagent":39}],17:[function(require,module,exports){
|
|
8953
|
+
},{"../../helpers":3,"../../helpers/lib/api/converter":4,"../../helpers/lib/requestLayer":7,"agentkeepalive":31,"q":36,"superagent":39}],17:[function(require,module,exports){
|
|
8834
8954
|
/*************************************************************************
|
|
8835
8955
|
*
|
|
8836
8956
|
* COMPRO CONFIDENTIAL
|
|
@@ -13306,7 +13426,8 @@ function xapi(accountId) {
|
|
|
13306
13426
|
this.accountId = accountId;
|
|
13307
13427
|
return {
|
|
13308
13428
|
postStatement: postStatements.bind(this),
|
|
13309
|
-
postExternalStatements: postExternalStatements.bind(this)
|
|
13429
|
+
postExternalStatements: postExternalStatements.bind(this),
|
|
13430
|
+
postSchoolStatement: postSchoolStatements.bind(this)
|
|
13310
13431
|
};
|
|
13311
13432
|
}
|
|
13312
13433
|
|
|
@@ -13380,7 +13501,35 @@ function postExternalStatements(options) {
|
|
|
13380
13501
|
});
|
|
13381
13502
|
return dfd.promise;
|
|
13382
13503
|
}
|
|
13383
|
-
|
|
13504
|
+
|
|
13505
|
+
/**
|
|
13506
|
+
* Wiki Link for SDK params
|
|
13507
|
+
* https://github.com/comprodls/comprodls-sdk-js/wiki/08_XAPI-Adapter#postschoolstatementsparams
|
|
13508
|
+
*/
|
|
13509
|
+
function postSchoolStatements(options) {
|
|
13510
|
+
var self = this;
|
|
13511
|
+
var dfd = q.defer();
|
|
13512
|
+
|
|
13513
|
+
var url = self.config.DEFAULT_HOSTS.XAPI + self.config.XAPI_API_URLS.postSchoolStatements;
|
|
13514
|
+
url = helpers.api.constructAPIUrl(url, { orgId: self.orgId });
|
|
13515
|
+
//Passed all validations, Construct API url
|
|
13516
|
+
|
|
13517
|
+
//Setup request with URL and Params
|
|
13518
|
+
var requestAPI = request.post(url).send(options);
|
|
13519
|
+
|
|
13520
|
+
if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
13521
|
+
|
|
13522
|
+
//Call Product Timespent Api
|
|
13523
|
+
|
|
13524
|
+
requestAPI.end(function(err, response) {
|
|
13525
|
+
if(err) {
|
|
13526
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
13527
|
+
dfd.reject(err);
|
|
13528
|
+
}
|
|
13529
|
+
else { dfd.resolve(response.body); }
|
|
13530
|
+
});
|
|
13531
|
+
return dfd.promise;
|
|
13532
|
+
}
|
|
13384
13533
|
},{"../../helpers":3,"q":36,"superagent":39}],29:[function(require,module,exports){
|
|
13385
13534
|
/*************************************************************************
|
|
13386
13535
|
*
|