@contentstack/marketplace-sdk 1.2.8 → 1.2.9

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.
@@ -40,8 +40,9 @@ export function Oauth(http, data, params) {
40
40
  var param,
41
41
  headers,
42
42
  response,
43
- _args = arguments;
44
- return _regeneratorRuntime.wrap(function _callee$(_context) {
43
+ _args = arguments,
44
+ _t;
45
+ return _regeneratorRuntime.wrap(function (_context) {
45
46
  while (1) switch (_context.prev = _context.next) {
46
47
  case 0:
47
48
  param = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
@@ -50,29 +51,29 @@ export function Oauth(http, data, params) {
50
51
  headers: _objectSpread({}, cloneDeep(_this.params)),
51
52
  params: _objectSpread({}, cloneDeep(param))
52
53
  } || {};
53
- _context.next = 5;
54
+ _context.next = 2;
54
55
  return http.get(_this.urlPath, headers);
55
- case 5:
56
+ case 2:
56
57
  response = _context.sent;
57
58
  if (!response.data) {
58
- _context.next = 10;
59
+ _context.next = 3;
59
60
  break;
60
61
  }
61
62
  return _context.abrupt("return", response.data.data || {});
62
- case 10:
63
+ case 3:
63
64
  throw error(response);
64
- case 11:
65
- _context.next = 16;
65
+ case 4:
66
+ _context.next = 6;
66
67
  break;
67
- case 13:
68
- _context.prev = 13;
69
- _context.t0 = _context["catch"](1);
70
- throw error(_context.t0);
71
- case 16:
68
+ case 5:
69
+ _context.prev = 5;
70
+ _t = _context["catch"](1);
71
+ throw error(_t);
72
+ case 6:
72
73
  case "end":
73
74
  return _context.stop();
74
75
  }
75
- }, _callee, null, [[1, 13]]);
76
+ }, _callee, null, [[1, 5]]);
76
77
  }));
77
78
 
78
79
  /**
@@ -100,8 +101,8 @@ export function Oauth(http, data, params) {
100
101
  */
101
102
  this.update = /*#__PURE__*/function () {
102
103
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
103
- var config, _ref2$param, param, headers, response;
104
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
104
+ var config, _ref2$param, param, headers, response, _t2;
105
+ return _regeneratorRuntime.wrap(function (_context2) {
105
106
  while (1) switch (_context2.prev = _context2.next) {
106
107
  case 0:
107
108
  config = _ref2.config, _ref2$param = _ref2.param, param = _ref2$param === void 0 ? {} : _ref2$param;
@@ -110,29 +111,29 @@ export function Oauth(http, data, params) {
110
111
  headers: _objectSpread({}, cloneDeep(_this.params)),
111
112
  params: _objectSpread({}, cloneDeep(param))
112
113
  } || {};
113
- _context2.next = 5;
114
+ _context2.next = 2;
114
115
  return http.put(_this.urlPath, config, headers);
115
- case 5:
116
+ case 2:
116
117
  response = _context2.sent;
117
118
  if (!response.data) {
118
- _context2.next = 10;
119
+ _context2.next = 3;
119
120
  break;
120
121
  }
121
122
  return _context2.abrupt("return", response.data.data || {});
122
- case 10:
123
+ case 3:
123
124
  throw error(response);
124
- case 11:
125
- _context2.next = 16;
125
+ case 4:
126
+ _context2.next = 6;
126
127
  break;
127
- case 13:
128
- _context2.prev = 13;
129
- _context2.t0 = _context2["catch"](1);
130
- throw error(_context2.t0);
131
- case 16:
128
+ case 5:
129
+ _context2.prev = 5;
130
+ _t2 = _context2["catch"](1);
131
+ throw error(_t2);
132
+ case 6:
132
133
  case "end":
133
134
  return _context2.stop();
134
135
  }
135
- }, _callee2, null, [[1, 13]]);
136
+ }, _callee2, null, [[1, 5]]);
136
137
  }));
