comprodls-sdk 2.123.2-security → 2.123.4-oidc-poc.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.
Files changed (36) hide show
  1. package/.eslintrc +28 -28
  2. package/.github/workflows/npm-publish.yml +76 -0
  3. package/README.md +235 -235
  4. package/dist/comprodls-sdk.js +13543 -13543
  5. package/docs/npm-oidc-publishing-runbook.md +229 -0
  6. package/lib/comprodls.js +132 -132
  7. package/lib/config/index.js +356 -356
  8. package/lib/helpers/index.js +31 -31
  9. package/lib/helpers/lib/api/converter.js +129 -129
  10. package/lib/helpers/lib/api/index.js +46 -46
  11. package/lib/helpers/lib/errors.js +122 -122
  12. package/lib/helpers/lib/requestLayer.js +154 -154
  13. package/lib/helpers/lib/validator.js +192 -192
  14. package/lib/open_access/index.js +116 -116
  15. package/lib/services/analytics/index.js +1365 -1365
  16. package/lib/services/attempts/index.js +389 -389
  17. package/lib/services/auth/index.js +3708 -3708
  18. package/lib/services/authextn/index.js +1032 -1032
  19. package/lib/services/datasyncmanager/index.js +275 -275
  20. package/lib/services/drive/index.js +270 -270
  21. package/lib/services/integrations/index.js +525 -525
  22. package/lib/services/invitations/index.js +282 -282
  23. package/lib/services/product/index.js +343 -343
  24. package/lib/services/pub/index.js +530 -530
  25. package/lib/services/pushX/index.js +251 -251
  26. package/lib/services/pushX/pubnubClientWrapper.js +438 -438
  27. package/lib/services/rules/index.js +416 -416
  28. package/lib/services/spaces/index.js +999 -999
  29. package/lib/services/spacesextn/index.js +131 -131
  30. package/lib/services/superuser/index.js +160 -160
  31. package/lib/services/taxonomy/index.js +405 -405
  32. package/lib/services/workflows/index.js +406 -406
  33. package/lib/services/xapi/index.js +114 -114
  34. package/lib/token/index.js +120 -120
  35. package/lib/token/validations.js +85 -85
  36. package/package.json +5 -1
