comprodls-sdk 2.102.0-thor → 2.103.0-qa.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 +54 -109
- package/dist/comprodls-sdk.min.js +1 -1
- package/lib/config/index.js +0 -2
- package/lib/helpers/lib/errors.js +1 -3
- package/lib/services/spaces/index.js +29 -35
- package/lib/services/spacesextn/index.js +1 -46
- package/lib/services/superuser/index.js +22 -22
- package/package.json +1 -1
package/dist/comprodls-sdk.js
CHANGED
|
@@ -289,7 +289,6 @@ exports.AUTH_API_URLS = {
|
|
|
289
289
|
validateSpaceCode: '/accounts/{accountid}/space-code/validate',
|
|
290
290
|
validateClassCode: '/accounts/{accountid}/class-code/validate',
|
|
291
291
|
joinInstituteSpace: '/accounts/{accountid}/join-institute-space',
|
|
292
|
-
provisionStudentInInstitutionalSpace: '/accounts/{accountid}/student/join-institute-space',
|
|
293
292
|
provisionSpacesToStudent: '/accounts/{accountId}/student/provision-spaces',
|
|
294
293
|
provisionSpacesToTeacher: '/accounts/{accountId}/teacher/provision-spaces',
|
|
295
294
|
shadowProvision: '/org/{orgId}/shadow-provision',
|
|
@@ -372,7 +371,6 @@ exports.AUTHEXTN_API_URLS = {
|
|
|
372
371
|
|
|
373
372
|
//Space related API
|
|
374
373
|
entitleBulkUsersToProducts: '/accounts/{accountid}/entitle-users/bulk',
|
|
375
|
-
deleteUserAccount : '/accounts/{accountid}/ext-users/{ext_user_id}',
|
|
376
374
|
|
|
377
375
|
// Assigned Path APIs
|
|
378
376
|
userAssignedPaths: '/org/{orgid}/classes/{classid}/assigned-paths/{assignedpathid}/enroll-user/multi',
|
|
@@ -733,9 +731,7 @@ function setupAPIToken(request, token) {
|
|
|
733
731
|
var ERROR_TYPES = {
|
|
734
732
|
API_ERROR: 'API_ERROR',
|
|
735
733
|
SDK_ERROR: 'SDK_ERROR',
|
|
736
|
-
CHANNEL_SUBSCRIPTION: 'CHANNEL_SUBSCRIPTION'
|
|
737
|
-
UNEXPECTED_ERROR: 'UNEXPECTED_ERROR',
|
|
738
|
-
POLLING_INITIATION: 'POLLING_INITIATION'
|
|
734
|
+
CHANNEL_SUBSCRIPTION: 'CHANNEL_SUBSCRIPTION'
|
|
739
735
|
};
|
|
740
736
|
|
|
741
737
|
var ERROR_CATEGORY = {
|
|
@@ -11304,45 +11300,39 @@ function changeSpaceCode(options) {
|
|
|
11304
11300
|
*/
|
|
11305
11301
|
function joinInstituteSpace(options) {
|
|
11306
11302
|
var self = this;
|
|
11303
|
+
// Initializing promise
|
|
11304
|
+
var dfd = q.defer();
|
|
11307
11305
|
|
|
11308
|
-
|
|
11309
|
-
|
|
11310
|
-
|
|
11311
|
-
|
|
11312
|
-
|
|
11313
|
-
|
|
11314
|
-
|
|
11315
|
-
self.config.AUTH_API_URLS.provisionStudentInInstitutionalSpace;
|
|
11316
|
-
}
|
|
11317
|
-
else {
|
|
11318
|
-
url = self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.joinInstituteSpace;
|
|
11319
|
-
}
|
|
11320
|
-
url = helpers.api.constructAPIUrl(url, { accountid : self.accountId });
|
|
11306
|
+
if(options && options.ext_user_id &&
|
|
11307
|
+
options.ext_role && options.space_code)
|
|
11308
|
+
{
|
|
11309
|
+
// Passed all validations, Contruct API url
|
|
11310
|
+
var url = self.config.DEFAULT_HOSTS.AUTH +
|
|
11311
|
+
self.config.AUTH_API_URLS.joinInstituteSpace;
|
|
11312
|
+
url = helpers.api.constructAPIUrl(url, { accountid : self.accountId });
|
|
11321
11313
|
|
|
11322
|
-
|
|
11323
|
-
|
|
11314
|
+
// Setup request with URL and Params
|
|
11315
|
+
var requestAPI = request.post(url)
|
|
11324
11316
|
.set('Content-Type', 'application/json')
|
|
11325
|
-
.set('Accept', 'application/json')
|
|
11326
|
-
|
|
11317
|
+
.set('Accept', 'application/json')
|
|
11318
|
+
.send(options);
|
|
11319
|
+
if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
11327
11320
|
|
|
11328
|
-
|
|
11329
|
-
|
|
11330
|
-
|
|
11331
|
-
|
|
11332
|
-
|
|
11333
|
-
|
|
11334
|
-
|
|
11335
|
-
|
|
11336
|
-
|
|
11337
|
-
|
|
11338
|
-
|
|
11339
|
-
|
|
11340
|
-
|
|
11341
|
-
|
|
11342
|
-
|
|
11343
|
-
reject(err);
|
|
11344
|
-
}
|
|
11345
|
-
});
|
|
11321
|
+
requestAPI.end(function(error, response) {
|
|
11322
|
+
if(error) {
|
|
11323
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
11324
|
+
dfd.reject(err);
|
|
11325
|
+
}
|
|
11326
|
+
else { dfd.resolve(response.body); }
|
|
11327
|
+
});
|
|
11328
|
+
} else {
|
|
11329
|
+
var err = {};
|
|
11330
|
+
err.message = err.description = 'ext_user_id or ext_role or space_code not found in request options.';
|
|
11331
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
11332
|
+
dfd.reject(err);
|
|
11333
|
+
}
|
|
11334
|
+
|
|
11335
|
+
return dfd.promise;
|
|
11346
11336
|
}
|
|
11347
11337
|
|
|
11348
11338
|
/**
|
|
@@ -12077,8 +12067,7 @@ function spacesextn(accountId) {
|
|
|
12077
12067
|
this.accountId = accountId;
|
|
12078
12068
|
return {
|
|
12079
12069
|
entitleBulkUsersToProducts: entitleBulkUsersToProducts.bind(this),
|
|
12080
|
-
setupUser: setupUser.bind(this)
|
|
12081
|
-
deleteUserAccount : deleteUserAccount.bind(this)
|
|
12070
|
+
setupUser: setupUser.bind(this)
|
|
12082
12071
|
};
|
|
12083
12072
|
}
|
|
12084
12073
|
|
|
@@ -12165,50 +12154,6 @@ function setupUser(options) {
|
|
|
12165
12154
|
}
|
|
12166
12155
|
return deferred.promise;
|
|
12167
12156
|
}
|
|
12168
|
-
|
|
12169
|
-
/**
|
|
12170
|
-
* Wiki Link for SDK params
|
|
12171
|
-
* https://github.com/comprodls/comprodls-sdk-js/wiki/04_AUTH-Adapter#getuserprofileparams
|
|
12172
|
-
*/
|
|
12173
|
-
function deleteUserAccount(options) {
|
|
12174
|
-
var self = this;
|
|
12175
|
-
return new Promise(function(resolve, reject) {
|
|
12176
|
-
|
|
12177
|
-
if (options.ext_user_id && options.body) {
|
|
12178
|
-
//Passed all validations, Contruct API url
|
|
12179
|
-
var url = self.config.DEFAULT_HOSTS.AUTHEXTN +
|
|
12180
|
-
self.config.AUTHEXTN_API_URLS.deleteUserAccount;
|
|
12181
|
-
url = helpers.api.constructAPIUrl(url, {
|
|
12182
|
-
accountid: self.accountId,
|
|
12183
|
-
ext_user_id: options.ext_user_id,
|
|
12184
|
-
});
|
|
12185
|
-
|
|
12186
|
-
// Setup request
|
|
12187
|
-
var requestAPI = request.delete(url)
|
|
12188
|
-
.set('Content-Type', 'application/json')
|
|
12189
|
-
.set('Accept', 'application/json');
|
|
12190
|
-
if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
12191
|
-
|
|
12192
|
-
requestAPI
|
|
12193
|
-
.send(options.body)
|
|
12194
|
-
.agent(keepaliveAgent)
|
|
12195
|
-
.end(function(error, response) {
|
|
12196
|
-
if (error) {
|
|
12197
|
-
var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
12198
|
-
reject(err);
|
|
12199
|
-
} else {
|
|
12200
|
-
resolve(response.body);
|
|
12201
|
-
}
|
|
12202
|
-
});
|
|
12203
|
-
} else {
|
|
12204
|
-
var err = {};
|
|
12205
|
-
err.description = 'Mandatory field \'ext_user_id\' or \'body\' in request options.';
|
|
12206
|
-
err.message = err.description;
|
|
12207
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
12208
|
-
reject(err);
|
|
12209
|
-
}
|
|
12210
|
-
});
|
|
12211
|
-
}
|
|
12212
12157
|
|
|
12213
12158
|
},{"../../helpers":3,"agentkeepalive":31,"q":36,"superagent":39}],25:[function(require,module,exports){
|
|
12214
12159
|
/*************************************************************************
|
|
@@ -12240,6 +12185,7 @@ var q = require('q');
|
|
|
12240
12185
|
var request = require('superagent');
|
|
12241
12186
|
|
|
12242
12187
|
var helpers = require('../../helpers');
|
|
12188
|
+
var requestLayer = require('../../helpers/lib/requestLayer');
|
|
12243
12189
|
|
|
12244
12190
|
var DLSError = helpers.errors.DLSError;
|
|
12245
12191
|
|
|
@@ -12261,34 +12207,33 @@ function superuser(accountId) {
|
|
|
12261
12207
|
*/
|
|
12262
12208
|
function getAllInstitutions(options) {
|
|
12263
12209
|
var self = this;
|
|
12264
|
-
// Initializing promise
|
|
12265
|
-
var dfd = q.defer();
|
|
12266
12210
|
|
|
12267
|
-
var url =
|
|
12268
|
-
|
|
12269
|
-
|
|
12211
|
+
var url = helpers.api.constructAPIUrl(
|
|
12212
|
+
self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.getAllInstitutions,
|
|
12213
|
+
{ accountid : self.accountId }
|
|
12214
|
+
);
|
|
12270
12215
|
|
|
12271
12216
|
var params = {};
|
|
12272
|
-
if(options) {
|
|
12273
|
-
if(options.lookup) { params.lookup = options.lookup; }
|
|
12274
|
-
if(options.
|
|
12275
|
-
if(options.
|
|
12217
|
+
if (options) {
|
|
12218
|
+
if (options.lookup) { params.lookup = options.lookup; }
|
|
12219
|
+
if (options.country) { params.country = options.country; }
|
|
12220
|
+
if (options.cursor) { params.cursor = options.cursor; }
|
|
12221
|
+
if (options.start) { params.start = options.start; }
|
|
12222
|
+
if (options.end) { params.end = options.end; }
|
|
12276
12223
|
}
|
|
12277
12224
|
|
|
12278
|
-
//
|
|
12279
|
-
var
|
|
12280
|
-
|
|
12281
|
-
|
|
12282
|
-
|
|
12283
|
-
|
|
12284
|
-
|
|
12285
|
-
|
|
12286
|
-
|
|
12287
|
-
|
|
12288
|
-
|
|
12225
|
+
// Prepare request parameters & execute request
|
|
12226
|
+
var reqOptions = {
|
|
12227
|
+
params: params,
|
|
12228
|
+
headers: { traceid: self.traceid }
|
|
12229
|
+
};
|
|
12230
|
+
return requestLayer.get(url, reqOptions)
|
|
12231
|
+
.then(function (response) {
|
|
12232
|
+
return response.body;
|
|
12233
|
+
})
|
|
12234
|
+
.catch(function (err) {
|
|
12235
|
+
throw new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
12289
12236
|
});
|
|
12290
|
-
|
|
12291
|
-
return dfd.promise;
|
|
12292
12237
|
}
|
|
12293
12238
|
|
|
12294
12239
|
/**
|
|
@@ -12372,7 +12317,7 @@ function provisionSpacesToSuperAdmin(options) {
|
|
|
12372
12317
|
return dfd.promise;
|
|
12373
12318
|
}
|
|
12374
12319
|
|
|
12375
|
-
},{"../../helpers":3,"q":36,"superagent":39}],26:[function(require,module,exports){
|
|
12320
|
+
},{"../../helpers":3,"../../helpers/lib/requestLayer":7,"q":36,"superagent":39}],26:[function(require,module,exports){
|
|
12376
12321
|
/*************************************************************************
|
|
12377
12322
|
*
|
|
12378
12323
|
* COMPRO CONFIDENTIAL
|