comprodls-sdk 2.67.0 → 2.68.0-development

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.
@@ -913,36 +913,42 @@ function createOrgProductEntitlement(options) {
913
913
  var self = this;
914
914
  // Initializing promise
915
915
  var dfd = q.defer();
916
-
917
- if (options && options.productcode) {
918
- // Passed all validations, Contruct API url
919
- var url = self.config.DEFAULT_HOSTS.AUTHEXTN +
920
- self.config.AUTHEXTN_API_URLS.orgProductEntitlement;
921
- url = helpers.api.constructAPIUrl(url, { orgid: self.orgId });
922
-
923
- var requestAPI = request.post(url)
924
- .set('Content-Type', 'application/json')
925
- .set('Accept', 'application/json')
926
- .send(options);
927
-
928
- if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
929
-
930
- requestAPI
931
- .agent(keepaliveAgent)
932
- .end(function(error, response) {
933
- if (error) {
934
- var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
935
- dfd.reject(err);
936
- }
937
- else { dfd.resolve(response.body); }
938
- });
939
- } else {
916
+ if (!self.orgId) {
940
917
  var err = {};
941
- err.message = err.description = 'Mandatory param: productcode not found in request options.';
918
+ err.message = err.description = 'Mandatory param: orgid not found in options while ' +
919
+ 'initializing comprodls-sdk.';
942
920
  err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
943
921
  dfd.reject(err);
944
- }
922
+ } else {
923
+ if (options && options.productcode) {
924
+ // Passed all validations, Contruct API url
925
+ var url = self.config.DEFAULT_HOSTS.AUTHEXTN +
926
+ self.config.AUTHEXTN_API_URLS.orgProductEntitlement;
927
+ url = helpers.api.constructAPIUrl(url, { orgid: self.orgId });
928
+
929
+ var requestAPI = request.post(url)
930
+ .set('Content-Type', 'application/json')
931
+ .set('Accept', 'application/json')
932
+ .send(options);
933
+
934
+ if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
945
935
 
936
+ requestAPI
937
+ .agent(keepaliveAgent)
938
+ .end(function(error, response) {
939
+ if (error) {
940
+ var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
941
+ dfd.reject(err);
942
+ }
943
+ else { dfd.resolve(response.body); }
944
+ });
945
+ } else {
946
+ var err = {};
947
+ err.message = err.description = 'Mandatory param: productcode not found in request options.';
948
+ err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
949
+ dfd.reject(err);
950
+ }
951
+ }
946
952
  return dfd.promise;
947
953
  }
948
954
 
@@ -962,33 +968,41 @@ function updateOrgProductEntitlement(options) {
962
968
  // Initializing promise
963
969
  var dfd = q.defer();
964
970
 
965
- if (options && options.productcode) {
966
- // Passed all validations, Contruct API url
967
- var url = self.config.DEFAULT_HOSTS.AUTHEXTN +
968
- self.config.AUTHEXTN_API_URLS.orgProductEntitlement;
969
- url = helpers.api.constructAPIUrl(url, { orgid: self.orgId });
970
-
971
- var requestAPI = request.put(url)
972
- .set('Content-Type', 'application/json')
973
- .set('Accept', 'application/json')
974
- .send(options);
975
-
976
- if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
977
-
978
- requestAPI
979
- .agent(keepaliveAgent)
980
- .end(function(error, response) {
981
- if (error) {
982
- var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
983
- dfd.reject(err);
984
- }
985
- else { dfd.resolve(response.body); }
986
- });
987
- } else {
971
+ if (!self.orgId) {
988
972
  var err = {};
989
- err.message = err.description = 'Mandatory param: productcode not found in request options.';
973
+ err.message = err.description = 'Mandatory param: orgid not found in options while ' +
974
+ 'initializing comprodls-sdk.';
990
975
  err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
991
976
  dfd.reject(err);
977
+ } else {
978
+ if (options && options.productcode) {
979
+ // Passed all validations, Contruct API url
980
+ var url = self.config.DEFAULT_HOSTS.AUTHEXTN +
981
+ self.config.AUTHEXTN_API_URLS.orgProductEntitlement;
982
+ url = helpers.api.constructAPIUrl(url, { orgid: self.orgId });
983
+
984
+ var requestAPI = request.put(url)
985
+ .set('Content-Type', 'application/json')
986
+ .set('Accept', 'application/json')
987
+ .send(options);
988
+
989
+ if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
990
+
991
+ requestAPI
992
+ .agent(keepaliveAgent)
993
+ .end(function(error, response) {
994
+ if (error) {
995
+ var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
996
+ dfd.reject(err);
997
+ }
998
+ else { dfd.resolve(response.body); }
999
+ });
1000
+ } else {
1001
+ var err = {};
1002
+ err.message = err.description = 'Mandatory param: productcode not found in request options.';
1003
+ err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
1004
+ dfd.reject(err);
1005
+ }
992
1006
  }
993
1007
 
994
1008
  return dfd.promise;
@@ -1098,7 +1112,7 @@ function getAllOrgProductEntitlements(options) {
1098
1112
  /**
1099
1113
  * @param {
1100
1114
  * ext_user_id: "string", // mandatory
1101
- * workflow_type: "string", // mandatory
1115
+ * workflow_type: "string", // mandatory
1102
1116
  * <workflow_type>: {} // mandatory
1103
1117
  * } options
1104
1118
  */
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.67.0",
4
+ "version": "2.68.0-development",
5
5
  "author": {
6
6
  "name": "Compro Technologies Private Limited",
7
7
  "url": "http://www.comprotechnologies.com/"
@@ -17,7 +17,7 @@
17
17
  "pubnub": "7.5.0",
18
18
  "q": "~1.4.1",
19
19
  "string-template": "^1.0.0",
20
- "superagent": "3.8.3",
20
+ "superagent": "9.0.1",
21
21
  "validate.js": "^0.9.0"
22
22
  },
23
23
  "devDependencies": {