@@ -1,131 +1,131 @@
1
- /*************************************************************************
2
- *
3
- * COMPRO CONFIDENTIAL
4
- * __________________
5
- *
6
- * [2015] - [2020] Compro Technologies Private Limited
7
- * All Rights Reserved.
8
- *
9
- * NOTICE: All information contained herein is, and remains
10
- * the property of Compro Technologies Private Limited. The
11
- * intellectual and technical concepts contained herein are
12
- * proprietary to Compro Technologies Private Limited and may
13
- * be covered by U.S. and Foreign Patents, patents in process,
14
- * and are protected by trade secret or copyright law.
15
- *
16
- * Dissemination of this information or reproduction of this material
17
- * is strictly forbidden unless prior written permission is obtained
18
- * from Compro Technologies Pvt. Ltd..
19
- ***************************************************************************/
20
-
21
- /***********************************************************
22
- * comproDLS SDK SPACESEXTN Adaptor
23
- * Functions for calling AUTHEXTN API.
24
- ************************************************************/
25
-
26
- var q = require('q');
27
- var request = require('superagent');
28
- var Agent = require('agentkeepalive');
29
-
30
- var helpers = require('../../helpers');
31
- var DLSError = helpers.errors.DLSError;
32
-
33
- module.exports = spacesextn;
34
-
35
- var keepaliveAgent = new Agent({
36
- timeout: 60000,
37
- freeSocketTimeout: 30000
38
- });
39
-
40
- //AuthExtn Adaptor Contsructor
41
- function spacesextn(accountId) {
42
- this.accountId = accountId;
43
- return {
44
- entitleBulkUsersToProducts: entitleBulkUsersToProducts.bind(this),
45
- setupUser: setupUser.bind(this)
46
- };
47
- }
48
-
49
- /**
50
- * Wiki Link for SDK params
51
- * https://github.com/comprodls/comprodls-sdk-js/wiki/22_Integrations-Adapter#entitlebulkuserstoproductsparams
52
- */
53
- function entitleBulkUsersToProducts(options) {
54
- var self = this;
55
- // Initializing promise
56
- var dfd = q.defer();
57
-
58
- if (options && options.users && options.ext_actor_id) {
59
- // Passed all validations, Contruct API url
60
- var url = self.config.DEFAULT_HOSTS.AUTHEXTN +
61
- self.config.AUTHEXTN_API_URLS.entitleBulkUsersToProducts;
62
- url = helpers.api.constructAPIUrl(url, { accountid : self.accountId });
63
-
64
- // Setup request with URL and Params
65
- var requestAPI = request.post(url)
66
- .set('Content-Type', 'application/json')
67
- .set('Accept', 'application/json')
68
- .send(options);
69
-
70
- if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
71
-
72
- requestAPI
73
- .agent(keepaliveAgent)
74
- .end(function(error, response) {
75
- if(error) {
76
- var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
77
- dfd.reject(err);
78
- }
79
- else { dfd.resolve(response.body); }
80
- });
81
- } else {
82
- var err = {};
83
- err.description = 'Mandatory params: \'users\', \'ext_actor_id\' not found in request options.';
84
- err.message = err.description;
85
- err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
86
- dfd.reject(err);
87
- }
88
-
89
- return dfd.promise;
90
- }
91
-
92
- /**
93
- * Wiki Link for SDK params
94
- * https://github.com/comprodls/comprodls-sdk-js/wiki/22_Integrations-Adapter#setupuserparams
95
- */
96
- function setupUser(options) {
97
- var self = this;
98
- //Initializing promise
99
- var deferred = q.defer();
100
-
101
- if (options && options.ext_user_id && options.workflow_type) {
102
- //Passed all validations, Contruct API url
103
- var url = self.config.DEFAULT_HOSTS.AUTHEXTN + self.config.AUTHEXTN_API_URLS.setupUser;
104
- url = helpers.api.constructAPIUrl(url, { accountId: self.accountId });
105
-
106
- var requestAPI = request.post(url)
107
- .set('Content-Type', 'application/json')
108
- .set('Accept', 'application/json')
109
- .send(options);
110
-
111
- if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
112
-
113
- requestAPI
114
- .agent(keepaliveAgent)
115
- .end(function(err, res) {
116
- if (err) {
117
- err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
118
- deferred.reject(err);
119
- } else {
120
- deferred.resolve(res.body);
121
- }
122
- });
123
- } else {
124
- var err = {};
125
- err.message = err.description = 'Mandatory field \'ext_user_id\' or \'workflow_type\' not found '+
126
- 'in the request options.';
127
- err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
128
- deferred.reject(err);
129
- }
130
- return deferred.promise;
131
- }
1
+ /*************************************************************************
2
+ *
3
+ * COMPRO CONFIDENTIAL
4
+ * __________________
5
+ *
6
+ * [2015] - [2020] Compro Technologies Private Limited
7
+ * All Rights Reserved.
8
+ *
9
+ * NOTICE: All information contained herein is, and remains
10
+ * the property of Compro Technologies Private Limited. The
11
+ * intellectual and technical concepts contained herein are
12
+ * proprietary to Compro Technologies Private Limited and may
13
+ * be covered by U.S. and Foreign Patents, patents in process,
14
+ * and are protected by trade secret or copyright law.
15
+ *
16
+ * Dissemination of this information or reproduction of this material
17
+ * is strictly forbidden unless prior written permission is obtained
18
+ * from Compro Technologies Pvt. Ltd..
19
+ ***************************************************************************/
20
+
21
+ /***********************************************************
22
+ * comproDLS SDK SPACESEXTN Adaptor
23
+ * Functions for calling AUTHEXTN API.
24
+ ************************************************************/
25
+
26
+ var q = require('q');
27
+ var request = require('superagent');
28
+ var Agent = require('agentkeepalive');
29
+
30
+ var helpers = require('../../helpers');
31
+ var DLSError = helpers.errors.DLSError;
32
+
33
+ module.exports = spacesextn;
34
+
35
+ var keepaliveAgent = new Agent({
36
+ timeout: 60000,
37
+ freeSocketTimeout: 30000
38
+ });
39
+
40
+ //AuthExtn Adaptor Contsructor
41
+ function spacesextn(accountId) {
42
+ this.accountId = accountId;
43
+ return {
44
+ entitleBulkUsersToProducts: entitleBulkUsersToProducts.bind(this),
45
+ setupUser: setupUser.bind(this)
46
+ };
47
+ }
48
+
49
+ /**
50
+ * Wiki Link for SDK params
51
+ * https://github.com/comprodls/comprodls-sdk-js/wiki/22_Integrations-Adapter#entitlebulkuserstoproductsparams
52
+ */
53
+ function entitleBulkUsersToProducts(options) {
54
+ var self = this;
55
+ // Initializing promise
56
+ var dfd = q.defer();
57
+
58
+ if (options && options.users && options.ext_actor_id) {
59
+ // Passed all validations, Contruct API url
60
+ var url = self.config.DEFAULT_HOSTS.AUTHEXTN +
61
+ self.config.AUTHEXTN_API_URLS.entitleBulkUsersToProducts;
62
+ url = helpers.api.constructAPIUrl(url, { accountid : self.accountId });
63
+
64
+ // Setup request with URL and Params
65
+ var requestAPI = request.post(url)
66
+ .set('Content-Type', 'application/json')
67
+ .set('Accept', 'application/json')
68
+ .send(options);
69
+
70
+ if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
71
+
72
+ requestAPI
73
+ .agent(keepaliveAgent)
74
+ .end(function(error, response) {
75
+ if(error) {
76
+ var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
77
+ dfd.reject(err);
78
+ }
79
+ else { dfd.resolve(response.body); }
80
+ });
81
+ } else {
82
+ var err = {};
83
+ err.description = 'Mandatory params: \'users\', \'ext_actor_id\' not found in request options.';
84
+ err.message = err.description;
85
+ err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
86
+ dfd.reject(err);
87
+ }
88
+
89
+ return dfd.promise;
90
+ }
91
+
92
+ /**
93
+ * Wiki Link for SDK params
94
+ * https://github.com/comprodls/comprodls-sdk-js/wiki/22_Integrations-Adapter#setupuserparams
95
+ */
96
+ function setupUser(options) {
97
+ var self = this;
98
+ //Initializing promise
99
+ var deferred = q.defer();
100
+
101
+ if (options && options.ext_user_id && options.workflow_type) {
102
+ //Passed all validations, Contruct API url
103
+ var url = self.config.DEFAULT_HOSTS.AUTHEXTN + self.config.AUTHEXTN_API_URLS.setupUser;
104
+ url = helpers.api.constructAPIUrl(url, { accountId: self.accountId });
105
+
106
+ var requestAPI = request.post(url)
107
+ .set('Content-Type', 'application/json')
108
+ .set('Accept', 'application/json')
109
+ .send(options);
110
+
111
+ if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
112
+
113
+ requestAPI
114
+ .agent(keepaliveAgent)
115
+ .end(function(err, res) {
116
+ if (err) {
117
+ err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
118
+ deferred.reject(err);
119
+ } else {
120
+ deferred.resolve(res.body);
121
+ }
122
+ });
123
+ } else {
124
+ var err = {};
125
+ err.message = err.description = 'Mandatory field \'ext_user_id\' or \'workflow_type\' not found '+
126
+ 'in the request options.';
127
+ err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
128
+ deferred.reject(err);
129
+ }
130
+ return deferred.promise;
131
+ }
@@ -1,160 +1,160 @@
1
- /*************************************************************************
2
- *
3
- * COMPRO CONFIDENTIAL
4
- * __________________
5
- *
6
- * [2015] - [2020] Compro Technologies Private Limited
7
- * All Rights Reserved.
8
- *
9
- * NOTICE: All information contained herein is, and remains
10
- * the property of Compro Technologies Private Limited. The
11
- * intellectual and technical concepts contained herein are
12
- * proprietary to Compro Technologies Private Limited and may
13
- * be covered by U.S. and Foreign Patents, patents in process,
14
- * and are protected by trade secret or copyright law.
15
- *
16
- * Dissemination of this information or reproduction of this material
17
- * is strictly forbidden unless prior written permission is obtained
18
- * from Compro Technologies Pvt. Ltd..
19
- ***************************************************************************/
20
-
21
- /***********************************************************
22
- * comproDLS SDK AUTH API Adaptor
23
- * Functions for calling AUTH API.
24
- ************************************************************/
25
-
26
- var q = require('q');
27
- var request = require('superagent');
28
-
29
- var helpers = require('../../helpers');
30
- var requestLayer = require('../../helpers/lib/requestLayer');
31
-
32
- var DLSError = helpers.errors.DLSError;
33
-
34
- module.exports = superuser;
35
-
36
- //Superuser Adaptor Contsructor
37
- function superuser(accountId) {
38
- this.accountId = accountId;
39
- return {
40
- getAllInstitutions: getAllInstitutions.bind(this),
41
- getInstitution: getInstitution.bind(this),
42
- provisionSpacesToSuperAdmin: provisionSpacesToSuperAdmin.bind(this)
43
- };
44
- }
45
-
46
- /**
47
- * Wiki Link for SDK params
48
- * https://github.com/comprodls/comprodls-sdk-js/wiki/19_Superuser-Adapter#getallinstitutionsparams
49
- */
50
- function getAllInstitutions(options) {
51
- var self = this;
52
-
53
- var url = helpers.api.constructAPIUrl(
54
- self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.getAllInstitutions,
55
- { accountid : self.accountId }
56
- );
57
-
58
- var params = {};
59
- if (options) {
60
- if (options.lookup) { params.lookup = options.lookup; }
61
- if (options.country) { params.country = options.country; }
62
- if (options.cursor) { params.cursor = options.cursor; }
63
- if (options.start) { params.start = options.start; }
64
- if (options.end) { params.end = options.end; }
65
- }
66
-
67
- // Prepare request parameters & execute request
68
- var reqOptions = {
69
- params: params,
70
- headers: { traceid: self.traceid }
71
- };
72
- return requestLayer.get(url, reqOptions)
73
- .then(function (response) {
74
- return response.body;
75
- })
76
- .catch(function (err) {
77
- throw new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
78
- });
79
- }
80
-
81
- /**
82
- * Wiki Link for SDK params
83
- * https://github.com/comprodls/comprodls-sdk-js/wiki/19_Superuser-Adapter#getinstitutionparams
84
- */
85
- function getInstitution(options) {
86
- var self = this;
87
- // Initializing promise
88
- var dfd = q.defer();
89
-
90
- // Validations
91
- if(options && options.spacecode) {
92
- // Passed all validations, Contruct API url
93
- var url = self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.getInstitution;
94
- url = helpers.api.constructAPIUrl(url, {
95
- accountid: self.accountId, spacecode: options.spacecode
96
- });
97
-
98
- // Setup request with URL and Params
99
- var requestAPI = request.get(url);
100
- if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
101
-
102
- requestAPI.end(function(error, response) {
103
- if(error) {
104
- err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
105
- dfd.reject(err);
106
- }
107
- else { dfd.resolve(response.body); }
108
- });
109
- }
110
- else {
111
- var err = {};
112
- err.message = err.description = 'spacecode not found in request options.';
113
- err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
114
- dfd.reject(err);
115
- }
116
- return dfd.promise;
117
- }
118
-
119
- /**
120
- * Wiki Link for SDK params
121
- * https://github.com/comprodls/comprodls-sdk-js/wiki/19_Superuser-Adapter#provisionspacestosuperadminparams
122
- */
123
- function provisionSpacesToSuperAdmin(options) {
124
- var self = this;
125
- // Initializing promise
126
- var dfd = q.defer();
127
-
128
- if(options && options.ext_user_id &&
129
- options.ext_role && options.ext_email &&
130
- options.ext_first_name && options.ext_last_name)
131
- {
132
- // Passed all validations, Contruct API url
133
- var url = self.config.DEFAULT_HOSTS.AUTH +
134
- self.config.AUTH_API_URLS.provisionSpacesToSuperAdmin;
135
- url = helpers.api.constructAPIUrl(url, { accountid : self.accountId });
136
-
137
- // Setup request with URL and Params
138
- var requestAPI = request.post(url)
139
- .set('Content-Type', 'application/json')
140
- .set('Accept', 'application/json')
141
- .send(options);
142
- if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
143
-
144
- requestAPI.end(function(error, response) {
145
- if(error) {
146
- err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
147
- dfd.reject(err);
148
- }
149
- else { dfd.resolve(response.body); }
150
- });
151
- }
152
- else {
153
- var err = {};
154
- err.message = err.description = 'Missing required input data';
155
- err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
156
- dfd.reject(err);
157
- }
158
-
159
- return dfd.promise;
160
- }
1
+ /*************************************************************************
2
+ *
3
+ * COMPRO CONFIDENTIAL
4
+ * __________________
5
+ *
6
+ * [2015] - [2020] Compro Technologies Private Limited
7
+ * All Rights Reserved.
8
+ *
9
+ * NOTICE: All information contained herein is, and remains
10
+ * the property of Compro Technologies Private Limited. The
11
+ * intellectual and technical concepts contained herein are
12
+ * proprietary to Compro Technologies Private Limited and may
13
+ * be covered by U.S. and Foreign Patents, patents in process,
14
+ * and are protected by trade secret or copyright law.
15
+ *
16
+ * Dissemination of this information or reproduction of this material
17
+ * is strictly forbidden unless prior written permission is obtained
18
+ * from Compro Technologies Pvt. Ltd..
19
+ ***************************************************************************/
20
+
21
+ /***********************************************************
22
+ * comproDLS SDK AUTH API Adaptor
23
+ * Functions for calling AUTH API.
24
+ ************************************************************/
25
+
26
+ var q = require('q');
27
+ var request = require('superagent');
28
+
29
+ var helpers = require('../../helpers');
30
+ var requestLayer = require('../../helpers/lib/requestLayer');
31
+
32
+ var DLSError = helpers.errors.DLSError;
33
+
34
+ module.exports = superuser;
35
+
36
+ //Superuser Adaptor Contsructor
37
+ function superuser(accountId) {
38
+ this.accountId = accountId;
39
+ return {
40
+ getAllInstitutions: getAllInstitutions.bind(this),
41
+ getInstitution: getInstitution.bind(this),
42
+ provisionSpacesToSuperAdmin: provisionSpacesToSuperAdmin.bind(this)
43
+ };
44
+ }
45
+
46
+ /**
47
+ * Wiki Link for SDK params
48
+ * https://github.com/comprodls/comprodls-sdk-js/wiki/19_Superuser-Adapter#getallinstitutionsparams
49
+ */
50
+ function getAllInstitutions(options) {
51
+ var self = this;
52
+
53
+ var url = helpers.api.constructAPIUrl(
54
+ self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.getAllInstitutions,
55
+ { accountid : self.accountId }
56
+ );
57
+
58
+ var params = {};
59
+ if (options) {
60
+ if (options.lookup) { params.lookup = options.lookup; }
61
+ if (options.country) { params.country = options.country; }
62
+ if (options.cursor) { params.cursor = options.cursor; }
63
+ if (options.start) { params.start = options.start; }
64
+ if (options.end) { params.end = options.end; }
65
+ }
66
+
67
+ // Prepare request parameters & execute request
68
+ var reqOptions = {
69
+ params: params,
70
+ headers: { traceid: self.traceid }
71
+ };
72
+ return requestLayer.get(url, reqOptions)
73
+ .then(function (response) {
74
+ return response.body;
75
+ })
76
+ .catch(function (err) {
77
+ throw new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
78
+ });
79
+ }
80
+
81
+ /**
82
+ * Wiki Link for SDK params
83
+ * https://github.com/comprodls/comprodls-sdk-js/wiki/19_Superuser-Adapter#getinstitutionparams
84
+ */
85
+ function getInstitution(options) {
86
+ var self = this;
87
+ // Initializing promise
88
+ var dfd = q.defer();
89
+
90
+ // Validations
91
+ if(options && options.spacecode) {
92
+ // Passed all validations, Contruct API url
93
+ var url = self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.getInstitution;
94
+ url = helpers.api.constructAPIUrl(url, {
95
+ accountid: self.accountId, spacecode: options.spacecode
96
+ });
97
+
98
+ // Setup request with URL and Params
99
+ var requestAPI = request.get(url);
100
+ if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
101
+
102
+ requestAPI.end(function(error, response) {
103
+ if(error) {
104
+ err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
105
+ dfd.reject(err);
106
+ }
107
+ else { dfd.resolve(response.body); }
108
+ });
109
+ }
110
+ else {
111
+ var err = {};
112
+ err.message = err.description = 'spacecode not found in request options.';
113
+ err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
114
+ dfd.reject(err);
115
+ }
116
+ return dfd.promise;
117
+ }
118
+
119
+ /**
120
+ * Wiki Link for SDK params
121
+ * https://github.com/comprodls/comprodls-sdk-js/wiki/19_Superuser-Adapter#provisionspacestosuperadminparams
122
+ */
123
+ function provisionSpacesToSuperAdmin(options) {
124
+ var self = this;
125
+ // Initializing promise
126
+ var dfd = q.defer();
127
+
128
+ if(options && options.ext_user_id &&
129
+ options.ext_role && options.ext_email &&
130
+ options.ext_first_name && options.ext_last_name)
131
+ {
132
+ // Passed all validations, Contruct API url
133
+ var url = self.config.DEFAULT_HOSTS.AUTH +
134
+ self.config.AUTH_API_URLS.provisionSpacesToSuperAdmin;
135
+ url = helpers.api.constructAPIUrl(url, { accountid : self.accountId });
136
+
137
+ // Setup request with URL and Params
138
+ var requestAPI = request.post(url)
139
+ .set('Content-Type', 'application/json')
140
+ .set('Accept', 'application/json')
141
+ .send(options);
142
+ if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
143
+
144
+ requestAPI.end(function(error, response) {
145
+ if(error) {
146
+ err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
147
+ dfd.reject(err);
148
+ }
149
+ else { dfd.resolve(response.body); }
150
+ });
151
+ }
152
+ else {
153
+ var err = {};
154
+ err.message = err.description = 'Missing required input data';
155
+ err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
156
+ dfd.reject(err);
157
+ }
158
+
159
+ return dfd.promise;
160
+ }