137
138
  return function (_x) {
138
139
  return _ref3.apply(this, arguments);
@@ -153,37 +154,37 @@ export function Oauth(http, data, params) {
153
154
  * .then((scopes) => console.log(scopes))
154
155
  */
155
156
  this.getScopes = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
156
- var headers, response;
157
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
157
+ var headers, response, _t3;
158
+ return _regeneratorRuntime.wrap(function (_context3) {
158
159
  while (1) switch (_context3.prev = _context3.next) {
159
160
  case 0:
160
161
  _context3.prev = 0;
161
162
  headers = {
162
163
  headers: _objectSpread({}, cloneDeep(_this.params))
163
164
  } || {};
164
- _context3.next = 4;
165
+ _context3.next = 1;
165
166
  return http.get('/manifests/oauth/scopes', headers);
166
- case 4:
167
+ case 1:
167
168
  response = _context3.sent;
168
169
  if (!response.data) {
169
- _context3.next = 9;
170
+ _context3.next = 2;
170
171
  break;
171
172
  }
172
173
  return _context3.abrupt("return", response.data.data || {});
173
- case 9:
174
+ case 2:
174
175
  throw error(response);
175
- case 10:
176
- _context3.next = 15;
176
+ case 3:
177
+ _context3.next = 5;
177
178
  break;
178
- case 12:
179
- _context3.prev = 12;
180
- _context3.t0 = _context3["catch"](0);
181
- throw error(_context3.t0);
182
- case 15:
179
+ case 4:
180
+ _context3.prev = 4;
181
+ _t3 = _context3["catch"](0);
182
+ throw error(_t3);
183
+ case 5:
183
184
  case "end":
184
185
  return _context3.stop();
185
186
  }
186
- }, _callee3, null, [[0, 12]]);
187
+ }, _callee3, null, [[0, 4]]);
187
188
  }));
188
189
  }
189
190
  }
@@ -37,37 +37,37 @@ export function AppRequest(http, data, param) {
37
37
  */
38
38
  this["delete"] = /*#__PURE__*/function () {
39
39
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(requestUid) {
40
- var headers, response;
41
- return _regeneratorRuntime.wrap(function _callee$(_context) {
40
+ var headers, response, _t;
41
+ return _regeneratorRuntime.wrap(function (_context) {
42
42
  while (1) switch (_context.prev = _context.next) {
43
43
  case 0:
44
44
  _context.prev = 0;
45
45
  headers = {
46
46
  headers: _objectSpread({}, cloneDeep(_this.params))
47
47
  };
48
- _context.next = 4;
48
+ _context.next = 1;
49
49
  return http["delete"]("/requests/".concat(requestUid), headers);
50
- case 4:
50
+ case 1:
51
51
  response = _context.sent;
52
52
  if (!response.data) {
53
- _context.next = 9;
53
+ _context.next = 2;
54
54
  break;
55
55
  }
56
56
  return _context.abrupt("return", response.data);
57
- case 9:
57
+ case 2:
58
58
  throw error(response);
59
- case 10:
60
- _context.next = 15;
59
+ case 3:
60
+ _context.next = 5;
61
61
  break;
62
- case 12:
63
- _context.prev = 12;
64
- _context.t0 = _context["catch"](0);
65
- throw error(_context.t0);
66
- case 15:
62
+ case 4:
63
+ _context.prev = 4;
64
+ _t = _context["catch"](0);
65
+ throw error(_t);
66
+ case 5:
67
67
  case "end":
68
68
  return _context.stop();
69
69
  }
70
- }, _callee, null, [[0, 12]]);
70
+ }, _callee, null, [[0, 4]]);
71
71
  }));
72
72
  return function (_x) {
73
73
  return _ref.apply(this, arguments);
@@ -91,8 +91,8 @@ export function AppRequest(http, data, param) {
91
91
  */
92
92
  this.create = /*#__PURE__*/function () {
93
93
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref2) {
94
- var appUid, targetUid, headers, response;
95
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
94
+ var appUid, targetUid, headers, response, _t2;
95
+ return _regeneratorRuntime.wrap(function (_context2) {
96
96
  while (1) switch (_context2.prev = _context2.next) {
97
97
  case 0:
98
98
  appUid = _ref2.appUid, targetUid = _ref2.targetUid;
@@ -100,32 +100,32 @@ export function AppRequest(http, data, param) {
100
100
  headers = {
101
101
  headers: _objectSpread({}, cloneDeep(_this.params))
102
102
  };
103
- _context2.next = 5;
103
+ _context2.next = 2;
104
104
  return http.post("/requests", {
105
105
  app_uid: appUid,
106
106
  target_uid: targetUid
107
107
  }, headers);
108
- case 5:
108
+ case 2:
109
109
  response = _context2.sent;
110
110
  if (!response.data) {
111
- _context2.next = 10;
111
+ _context2.next = 3;
112
112
  break;
113
113
  }
114
114
  return _context2.abrupt("return", response.data);
115
- case 10:
115
+ case 3:
116
116
  throw error(response);
117
- case 11:
118
- _context2.next = 16;
117
+ case 4:
118
+ _context2.next = 6;
119
119
  break;
120
- case 13:
121
- _context2.prev = 13;
122
- _context2.t0 = _context2["catch"](1);
123
- throw error(_context2.t0);
124
- case 16:
120
+ case 5:
121
+ _context2.prev = 5;
122
+ _t2 = _context2["catch"](1);
123
+ throw error(_t2);
124
+ case 6:
125
125
  case "end":
126
126
  return _context2.stop();
127
127
  }
128
- }, _callee2, null, [[1, 13]]);
128
+ }, _callee2, null, [[1, 5]]);
129
129
  }));
