comprodls-sdk 2.102.0-thor → 2.104.0-valky
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 +82 -322
- package/dist/comprodls-sdk.min.js +1 -1
- package/lib/config/index.js +12 -2
- package/lib/helpers/lib/errors.js +1 -3
- package/lib/services/authextn/index.js +0 -40
- package/lib/services/spaces/index.js +29 -36
- package/lib/services/spacesextn/index.js +1 -46
- package/package.json +1 -1
package/lib/config/index.js
CHANGED
|
@@ -54,6 +54,18 @@ exports.REALM_HOSTS = {
|
|
|
54
54
|
ANALYTICS: 'http://dls-asgard-thor-1453383019.us-west-2.elb.amazonaws.com/lb-analytics',
|
|
55
55
|
INTEGRATION: 'http://dls-asgard-thor-1453383019.us-west-2.elb.amazonaws.com/lb-integrations',
|
|
56
56
|
DRIVE: 'http://dls-asgard-thor-1453383019.us-west-2.elb.amazonaws.com/lb-drive'
|
|
57
|
+
},
|
|
58
|
+
VALKY: {
|
|
59
|
+
PUB: 'http://internal-dls-asgard-valky-1830585247.us-west-2.elb.amazonaws.com/lb-pub',
|
|
60
|
+
AUTH: 'http://internal-dls-asgard-valky-1830585247.us-west-2.elb.amazonaws.com/lb-auth',
|
|
61
|
+
AUTHEXTN: 'http://internal-dls-asgard-valky-1830585247.us-west-2.elb.amazonaws.com/lb-authextn',
|
|
62
|
+
PUSHX: 'http://internal-dls-asgard-valky-1830585247.us-west-2.elb.amazonaws.com/lb-pushx',
|
|
63
|
+
XAPI: 'http://internal-dls-asgard-valky-1830585247.us-west-2.elb.amazonaws.com/lb-xapi',
|
|
64
|
+
ATTEMPTS: 'http://internal-dls-asgard-valky-1830585247.us-west-2.elb.amazonaws.com/lb-attempts',
|
|
65
|
+
PRODUCT: 'http://internal-dls-asgard-valky-1830585247.us-west-2.elb.amazonaws.com/lb-product',
|
|
66
|
+
ANALYTICS: 'http://internal-dls-asgard-valky-1830585247.us-west-2.elb.amazonaws.com/lb-analytics',
|
|
67
|
+
INTEGRATION: 'http://internal-dls-asgard-valky-1830585247.us-west-2.elb.amazonaws.com/lb-integrations',
|
|
68
|
+
DRIVE: 'http://internal-dls-asgard-valky-1830585247.us-west-2.elb.amazonaws.com/lb-drive'
|
|
57
69
|
}
|
|
58
70
|
},
|
|
59
71
|
CUP: {
|
|
@@ -154,7 +166,6 @@ exports.AUTH_API_URLS = {
|
|
|
154
166
|
validateSpaceCode: '/accounts/{accountid}/space-code/validate',
|
|
155
167
|
validateClassCode: '/accounts/{accountid}/class-code/validate',
|
|
156
168
|
joinInstituteSpace: '/accounts/{accountid}/join-institute-space',
|
|
157
|
-
provisionStudentInInstitutionalSpace: '/accounts/{accountid}/student/join-institute-space',
|
|
158
169
|
provisionSpacesToStudent: '/accounts/{accountId}/student/provision-spaces',
|
|
159
170
|
provisionSpacesToTeacher: '/accounts/{accountId}/teacher/provision-spaces',
|
|
160
171
|
shadowProvision: '/org/{orgId}/shadow-provision',
|
|
@@ -237,7 +248,6 @@ exports.AUTHEXTN_API_URLS = {
|
|
|
237
248
|
|
|
238
249
|
//Space related API
|
|
239
250
|
entitleBulkUsersToProducts: '/accounts/{accountid}/entitle-users/bulk',
|
|
240
|
-
deleteUserAccount : '/accounts/{accountid}/ext-users/{ext_user_id}',
|
|
241
251
|
|
|
242
252
|
// Assigned Path APIs
|
|
243
253
|
userAssignedPaths: '/org/{orgid}/classes/{classid}/assigned-paths/{assignedpathid}/enroll-user/multi',
|
|
@@ -27,9 +27,7 @@
|
|
|
27
27
|
var ERROR_TYPES = {
|
|
28
28
|
API_ERROR: 'API_ERROR',
|
|
29
29
|
SDK_ERROR: 'SDK_ERROR',
|
|
30
|
-
CHANNEL_SUBSCRIPTION: 'CHANNEL_SUBSCRIPTION'
|
|
31
|
-
UNEXPECTED_ERROR: 'UNEXPECTED_ERROR',
|
|
32
|
-
POLLING_INITIATION: 'POLLING_INITIATION'
|
|
30
|
+
CHANNEL_SUBSCRIPTION: 'CHANNEL_SUBSCRIPTION'
|
|
33
31
|
};
|
|
34
32
|
|
|
35
33
|
var ERROR_CATEGORY = {
|
|
@@ -27,7 +27,6 @@ var q = require('q');
|
|
|
27
27
|
var request = require('superagent');
|
|
28
28
|
var helpers = require('../../helpers');
|
|
29
29
|
var Agent = require('agentkeepalive');
|
|
30
|
-
var requestLayer = require('../../helpers/lib/requestLayer');
|
|
31
30
|
|
|
32
31
|
var DLSError = helpers.errors.DLSError;
|
|
33
32
|
|
|
@@ -64,7 +63,6 @@ function authextn() {
|
|
|
64
63
|
// Org Entitlement related APIs
|
|
65
64
|
createOrgProductEntitlement: createOrgProductEntitlement.bind(this),
|
|
66
65
|
updateOrgProductEntitlement: updateOrgProductEntitlement.bind(this),
|
|
67
|
-
deleteOrgProductEntitlement: deleteOrgProductEntitlement.bind(this),
|
|
68
66
|
getParticularOrgProductEntitlement: getParticularOrgProductEntitlement.bind(this),
|
|
69
67
|
getAllOrgProductEntitlements: getAllOrgProductEntitlements.bind(this)
|
|
70
68
|
};
|
|
@@ -914,44 +912,6 @@ function updateOrgProductEntitlement(options) {
|
|
|
914
912
|
return dfd.promise;
|
|
915
913
|
}
|
|
916
914
|
|
|
917
|
-
/**
|
|
918
|
-
* Wiki Link for SDK params
|
|
919
|
-
* https://github.com/comprodls/comprodls-sdk-js/wiki/28_AUTHEXTN-Adapter#deleteorgproductentitlementparams
|
|
920
|
-
*/
|
|
921
|
-
function deleteOrgProductEntitlement(options) {
|
|
922
|
-
var self = this;
|
|
923
|
-
|
|
924
|
-
// Validate productcode
|
|
925
|
-
if (!(options && options.productcode)) {
|
|
926
|
-
var err = {};
|
|
927
|
-
err.message = err.description = 'Mandatory param: productcode not found in request options.';
|
|
928
|
-
return Promise.reject(new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err));
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
// Authenticate token
|
|
932
|
-
var error = helpers.validations.isAuthenticatedV2(self.orgId, self.token);
|
|
933
|
-
if (error) { return Promise.reject(error); }
|
|
934
|
-
|
|
935
|
-
// Construct API URL
|
|
936
|
-
var url = helpers.api.constructAPIUrl(
|
|
937
|
-
self.config.DEFAULT_HOSTS.AUTHEXTN + self.config.AUTHEXTN_API_URLS.orgProductEntitlement,
|
|
938
|
-
{ orgid: self.orgId }
|
|
939
|
-
);
|
|
940
|
-
|
|
941
|
-
// Prepare request parameters & execute request
|
|
942
|
-
var reqOptions = {
|
|
943
|
-
params: options,
|
|
944
|
-
headers: { traceid: self.traceid, token: self.token }
|
|
945
|
-
};
|
|
946
|
-
return requestLayer.delete(url, reqOptions)
|
|
947
|
-
.then(function (response) {
|
|
948
|
-
return response.body;
|
|
949
|
-
})
|
|
950
|
-
.catch(function (err) {
|
|
951
|
-
throw new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
|
|
952
|
-
});
|
|
953
|
-
}
|
|
954
|
-
|
|
955
915
|
/**
|
|
956
916
|
* Wiki Link for SDK params
|
|
957
917
|
* https://github.com/comprodls/comprodls-sdk-js/wiki/28_AUTHEXTN-Adapter#getparticularorgproductentitlementparams
|
|
@@ -277,45 +277,39 @@ function changeSpaceCode(options) {
|
|
|
277
277
|
*/
|
|
278
278
|
function joinInstituteSpace(options) {
|
|
279
279
|
var self = this;
|
|
280
|
+
// Initializing promise
|
|
281
|
+
var dfd = q.defer();
|
|
280
282
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
self.config.AUTH_API_URLS.provisionStudentInInstitutionalSpace;
|
|
289
|
-
}
|
|
290
|
-
else {
|
|
291
|
-
url = self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.joinInstituteSpace;
|
|
292
|
-
}
|
|
293
|
-
url = helpers.api.constructAPIUrl(url, { accountid : self.accountId });
|
|
283
|
+
if(options && options.ext_user_id &&
|
|
284
|
+
options.ext_role && options.space_code)
|
|
285
|
+
{
|
|
286
|
+
// Passed all validations, Contruct API url
|
|
287
|
+
var url = self.config.DEFAULT_HOSTS.AUTH +
|
|
288
|
+
self.config.AUTH_API_URLS.joinInstituteSpace;
|
|
289
|
+
url = helpers.api.constructAPIUrl(url, { accountid : self.accountId });
|
|
294
290
|
|
|
295
|
-
|
|
296
|
-
|
|
291
|
+
// Setup request with URL and Params
|
|
292
|
+
var requestAPI = request.post(url)
|
|
297
293
|
.set('Content-Type', 'application/json')
|
|
298
|
-
.set('Accept', 'application/json')
|
|
299
|
-
|
|
294
|
+
.set('Accept', 'application/json')
|
|
295
|
+
.send(options);
|
|
296
|
+
if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
300
297
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
reject(err);
|
|
317
|
-
}
|
|
318
|
-
});
|
|
298
|
+
requestAPI.end(function(error, response) {
|
|
299
|
+
if(error) {
|
|
300
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
301
|
+
dfd.reject(err);
|
|
302
|
+
}
|
|
303
|
+
else { dfd.resolve(response.body); }
|
|
304
|
+
});
|
|
305
|
+
} else {
|
|
306
|
+
var err = {};
|
|
307
|
+
err.message = err.description = 'ext_user_id or ext_role or space_code not found in request options.';
|
|
308
|
+
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
309
|
+
dfd.reject(err);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return dfd.promise;
|
|
319
313
|
}
|
|
320
314
|
|
|
321
315
|
/**
|
|
@@ -855,7 +849,6 @@ function updateUserInformation(options) {
|
|
|
855
849
|
};
|
|
856
850
|
if(options.ref_id) { bodyParams.ref_id = options.ref_id; }
|
|
857
851
|
if(options.ext_email) { bodyParams.ext_email = options.ext_email; }
|
|
858
|
-
if(options.ext_username) { bodyParams.ext_username = options.ext_username; }
|
|
859
852
|
if(options.ext_first_name) { bodyParams.ext_first_name = options.ext_first_name; }
|
|
860
853
|
if(options.ext_last_name) { bodyParams.ext_last_name = options.ext_last_name; }
|
|
861
854
|
if(options.address) { bodyParams.address = options.address; }
|
|
@@ -42,8 +42,7 @@ function spacesextn(accountId) {
|
|
|
42
42
|
this.accountId = accountId;
|
|
43
43
|
return {
|
|
44
44
|
entitleBulkUsersToProducts: entitleBulkUsersToProducts.bind(this),
|
|
45
|
-
setupUser: setupUser.bind(this)
|
|
46
|
-
deleteUserAccount : deleteUserAccount.bind(this)
|
|
45
|
+
setupUser: setupUser.bind(this)
|
|
47
46
|
};
|
|
48
47
|
}
|
|
49
48
|
|
|
@@ -130,47 +129,3 @@ function setupUser(options) {
|
|
|
130
129
|
}
|
|
131
130
|
return deferred.promise;
|
|
132
131
|
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Wiki Link for SDK params
|
|
136
|
-
* https://github.com/comprodls/comprodls-sdk-js/wiki/04_AUTH-Adapter#getuserprofileparams
|
|
137
|
-
*/
|
|
138
|
-
function deleteUserAccount(options) {
|
|
139
|
-
var self = this;
|
|
140
|
-
return new Promise(function(resolve, reject) {
|
|
141
|
-
|
|
142
|
-
if (options.ext_user_id && options.body) {
|
|
143
|
-
//Passed all validations, Contruct API url
|
|
144
|
-
var url = self.config.DEFAULT_HOSTS.AUTHEXTN +
|
|
145
|
-
self.config.AUTHEXTN_API_URLS.deleteUserAccount;
|
|
146
|
-
url = helpers.api.constructAPIUrl(url, {
|
|
147
|
-
accountid: self.accountId,
|
|
148
|
-
ext_user_id: options.ext_user_id,
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
// Setup request
|
|
152
|
-
var requestAPI = request.delete(url)
|
|
153
|
-
.set('Content-Type', 'application/json')
|
|
154
|
-
.set('Accept', 'application/json');
|
|
155
|
-
if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
|
|
156
|
-
|
|
157
|
-
requestAPI
|
|
158
|
-
.send(options.body)
|
|
159
|
-
.agent(keepaliveAgent)
|
|
160
|
-
.end(function(error, response) {
|
|
161
|
-
if (error) {
|
|
162
|
-
var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
|
|
163
|
-
reject(err);
|
|
164
|
-
} else {
|
|
165
|
-
resolve(response.body);
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
} else {
|
|
169
|
-
var err = {};
|
|
170
|
-
err.description = 'Mandatory field \'ext_user_id\' or \'body\' in request options.';
|
|
171
|
-
err.message = err.description;
|
|
172
|
-
err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
|
|
173
|
-
reject(err);
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
}
|
package/package.json
CHANGED