@contentstack/marketplace-sdk 1.2.8 → 1.3.0

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 (27) hide show
  1. package/CHANGELOG.md +11 -2
  2. package/dist/es-modules/entity.js +78 -74
  3. package/dist/es-modules/marketplace/app/hosting/deployment.js +71 -70
  4. package/dist/es-modules/marketplace/app/hosting/index.js +85 -84
  5. package/dist/es-modules/marketplace/app/index.js +84 -84
  6. package/dist/es-modules/marketplace/app/oauth/index.js +43 -42
  7. package/dist/es-modules/marketplace/apprequest/index.js +43 -42
  8. package/dist/es-modules/marketplace/authorization/index.js +43 -42
  9. package/dist/es-modules/marketplace/index.js +91 -22
  10. package/dist/es-modules/marketplace/installation/index.js +129 -126
  11. package/dist/es-modules/marketplace/installation/webhooks/index.js +42 -42
  12. package/dist/es5/entity.js +78 -74
  13. package/dist/es5/marketplace/app/hosting/deployment.js +71 -70
  14. package/dist/es5/marketplace/app/hosting/index.js +85 -84
  15. package/dist/es5/marketplace/app/index.js +84 -84
  16. package/dist/es5/marketplace/app/oauth/index.js +43 -42
  17. package/dist/es5/marketplace/apprequest/index.js +43 -42
  18. package/dist/es5/marketplace/authorization/index.js +43 -42
  19. package/dist/es5/marketplace/index.js +91 -22
  20. package/dist/es5/marketplace/installation/index.js +129 -126
  21. package/dist/es5/marketplace/installation/webhooks/index.js +42 -42
  22. package/dist/nativescript/contentstack-marketplace.js +1 -1
  23. package/dist/node/contentstack-marketplace.js +1 -1
  24. package/dist/react-native/contentstack-marketplace.js +1 -1
  25. package/dist/web/contentstack-marketplace.js +1 -1
  26. package/package.json +14 -13
  27. package/types/marketplace/index.d.ts +1 -0
@@ -52,8 +52,9 @@ function Oauth(http, data, params) {
52
52
  var param,
53
53
  headers,
54
54
  response,
55
- _args = arguments;
56
- return _regenerator2["default"].wrap(function _callee$(_context) {
55
+ _args = arguments,
56
+ _t;
57
+ return _regenerator2["default"].wrap(function (_context) {
57
58
  while (1) switch (_context.prev = _context.next) {
58
59
  case 0:
59
60
  param = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
@@ -62,29 +63,29 @@ function Oauth(http, data, params) {
62
63
  headers: _objectSpread({}, (0, _cloneDeep2["default"])(_this.params)),
63
64
  params: _objectSpread({}, (0, _cloneDeep2["default"])(param))
64
65
  } || {};
65
- _context.next = 5;
66
+ _context.next = 2;
66
67
  return http.get(_this.urlPath, headers);
67
- case 5:
68
+ case 2:
68
69
  response = _context.sent;
69
70
  if (!response.data) {
70
- _context.next = 10;
71
+ _context.next = 3;
71
72
  break;
72
73
  }
73
74
  return _context.abrupt("return", response.data.data || {});
74
- case 10:
75
+ case 3:
75
76
  throw (0, _contentstackError2["default"])(response);
76
- case 11:
77
- _context.next = 16;
77
+ case 4:
78
+ _context.next = 6;
78
79
  break;
79
- case 13:
80
- _context.prev = 13;
81
- _context.t0 = _context["catch"](1);
82
- throw (0, _contentstackError2["default"])(_context.t0);
83
- case 16:
80
+ case 5:
81
+ _context.prev = 5;
82
+ _t = _context["catch"](1);
83
+ throw (0, _contentstackError2["default"])(_t);
84
+ case 6:
84
85
  case "end":
85
86
  return _context.stop();
86
87
  }
87
- }, _callee, null, [[1, 13]]);
88
+ }, _callee, null, [[1, 5]]);
88
89
  }));
