comprodls-sdk 2.86.2-valky → 2.90.2

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.
@@ -26,7 +26,6 @@
26
26
 
27
27
  var q = require('q');
28
28
  var request = require('superagent');
29
- var Agent = require('agentkeepalive');
30
29
 
31
30
  var helpers = require('../../helpers');
32
31
  var pubnubClientWrapper = require('./pubnubClientWrapper');
@@ -37,25 +36,18 @@ var DLSError = helpers.errors.DLSError;
37
36
  **********************************/
38
37
  module.exports = pushX;
39
38
 
40
- var keepaliveAgent = new Agent({
41
- timeout: 60000,
42
- freeSocketTimeout: 30000
43
- });
44
-
45
39
  /*********************************
46
40
  * Public Function definitions
47
41
  **********************************/
48
42
  function pushX() {
49
- var _pubnubClientWrapper = pubnubClientWrapper();
50
- return {
51
- "connect": _connect.bind(this, _pubnubClientWrapper),
52
- "cleanup": _cleanup.bind(this, _pubnubClientWrapper),
53
- "grantByUserOrgId": grantByUserOrgId.bind(this),
54
- "grantByAccountId": grantByAccountId.bind(this),
55
- "grantByAccountIdOnExtUserId": grantByAccountIdOnExtUserId.bind(this),
56
- "grantV2": grantV2.bind(this),
57
- "getPushedEvents": getPushedEvents.bind(this)
58
- };
43
+ var _pubnubClientWrapper = pubnubClientWrapper();
44
+ return {
45
+ "connect": _connect.bind(this, _pubnubClientWrapper),
46
+ "cleanup": _cleanup.bind(this, _pubnubClientWrapper),
47
+ "grantByUserOrgId": grantByUserOrgId.bind(this),
48
+ "grantByAccountId": grantByAccountId.bind(this),
49
+ "grantByAccountIdOnExtUserId": grantByAccountIdOnExtUserId.bind(this)
50
+ };
59
51
  }
60
52
 
61
53
  /*********************************
@@ -63,190 +55,144 @@ function pushX() {
63
55
  **********************************/
64
56
 
