@contentstack/marketplace-sdk 1.0.0 → 1.0.1

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # Changelog
2
+
3
+ ## [v1.0.1](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.0.1) (2023-12-12)
4
+ - Bug Fix
5
+ - Added missing Region to endpoint
6
+
7
+ ## [v1.0.0](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.0.0) (2023-10-18)
8
+ - Initial release of Marketplace SDK
@@ -10,6 +10,7 @@ import clonedeep from 'lodash/cloneDeep';
10
10
  import getUserAgent from './core/Util.js';
11
11
  import contentstackClient from './contentstackClient.js';
12
12
  import httpClient from './core/contentstackHTTPClient.js';
13
+ import Region from './core/region.js';
13
14
 
14
15
  /**
15
16
  * Create client instance
@@ -158,7 +159,7 @@ import httpClient from './core/contentstackHTTPClient.js';
158
159
  * @prop {string=} params.integration - Integration name and version e.g react/version
159
160
  * @returns Contentstack.Client
160
161
  */
161
- export function client() {
162
+ function client() {
162
163
  var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
163
164
  var defaultParameter = {
164
165
  defaultHostName: 'developerhub-api.contentstack.com'
@@ -181,4 +182,5 @@ export function client() {
181
182
  return contentstackClient({
182
183
  http: http
183
184
  });
184
- }
185
+ }
186
+ export { client, Region };
@@ -4,6 +4,7 @@
4
4
 
5
5
  import error from './core/contentstackError';
6
6
  import { Marketplace } from './marketplace/index.js';
7
+ import { Region } from './contentstack.js';
7
8
  export default function contentstackClient(_ref) {
8
9
  var http = _ref.http;
9
10
  /**
@@ -24,10 +25,16 @@ export default function contentstackClient(_ref) {
24
25
  *
25
26
  * client.marketplace()
26
27
  */
28
+
29
+ var region = http.defaults.region;
30
+ var baseUrlPath = "https://api.contentstack.io:443/v3/user-session";
31
+ if (region && region !== Region.NA) {
32
+ baseUrlPath = "https://".concat(region, "-api.contentstack.com:443/v3/user-session");
33
+ }
27
34
  function login(requestBody) {
28
35
  var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
29
36
  http.defaults.versioningStrategy = 'path';
30
- return http.post('https://api.contentstack.io:443/v3/user-session', {
37
+ return http.post(baseUrlPath, {
31
38
  user: requestBody
32
39
  }, {
33
40
  params: params
@@ -89,7 +96,7 @@ export default function contentstackClient(_ref) {
89
96
  function logout(authtoken) {
90
97
  http.defaults.versioningStrategy = 'path';
91
98
  if (authtoken !== undefined) {
92
- return http["delete"]('https://api.contentstack.io:443/v3/user-session', {
99
+ return http["delete"](baseUrlPath, {
93
100
  headers: {
94
101
  authtoken: authtoken
95
102
  }
@@ -97,7 +104,7 @@ export default function contentstackClient(_ref) {
97
104
  return response.data;
98
105
  }, error);
99
106
  }
100
- return http["delete"]('https://api.contentstack.io:443/v3/user-session').then(function (response) {
107
+ return http["delete"](baseUrlPath).then(function (response) {
101
108
  if (http.defaults.headers.common) {
102
109
  delete http.defaults.headers.common.authtoken;
103
110
  }
@@ -7,6 +7,7 @@ import clonedeep from 'lodash/cloneDeep';
7
7
  import Qs from 'qs';
8
8
  import { ConcurrencyQueue } from './concurrency-queue';
9
9
  import { isHost } from './Util';
10
+ import Region from './region';
10
11
  export default function contentstackHttpClient(options) {
11
12
  var defaultConfig = {
12
13
  insecure: false,
@@ -45,6 +46,7 @@ export default function contentstackHttpClient(options) {
45
46
  var protocol = config.insecure ? 'http' : 'https';
46
47
  var hostname = config.defaultHostName;
47
48
  var port = config.port || 443;
49
+ var baseUrlPath = '';
48
50
  if (isHost(config.host)) {
49
51
  var parsed = config.host.split(':');
50
52
  if (parsed.length === 2) {
@@ -58,7 +60,12 @@ export default function contentstackHttpClient(options) {
58
60
  if (config.basePath) {
59
61
  config.basePath = "/".concat(config.basePath.split('/').filter(Boolean).join('/'));
60
62
  }
61
- var baseURL = config.endpoint || "".concat(protocol, "://").concat(hostname, ":").concat(port).concat(config.basePath);
63
+ if (config.region && config.region !== Region.NA) {
64
+ baseUrlPath = "".concat(protocol, "://").concat(config.region, "-").concat(hostname, ":").concat(port).concat(config.basePath);
65
+ } else {
66
+ baseUrlPath = "".concat(protocol, "://").concat(hostname, ":").concat(port).concat(config.basePath);
67
+ }
68
+ var baseURL = config.endpoint || baseUrlPath;
62
69
  var axiosOptions = _objectSpread(_objectSpread({
63
70
  // Axios
64
71
  baseURL: baseURL
@@ -0,0 +1,7 @@
1
+ var Region = {
2
+ EU: 'eu',
3
+ NA: '',
4
+ AZURE_NA: 'azure-na',
5
+ AZURE_EU: 'azure-eu'
6
+ };
7
+ export default Region;
@@ -6,191 +6,61 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
6
6
  import error from './core/contentstackError';
7
7
  import cloneDeep from 'lodash/cloneDeep';
8
8
  import ContentstackCollection from './contentstackCollection';
9
- export var publish = function publish(http, type) {
9
+ export var create = function create(_ref) {
10
+ var http = _ref.http,
11
+ params = _ref.params;
10
12
  return /*#__PURE__*/function () {
11
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref) {
12
- var publishDetails, _ref$locale, locale, _ref$version, version, _ref$scheduledAt, scheduledAt, url, headers, httpBody;
13
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(data, param) {
14
+ var headers, response;
13
15
  return _regeneratorRuntime.wrap(function _callee$(_context) {
14
16
  while (1) switch (_context.prev = _context.next) {
15
- case 0:
16
- publishDetails = _ref.publishDetails, _ref$locale = _ref.locale, locale = _ref$locale === void 0 ? null : _ref$locale, _ref$version = _ref.version, version = _ref$version === void 0 ? null : _ref$version, _ref$scheduledAt = _ref.scheduledAt, scheduledAt = _ref$scheduledAt === void 0 ? null : _ref$scheduledAt;
17
- url = this.urlPath + '/publish';
18
- headers = {
19
- headers: _objectSpread({}, cloneDeep(this.stackHeaders))
20
- } || {};
21
- httpBody = {};
22
- httpBody[type] = cloneDeep(publishDetails);
23
- return _context.abrupt("return", publishUnpublish(http, url, httpBody, headers, locale, version, scheduledAt));
24
- case 6:
25
- case "end":
26
- return _context.stop();
27
- }
28
- }, _callee, this);
29
- }));
30
- return function (_x) {
31
- return _ref2.apply(this, arguments);
32
- };
33
- }();
34
- };
35
- export var unpublish = function unpublish(http, type) {
36
- return /*#__PURE__*/function () {
37
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) {
38
- var publishDetails, _ref3$locale, locale, _ref3$version, version, _ref3$scheduledAt, scheduledAt, url, headers, httpBody;
39
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
40
- while (1) switch (_context2.prev = _context2.next) {
41
- case 0:
42
- publishDetails = _ref3.publishDetails, _ref3$locale = _ref3.locale, locale = _ref3$locale === void 0 ? null : _ref3$locale, _ref3$version = _ref3.version, version = _ref3$version === void 0 ? null : _ref3$version, _ref3$scheduledAt = _ref3.scheduledAt, scheduledAt = _ref3$scheduledAt === void 0 ? null : _ref3$scheduledAt;
43
- url = this.urlPath + '/unpublish';
44
- headers = {
45
- headers: _objectSpread({}, cloneDeep(this.stackHeaders))
46
- } || {};
47
- httpBody = {};
48
- httpBody[type] = cloneDeep(publishDetails);
49
- return _context2.abrupt("return", publishUnpublish(http, url, httpBody, headers, locale, version, scheduledAt));
50
- case 6:
51
- case "end":
52
- return _context2.stop();
53
- }
54
- }, _callee2, this);
55
- }));
56
- return function (_x2) {
57
- return _ref4.apply(this, arguments);
58
- };
59
- }();
60
- };
61
- export var publishUnpublish = /*#__PURE__*/function () {
62
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(http, url, httpBody, headers) {
63
- var locale,
64
- version,
65
- scheduledAt,
66
- response,
67
- _args3 = arguments;
68
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
69
- while (1) switch (_context3.prev = _context3.next) {
70
- case 0:
71
- locale = _args3.length > 4 && _args3[4] !== undefined ? _args3[4] : null;
72
- version = _args3.length > 5 && _args3[5] !== undefined ? _args3[5] : null;
73
- scheduledAt = _args3.length > 6 && _args3[6] !== undefined ? _args3[6] : null;
74
- if (locale !== null) {
75
- httpBody.locale = locale;
76
- }
77
- if (version !== null) {
78
- httpBody.version = version;
79
- }
80
- if (scheduledAt !== null) {
81
- httpBody.scheduled_at = scheduledAt;
82
- }
83
- _context3.prev = 6;
84
- _context3.next = 9;
85
- return http.post(url, httpBody, headers);
86
- case 9:
87
- response = _context3.sent;
88
- if (!response.data) {
89
- _context3.next = 14;
90
- break;
91
- }
92
- return _context3.abrupt("return", response.data);
93
- case 14:
94
- throw error(response);
95
- case 15:
96
- _context3.next = 20;
97
- break;
98
- case 17:
99
- _context3.prev = 17;
100
- _context3.t0 = _context3["catch"](6);
101
- throw error(_context3.t0);
102
- case 20:
103
- case "end":
104
- return _context3.stop();
105
- }
106
- }, _callee3, null, [[6, 17]]);
107
- }));
108
- return function publishUnpublish(_x3, _x4, _x5, _x6) {
109
- return _ref5.apply(this, arguments);
110
- };
111
- }();
112
- export var upload = /*#__PURE__*/function () {
113
- var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref6) {
114
- var http, urlPath, stackHeaders, formData, params, _ref6$method, method, headers;
115
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
116
- while (1) switch (_context4.prev = _context4.next) {
117
- case 0:
118
- http = _ref6.http, urlPath = _ref6.urlPath, stackHeaders = _ref6.stackHeaders, formData = _ref6.formData, params = _ref6.params, _ref6$method = _ref6.method, method = _ref6$method === void 0 ? 'POST' : _ref6$method;
119
- headers = {
120
- headers: _objectSpread(_objectSpread({}, params), cloneDeep(stackHeaders))
121
- } || {};
122
- if (!(method === 'POST')) {
123
- _context4.next = 6;
124
- break;
125
- }
126
- return _context4.abrupt("return", http.post(urlPath, formData, headers));
127
- case 6:
128
- return _context4.abrupt("return", http.put(urlPath, formData, headers));
129
- case 7:
130
- case "end":
131
- return _context4.stop();
132
- }
133
- }, _callee4);
134
- }));
135
- return function upload(_x7) {
136
- return _ref7.apply(this, arguments);
137
- };
138
- }();
139
- export var create = function create(_ref8) {
140
- var http = _ref8.http,
141
- params = _ref8.params;
142
- return /*#__PURE__*/function () {
143
- var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data, param) {
144
- var headers, response;
145
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
146
- while (1) switch (_context5.prev = _context5.next) {
147
17
  case 0:
148
18
  headers = {
149
19
  headers: _objectSpread(_objectSpread({}, cloneDeep(params)), cloneDeep(this.stackHeaders)),
150
20
  params: _objectSpread({}, cloneDeep(param))
151
21
  } || {};
152
- _context5.prev = 1;
153
- _context5.next = 4;
22
+ _context.prev = 1;
23
+ _context.next = 4;
154
24
  return http.post(this.urlPath, data, headers);
155
25
  case 4:
156
- response = _context5.sent;
26
+ response = _context.sent;
157
27
  if (!response.data) {
158
- _context5.next = 9;
28
+ _context.next = 9;
159
29
  break;
160
30
  }
161
- return _context5.abrupt("return", new this.constructor(http, parseData(response, this.stackHeaders, this.content_type_uid)));
31
+ return _context.abrupt("return", new this.constructor(http, parseData(response, this.stackHeaders, this.content_type_uid)));
162
32
  case 9:
163
33
  throw error(response);
164
34
  case 10:
165
- _context5.next = 15;
35
+ _context.next = 15;
166
36
  break;
167
37
  case 12:
168
- _context5.prev = 12;
169
- _context5.t0 = _context5["catch"](1);
170
- throw error(_context5.t0);
38
+ _context.prev = 12;
39
+ _context.t0 = _context["catch"](1);
40
+ throw error(_context.t0);
171
41
  case 15:
172
42
  case "end":
173
- return _context5.stop();
43
+ return _context.stop();
174
44
  }
175
- }, _callee5, this, [[1, 12]]);
45
+ }, _callee, this, [[1, 12]]);
176
46
  }));
177
- return function (_x8, _x9) {
178
- return _ref9.apply(this, arguments);
47
+ return function (_x, _x2) {
48
+ return _ref2.apply(this, arguments);
179
49
  };
180
50
  }();
181
51
  };
182
52
  export var update = function update(http, type) {
183
53
  var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
184
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
54
+ return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
185
55
  var param,
186
56
  updateData,
187
57
  json,
188
58
  response,
189
- _args6 = arguments;
190
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
191
- while (1) switch (_context6.prev = _context6.next) {
59
+ _args2 = arguments;
60
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
61
+ while (1) switch (_context2.prev = _context2.next) {
192
62
  case 0:
193
- param = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
63
+ param = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
194
64
  updateData = {};
195
65
  json = cloneDeep(this);
196
66
  delete json.stackHeaders;
@@ -209,48 +79,48 @@ export var update = function update(http, type) {
209
79
  } else {
210
80
  updateData = json;
211
81
  }
212
- _context6.prev = 15;
213
- _context6.next = 18;
82
+ _context2.prev = 15;
83
+ _context2.next = 18;
214
84
  return http.put(this.urlPath, updateData, {
215
85
  headers: _objectSpread(_objectSpread({}, cloneDeep(this.stackHeaders)), cloneDeep(params)),
216
86
  params: _objectSpread({}, cloneDeep(param))
217
87
  });
218
88
  case 18:
219
- response = _context6.sent;
89
+ response = _context2.sent;
220
90
  if (!response.data) {
221
- _context6.next = 23;
91
+ _context2.next = 23;
222
92
  break;
223
93
  }
224
- return _context6.abrupt("return", new this.constructor(http, parseData(response, this.stackHeaders, this.content_type_uid)));
94
+ return _context2.abrupt("return", new this.constructor(http, parseData(response, this.stackHeaders, this.content_type_uid)));
225
95
  case 23:
226
96
  throw error(response);
227
97
  case 24:
228
- _context6.next = 29;
98
+ _context2.next = 29;
229
99
  break;
230
100
  case 26:
231
- _context6.prev = 26;
232
- _context6.t0 = _context6["catch"](15);
233
- throw error(_context6.t0);
101
+ _context2.prev = 26;
102
+ _context2.t0 = _context2["catch"](15);
103
+ throw error(_context2.t0);
234
104
  case 29:
235
105
  case "end":
236
- return _context6.stop();
106
+ return _context2.stop();
237
107
  }
238
- }, _callee6, this, [[15, 26]]);
108
+ }, _callee2, this, [[15, 26]]);
239
109
  }));
