@contentstack/marketplace-sdk
Advanced tools
Comparing version 1.0.2 to 1.1.0
# Changelog | ||
## [v1.1.0](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.1.0) (2024-06-05) | ||
- added reinstall app function | ||
## [v1.0.2](https://github.com/contentstack/contentstack-marketplace-sdk/tree/v1.0.2) (2024-01-16) | ||
@@ -4,0 +7,0 @@ - Updated dependencies |
@@ -185,8 +185,8 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
/** | ||
* @description The upgrade call is used to upgrade the installation of an app | ||
* @description The reinstall call is used to initiate the reinstallation of the app | ||
* @memberof App | ||
* @func upgrade | ||
* @param {String} param.targetType - The target on which app needs to be installed, stack or ogranization. | ||
* @param {String} param.targetUid - The uid of the target, on which the app will be installed | ||
* @returns Promise<Installation> | ||
* @func reinstall | ||
* @param {String} param.targetType - The target on which app needs to be reinstalled, stack or ogranization. | ||
* @param {String} param.targetUid - The uid of the target, on which the app will be reinstalled | ||
* @returns Promise<Reinstallation> | ||
* | ||
@@ -196,6 +196,6 @@ * @example | ||
* const client = contentstack.client({ authtoken: 'TOKEN'}) | ||
* client.marketplace('organization_uid').app('manifest_uid').install({ targetUid: 'STACK_API_KEY', targetType: 'stack' }) | ||
* .then((installation) => console.log(installation)) | ||
* client.marketplace('organization_uid').app('manifest_uid').reinstall({ targetUid: 'STACK_API_KEY', targetType: 'stack' }) | ||
* .then((reinstallation) => console.log(installation)) | ||
*/ | ||
this.upgrade = /*#__PURE__*/function () { | ||
this.reinstall = /*#__PURE__*/function () { | ||
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref3) { | ||
@@ -242,3 +242,60 @@ var targetUid, targetType, headers, response; | ||
}(); | ||
/** | ||
* @description The upgrade call is used to upgrade the installation of an app | ||
* @memberof App | ||
* @func upgrade | ||
* @param {String} param.targetType - The target on which app needs to be installed, stack or ogranization. | ||
* @param {String} param.targetUid - The uid of the target, on which the app will be installed | ||
* @returns Promise<Installation> | ||
* | ||
* @example | ||
* import * as contentstack from '@contentstack/marketplace' | ||
* const client = contentstack.client({ authtoken: 'TOKEN'}) | ||
* client.marketplace('organization_uid').app('manifest_uid').install({ targetUid: 'STACK_API_KEY', targetType: 'stack' }) | ||
* .then((installation) => console.log(installation)) | ||
*/ | ||
this.upgrade = /*#__PURE__*/function () { | ||
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref5) { | ||
var targetUid, targetType, headers, response; | ||
return _regeneratorRuntime.wrap(function _callee3$(_context3) { | ||
while (1) switch (_context3.prev = _context3.next) { | ||
case 0: | ||
targetUid = _ref5.targetUid, targetType = _ref5.targetType; | ||
_context3.prev = 1; | ||
headers = { | ||
headers: _objectSpread({}, cloneDeep(_this.params)) | ||
} || {}; | ||
_context3.next = 5; | ||
return http.put("".concat(_this.urlPath, "/reinstall"), { | ||
target_type: targetType, | ||
target_uid: targetUid | ||
}, headers); | ||
case 5: | ||
response = _context3.sent; | ||
if (!response.data) { | ||
_context3.next = 10; | ||
break; | ||
} | ||
return _context3.abrupt("return", new Installation(http, response.data, _this.params) || {}); | ||
case 10: | ||
throw error(response); | ||
case 11: | ||
_context3.next = 16; | ||
break; | ||
case 13: | ||
_context3.prev = 13; | ||
_context3.t0 = _context3["catch"](1); | ||
throw error(_context3.t0); | ||
case 16: | ||
case "end": | ||
return _context3.stop(); | ||
} | ||
}, _callee3, null, [[1, 13]]); | ||
})); | ||
return function (_x3) { | ||
return _ref6.apply(this, arguments); | ||
}; | ||
}(); | ||
/** | ||
* @description The GET app requests of an app call is used to retrieve all requests of an app. | ||
@@ -257,34 +314,34 @@ * @returns Promise<Response> | ||
*/ | ||
this.getRequests = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() { | ||
this.getRequests = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() { | ||
var headers, response; | ||
return _regeneratorRuntime.wrap(function _callee3$(_context3) { | ||
while (1) switch (_context3.prev = _context3.next) { | ||
return _regeneratorRuntime.wrap(function _callee4$(_context4) { | ||
while (1) switch (_context4.prev = _context4.next) { | ||
case 0: | ||
_context3.prev = 0; | ||
_context4.prev = 0; | ||
headers = { | ||
headers: _objectSpread({}, cloneDeep(_this.params)) | ||
}; | ||
_context3.next = 4; | ||
_context4.next = 4; | ||
return http.get("".concat(_this.urlPath, "/requests"), headers); | ||
case 4: | ||
response = _context3.sent; | ||
response = _context4.sent; | ||
if (!response.data) { | ||
_context3.next = 9; | ||
_context4.next = 9; | ||
break; | ||
} | ||
return _context3.abrupt("return", response.data); | ||
return _context4.abrupt("return", response.data); | ||
case 9: | ||
throw error(response); | ||
case 10: | ||
_context3.next = 15; | ||
_context4.next = 15; | ||
break; | ||
case 12: | ||
_context3.prev = 12; | ||
_context3.t0 = _context3["catch"](0); | ||
throw error(_context3.t0); | ||
_context4.prev = 12; | ||
_context4.t0 = _context4["catch"](0); | ||
throw error(_context4.t0); | ||
case 15: | ||
case "end": | ||
return _context3.stop(); | ||
return _context4.stop(); | ||
} | ||
}, _callee3, null, [[0, 12]]); | ||
}, _callee4, null, [[0, 12]]); | ||
})); | ||
@@ -312,9 +369,9 @@ /** | ||
this.authorize = /*#__PURE__*/function () { | ||
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref6) { | ||
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref8) { | ||
var responseType, clientId, redirectUri, scope, state, headers, content, response; | ||
return _regeneratorRuntime.wrap(function _callee4$(_context4) { | ||
while (1) switch (_context4.prev = _context4.next) { | ||
return _regeneratorRuntime.wrap(function _callee5$(_context5) { | ||
while (1) switch (_context5.prev = _context5.next) { | ||
case 0: | ||
responseType = _ref6.responseType, clientId = _ref6.clientId, redirectUri = _ref6.redirectUri, scope = _ref6.scope, state = _ref6.state; | ||
_context4.prev = 1; | ||
responseType = _ref8.responseType, clientId = _ref8.clientId, redirectUri = _ref8.redirectUri, scope = _ref8.scope, state = _ref8.state; | ||
_context5.prev = 1; | ||
headers = { | ||
@@ -332,28 +389,28 @@ headers: _objectSpread({}, cloneDeep(_this.params)) | ||
} | ||
_context4.next = 7; | ||
_context5.next = 7; | ||
return http.post("".concat(_this.urlPath, "/authorize"), content, headers); | ||
case 7: | ||
response = _context4.sent; | ||
response = _context5.sent; | ||
if (!response.data) { | ||
_context4.next = 12; | ||
_context5.next = 12; | ||
break; | ||
} | ||
return _context4.abrupt("return", response.data); | ||
return _context5.abrupt("return", response.data); | ||
case 12: | ||
throw error(response); | ||
case 13: | ||
_context4.next = 18; | ||
_context5.next = 18; | ||
break; | ||
case 15: | ||
_context4.prev = 15; | ||
_context4.t0 = _context4["catch"](1); | ||
throw error(_context4.t0); | ||
_context5.prev = 15; | ||
_context5.t0 = _context5["catch"](1); | ||
throw error(_context5.t0); | ||
case 18: | ||
case "end": | ||
return _context4.stop(); | ||
return _context5.stop(); | ||
} | ||
}, _callee4, null, [[1, 15]]); | ||
}, _callee5, null, [[1, 15]]); | ||
})); | ||
return function (_x3) { | ||
return _ref7.apply(this, arguments); | ||
return function (_x4) { | ||
return _ref9.apply(this, arguments); | ||
}; | ||
@@ -392,34 +449,34 @@ }(); | ||
*/ | ||
this.listInstallations = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() { | ||
this.listInstallations = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() { | ||
var headers, response; | ||
return _regeneratorRuntime.wrap(function _callee5$(_context5) { | ||
while (1) switch (_context5.prev = _context5.next) { | ||
return _regeneratorRuntime.wrap(function _callee6$(_context6) { | ||
while (1) switch (_context6.prev = _context6.next) { | ||
case 0: | ||
_context5.prev = 0; | ||
_context6.prev = 0; | ||
headers = { | ||
headers: _objectSpread(_objectSpread({}, cloneDeep(_this.params)), cloneDeep(_this.headers)) | ||
}; | ||
_context5.next = 4; | ||
_context6.next = 4; | ||
return http.get("manifests/".concat(_this.uid, "/installations"), headers); | ||
case 4: | ||
response = _context5.sent; | ||
response = _context6.sent; | ||
if (!response.data) { | ||
_context5.next = 9; | ||
_context6.next = 9; | ||
break; | ||
} | ||
return _context5.abrupt("return", new ContentstackCollection(response, http, _this.stackHeaders, InstallationCollection)); | ||
return _context6.abrupt("return", new ContentstackCollection(response, http, _this.stackHeaders, InstallationCollection)); | ||
case 9: | ||
throw error(response); | ||
case 10: | ||
_context5.next = 15; | ||
_context6.next = 15; | ||
break; | ||
case 12: | ||
_context5.prev = 12; | ||
_context5.t0 = _context5["catch"](0); | ||
throw error(_context5.t0); | ||
_context6.prev = 12; | ||
_context6.t0 = _context6["catch"](0); | ||
throw error(_context6.t0); | ||
case 15: | ||
case "end": | ||
return _context5.stop(); | ||
return _context6.stop(); | ||
} | ||
}, _callee5, null, [[0, 12]]); | ||
}, _callee6, null, [[0, 12]]); | ||
})); | ||
@@ -426,0 +483,0 @@ } else { |
@@ -198,8 +198,8 @@ "use strict"; | ||
/** | ||
* @description The upgrade call is used to upgrade the installation of an app | ||
* @description The reinstall call is used to initiate the reinstallation of the app | ||
* @memberof App | ||
* @func upgrade | ||
* @param {String} param.targetType - The target on which app needs to be installed, stack or ogranization. | ||
* @param {String} param.targetUid - The uid of the target, on which the app will be installed | ||
* @returns Promise<Installation> | ||
* @func reinstall | ||
* @param {String} param.targetType - The target on which app needs to be reinstalled, stack or ogranization. | ||
* @param {String} param.targetUid - The uid of the target, on which the app will be reinstalled | ||
* @returns Promise<Reinstallation> | ||
* | ||
@@ -209,6 +209,6 @@ * @example | ||
* const client = contentstack.client({ authtoken: 'TOKEN'}) | ||
* client.marketplace('organization_uid').app('manifest_uid').install({ targetUid: 'STACK_API_KEY', targetType: 'stack' }) | ||
* .then((installation) => console.log(installation)) | ||
* client.marketplace('organization_uid').app('manifest_uid').reinstall({ targetUid: 'STACK_API_KEY', targetType: 'stack' }) | ||
* .then((reinstallation) => console.log(installation)) | ||
*/ | ||
this.upgrade = /*#__PURE__*/function () { | ||
this.reinstall = /*#__PURE__*/function () { | ||
var _ref4 = (0, _asyncToGenerator3["default"])( /*#__PURE__*/_regenerator2["default"].mark(function _callee2(_ref3) { | ||
@@ -255,3 +255,60 @@ var targetUid, targetType, headers, response; | ||
}(); | ||
/** | ||
* @description The upgrade call is used to upgrade the installation of an app | ||
* @memberof App | ||
* @func upgrade | ||
* @param {String} param.targetType - The target on which app needs to be installed, stack or ogranization. | ||
* @param {String} param.targetUid - The uid of the target, on which the app will be installed | ||
* @returns Promise<Installation> | ||
* | ||
* @example | ||
* import * as contentstack from '@contentstack/marketplace' | ||
* const client = contentstack.client({ authtoken: 'TOKEN'}) | ||
* client.marketplace('organization_uid').app('manifest_uid').install({ targetUid: 'STACK_API_KEY', targetType: 'stack' }) | ||
* .then((installation) => console.log(installation)) | ||
*/ | ||
this.upgrade = /*#__PURE__*/function () { | ||
var _ref6 = (0, _asyncToGenerator3["default"])( /*#__PURE__*/_regenerator2["default"].mark(function _callee3(_ref5) { | ||
var targetUid, targetType, headers, response; | ||
return _regenerator2["default"].wrap(function _callee3$(_context3) { | ||
while (1) switch (_context3.prev = _context3.next) { | ||
case 0: | ||
targetUid = _ref5.targetUid, targetType = _ref5.targetType; | ||
_context3.prev = 1; | ||
headers = { | ||
headers: _objectSpread({}, (0, _cloneDeep2["default"])(_this.params)) | ||
} || {}; | ||
_context3.next = 5; | ||
return http.put("".concat(_this.urlPath, "/reinstall"), { | ||
target_type: targetType, | ||
target_uid: targetUid | ||
}, headers); | ||
case 5: | ||
response = _context3.sent; | ||
if (!response.data) { | ||
_context3.next = 10; | ||
break; | ||
} | ||
return _context3.abrupt("return", new _installation.Installation(http, response.data, _this.params) || {}); | ||
case 10: | ||
throw (0, _contentstackError2["default"])(response); | ||
case 11: | ||
_context3.next = 16; | ||
break; | ||
case 13: | ||
_context3.prev = 13; | ||
_context3.t0 = _context3["catch"](1); | ||
throw (0, _contentstackError2["default"])(_context3.t0); | ||
case 16: | ||
case "end": | ||
return _context3.stop(); | ||
} | ||
}, _callee3, null, [[1, 13]]); | ||
})); | ||
return function (_x3) { | ||
return _ref6.apply(this, arguments); | ||
}; | ||
}(); | ||
/** | ||
* @description The GET app requests of an app call is used to retrieve all requests of an app. | ||
@@ -270,34 +327,34 @@ * @returns Promise<Response> | ||
*/ | ||
this.getRequests = /*#__PURE__*/(0, _asyncToGenerator3["default"])( /*#__PURE__*/_regenerator2["default"].mark(function _callee3() { | ||
this.getRequests = /*#__PURE__*/(0, _asyncToGenerator3["default"])( /*#__PURE__*/_regenerator2["default"].mark(function _callee4() { | ||
var headers, response; | ||
return _regenerator2["default"].wrap(function _callee3$(_context3) { | ||
while (1) switch (_context3.prev = _context3.next) { | ||
return _regenerator2["default"].wrap(function _callee4$(_context4) { | ||
while (1) switch (_context4.prev = _context4.next) { | ||
case 0: | ||
_context3.prev = 0; | ||
_context4.prev = 0; | ||
headers = { | ||
headers: _objectSpread({}, (0, _cloneDeep2["default"])(_this.params)) | ||
}; | ||
_context3.next = 4; | ||
_context4.next = 4; | ||
return http.get("".concat(_this.urlPath, "/requests"), headers); | ||
case 4: | ||
response = _context3.sent; | ||
response = _context4.sent; | ||
if (!response.data) { | ||
_context3.next = 9; | ||
_context4.next = 9; | ||
break; | ||
} | ||
return _context3.abrupt("return", response.data); | ||
return _context4.abrupt("return", response.data); | ||
case 9: | ||
throw (0, _contentstackError2["default"])(response); | ||
case 10: | ||
_context3.next = 15; | ||
_context4.next = 15; | ||
break; | ||
case 12: | ||
_context3.prev = 12; | ||
_context3.t0 = _context3["catch"](0); | ||
throw (0, _contentstackError2["default"])(_context3.t0); | ||
_context4.prev = 12; | ||
_context4.t0 = _context4["catch"](0); | ||
throw (0, _contentstackError2["default"])(_context4.t0); | ||
case 15: | ||
case "end": | ||
return _context3.stop(); | ||
return _context4.stop(); | ||
} | ||
}, _callee3, null, [[0, 12]]); | ||
}, _callee4, null, [[0, 12]]); | ||
})); | ||
@@ -325,9 +382,9 @@ /** | ||
this.authorize = /*#__PURE__*/function () { | ||
var _ref7 = (0, _asyncToGenerator3["default"])( /*#__PURE__*/_regenerator2["default"].mark(function _callee4(_ref6) { | ||
var _ref9 = (0, _asyncToGenerator3["default"])( /*#__PURE__*/_regenerator2["default"].mark(function _callee5(_ref8) { | ||
var responseType, clientId, redirectUri, scope, state, headers, content, response; | ||
return _regenerator2["default"].wrap(function _callee4$(_context4) { | ||
while (1) switch (_context4.prev = _context4.next) { | ||
return _regenerator2["default"].wrap(function _callee5$(_context5) { | ||
while (1) switch (_context5.prev = _context5.next) { | ||
case 0: | ||
responseType = _ref6.responseType, clientId = _ref6.clientId, redirectUri = _ref6.redirectUri, scope = _ref6.scope, state = _ref6.state; | ||
_context4.prev = 1; | ||
responseType = _ref8.responseType, clientId = _ref8.clientId, redirectUri = _ref8.redirectUri, scope = _ref8.scope, state = _ref8.state; | ||
_context5.prev = 1; | ||
headers = { | ||
@@ -345,28 +402,28 @@ headers: _objectSpread({}, (0, _cloneDeep2["default"])(_this.params)) | ||
} | ||
_context4.next = 7; | ||
_context5.next = 7; | ||
return http.post("".concat(_this.urlPath, "/authorize"), content, headers); | ||
case 7: | ||
response = _context4.sent; | ||
response = _context5.sent; | ||
if (!response.data) { | ||
_context4.next = 12; | ||
_context5.next = 12; | ||
break; | ||
} | ||
return _context4.abrupt("return", response.data); | ||
return _context5.abrupt("return", response.data); | ||
case 12: | ||
throw (0, _contentstackError2["default"])(response); | ||
case 13: | ||
_context4.next = 18; | ||
_context5.next = 18; | ||
break; | ||
case 15: | ||
_context4.prev = 15; | ||
_context4.t0 = _context4["catch"](1); | ||
throw (0, _contentstackError2["default"])(_context4.t0); | ||
_context5.prev = 15; | ||
_context5.t0 = _context5["catch"](1); | ||
throw (0, _contentstackError2["default"])(_context5.t0); | ||
case 18: | ||
case "end": | ||
return _context4.stop(); | ||
return _context5.stop(); | ||
} | ||
}, _callee4, null, [[1, 15]]); | ||
}, _callee5, null, [[1, 15]]); | ||
})); | ||
return function (_x3) { | ||
return _ref7.apply(this, arguments); | ||
return function (_x4) { | ||
return _ref9.apply(this, arguments); | ||
}; | ||
@@ -405,34 +462,34 @@ }(); | ||
*/ | ||
this.listInstallations = /*#__PURE__*/(0, _asyncToGenerator3["default"])( /*#__PURE__*/_regenerator2["default"].mark(function _callee5() { | ||
this.listInstallations = /*#__PURE__*/(0, _asyncToGenerator3["default"])( /*#__PURE__*/_regenerator2["default"].mark(function _callee6() { | ||
var headers, response; | ||
return _regenerator2["default"].wrap(function _callee5$(_context5) { | ||
while (1) switch (_context5.prev = _context5.next) { | ||
return _regenerator2["default"].wrap(function _callee6$(_context6) { | ||
while (1) switch (_context6.prev = _context6.next) { | ||
case 0: | ||
_context5.prev = 0; | ||
_context6.prev = 0; | ||
headers = { | ||
headers: _objectSpread(_objectSpread({}, (0, _cloneDeep2["default"])(_this.params)), (0, _cloneDeep2["default"])(_this.headers)) | ||
}; | ||
_context5.next = 4; | ||
_context6.next = 4; | ||
return http.get("manifests/".concat(_this.uid, "/installations"), headers); | ||
case 4: | ||
response = _context5.sent; | ||
response = _context6.sent; | ||
if (!response.data) { | ||
_context5.next = 9; | ||
_context6.next = 9; | ||
break; | ||
} | ||
return _context5.abrupt("return", new _contentstackCollection2["default"](response, http, _this.stackHeaders, _installation.InstallationCollection)); | ||
return _context6.abrupt("return", new _contentstackCollection2["default"](response, http, _this.stackHeaders, _installation.InstallationCollection)); | ||
case 9: | ||
throw (0, _contentstackError2["default"])(response); | ||
case 10: | ||
_context5.next = 15; | ||
_context6.next = 15; | ||
break; | ||
case 12: | ||
_context5.prev = 12; | ||
_context5.t0 = _context5["catch"](0); | ||
throw (0, _contentstackError2["default"])(_context5.t0); | ||
_context6.prev = 12; | ||
_context6.t0 = _context6["catch"](0); | ||
throw (0, _contentstackError2["default"])(_context6.t0); | ||
case 15: | ||
case "end": | ||
return _context5.stop(); | ||
return _context6.stop(); | ||
} | ||
}, _callee5, null, [[0, 12]]); | ||
}, _callee6, null, [[0, 12]]); | ||
})); | ||
@@ -439,0 +496,0 @@ } else { |
{ | ||
"name": "@contentstack/marketplace-sdk", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "The Contentstack Marketplace SDK is used to manage the content of your Contentstack marketplace apps", | ||
@@ -5,0 +5,0 @@ "main": "./dist/node/contentstack-marketplace.js", |
@@ -23,2 +23,3 @@ import { ContentstackCollection } from "../../contentstackCollection"; | ||
state: string }): Promise<AnyProperty> | ||
reinstall(data: {targetUid: string, targetType: AppTarget}): Promise<Installation> | ||
authorization(): Authorization | ||
@@ -25,0 +26,0 @@ listInstallations(): Promise<ContentstackCollection<App>> |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1155017
7779