65
57
  function _connect(pubnubCW, options) {
66
- var bpubnubV7 = true; // If pubnub v7 or higher in package.json, set it true
67
- if (bpubnubV7 && !options.userid) {
68
- var err = {};
69
- err.message = err.description = 'Mandatory parameter userid not found in request options.';
70
- err = new DLSError(helpers.errors.ERROR_TYPES.PUSHX_ERROR, err);
71
- throw err;
72
- }
73
-
74
- // Adding SSL flag
75
- return pubnubCW.setup({
76
- 'userid': options.userid,
77
- 'accountid': options.accountid,
78
- 'token': options.token,
79
- 'pubnub': {
80
- 'publishKey': options.publishKey,
81
- 'subscribeKey': options.subscribeKey,
82
- 'ssl': true,
83
- 'suppressLeaveEvents': true
58
+ var bpubnubV7 = true; // If pubnub v7 or higher in package.json, set it true
59
+ if (bpubnubV7 && !options.userid) {
60
+ var err = {};
61
+ err.message = err.description = 'Mandatory parameter userid not found in request options.';
62
+ err = new DLSError(helpers.errors.ERROR_TYPES.PUSHX_ERROR, err);
63
+ throw err;
84
64
  }
85
- });
65
+
66
+ // Adding SSL flag
67
+ return pubnubCW.setup({
68
+ 'userid': options.userid,
69
+ 'pubnub': {
70
+ 'publishKey': options.publishKey,
71
+ 'subscribeKey': options.subscribeKey,
72
+ 'authKey': options.authKey,
73
+ 'ssl': true
74
+ }
75
+ });
86
76
  }
87
77
 
88
78
  function _cleanup(pubnubCW) { pubnubCW.cleanup(); }
89
79
 
90
- /*options = {}*/
80
+ /*options = {
81
+ authKey: <authKey>
82
+ }*/
91
83
  function grantByUserOrgId(options) {
92
- var dfd = q.defer(); // Initializing promise
93
- var allowedChannels = ['jobs', 'systemevents'];
94
- var baseChannelName = "o-" + this.orgId + "\\$u-" + this.token.access_token + "\\$";
95
- var patterns = [];
96
- for(var i in allowedChannels) {
97
- var channelName = baseChannelName + allowedChannels[i] + "\\..*";
98
- patterns.push(channelName);
99
- }
100
- options.channels = {};
101
- options.channels.patterns = patterns;
102
- grantV2.call(this, options)
103
- .then(function (res) {
104
- dfd.resolve(res);
105
- })
106
- .catch(function(err) {
107
- dfd.reject(err);
108
- });
109
- return dfd.promise;
84
+ var self = this;
85
+ var dfd = q.defer(); // Initializing promise
86
+ // Validations
87
+ var err = helpers.validations.isAuthenticated(self.orgId, self.token);
88
+ if(err) { dfd.reject(err); }
89
+ else {
90
+ // Passed all validations, Construct API url
91
+ var url = self.config.DEFAULT_HOSTS.PUSHX + self.config.PUSHX_API_URLS.grantByUserOrgId;
92
+ url = helpers.api.constructAPIUrl(url, { orgId: self.orgId });
93
+ // Setup request with URL and Params
94
+ var requestAPI = request.post(url)
95
+ .set('Content-Type', 'application/json')
96
+ .set('Accept', 'application/json');
97
+
98
+ var body = {};
99
+ if(options.authKey) { body.authKey = options.authKey; }
100
+
101
+ requestAPI.send(body);
102
+
103
+ //Setup token in Authorization header
104
+ requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
105
+ if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
106
+
107
+ // Call Change Password Api
108
+ requestAPI.end(function(err, response) {
109
+ if(err) {
110
+ err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
111
+ dfd.reject(err);
112
+ }
113
+ else { dfd.resolve(response.body); }
114
+ });
115
+ }
116
+ return dfd.promise;
110
117
  }
111
118
 
112
119
  /*options = {
113
120
  accountId: <accountid>,
114
- refId: <extRefId>
121
+ refId: <extRefId>,
122
+ authKey: <authKey>
115
123
  }*/
116
124
  function grantByAccountId(options) {
117
- var err ={};
118
- var dfd = q.defer(); // Initializing promise
119
-
120
- if(options.accountId && options.refId) {
121
- var channel = "a-" + options.accountId + "$refid." + options.refId;
122
- var exactMatch = [channel];
123
- options.channels = {};
124
- options.channels.exactMatch = exactMatch;
125
- grantV2.call(this, options)
126
- .then(function (res) {
127
- dfd.resolve(res);
128
- })
129
- .catch(function(err) {
130
- dfd.reject(err);
131
- });
132
- }
133
- else {
134
- err.message = err.description = "Required parameter ['accountId', 'refId'] " +
135
- "not found in request options";
136
- err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
137
- dfd.reject(err);
138
- }
139
- return dfd.promise;
125
+ var self = this, err ={};
126
+ var dfd = q.defer(); // Initializing promise
127
+
128
+ if(options.accountId && options.refId) {
129
+ // Passed all validations, Construct API url
130
+ var url = self.config.DEFAULT_HOSTS.PUSHX + self.config.PUSHX_API_URLS.grantByAccountId;
131
+ url = helpers.api.constructAPIUrl(url, { accountId: options.accountId });
132
+ // Setup request with URL and Params
133
+ var requestAPI = request.post(url)
134
+ .set('Content-Type', 'application/json')
135
+ .set('Accept', 'application/json');
136
+ if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
137
+
138
+ var body = { refId: options.refId };
139
+ if(options.authKey) { body.authKey = options.authKey; }
140
+
141
+ requestAPI.send(body);
142
+ requestAPI.end(function(err, response) {
143
+ if(err) {
144
+ err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
145
+ dfd.reject(err);
146
+ }
147
+ else { dfd.resolve(response.body); }
148
+ });
149
+ }
150
+ else {
151
+ err.message = err.description = "Required parameter ['accountId', 'refId'] " +
152
+ "not found in request options";
153
+ err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
154
+ dfd.reject(err);
155
+ }
156
+ return dfd.promise;
140
157
  }
141
158
 
142
159
  /*options = {
143
160
  accountId: <accountid>,
144
161
  extUserId: <extUserId>, //mandatory
162
+ authKey: <authKey>
145
163
  }*/
146
164
  function grantByAccountIdOnExtUserId(options) {
147
- var err ={};
148
- var dfd = q.defer(); // Initializing promise
149
-
150
- if(options.accountId && options.extUserId) {
151
- var channel = "a-" + options.accountId + "$u-" + options.extUserId;
152
- var exactMatch = [channel];
153
- options.channels = {};
154
- options.channels.exactMatch = exactMatch;
155
- grantV2.call(this, options)
156
- .then(function (res) {
157
- dfd.resolve(res);
158
- })
159
- .catch(function(err) {
160
- dfd.reject(err);
161
- });
162
- }
163
- else {
164
- err.message = err.description = "Required parameter ['accountId', 'extUserId'] " +
165
- "not found in request options";
166
- err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
167
- dfd.reject(err);
168
- }
169
- return dfd.promise;
170
- }
171
-
172
- /**
173
- * This function provides grant token on given channels
174
- * @param { channels: { exactMatch: [], patterns: [] } } options
175
- * @returns { token, publishKey, subscribeKey }
176
- */
177
- function grantV2(options) {
178
- var self = this, err = {};
179
- var dfd = q.defer();
180
- var body = { channels: {} };
181
- if(!options.channels) {
182
- err.message = err.description = "channels not given in input body.";
183
- err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
184
- dfd.reject(err);
185
- return dfd.promise;
186
- }
187
- body.channels = options.channels;
188
- // Passed all validations, Construct API url
189
- var url = self.config.DEFAULT_HOSTS.PUSHX + self.config.PUSHX_API_URLS.grantV2;
190
- // Setup request with URL and Params
191
- var requestAPI = request.post(url)
192
- .set('Content-Type', 'application/json')
193
- .set('Accept', 'application/json');
194
- if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
195
-
196
- requestAPI.send(body);
197
- requestAPI.end(function(err, response) {
198
- if(err) {
199
- err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
200
- dfd.reject(err);
165
+ var self = this, err ={};
166
+ var dfd = q.defer(); // Initializing promise
167
+
168
+ if(options.accountId && options.extUserId) {
169
+ // Passed all validations, Construct API url
170
+ var url = self.config.DEFAULT_HOSTS.PUSHX + self.config.PUSHX_API_URLS.grantByAccountId;
171
+ url = helpers.api.constructAPIUrl(url, { accountId: options.accountId });
172
+ // Setup request with URL and Params
173
+ var requestAPI = request.post(url)
174
+ .set('Content-Type', 'application/json')
175
+ .set('Accept', 'application/json');
176
+ if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
177
+
178
+ var body = { extUserId: options.extUserId };
179
+ if(options.authKey) { body.authKey = options.authKey; }
180
+
181
+ requestAPI.send(body);
182
+ requestAPI.end(function(err, response) {
183
+ if(err) {
184
+ err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
185
+ dfd.reject(err);
186
+ }
187
+ else { dfd.resolve(response.body); }
188
+ });
201
189
  }
202
- else { dfd.resolve(response.body); }
203
- });
204
- return dfd.promise;
190
+ else {
191
+ err.message = err.description = "Required parameter ['accountId', 'extUserId'] " +
192
+ "not found in request options";
193
+ err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
194
+ dfd.reject(err);
195
+ }
196
+ return dfd.promise;
205
197
  }
206
198
 
207
- /**
208
- * @param {
209
- * *accountid: "string",
210
- * *channelName: "string",
211
- * *starttime: number,
212
- * *endtime: number
213
- * } options
214
- */
215
- function getPushedEvents(options) {
216
- var self = this;
217
- var dfd = q.defer(); // Initializing promise
218
- var accountid = options.accountid,
219
- channelname = options.channelname,
220
- starttime = options.starttime,
221
- endtime = options.endtime;
222
-
223
- if (accountid && channelname && starttime && endtime) {
224
- // Passed all validations, Construct API url
225
- var url = self.config.DEFAULT_HOSTS.PUSHX + self.config.PUSHX_API_URLS.getPushedEvents;
226
- url = helpers.api.constructAPIUrl(url, { accountId: accountid });
227
-
228
- // Setup request with URL and Params
229
- var params = {channelname: channelname, starttime: starttime, endtime: endtime};
230
- var requestAPI = request.get(url).query(params);
231
- if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
232
-
233
- requestAPI
234
- .agent(keepaliveAgent)
235
- .end(function(error, response) {
236
- if (error) {
237
- error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
238
- dfd.reject(error);
239
- } else {
240
- dfd.resolve(response.body);
241
- }
242
- });
243
- }
244
- else {
245
- var err = {};
246
- err.message = err.description = 'Mandatory parameters [accountId, channelname,' +
247
- ' starttime, endtime] not found in request options';
248
- err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
249
- dfd.reject(err);
250
- }
251
- return dfd.promise;
252
- }
@@ -75,7 +75,7 @@ module.exports = function () {
75
75
  _eventEmitter.emit(subscribedChannel, message);
76
76
  };
77
77
 
78
- var _translatePubnubStatus = function(status, options) {
78
+ var _translatePubnubStatus = function(status) {
79
79
  var channels = [], error, successObj;
80
80
  switch (status.category) {
81
81
  case "PNConnectedCategory":
@@ -104,10 +104,8 @@ module.exports = function () {
104
104
  break;
105
105
  case "PNAccessDeniedCategory":
106
106
  if(status.operation === "PNSubscribeOperation") {
107
- var errorText = status.errorData.response && status.errorData.response.text;
108
- var errorJSON = errorText ? JSON.parse(errorText) : undefined;
109
107
  var errorData = {
110
- payload: errorJSON && errorJSON.payload || status.errorData.payload,
108
+ payload: JSON.parse(status.errorData.response.text).payload,
111
109
  message: 'Forbidden: Subscription failed.',
112
110
  errorDetails: {
113
111
  operation: status.operation,
@@ -136,46 +134,6 @@ module.exports = function () {
136
134
  error = new PUSHXError(helpers.errors.ERROR_CATEGORY.PUSHX, error);
137
135
  _eventEmitter.emit('pushx_status', error);
138
136
  break;
139
- case "PNNetworkIssuesCategory":
140
- if(status.operation === 'PNSubscribeOperation') {
141
- if(!options.accountId) {
142
- error = {
143
- message: "Missing mandatory parameters to initiate polling operation - accountId",
144
- status: status.statusCode,
145
- type: helpers.errors.ERROR_TYPES.POLLING_INITIATION,
146
- };
147
- error = new PUSHXError(helpers.errors.ERROR_CATEGORY.PUSHX, error);
148
- _eventEmitter.emit('pushx_status', error);
149
- break;
150
- }
151
- else {
152
- /**
153
- * Handle network issue category status for 'subscription' opreration
154
- * Start the events polling here.
155
- *
156
- * The wrapper supports multiple channels, but the APP currently uses a single channel only.
157
- * Polling will also limited to a single channel.
158
- */
159
- }
160
- }
161
- else {
162
- // Handle network issue category status for other operations like 'unsubscription'
163
- }
164
- break;
165
- case "PNReconnectedCategory":
166
- // Handle reconnected category status.
167
- break;
168
- default:
169
- // Emit error for other status-category received from pubnub
170
- error = {
171
- message: "PushX Error",
172
- status: status.statusCode,
173
- type: helpers.errors.ERROR_TYPES.UNEXPECTED_ERROR,
174
- pushXError: status
175
- };
176
- error = new PUSHXError(helpers.errors.ERROR_CATEGORY.PUSHX, error);
177
- _eventEmitter.emit('pushx_status', error);
178
- break;
179
137
  }
180
138
  };
181
139
 
@@ -209,12 +167,9 @@ module.exports = function () {
209
167
  var __setup = function (userOptions) {
210
168
  var pubnubConfig = userOptions.pubnub;
211
169
  pubnubConfig.uuid = userOptions.userid;
212
- var accountId = userOptions.accountid;
213
- var token = userOptions.token;
214
170
 
215
171
  if (!_pubnubClient && pubnubConfig) {
216
172
  _pubnubClient = new pubNub(pubnubConfig); //Connect with PubNub SDK
217
- _pubnubClient.setToken(token);
218
173
  processSetup();
219
174
  } else {
220
175
  return new Error('Already Initialized');
@@ -230,8 +185,7 @@ module.exports = function () {
230
185
  _translatePubnubMessage(data);
231
186
  },
232
187
  "status": function (status) {
233
- var statusOptions = { accountId: accountId };
234
- _translatePubnubStatus(status, statusOptions);
188
+ _translatePubnubStatus(status);
235
189
  }
236
190
  });
237
191
  }
@@ -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.86.2-valky",
4
+ "version": "2.90.2",
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": "4.0.1",
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
+