240
110
  };
241
111
  export var deleteEntity = function deleteEntity(http) {
242
112
  var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
243
113
  var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
244
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
114
+ return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
245
115
  var param,
246
116
  headers,
247
117
  response,
248
- _args7 = arguments;
249
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
250
- while (1) switch (_context7.prev = _context7.next) {
118
+ _args3 = arguments;
119
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
120
+ while (1) switch (_context3.prev = _context3.next) {
251
121
  case 0:
252
- param = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
253
- _context7.prev = 1;
122
+ param = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
123
+ _context3.prev = 1;
254
124
  headers = {
255
125
  headers: _objectSpread(_objectSpread({}, cloneDeep(this.stackHeaders)), cloneDeep(params)),
256
126
  params: _objectSpread({}, cloneDeep(param))
@@ -258,52 +128,52 @@ export var deleteEntity = function deleteEntity(http) {
258
128
  if (force === true) {
259
129
  headers.params.force = true;
260
130
  }
261
- _context7.next = 6;
131
+ _context3.next = 6;
262
132
  return http["delete"](this.urlPath, headers);
263
133
  case 6:
264
- response = _context7.sent;
134
+ response = _context3.sent;
265
135
  if (!response.data) {
266
- _context7.next = 11;
136
+ _context3.next = 11;
267
137
  break;
268
138
  }
269
- return _context7.abrupt("return", response.data);
139
+ return _context3.abrupt("return", response.data);
270
140
  case 11:
271
141
  if (!(response.status >= 200 && response.status < 300)) {
272
- _context7.next = 15;
142
+ _context3.next = 15;
273
143
  break;
274
144
  }
275
- return _context7.abrupt("return", {
145
+ return _context3.abrupt("return", {
276
146
  status: response.status,
277
147
  statusText: response.statusText
278
148
  });
279
149
  case 15:
280
150
  throw error(response);
281
151
  case 16:
282
- _context7.next = 21;
152
+ _context3.next = 21;
283
153
  break;
284
154
  case 18:
285
- _context7.prev = 18;
286
- _context7.t0 = _context7["catch"](1);
287
- throw error(_context7.t0);
155
+ _context3.prev = 18;
156
+ _context3.t0 = _context3["catch"](1);
157
+ throw error(_context3.t0);
288
158
  case 21:
289
159
  case "end":
290
- return _context7.stop();
160
+ return _context3.stop();
291
161
  }
292
- }, _callee7, this, [[1, 18]]);
162
+ }, _callee3, this, [[1, 18]]);
293
163
  }));