89
90
 
90
91
  /**
@@ -112,8 +113,8 @@ function Oauth(http, data, params) {
112
113
  */
113
114
  this.update = /*#__PURE__*/function () {
114
115
  var _ref3 = (0, _asyncToGenerator3["default"])(/*#__PURE__*/_regenerator2["default"].mark(function _callee2(_ref2) {
115
- var config, _ref2$param, param, headers, response;
116
- return _regenerator2["default"].wrap(function _callee2$(_context2) {
116
+ var config, _ref2$param, param, headers, response, _t2;
117
+ return _regenerator2["default"].wrap(function (_context2) {
117
118
  while (1) switch (_context2.prev = _context2.next) {
118
119
  case 0:
119
120
  config = _ref2.config, _ref2$param = _ref2.param, param = _ref2$param === void 0 ? {} : _ref2$param;
@@ -122,29 +123,29 @@ function Oauth(http, data, params) {
122
123
  headers: _objectSpread({}, (0, _cloneDeep2["default"])(_this.params)),
123
124
  params: _objectSpread({}, (0, _cloneDeep2["default"])(param))
124
125
  } || {};
125
- _context2.next = 5;
126
+ _context2.next = 2;
126
127
  return http.put(_this.urlPath, config, headers);
127
- case 5:
128
+ case 2:
128
129
  response = _context2.sent;
129
130
  if (!response.data) {
130
- _context2.next = 10;
131
+ _context2.next = 3;
131
132
  break;
132
133
  }
133
134
  return _context2.abrupt("return", response.data.data || {});
134
- case 10:
135
+ case 3:
135
136
  throw (0, _contentstackError2["default"])(response);
136
- case 11:
137
- _context2.next = 16;
137
+ case 4:
138
+ _context2.next = 6;
138
139
  break;
139
- case 13:
140
- _context2.prev = 13;
141
- _context2.t0 = _context2["catch"](1);
142
- throw (0, _contentstackError2["default"])(_context2.t0);
143
- case 16:
140
+ case 5:
141
+ _context2.prev = 5;
142
+ _t2 = _context2["catch"](1);
143
+ throw (0, _contentstackError2["default"])(_t2);
144
+ case 6:
144
145
  case "end":
145
146
  return _context2.stop();
146
147
  }
147
- }, _callee2, null, [[1, 13]]);
148
+ }, _callee2, null, [[1, 5]]);
148
149
  }));
149
150
  return function (_x) {
150
151
  return _ref3.apply(this, arguments);
@@ -165,37 +166,37 @@ function Oauth(http, data, params) {
165
166
  * .then((scopes) => console.log(scopes))
166
167
  */
167
168
  this.getScopes = /*#__PURE__*/(0, _asyncToGenerator3["default"])(/*#__PURE__*/_regenerator2["default"].mark(function _callee3() {
168
- var headers, response;
169
- return _regenerator2["default"].wrap(function _callee3$(_context3) {
169
+ var headers, response, _t3;
170
+ return _regenerator2["default"].wrap(function (_context3) {
170
171
  while (1) switch (_context3.prev = _context3.next) {
171
172
  case 0:
172
173
  _context3.prev = 0;
173
174
  headers = {
174
175
  headers: _objectSpread({}, (0, _cloneDeep2["default"])(_this.params))
175
176
  } || {};
176
- _context3.next = 4;
177
+ _context3.next = 1;
177
178
  return http.get('/manifests/oauth/scopes', headers);
178
- case 4:
179
+ case 1:
179
180
  response = _context3.sent;
180
181
  if (!response.data) {
181
- _context3.next = 9;
182
+ _context3.next = 2;
182
183
  break;
183
184
  }
184
185
  return _context3.abrupt("return", response.data.data || {});
185
- case 9:
186
+ case 2:
186
187
  throw (0, _contentstackError2["default"])(response);
187
- case 10:
188
- _context3.next = 15;
188
+ case 3:
189
+ _context3.next = 5;
189
190
  break;
190
- case 12:
191
- _context3.prev = 12;
192
- _context3.t0 = _context3["catch"](0);
193
- throw (0, _contentstackError2["default"])(_context3.t0);
194
- case 15:
191
+ case 4:
192
+ _context3.prev = 4;
193
+ _t3 = _context3["catch"](0);
194
+ throw (0, _contentstackError2["default"])(_t3);
195
+ case 5:
195
196
  case "end":
196
197
  return _context3.stop();
197
198
  }
198
- }, _callee3, null, [[0, 12]]);
199
+ }, _callee3, null, [[0, 4]]);
199
200
  }));
200
201
  }
201
202
  }
@@ -49,37 +49,37 @@ function AppRequest(http, data, param) {
49
49
  */
50
50
  this["delete"] = /*#__PURE__*/function () {
51
51
  var _ref = (0, _asyncToGenerator3["default"])(/*#__PURE__*/_regenerator2["default"].mark(function _callee(requestUid) {
52
- var headers, response;
53
- return _regenerator2["default"].wrap(function _callee$(_context) {
52
+ var headers, response, _t;
53
+ return _regenerator2["default"].wrap(function (_context) {
54
54
  while (1) switch (_context.prev = _context.next) {
55
55
  case 0:
56
56
  _context.prev = 0;
57
57
  headers = {
58
58
  headers: _objectSpread({}, (0, _cloneDeep2["default"])(_this.params))
59
59
  };
60
- _context.next = 4;
60
+ _context.next = 1;
61
61
  return http["delete"]("/requests/".concat(requestUid), headers);
62
- case 4:
62
+ case 1:
63
63
  response = _context.sent;
64
64
  if (!response.data) {
65
- _context.next = 9;
65
+ _context.next = 2;
66
66
  break;
67
67
  }
68
68
  return _context.abrupt("return", response.data);
69
- case 9:
69
+ case 2:
70
70
  throw (0, _contentstackError2["default"])(response);
71
- case 10:
72
- _context.next = 15;
71
+ case 3:
72
+ _context.next = 5;
73
73
  break;
74
- case 12:
75
- _context.prev = 12;
76
- _context.t0 = _context["catch"](0);
77
- throw (0, _contentstackError2["default"])(_context.t0);
78
- case 15:
74
+ case 4:
75
+ _context.prev = 4;
76
+ _t = _context["catch"](0);
77
+ throw (0, _contentstackError2["default"])(_t);
78
+ case 5:
79
79
  case "end":
80
80
  return _context.stop();
81
81
  }
82
- }, _callee, null, [[0, 12]]);
82
+ }, _callee, null, [[0, 4]]);
83
83
  }));
84
84
  return function (_x) {
85
85
  return _ref.apply(this, arguments);
@@ -103,8 +103,8 @@ function AppRequest(http, data, param) {
103
103
  */
104
104
  this.create = /*#__PURE__*/function () {
105
105
  var _ref3 = (0, _asyncToGenerator3["default"])(/*#__PURE__*/_regenerator2["default"].mark(function _callee2(_ref2) {
106
- var appUid, targetUid, headers, response;
107
- return _regenerator2["default"].wrap(function _callee2$(_context2) {
106
+ var appUid, targetUid, headers, response, _t2;
107
+ return _regenerator2["default"].wrap(function (_context2) {
108
108
  while (1) switch (_context2.prev = _context2.next) {
109
109
  case 0:
110
110
  appUid = _ref2.appUid, targetUid = _ref2.targetUid;
@@ -112,32 +112,32 @@ function AppRequest(http, data, param) {
112
112
  headers = {
113
113
  headers: _objectSpread({}, (0, _cloneDeep2["default"])(_this.params))
114
114
  };
115
- _context2.next = 5;
115
+ _context2.next = 2;
116
116
  return http.post("/requests", {
117
117
  app_uid: appUid,
118
118
  target_uid: targetUid
119
119
  }, headers);
120
- case 5:
120
+ case 2:
121
121
  response = _context2.sent;
122
122
  if (!response.data) {
123
- _context2.next = 10;
123
+ _context2.next = 3;
124
124
  break;
125
125
  }
126
126
  return _context2.abrupt("return", response.data);
127
- case 10:
127
+ case 3:
128
128
  throw (0, _contentstackError2["default"])(response);
129
- case 11:
130
- _context2.next = 16;
129
+ case 4:
130
+ _context2.next = 6;
131
131
  break;
132
- case 13:
133
- _context2.prev = 13;
134
- _context2.t0 = _context2["catch"](1);
135
- throw (0, _contentstackError2["default"])(_context2.t0);
136
- case 16:
132
+ case 5:
133
+ _context2.prev = 5;
134
+ _t2 = _context2["catch"](1);
135
+ throw (0, _contentstackError2["default"])(_t2);
136
+ case 6:
137
137
  case "end":
138
138
  return _context2.stop();
139
139
  }
140
- }, _callee2, null, [[1, 13]]);
140
+ }, _callee2, null, [[1, 5]]);
141
141
  }));
142
142
  return function (_x2) {
143
143
  return _ref3.apply(this, arguments);
@@ -162,8 +162,9 @@ function AppRequest(http, data, param) {
162
162
  var param,
163
163
  headers,
164
164
  response,
165
- _args3 = arguments;
166
- return _regenerator2["default"].wrap(function _callee3$(_context3) {
165
+ _args3 = arguments,
166
+ _t3;
167
+ return _regenerator2["default"].wrap(function (_context3) {
167
168
  while (1) switch (_context3.prev = _context3.next) {
168
169
  case 0:
169
170
  param = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
@@ -172,29 +173,29 @@ function AppRequest(http, data, param) {
172
173
  headers: _objectSpread({}, (0, _cloneDeep2["default"])(_this.params)),
173
174
  params: _objectSpread({}, param)
174
175
  };
175
- _context3.next = 5;
176
+ _context3.next = 2;
176
177
  return http.get("/requests", headers);
177
- case 5:
178
+ case 2:
178
179
  response = _context3.sent;
179
180
  if (!response.data) {
180
- _context3.next = 10;
181
+ _context3.next = 3;
181
182
  break;
182
183
  }
183
184
  return _context3.abrupt("return", response.data);
184
- case 10:
185
+ case 3:
185
186
  throw (0, _contentstackError2["default"])(response);
186
- case 11:
187
- _context3.next = 16;
187
+ case 4:
188
+ _context3.next = 6;
188
189
  break;
189
- case 13:
190
- _context3.prev = 13;
191
- _context3.t0 = _context3["catch"](1);
192
- throw (0, _contentstackError2["default"])(_context3.t0);
193
- case 16:
190
+ case 5:
191
+ _context3.prev = 5;
192
+ _t3 = _context3["catch"](1);
193
+ throw (0, _contentstackError2["default"])(_t3);
194
+ case 6:
194
195
  case "end":
195
196
  return _context3.stop();
196
197
  }
197
- }, _callee3, null, [[1, 13]]);
198
+ }, _callee3, null, [[1, 5]]);
198
199
  }));
199
200
  }
200
201
  }
@@ -51,8 +51,9 @@ function Authorization(http, data, params) {
51
51
  var param,
52
52
  headers,
53
53
  response,
54
- _args = arguments;
55
- return _regenerator2["default"].wrap(function _callee$(_context) {
54
+ _args = arguments,
55
+ _t;
56
+ return _regenerator2["default"].wrap(function (_context) {
56
57
  while (1) switch (_context.prev = _context.next) {
57
58
  case 0:
58
59
  param = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
@@ -61,29 +62,29 @@ function Authorization(http, data, params) {
61
62
  headers: _objectSpread({}, (0, _cloneDeep2["default"])(_this.params)),
62
63
  params: _objectSpread({}, (0, _cloneDeep2["default"])(param))
63
64
  };
64
- _context.next = 5;
65
+ _context.next = 2;
65
66
  return http.get(_this.urlPath, headers);
66
- case 5:
67
+ case 2:
67
68
  response = _context.sent;
68
69
  if (!response.data) {
69
- _context.next = 10;
70
+ _context.next = 3;
70
71
  break;
71
72
  }
72
73
  return _context.abrupt("return", response.data);
73
- case 10:
74
+ case 3:
74
75
  throw (0, _contentstackError2["default"])(response);
75
- case 11:
76
- _context.next = 16;
76
+ case 4:
77
+ _context.next = 6;
77
78
  break;
78
- case 13:
79
- _context.prev = 13;
80
- _context.t0 = _context["catch"](1);
81
- throw (0, _contentstackError2["default"])(_context.t0);
82
- case 16:
79
+ case 5:
80
+ _context.prev = 5;
81
+ _t = _context["catch"](1);
82
+ throw (0, _contentstackError2["default"])(_t);
83
+ case 6:
83
84
  case "end":
84
85
  return _context.stop();
85
86
  }
86
- }, _callee, null, [[1, 13]]);
87
+ }, _callee, null, [[1, 5]]);
87
88
  }));
88
89
  /**
89
90
  * @description Revoke all users tokens issued to an authorized app for the particular organization
@@ -99,37 +100,37 @@ function Authorization(http, data, params) {
99
100
  * .then((response) => console.log(response))
100
101
  */
101
102
  this.revokeAll = /*#__PURE__*/(0, _asyncToGenerator3["default"])(/*#__PURE__*/_regenerator2["default"].mark(function _callee2() {
102
- var headers, response;
103
- return _regenerator2["default"].wrap(function _callee2$(_context2) {
103
+ var headers, response, _t2;
104
+ return _regenerator2["default"].wrap(function (_context2) {
104
105
  while (1) switch (_context2.prev = _context2.next) {
105
106
  case 0:
106
107
  _context2.prev = 0;
107
108
  headers = {
108
109
  headers: _objectSpread({}, (0, _cloneDeep2["default"])(_this.params))
109
110
  };
110
- _context2.next = 4;
111
+ _context2.next = 1;
111
112
  return http["delete"](_this.urlPath, headers);
112
- case 4:
113
+ case 1:
113
114
  response = _context2.sent;
114
115
  if (!response.data) {
115
- _context2.next = 9;
116
+ _context2.next = 2;
116
117
  break;
117
118
  }
118
119
  return _context2.abrupt("return", response.data);
119
- case 9:
120
+ case 2:
120
121
  throw (0, _contentstackError2["default"])(response);
121
- case 10:
122
- _context2.next = 15;
122
+ case 3:
123
+ _context2.next = 5;
123
124
  break;
124
- case 12:
125
- _context2.prev = 12;
126
- _context2.t0 = _context2["catch"](0);
127
- throw (0, _contentstackError2["default"])(_context2.t0);
128
- case 15:
125
+ case 4:
126
+ _context2.prev = 4;
127
+ _t2 = _context2["catch"](0);
128
+ throw (0, _contentstackError2["default"])(_t2);
129
+ case 5:
129
130
  case "end":
130
131
  return _context2.stop();
131
132
  }
132
- }, _callee2, null, [[0, 12]]);
133
+ }, _callee2, null, [[0, 4]]);
133
134
  }));
134
135
  /**
135
136
  * @description Revoke user token issued to an authorized app for the particular organization
@@ -146,37 +147,37 @@ function Authorization(http, data, params) {
146
147
  */
147
148
  this.revoke = /*#__PURE__*/function () {
148
149
  var _ref3 = (0, _asyncToGenerator3["default"])(/*#__PURE__*/_regenerator2["default"].mark(function _callee3(authorizationUid) {
149
- var headers, response;
150
- return _regenerator2["default"].wrap(function _callee3$(_context3) {
150
+ var headers, response, _t3;
151
+ return _regenerator2["default"].wrap(function (_context3) {
151
152
  while (1) switch (_context3.prev = _context3.next) {
152
153
  case 0:
153
154
  _context3.prev = 0;
154
155
  headers = {
155
156
  headers: _objectSpread({}, (0, _cloneDeep2["default"])(_this.params))
156
157
  };
157
- _context3.next = 4;
158
+ _context3.next = 1;
158
159
  return http["delete"]("".concat(_this.urlPath, "/").concat(authorizationUid), headers);
159
- case 4:
160
+ case 1:
160
161
  response = _context3.sent;
161
162
  if (!response.data) {
162
- _context3.next = 9;
163
+ _context3.next = 2;
163
164
  break;
164
165
  }
165
166
  return _context3.abrupt("return", response.data);
166
- case 9:
167
+ case 2:
167
168
  throw (0, _contentstackError2["default"])(response);
168
- case 10:
169
- _context3.next = 15;
169
+ case 3:
170
+ _context3.next = 5;
170
171
  break;
171
- case 12:
172
- _context3.prev = 12;
173
- _context3.t0 = _context3["catch"](0);
174
- throw (0, _contentstackError2["default"])(_context3.t0);
175
- case 15:
172
+ case 4:
173
+ _context3.prev = 4;
174
+ _t3 = _context3["catch"](0);
175
+ throw (0, _contentstackError2["default"])(_t3);
176
+ case 5:
176
177
  case "end":
177
178
  return _context3.stop();
178
179
  }
179
- }, _callee3, null, [[0, 12]]);
180
+ }, _callee3, null, [[0, 4]]);
180
181
  }));
181
182
  return function (_x) {
182
183
  return _ref3.apply(this, arguments);
@@ -125,6 +125,74 @@ function Marketplace(http, data) {
125
125
  this.urlPath = '/manifests';
126
126
  this.findAllApps = (0, _entity.fetchAll)(http, AppCollection, this.params);
127
127
 
128
+ /**
129
+ * @description Search installed apps
130
+ * @memberof Marketplace
131
+ * @func searchInstalledApps
132
+ * @param {String} search - Search term
133
+ * @param {Object} queryParams - Additional query parameters
134
+ * @returns {Promise<ContentstackCollection<App>>}
135
+ *
136
+ * @example
137
+ * import * as contentstack from '@contentstack/marketplace'
138
+ * const client = contentstack.client({ authtoken: 'TOKEN'})
139
+ *
140
+ * client.marketplace('organization_uid').searchApps('search_term')
141
+ * .then((collection) => console.log(collection))
142
+ *
143
+ */
144
+ this.searchApps = /*#__PURE__*/function () {
145
+ var _ref = (0, _asyncToGenerator3["default"])(/*#__PURE__*/_regenerator2["default"].mark(function _callee(search) {
146
+ var queryParams,
147
+ headers,
148
+ response,
149
+ _args = arguments,
150
+ _t;
151
+ return _regenerator2["default"].wrap(function (_context) {
152
+ while (1) switch (_context.prev = _context.next) {
153
+ case 0:
154
+ queryParams = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
155
+ _context.prev = 1;
156
+ if (search) {
157
+ _context.next = 2;
158
+ break;
159
+ }
160
+ throw new Error("Search parameter is required");
161
+ case 2:
162
+ headers = {
163
+ headers: _objectSpread({}, (0, _cloneDeep2["default"])(_this.params)),
164
+ params: _objectSpread({
165
+ search: search
166
+ }, (0, _cloneDeep2["default"])(queryParams))
167
+ };
168
+ _context.next = 3;
169
+ return http.get(_this.urlPath, headers);
170
+ case 3:
171
+ response = _context.sent;
172
+ if (!response.data) {
173
+ _context.next = 4;
174
+ break;
175
+ }
176
+ return _context.abrupt("return", response.data);
177
+ case 4:
178
+ throw (0, _contentstackError2["default"])(response);
179
+ case 5:
180
+ _context.next = 7;
181
+ break;
182
+ case 6:
183
+ _context.prev = 6;
184
+ _t = _context["catch"](1);
185
+ throw (0, _contentstackError2["default"])(_t);
186
+ case 7:
187
+ case "end":
188
+ return _context.stop();
189
+ }
190
+ }, _callee, null, [[1, 6]]);
191
+ }));
192
+ return function (_x) {
193
+ return _ref.apply(this, arguments);
194
+ };
195
+ }();
128
196
  /**
129
197
  * @description To get the apps list of authorized apps for the particular organization
130
198
  * @memberof Marketplace
@@ -139,43 +207,44 @@ function Marketplace(http, data) {
139
207
  * .then((roles) => console.log(roles))
140
208
  *
141
209
  */
142
- this.findAllAuthorizedApps = /*#__PURE__*/(0, _asyncToGenerator3["default"])(/*#__PURE__*/_regenerator2["default"].mark(function _callee() {
210
+ this.findAllAuthorizedApps = /*#__PURE__*/(0, _asyncToGenerator3["default"])(/*#__PURE__*/_regenerator2["default"].mark(function _callee2() {
143
211
  var param,
144
212
  headers,
145
213
  response,
146
- _args = arguments;
147
- return _regenerator2["default"].wrap(function _callee$(_context) {
148
- while (1) switch (_context.prev = _context.next) {
214
+ _args2 = arguments,
215
+ _t2;
216
+ return _regenerator2["default"].wrap(function (_context2) {
217
+ while (1) switch (_context2.prev = _context2.next) {
149
218
  case 0:
150
- param = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
219
+ param = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
151
220
  headers = {
152
221
  headers: _objectSpread({}, (0, _cloneDeep2["default"])(_this.params))
153
222
  };
154
223
  headers.params = _objectSpread({}, param);
155
- _context.prev = 3;
156
- _context.next = 6;
224
+ _context2.prev = 1;
225
+ _context2.next = 2;
157
226
  return http.get("/authorized-apps", headers);
158
- case 6:
159
- response = _context.sent;
227
+ case 2:
228
+ response = _context2.sent;
160
229
  if (!response.data) {
161
- _context.next = 11;
230
+ _context2.next = 3;
162
231
  break;
163
232
  }
164
- return _context.abrupt("return", response.data);
165
- case 11:
166
- return _context.abrupt("return", (0, _contentstackError2["default"])(response));
167
- case 12:
168
- _context.next = 17;
233
+ return _context2.abrupt("return", response.data);
234
+ case 3:
235
+ return _context2.abrupt("return", (0, _contentstackError2["default"])(response));
236
+ case 4:
237
+ _context2.next = 6;
169
238
  break;
170
- case 14:
171
- _context.prev = 14;
172
- _context.t0 = _context["catch"](3);
173
- return _context.abrupt("return", (0, _contentstackError2["default"])(_context.t0));
174
- case 17:
239
+ case 5:
240
+ _context2.prev = 5;
241
+ _t2 = _context2["catch"](1);
242
+ return _context2.abrupt("return", (0, _contentstackError2["default"])(_t2));
243
+ case 6:
175
244
  case "end":
176
- return _context.stop();
245
+ return _context2.stop();
177
246
  }
178
- }, _callee, null, [[3, 14]]);
247
+ }, _callee2, null, [[1, 5]]);
179
248
  }));
180
249
  }
181
250
  return this;