130
130
  return function (_x2) {
131
131
  return _ref3.apply(this, arguments);
@@ -150,8 +150,9 @@ export function AppRequest(http, data, param) {
150
150
  var param,
151
151
  headers,
152
152
  response,
153
- _args3 = arguments;
154
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
153
+ _args3 = arguments,
154
+ _t3;
155
+ return _regeneratorRuntime.wrap(function (_context3) {
155
156
  while (1) switch (_context3.prev = _context3.next) {
156
157
  case 0:
157
158
  param = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
@@ -160,29 +161,29 @@ export function AppRequest(http, data, param) {
160
161
  headers: _objectSpread({}, cloneDeep(_this.params)),
161
162
  params: _objectSpread({}, param)
162
163
  };
163
- _context3.next = 5;
164
+ _context3.next = 2;
164
165
  return http.get("/requests", headers);
165
- case 5:
166
+ case 2:
166
167
  response = _context3.sent;
167
168
  if (!response.data) {
168
- _context3.next = 10;
169
+ _context3.next = 3;
169
170
  break;
170
171
  }
171
172
  return _context3.abrupt("return", response.data);
172
- case 10:
173
+ case 3:
173
174
  throw error(response);
174
- case 11:
175
- _context3.next = 16;
175
+ case 4:
176
+ _context3.next = 6;
176
177
  break;
177
- case 13:
178
- _context3.prev = 13;
179
- _context3.t0 = _context3["catch"](1);
180
- throw error(_context3.t0);
181
- case 16:
178
+ case 5:
179
+ _context3.prev = 5;
180
+ _t3 = _context3["catch"](1);
181
+ throw error(_t3);
182
+ case 6:
182
183
  case "end":
183
184
  return _context3.stop();
184
185
  }
185
- }, _callee3, null, [[1, 13]]);
186
+ }, _callee3, null, [[1, 5]]);
186
187
  }));
187
188
  }
188
189
  }
@@ -39,8 +39,9 @@ export function Authorization(http, data, params) {
39
39
  var param,
40
40
  headers,
41
41
  response,
42
- _args = arguments;
43
- return _regeneratorRuntime.wrap(function _callee$(_context) {
42
+ _args = arguments,
43
+ _t;
44
+ return _regeneratorRuntime.wrap(function (_context) {
44
45
  while (1) switch (_context.prev = _context.next) {
45
46
  case 0:
46
47
  param = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
@@ -49,29 +50,29 @@ export function Authorization(http, data, params) {
49
50
  headers: _objectSpread({}, cloneDeep(_this.params)),
50
51
  params: _objectSpread({}, cloneDeep(param))
51
52
  };
52
- _context.next = 5;
53
+ _context.next = 2;
53
54
  return http.get(_this.urlPath, headers);
54
- case 5:
55
+ case 2:
55
56
  response = _context.sent;
56
57
  if (!response.data) {
57
- _context.next = 10;
58
+ _context.next = 3;
58
59
  break;
59
60
  }
60
61
  return _context.abrupt("return", response.data);
61
- case 10:
62
+ case 3:
62
63
  throw error(response);
63
- case 11:
64
- _context.next = 16;
64
+ case 4:
65
+ _context.next = 6;
65
66
  break;
66
- case 13:
67
- _context.prev = 13;
68
- _context.t0 = _context["catch"](1);
69
- throw error(_context.t0);
70
- case 16:
67
+ case 5:
68
+ _context.prev = 5;
69
+ _t = _context["catch"](1);
70
+ throw error(_t);
71
+ case 6:
71
72
  case "end":
72
73
  return _context.stop();
73
74
  }
74
- }, _callee, null, [[1, 13]]);
75
+ }, _callee, null, [[1, 5]]);
75
76
  }));
76
77
  /**
77
78
  * @description Revoke all users tokens issued to an authorized app for the particular organization
@@ -87,37 +88,37 @@ export function Authorization(http, data, params) {
87
88
  * .then((response) => console.log(response))
88
89
  */
89
90
  this.revokeAll = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