294
164
  };
295
165
  export var fetch = function fetch(http, type) {
296
166
  var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
297
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
167
+ return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
298
168
  var param,
299
169
  headers,
300
170
  response,
301
- _args8 = arguments;
302
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
303
- while (1) switch (_context8.prev = _context8.next) {
171
+ _args4 = arguments;
172
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
173
+ while (1) switch (_context4.prev = _context4.next) {
304
174
  case 0:
305
- param = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
306
- _context8.prev = 1;
175
+ param = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
176
+ _context4.prev = 1;
307
177
  headers = {
308
178
  headers: _objectSpread(_objectSpread({}, cloneDeep(this.stackHeaders)), cloneDeep(params)),
309
179
  params: _objectSpread({}, cloneDeep(param))
@@ -311,74 +181,74 @@ export var fetch = function fetch(http, type) {
311
181
  if (this.organization_uid) {
312
182
  headers.headers.organization_uid = this.organization_uid;
313
183
  }
314
- _context8.next = 6;
184
+ _context4.next = 6;
315
185
  return http.get(this.urlPath, headers);
316
186
  case 6:
317
- response = _context8.sent;
187
+ response = _context4.sent;
318
188
  if (!response.data) {
319
- _context8.next = 12;
189
+ _context4.next = 12;
320
190
  break;
321
191
  }
322
192
  if (type === 'entry') {
323
193
  response.data[type]['content_type'] = response.data['content_type'];
324
194
  response.data[type]['schema'] = response.data['schema'];
325
195
  }
326
- return _context8.abrupt("return", new this.constructor(http, parseData(response, this.stackHeaders, this.content_type_uid)));
196
+ return _context4.abrupt("return", new this.constructor(http, parseData(response, this.stackHeaders, this.content_type_uid)));
327
197
  case 12:
328
198
  throw error(response);
329
199
  case 13:
330
- _context8.next = 18;
200
+ _context4.next = 18;
331
201
  break;
332
202
  case 15:
333
- _context8.prev = 15;
334
- _context8.t0 = _context8["catch"](1);
335
- throw error(_context8.t0);
203
+ _context4.prev = 15;
204
+ _context4.t0 = _context4["catch"](1);
205
+ throw error(_context4.t0);
336
206
  case 18:
337
207
  case "end":
338
- return _context8.stop();
208
+ return _context4.stop();
339
209
  }
340
- }, _callee8, this, [[1, 15]]);
210
+ }, _callee4, this, [[1, 15]]);
341
211
  }));
