comprodls-sdk 2.42.2 → 2.42.3

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.
@@ -2009,8 +2009,28 @@ function updateClass(options) {
2009
2009
  "analytics_score_aggregation_type": true,
2010
2010
  "ext_data": true,
2011
2011
  "advanced": {
2012
- "students": [ { "ext_user_id": "string" } ],
2013
- "teachers": [ { "ext_user_id": "string" } ],
2012
+ "students": [
2013
+ {
2014
+ "ext_user_id": "string",
2015
+ "invite-students": <boolean>,
2016
+ "first_name": "string",
2017
+ "last_name": "string",
2018
+ "email": "string",
2019
+ "dls_org_status": "string",
2020
+ "ext_account_status": "string"
2021
+ }
2022
+ ],
2023
+ "teachers": [
2024
+ {
2025
+ "ext_user_id": "string",
2026
+ "invite-teachers": <boolean>,
2027
+ "first_name": "string",
2028
+ "last_name": "string",
2029
+ "email": "string",
2030
+ "dls_org_status": "string",
2031
+ "ext_account_status": "string"
2032
+ }
2033
+ ]
2014
2034
  "groups": [ { "groupid": "string" } ],
2015
2035
  "assigned_paths": [
2016
2036
  {
@@ -3256,7 +3276,15 @@ function getParticularGradebookMetaOfAClass(options) {
3256
3276
  error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
3257
3277
  deferred.reject(error);
3258
3278
  } else {
3259
- deferred.resolve(response.body.entities[0]);
3279
+ if (response.body.entities) {
3280
+ deferred.resolve(response.body.entities[0]);
3281
+ } else {
3282
+ /**
3283
+ * An empty response is sent when the requested gradebook doesn't exist in the class.
3284
+ * In this case, the API sends an 204 (No-Content) response.
3285
+ */
3286
+ deferred.resolve();
3287
+ }
3260
3288
  }
3261
3289
  });
3262
3290
  } else {
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.42.2",
4
+ "version": "2.42.3",
5
5
  "author": {
6
6
  "name": "Compro Technologies Private Limited",
7
7
  "url": "http://www.comprotechnologies.com/"
@@ -1,198 +0,0 @@
1
- let comprodls = require('./lib/comprodls');
2
- let bunyan = require('bunyan');
3
- let bformat = require('bunyan-format');
4
- let Q = require('q');
5
- const { async } = require('q');
6
- // let comproDLS = require('comprodls-sdk').init();
7
- let options = require('./input');
8
-
9
- var formatOut = bformat({ outputMode: 'short' });
10
- var loggerOpptions = {
11
- name: 'script', stream: formatOut, level: 'debug'
12
- };
13
-
14
- // let authOptions = {
15
- // 'access_token': '3a63697f-1817-11eb-9368-0242ac110003'
16
- // };
17
-
18
- function apiTimeResponse(){
19
- var logger = bunyan.createLogger(loggerOpptions);
20
- console.log(JSON.stringify(options));
21
- // let options = {//import from diff file
22
- // configuration: {
23
- // NTimes: 2,
24
- // orgid: 'dev1',
25
- // account: 'compro',
26
- // intraBatchDelay: 500,
27
- // interBatchDelay: 1000
28
- // },
29
- // token: authOptions,
30
- // // getClassUsers:{
31
- // // classid: 'd982518b-86e0-4e14-b0fa-00e0afe63434'
32
- // // // cursor
33
- // // },
34
- // getAGroup: {
35
- // groupId: '84339a32-8950-4121-9ec0-8ac6d11409ea'
36
- // },
37
- // getUserSpaces: {
38
- // extuserid: 'SuperAdmin-20-July-2021-1',
39
- // details: true
40
- // // spaceRole,
41
- // // spaceType,
42
- // // spaceOrgContext,
43
- // // cursor
44
- // }
45
- // };
46
- let authToken = {
47
- token: options.token
48
- };
49
- authToken.orgid = options.configuration.orgid;
50
-
51
- // comproDLS.authWithToken('dev1', saved_token , {})
52
- // .then(function success(response) {
53
- // var token = response["token"];
54
- // },
55
- // function error(errorObject) {
56
- // //Do error handling here
57
- // console.log(errorObject);
58
- // }
59
- // );
60
- // var auth = comproDLS.Auth();
61
- // auth.getAGroup(options.getAGroup)
62
- // .then(function(response) {
63
- // console.log(response);
64
- // })
65
- // .catch(function(err) {
66
- // console.log(err);
67
- // });
68
- let SDKCaller = comprodls.init('DEVELOPMENT', 'GLOBAL', authToken);
69
-
70
-
71
-
72
- // recursiveFunc(SDKCaller, options, logger);
73
- getResponseTime(SDKCaller, options, logger);
74
- }
75
-
76
- async function getResponseTime(SDKCaller, options, logger){
77
- let { configuration, getAGroup, getUserSpaces } = options;
78
- let delayOptions;
79
- for(let i=0; i<configuration.NTimes; i++) {
80
- try{
81
- delayOptions = {
82
- params: getAGroup,
83
- account: configuration.account,
84
- waitTime: configuration.interBatchDelay
85
- };
86
- await delay(getAGroupFunc, SDKCaller, delayOptions, logger);
87
- delayOptions = {
88
- params: getUserSpaces,
89
- account: configuration.account,
90
- waitTime: configuration.intraBatchDelay
91
- };
92
- await delay(getUserSpacesFunc, SDKCaller, delayOptions, logger);
93
- }
94
- catch(err) {
95
- logger.info(`apiResponse#error = ${err}`);
96
- }
97
- }
98
- }
99
-
100
- // function recursiveFunc(SDKCaller, options, logger) {
101
- // let { configuration, getAGroup, getUserSpaces } = options;
102
- // let startTime, delayOptions;
103
-
104
- // if (configuration.NTimes<=0) {
105
- // return;
106
- // }
107
-
108
- // delayOptions = {
109
- // params: getAGroup,
110
- // account: configuration.account,
111
- // waitTime: configuration.interBatchDelay
112
- // };
113
- // delay(getAGroupFunc, SDKCaller, delayOptions, logger)
114
- // // .then(function () {
115
- // // delayOptions = {
116
- // // params: getAGroup,
117
- // // account: configuration.account,
118
- // // waitTime: configuration.intraBatchDelay
119
- // // };
120
- // // return delay(getAGroupFunc, SDKCaller, delayOptions, logger);
121
- // // })
122
- // .then(function () {
123
- // delayOptions = {
124
- // params: getUserSpaces,
125
- // account: configuration.account,
126
- // waitTime: configuration.intraBatchDelay
127
- // };
128
- // return delay(getUserSpacesFunc, SDKCaller, delayOptions, logger);
129
- // })
130
- // .then(function () {
131
- // configuration.NTimes--;
132
- // return recursiveFunc(SDKCaller, options, logger);
133
- // })
134
- // .catch(function (err) {
135
- // logger.info(`apiResponse#error = ${err}`);
136
- // });
137
- // }
138
-
139
-
140
- function delay(waitFunc, SDKCaller, options, logger) {
141
- let deferred = Q.defer();
142
-
143
- setTimeout(waitFunc, options.waitTime, SDKCaller, options, logger, deferred);
144
-
145
- return deferred.promise;
146
- }
147
-
148
- function getClassUsersFunc(SDKCaller, options, logger, deferred) {
149
- let { params, account } = options;
150
- let startTime = Date.now();
151
-
152
- SDKCaller.Auth(account).getClassUsers(params)
153
- .then(function () {
154
- logger.info(`apiResponse#getClassUsers#success#time=${(Date.now()-startTime)}ms.`);
155
- deferred.resolve();
156
- })
157
- .catch(function (err) {
158
- logger.info(`apiResponse#getClassUsers#error: ${err}`);
159
- logger.info(`apiResponse#getClassUsers#error#time=${(Date.now()-startTime)}ms.`);
160
- deferred.resolve();
161
- });
162
- return deferred.promise;
163
- }
164
-
165
- function getAGroupFunc(SDKCaller, options, logger, deferred) {
166
- let { params, account } = options;
167
- let startTime = Date.now();
168
-
169
- SDKCaller.Auth(account).getAGroup(params)
170
- .then(function () {
171
- logger.info(`apiResponse#getAGroup#success#time=${(Date.now()-startTime)}ms.`);
172
- deferred.resolve();
173
- })
174
- .catch(function (err) {
175
- logger.info(`apiResponse#getAGroup#error: ${JSON.stringify(err)}`);
176
- logger.info(`apiResponse#getAGroup#error#time=${(Date.now()-startTime)}ms.`);
177
- deferred.resolve();
178
- });
179
- return deferred.promise;
180
- }
181
-
182
- function getUserSpacesFunc(SDKCaller, options, logger, deferred) {
183
- let { params, account } = options;
184
- let startTime = Date.now();
185
- SDKCaller.Spaces(account).getUserSpaces(params)
186
- .then(function () {
187
- logger.info(`apiResponse#getUserSpaces#success#time=${(Date.now()-startTime)}ms.`);
188
- deferred.resolve();
189
- })
190
- .catch(function (err) {
191
- logger.info(`apiResponse#getUserSpaces#error: ${JSON.stringify(err)}`);
192
- logger.info(`apiResponse#getUserSpaces#error#time=${(Date.now()-startTime)}ms.`);
193
- deferred.resolve();
194
- });
195
- return deferred.promise;
196
- }
197
-
198
- apiTimeResponse();
package/input.js DELETED
@@ -1,28 +0,0 @@
1
- let input = {//import from diff file
2
- configuration: {
3
- NTimes: 20,
4
- orgid: 'aberystwyth-thor',
5
- account: 'cup1',
6
- intraBatchDelay: 500,
7
- interBatchDelay: 1000
8
- },
9
- token: {
10
- 'access_token': '3a63697f-1817-11eb-9368-0242ac110003'
11
- },
12
- // getClassUsers:{
13
- // classid: 'd982518b-86e0-4e14-b0fa-00e0afe63434'
14
- // // cursor
15
- // },
16
- getAGroup: {
17
- groupId: 'e842f79d-44b8-4f0b-88d6-3346ffa92a53'
18
- },
19
- getUserSpaces: {
20
- extuserid: 'api_team_admin',
21
- details: true
22
- // spaceRole,
23
- // spaceType,
24
- // spaceOrgContext,
25
- // cursor
26
- }
27
- };
28
- module.exports = input;
package/input.json DELETED
@@ -1,27 +0,0 @@
1
- let input = {//import from diff file
2
- configuration: {
3
- NTimes: 20,
4
- orgid: 'aberystwyth-thor',
5
- account: 'cup1',
6
- intraBatchDelay: 500,
7
- interBatchDelay: 1000
8
- },
9
- token: {
10
- 'access_token': '3a63697f-1817-11eb-9368-0242ac110003'
11
- },
12
- // getClassUsers:{
13
- // classid: 'd982518b-86e0-4e14-b0fa-00e0afe63434'
14
- // // cursor
15
- // },
16
- getAGroup: {
17
- groupId: 'e842f79d-44b8-4f0b-88d6-3346ffa92a53'
18
- },
19
- getUserSpaces: {
20
- extuserid: 'api_team_admin',
21
- details: true
22
- // spaceRole,
23
- // spaceType,
24
- // spaceOrgContext,
25
- // cursor
26
- }
27
- };
package/test.js DELETED
@@ -1,30 +0,0 @@
1
- var comprodls = require('./lib/comprodls');
2
-
3
- var authOptions = {
4
- 'access_token': '97fe7f89-6883-4294-9c3e-5da969e8795e',
5
- 'expires_in': 604800,
6
- 'refresh_token': 'c002d2710236789e3f36d0b8670a07b684f44b4a43e9c4a322260c11390d37826a889053c876df0dc3ae49f4702fd014c36cd83654ec3729fa95a0be72ec36f16bf297d7003ed2d3b7ceab74dd70cadbcf9794db1e50b0b3bff0daa0078590e7e271532f9b8faab3',
7
- };
8
- var options = {
9
- token: authOptions
10
- };
11
- options.orgid = 'dev1';
12
-
13
- var params = {
14
- classid: 'd982518b-86e0-4e14-b0fa-00e0afe63434'
15
-
16
- };
17
-
18
- var temp = comprodls.init('DEVELOPMENT','GLOBAL', options);
19
- temp.Auth('compro').getClassUsers(params)
20
- .then((result)=>{
21
- console.log(JSON.stringify(result, 0, 2));
22
- })
23
- .catch((err)=>{
24
- console.log(err);
25
- });
26
-
27
- // ,
28
- // DEVELOPMENT: {
29
- // AUTH: 'http://localhost:5000'
30
- // }