90
- var headers, response;
91
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
91
+ var headers, response, _t2;
92
+ return _regeneratorRuntime.wrap(function (_context2) {
92
93
  while (1) switch (_context2.prev = _context2.next) {
93
94
  case 0:
94
95
  _context2.prev = 0;
95
96
  headers = {
96
97
  headers: _objectSpread({}, cloneDeep(_this.params))
97
98
  };
98
- _context2.next = 4;
99
+ _context2.next = 1;
99
100
  return http["delete"](_this.urlPath, headers);
100
- case 4:
101
+ case 1:
101
102
  response = _context2.sent;
102
103
  if (!response.data) {
103
- _context2.next = 9;
104
+ _context2.next = 2;
104
105
  break;
105
106
  }
106
107
  return _context2.abrupt("return", response.data);
107
- case 9:
108
+ case 2:
108
109
  throw error(response);
109
- case 10:
110
- _context2.next = 15;
110
+ case 3:
111
+ _context2.next = 5;
111
112
  break;
112
- case 12:
113
- _context2.prev = 12;
114
- _context2.t0 = _context2["catch"](0);
115
- throw error(_context2.t0);
116
- case 15:
113
+ case 4:
114
+ _context2.prev = 4;
115
+ _t2 = _context2["catch"](0);
116
+ throw error(_t2);
117
+ case 5:
117
118
  case "end":
118
119
  return _context2.stop();
119
120
  }
120
- }, _callee2, null, [[0, 12]]);
121
+ }, _callee2, null, [[0, 4]]);
121
122
  }));
122
123
  /**
123
124
  * @description Revoke user token issued to an authorized app for the particular organization
@@ -134,37 +135,37 @@ export function Authorization(http, data, params) {
134
135
  */
135
136
  this.revoke = /*#__PURE__*/function () {
136
137
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(authorizationUid) {
137
- var headers, response;
138
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
138
+ var headers, response, _t3;
139
+ return _regeneratorRuntime.wrap(function (_context3) {
139
140
  while (1) switch (_context3.prev = _context3.next) {
140
141
  case 0:
141
142
  _context3.prev = 0;
142
143
  headers = {
143
144
  headers: _objectSpread({}, cloneDeep(_this.params))
144
145
  };
145
- _context3.next = 4;
146
+ _context3.next = 1;
146
147
  return http["delete"]("".concat(_this.urlPath, "/").concat(authorizationUid), headers);
147
- case 4:
148
+ case 1:
148
149
  response = _context3.sent;
149
150
  if (!response.data) {
150
- _context3.next = 9;
151
+ _context3.next = 2;
151
152
  break;
152
153
  }
153
154
  return _context3.abrupt("return", response.data);
154
- case 9:
155
+ case 2:
155
156
  throw error(response);
156
- case 10:
157
- _context3.next = 15;
157
+ case 3:
158
+ _context3.next = 5;
158
159
  break;
159
- case 12:
160
- _context3.prev = 12;
161
- _context3.t0 = _context3["catch"](0);
162
- throw error(_context3.t0);
163
- case 15:
160
+ case 4:
161
+ _context3.prev = 4;
162
+ _t3 = _context3["catch"](0);
163
+ throw error(_t3);
164
+ case 5:
164
165
  case "end":
165
166
  return _context3.stop();
166
167
  }
167
- }, _callee3, null, [[0, 12]]);
168
+ }, _callee3, null, [[0, 4]]);
168
169
  }));
169
170
  return function (_x) {
170
171
  return _ref3.apply(this, arguments);
@@ -130,8 +130,9 @@ export function Marketplace(http, data) {
130
130
  var param,
131
131
  headers,
132
132
  response,
133
- _args = arguments;
134
- return _regeneratorRuntime.wrap(function _callee$(_context) {
133
+ _args = arguments,
134
+ _t;
135
+ return _regeneratorRuntime.wrap(function (_context) {
135
136
  while (1) switch (_context.prev = _context.next) {
136
137
  case 0:
137
138
  param = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
@@ -139,30 +140,30 @@ export function Marketplace(http, data) {
139
140
  headers: _objectSpread({}, cloneDeep(_this.params))
140
141
  };
141
142
  headers.params = _objectSpread({}, param);
142
- _context.prev = 3;
143
- _context.next = 6;
143
+ _context.prev = 1;
144
+ _context.next = 2;
144
145
  return http.get("/authorized-apps", headers);
145
- case 6:
146
+ case 2:
146
147
  response = _context.sent;
147
148
  if (!response.data) {
148
- _context.next = 11;
149
+ _context.next = 3;
149
150
  break;
150
151
  }
151
152
  return _context.abrupt("return", response.data);
152
- case 11:
153
+ case 3:
153
154
  return _context.abrupt("return", error(response));
154
- case 12:
155
- _context.next = 17;
155
+ case 4:
156
+ _context.next = 6;
156
157
  break;
157
- case 14:
158
- _context.prev = 14;
159
- _context.t0 = _context["catch"](3);
160
- return _context.abrupt("return", error(_context.t0));
161
- case 17:
158
+ case 5:
159
+ _context.prev = 5;
160
+ _t = _context["catch"](1);
161
+ return _context.abrupt("return", error(_t));
162
+ case 6:
162
163
  case "end":
163
164
  return _context.stop();
164
165
  }
165
- }, _callee, null, [[3, 14]]);
166
+ }, _callee, null, [[1, 5]]);
166
167
  }));
167
168
  }
168
169
  return this;