342
212
  };
343
213
  export var fetchAll = function fetchAll(http, wrapperCollection) {
344
214
  var params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
345
- return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
215
+ return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
346
216
  var param,
347
217
  headers,
348
218
  response,
349
- _args9 = arguments;
350
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
351
- while (1) switch (_context9.prev = _context9.next) {
219
+ _args5 = arguments;
220
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
221
+ while (1) switch (_context5.prev = _context5.next) {
352
222
  case 0:
353
- param = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
223
+ param = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
354
224
  headers = {
355
225
  headers: _objectSpread(_objectSpread({}, cloneDeep(this.stackHeaders)), cloneDeep(params)),
356
226
  params: _objectSpread({}, cloneDeep(param))
357
227
  } || {};
358
- _context9.prev = 2;
359
- _context9.next = 5;
228
+ _context5.prev = 2;
229
+ _context5.next = 5;
360
230
  return http.get(this.urlPath, headers);
361
231
  case 5:
362
- response = _context9.sent;
232
+ response = _context5.sent;
363
233
  if (!response.data) {
364
- _context9.next = 10;
234
+ _context5.next = 10;
365
235
  break;
366
236
  }
367
- return _context9.abrupt("return", new ContentstackCollection(response, http, this.stackHeaders, wrapperCollection));
237
+ return _context5.abrupt("return", new ContentstackCollection(response, http, this.stackHeaders, wrapperCollection));
368
238
  case 10:
369
239
  throw error(response);
370
240
  case 11:
371
- _context9.next = 16;
241
+ _context5.next = 16;
372
242
  break;
373
243
  case 13:
374
- _context9.prev = 13;
375
- _context9.t0 = _context9["catch"](2);
376
- throw error(_context9.t0);
244
+ _context5.prev = 13;
245
+ _context5.t0 = _context5["catch"](2);
246
+ throw error(_context5.t0);
377
247
  case 16:
378
248
  case "end":
379
- return _context9.stop();
249
+ return _context5.stop();
380
250
  }
381
- }, _callee9, this, [[2, 13]]);
251
+ }, _callee5, this, [[2, 13]]);
382
252
  }));
383
253
  };
384
254
  export function parseData(response, stackHeaders, contentTypeUID) {
@@ -390,44 +260,4 @@ export function parseData(response, stackHeaders, contentTypeUID) {
390
260
  data.content_type_uid = contentTypeUID;
391
261
  }
392
262
  return data;
393
- }
394
- export function get(_x10, _x11, _x12, _x13) {
395
- return _get.apply(this, arguments);
396
- }
397
- function _get() {
398
- _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(http, url, params, data) {
399
- var headers, response;
400
- return _regeneratorRuntime.wrap(function _callee10$(_context10) {
401
- while (1) switch (_context10.prev = _context10.next) {
402
- case 0:
403
- headers = {
404
- params: _objectSpread(_objectSpread({}, cloneDeep(data.branches)), cloneDeep(params)),
405
- headers: _objectSpread({}, cloneDeep(data.stackHeaders))
406
- } || {};
407
- _context10.prev = 1;
408
- _context10.next = 4;
409
- return http.get(url, headers);
410
- case 4:
411
- response = _context10.sent;
412
- if (!response.data) {
413
- _context10.next = 9;
414
- break;
415
- }
416
- return _context10.abrupt("return", response.data);
417
- case 9:
418
- throw error(response);
419
- case 10:
420
- _context10.next = 15;
421
- break;
422
- case 12:
423
- _context10.prev = 12;
424
- _context10.t0 = _context10["catch"](1);
425
- throw error(_context10.t0);
426
- case 15:
427
- case "end":
428
- return _context10.stop();
429
- }
430
- }, _callee10, null, [[1, 12]]);
431
- }));
432
- return _get.apply(this, arguments);
433
263
  }
@@ -422,7 +422,7 @@ export function Installation(http, data) {
422
422
  * .then((collection) => console.log(collection))
423
423
  *
424
424
  */
425
- this.fetchAll = fetchAll(http, InstallationCollection);
425
+ this.fetchAll = fetchAll(http, InstallationCollection, params);
426
426
 
427
427
  /**
428
428
  * @description The getInstalledApps call is used to fetch all the installed apps in your Contentstack organization.
@@ -5,9 +5,9 @@ var _interopRequireDefault2 = _interopRequireDefault3(require("@babel/runtime/he
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ exports.Region = exports.client = undefined;
8
9
  var _defineProperty2 = require("@babel/runtime/helpers/defineProperty");
9
10
  var _defineProperty3 = (0, _interopRequireDefault2["default"])(_defineProperty2);
10
- exports.client = client;
11
11
  var _package = require("../package.json");
12
12
  var _package2 = (0, _interopRequireDefault2["default"])(_package);
13
13
  var _cloneDeep = require("lodash/cloneDeep");
@@ -18,6 +18,8 @@ var _contentstackClient = require("./contentstackClient.js");
18
18
  var _contentstackClient2 = (0, _interopRequireDefault2["default"])(_contentstackClient);
19
19
  var _contentstackHTTPClient = require("./core/contentstackHTTPClient.js");
20
20
  var _contentstackHTTPClient2 = (0, _interopRequireDefault2["default"])(_contentstackHTTPClient);
21
+ var _region = require("./core/region.js");
22
+ var _region2 = (0, _interopRequireDefault2["default"])(_region);
21
23
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
22
24
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty3["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
23
25
  * The Content Management API (CMA) is used to manage the content of your Contentstack account. This includes creating, updating, deleting, and fetching content of your account.
@@ -193,4 +195,6 @@ function client() {
193
195
  return (0, _contentstackClient2["default"])({
194
196
  http: http
195
197
  });
196
- }
198
+ }
199
+ exports.client = client;
200
+ exports.Region = _region2["default"];