UNPKG

@contentstack/management

Version:

The Content Management API is used to manage the content of your Contentstack account

718 lines (703 loc) 30.6 kB
"use strict"; var _interopRequireDefault3 = require("@babel/runtime/helpers/interopRequireDefault"); var _interopRequireDefault2 = _interopRequireDefault3(require("@babel/runtime/helpers/interopRequireDefault")); Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = undefined; var _defineProperty2 = require("@babel/runtime/helpers/defineProperty"); var _defineProperty3 = (0, _interopRequireDefault2["default"])(_defineProperty2); var _asyncToGenerator2 = require("@babel/runtime/helpers/asyncToGenerator"); var _asyncToGenerator3 = (0, _interopRequireDefault2["default"])(_asyncToGenerator2); var _classCallCheck2 = require("@babel/runtime/helpers/classCallCheck"); var _classCallCheck3 = (0, _interopRequireDefault2["default"])(_classCallCheck2); var _createClass2 = require("@babel/runtime/helpers/createClass"); var _createClass3 = (0, _interopRequireDefault2["default"])(_createClass2); var _regenerator = require("@babel/runtime/regenerator"); var _regenerator2 = (0, _interopRequireDefault2["default"])(_regenerator); var _contentstackError = require("./contentstackError"); var _contentstackError2 = (0, _interopRequireDefault2["default"])(_contentstackError); 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; } 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; } /** * @description OAuthHandler class to handle OAuth authorization and token management * @class OAuthHandler * @param {any} axiosInstance * @param {any} appId * @param {any} clientId * @param {any} redirectUri * @param {any} responseType='code' * @param {any} clientSecret * @param {any} scope=[] * @returns {OAuthHandler} OAuthHandler instance * @example * import * as contentstack from '@contentstack/management' * const client = contentstack.client(); * const oauthHandler = client.oauth({ appId: 'appId', clientId: 'clientId', redirectUri: 'http://localhost:8184' }); */ var OAuthHandler = /*#__PURE__*/function () { function OAuthHandler(axiosInstance, appId, clientId, redirectUri, clientSecret) { var responseType = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'code'; var scope = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : []; (0, _classCallCheck3["default"])(this, OAuthHandler); this.appId = appId; this.clientId = clientId; this.redirectUri = redirectUri; this.responseType = responseType; this.scope = scope.join(' '); this.clientSecret = clientSecret; // Optional, if provided, PKCE will be skipped this.OAuthBaseURL = axiosInstance.defaults.uiBaseUrl; this.axiosInstance = axiosInstance; this.axiosInstance.oauth = (axiosInstance === null || axiosInstance === void 0 ? void 0 : axiosInstance.oauth) || {}; this.axiosInstance.oauth.redirectUri = redirectUri; this.axiosInstance.oauth.clientId = clientId; this.axiosInstance.oauth.appId = appId; this.developerHubBaseUrl = axiosInstance.defaults.developerHubBaseUrl; // Only generate PKCE codeVerifier and codeChallenge if clientSecret is not provided if (!this.clientSecret) { this.codeVerifier = this.generateCodeVerifier(); this.codeChallenge = null; } } // Helper function for setting common headers for API requests return (0, _createClass3["default"])(OAuthHandler, [{ key: "_getHeaders", value: function _getHeaders() { return { 'Content-Type': 'application/x-www-form-urlencoded' }; } // Generate a random string (code_verifier) }, { key: "generateCodeVerifier", value: function generateCodeVerifier() { var length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 128; var charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~'; return Array.from({ length: length }, function () { return charset.charAt(Math.floor(Math.random() * charset.length)); }).join(''); } }, { key: "generateCodeChallenge", value: function () { var _generateCodeChallenge = (0, _asyncToGenerator3["default"])(/*#__PURE__*/_regenerator2["default"].mark(function _callee(codeVerifier) { var encoder, data, hashBuffer, hashArray, base64String, crypto, hash, _hashBuffer, _base64String; return _regenerator2["default"].wrap(function (_context) { while (1) switch (_context.prev = _context.next) { case 0: if (!(typeof window !== 'undefined' && window.crypto && window.crypto.subtle)) { _context.next = 2; break; } // Use the native Web Crypto API in the browser encoder = new TextEncoder(); data = encoder.encode(codeVerifier); _context.next = 1; return window.crypto.subtle.digest('SHA-256', data); case 1: hashBuffer = _context.sent; hashArray = Array.from(new Uint8Array(hashBuffer)); base64String = btoa(String.fromCharCode.apply(String, hashArray)); return _context.abrupt("return", base64String.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '')); case 2: // In Node.js: Use the native `crypto` module for hashing crypto = require('crypto'); hash = crypto.createHash('sha256'); hash.update(codeVerifier); _hashBuffer = hash.digest(); // Convert to Base64 and URL-safe Base64 _base64String = _hashBuffer.toString('base64'); return _context.abrupt("return", _base64String.replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '')); case 3: case "end": return _context.stop(); } }, _callee); })); function generateCodeChallenge(_x) { return _generateCodeChallenge.apply(this, arguments); } return generateCodeChallenge; }() /** * @description Authorize the user by redirecting to the OAuth provider's authorization page * @memberof OAuthHandler * @func authorize * @returns {any} Authorization URL * @example * import * as contentstack from '@contentstack/management' * const client = contentstack.client(); * const oauthHandler = client.oauth({ appId: 'appId', clientId: 'clientId', redirectUri: 'http://localhost:8184' }); * const authUrl = await oauthHandler.authorize(); */ }, { key: "authorize", value: (function () { var _authorize = (0, _asyncToGenerator3["default"])(/*#__PURE__*/_regenerator2["default"].mark(function _callee2() { var baseUrl, authUrl, _t; return _regenerator2["default"].wrap(function (_context2) { while (1) switch (_context2.prev = _context2.next) { case 0: _context2.prev = 0; if (this.OAuthBaseURL) { _context2.next = 1; break; } throw new Error('OAuthBaseURL is not set'); case 1: baseUrl = "".concat(this.OAuthBaseURL, "/#!/apps/").concat(this.appId, "/authorize"); authUrl = new URL(baseUrl); authUrl.searchParams.set('response_type', 'code'); // Using set() to avoid duplicate parameters authUrl.searchParams.set('client_id', this.clientId); if (!this.clientSecret) { _context2.next = 2; break; } return _context2.abrupt("return", authUrl.toString()); case 2: _context2.next = 3; return this.generateCodeChallenge(this.codeVerifier); case 3: this.codeChallenge = _context2.sent; authUrl.searchParams.set('code_challenge', this.codeChallenge); authUrl.searchParams.set('code_challenge_method', 'S256'); return _context2.abrupt("return", authUrl.toString()); case 4: _context2.next = 6; break; case 5: _context2.prev = 5; _t = _context2["catch"](0); (0, _contentstackError2["default"])(_t); case 6: case "end": return _context2.stop(); } }, _callee2, this, [[0, 5]]); })); function authorize() { return _authorize.apply(this, arguments); } return authorize; }() /** * @description Exchange the authorization code for an access token * @memberof OAuthHandler * @func exchangeCodeForToken * @param {any} code - Authorization code received from the OAuth provider * @returns {any} Token data * @example * import * as contentstack from '@contentstack/management' * const client = contentstack.client(); * const oauthHandler = client.oauth({ appId: 'appId', clientId: 'clientId', redirectUri: 'http://localhost:8184' }); * const tokenData = await oauthHandler.exchangeCodeForToken('authorization_code'); */ ) }, { key: "exchangeCodeForToken", value: (function () { var _exchangeCodeForToken = (0, _asyncToGenerator3["default"])(/*#__PURE__*/_regenerator2["default"].mark(function _callee3(code) { var body, response, _t2; return _regenerator2["default"].wrap(function (_context3) { while (1) switch (_context3.prev = _context3.next) { case 0: body = new URLSearchParams(_objectSpread({ grant_type: 'authorization_code', code: code, redirect_uri: this.redirectUri, client_id: this.clientId }, this.clientSecret ? { client_secret: this.clientSecret } : { code_verifier: this.codeVerifier })); this.axiosInstance.defaults.headers = this._getHeaders(); _context3.prev = 1; _context3.next = 2; return this.axiosInstance.post("".concat(this.developerHubBaseUrl, "/token"), body); case 2: response = _context3.sent; this._saveTokens(response.data); return _context3.abrupt("return", response.data); case 3: _context3.prev = 3; _t2 = _context3["catch"](1); (0, _contentstackError2["default"])(_t2); case 4: case "end": return _context3.stop(); } }, _callee3, this, [[1, 3]]); })); function exchangeCodeForToken(_x2) { return _exchangeCodeForToken.apply(this, arguments); } return exchangeCodeForToken; }() // Save tokens and token expiry details ) }, { key: "_saveTokens", value: function _saveTokens(data) { this.axiosInstance.oauth.accessToken = data.access_token; this.axiosInstance.oauth.refreshToken = data.refresh_token || this.axiosInstance.oauth.refreshToken; this.axiosInstance.oauth.organizationUID = data.organization_uid; this.axiosInstance.oauth.userUID = data.user_uid; this.axiosInstance.oauth.tokenExpiryTime = Date.now() + (data.expires_in - 60) * 1000; // Store expiry time } /** * @description Refreshes the access token using the provided refresh token or the one stored in the axios instance. * @memberof OAuthHandler * @func refreshAccessToken * @param {string|null} [providedRefreshToken=null] - The refresh token to use for refreshing the access token. If not provided, the stored refresh token will be used. * @returns {Promise<Object>} - A promise that resolves to the response data containing the new access token, refresh token, and expiry time. * @throws {Error} - Throws an error if no refresh token is available or if the token refresh request fails. * @example * import * as contentstack from '@contentstack/management' * const client = contentstack.client(); * const oauthHandler = client.oauth({ appId: 'appId', clientId: 'clientId', redirectUri: 'http://localhost:8184' }); * const tokenData = await oauthHandler.refreshAccessToken(); */ }, { key: "refreshAccessToken", value: (function () { var _refreshAccessToken = (0, _asyncToGenerator3["default"])(/*#__PURE__*/_regenerator2["default"].mark(function _callee4() { var providedRefreshToken, refreshToken, body, response, data, _args4 = arguments, _t3; return _regenerator2["default"].wrap(function (_context4) { while (1) switch (_context4.prev = _context4.next) { case 0: providedRefreshToken = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : null; refreshToken = providedRefreshToken || this.axiosInstance.oauth.refreshToken; if (refreshToken) { _context4.next = 1; break; } throw new Error('No refresh token available. Please authenticate first.'); case 1: body = new URLSearchParams({ grant_type: 'refresh_token', refresh_token: refreshToken, client_id: this.axiosInstance.oauth.clientId, redirect_uri: this.axiosInstance.oauth.redirectUri }); this.axiosInstance.defaults.headers = this._getHeaders(); _context4.prev = 2; _context4.next = 3; return this.axiosInstance.post("".concat(this.developerHubBaseUrl, "/token"), body); case 3: response = _context4.sent; data = response.data; this.axiosInstance.oauth.accessToken = data.access_token; this.axiosInstance.oauth.refreshToken = data.refresh_token || this.axiosInstance.oauth.refreshToken; // Optionally update refresh token this.axiosInstance.oauth.tokenExpiryTime = Date.now() + (data.expires_in - 60) * 1000; // Update expiry time return _context4.abrupt("return", data); case 4: _context4.prev = 4; _t3 = _context4["catch"](2); (0, _contentstackError2["default"])(_t3); case 5: case "end": return _context4.stop(); } }, _callee4, this, [[2, 4]]); })); function refreshAccessToken() { return _refreshAccessToken.apply(this, arguments); } return refreshAccessToken; }() /** * @description Logs out the user by revoking the OAuth app authorization * @memberof OAuthHandler * @func logout * @returns {Promise<string>} - A promise that resolves to a success message if the logout was successful. * @throws {Error} - Throws an error if the logout request fails. * @example * import * as contentstack from '@contentstack/management' * const client = contentstack.client(); * const oauthHandler = client.oauth({ appId: 'appId', clientId: 'clientId', redirectUri: 'http://localhost:8184' }); * const resp = await oauthHandler.logout(); */ ) }, { key: "logout", value: (function () { var _logout = (0, _asyncToGenerator3["default"])(/*#__PURE__*/_regenerator2["default"].mark(function _callee5() { var authorizationId, _t4; return _regenerator2["default"].wrap(function (_context5) { while (1) switch (_context5.prev = _context5.next) { case 0: _context5.prev = 0; _context5.next = 1; return this.getOauthAppAuthorization(); case 1: authorizationId = _context5.sent; _context5.next = 2; return this.revokeOauthAppAuthorization(authorizationId); case 2: this.axiosInstance.oauth = {}; // Clear OAuth data return _context5.abrupt("return", 'Logged out successfully'); case 3: _context5.prev = 3; _t4 = _context5["catch"](0); (0, _contentstackError2["default"])(_t4); case 4: case "end": return _context5.stop(); } }, _callee5, this, [[0, 3]]); })); function logout() { return _logout.apply(this, arguments); } return logout; }() /** * @description Get the current access token * @memberof OAuthHandler * @func getAccessToken * @returns {any} * @example * import * as contentstack from '@contentstack/management' * const client = contentstack.client(); * const oauthHandler = client.oauth({ appId: 'appId', clientId: 'clientId', redirectUri: 'http://localhost:8184' }); * const accessToken = oauthHandler.getAccessToken(); */ ) }, { key: "getAccessToken", value: function getAccessToken() { return this.axiosInstance.oauth.accessToken; } /** * @description Get the refresh token from the axios instance * @memberof OAuthHandler * @func getRefreshToken * @returns {string|null} * @example * import * as contentstack from '@contentstack/management' * const client = contentstack.client(); * const oauthHandler = client.oauth({ appId: 'appId', clientId: 'clientId', redirectUri: 'http://localhost:8184' }); * const refreshToken = oauthHandler.getRefreshToken(); */ }, { key: "getRefreshToken", value: function getRefreshToken() { return this.axiosInstance.oauth.refreshToken || null; } /** * @description Get the organization UID from the axios instance * @memberof OAuthHandler * @func getOrganizationUID * @returns {string|null} * @example * import * as contentstack from '@contentstack/management' * const client = contentstack.client(); * const oauthHandler = client.oauth({ appId: 'appId', clientId: 'clientId', redirectUri: 'http://localhost:8184' }); * const orgUID = oauthHandler.getOrganizationUID(); */ }, { key: "getOrganizationUID", value: function getOrganizationUID() { return this.axiosInstance.oauth.organizationUID || null; } /** * @description Get the user UID from the axios instance * @memberof OAuthHandler * @func getUserUID * @returns {string|null} * @example * import * as contentstack from '@contentstack/management' * const client = contentstack.client(); * const oauthHandler = client.oauth({ appId: 'appId', clientId: 'clientId', redirectUri: 'http://localhost:8184' }); * const userId = oauthHandler.getUserUID(); */ }, { key: "getUserUID", value: function getUserUID() { return this.axiosInstance.oauth.userUID || null; } /** * @description Get the token expiry time from the axios instance * @memberof OAuthHandler * @func getTokenExpiryTime * @returns {number|null} * @example * import * as contentstack from '@contentstack/management' * const client = contentstack.client(); * const oauthHandler = client.oauth({ appId: 'appId', clientId: 'clientId', redirectUri: 'http://localhost:8184' }); * const expiryTime = oauthHandler.getTokenExpiryTime(); */ }, { key: "getTokenExpiryTime", value: function getTokenExpiryTime() { return this.axiosInstance.oauth.tokenExpiryTime || null; } /** * @description Set the access token in the axios instance * @memberof OAuthHandler * @func setAccessToken * @param {*} token * @example * import * as contentstack from '@contentstack/management' * const client = contentstack.client(); * const oauthHandler = client.oauth({ appId: 'appId', clientId: 'clientId', redirectUri: 'http://localhost:8184' }); * oauthHandler.setAccessToken('accessToken'); */ }, { key: "setAccessToken", value: function setAccessToken(token) { if (!token) { throw new Error('Access token is required'); } this.axiosInstance.oauth.accessToken = token; } /** * @description Set the refresh token in the axios instance * @memberof OAuthHandler * @func setRefreshToken * @param {*} token * @example * import * as contentstack from '@contentstack/management' * const client = contentstack.client(); * const oauthHandler = client.oauth({ appId: 'appId', clientId: 'clientId', redirectUri: 'http://localhost:8184' }); * oauthHandler.setRefreshToken('refreshToken'); */ }, { key: "setRefreshToken", value: function setRefreshToken(token) { if (!token) { throw new Error('Refresh token is required'); } this.axiosInstance.oauth.refreshToken = token; } /** * @description Set the organization UID in the axios instance * @memberof OAuthHandler * @func setOrganizationUID * @param {*} organizationUID * @example * import * as contentstack from '@contentstack/management' * const client = contentstack.client(); * const oauthHandler = client.oauth({ appId: 'appId', clientId: 'clientId', redirectUri: 'http://localhost:8184' }); * oauthHandler.setOrganizationUID('organizationUID'); */ }, { key: "setOrganizationUID", value: function setOrganizationUID(organizationUID) { if (!organizationUID) { throw new Error('Organization UID is required'); } this.axiosInstance.oauth.organizationUID = organizationUID; } /** * @description Set the user UID in the axios instance * @memberof OAuthHandler * @func setUserUID * @param {*} userUID * @example * import * as contentstack from '@contentstack/management' * const client = contentstack.client(); * const oauthHandler = client.oauth({ appId: 'appId', clientId: 'clientId', redirectUri: 'http://localhost:8184' }); * oauthHandler.setUserUID('userID'); */ }, { key: "setUserUID", value: function setUserUID(userUID) { if (!userUID) { throw new Error('User UID is required'); } this.axiosInstance.oauth.userUID = userUID; } /** * @description Set the token expiry time in the axios instance * @memberof OAuthHandler * @func setTokenExpiryTime * @param {*} expiryTime * @example * import * as contentstack from '@contentstack/management' * const client = contentstack.client(); * const oauthHandler = client.oauth({ appId: 'appId', clientId: 'clientId', redirectUri: 'http://localhost:8184' }); * oauthHandler.setTokenExpiryTime('expiryTime'); // date format */ }, { key: "setTokenExpiryTime", value: function setTokenExpiryTime(expiryTime) { if (!expiryTime) { throw new Error('Token expiry time is required'); } this.axiosInstance.oauth.tokenExpiryTime = expiryTime; } /** * @description Handles the redirect URL after OAuth authorization * @memberof OAuthHandler * @func handleRedirect * @async * @param {string} url - The URL to handle after the OAuth authorization * @returns {Promise<void>} - A promise that resolves if the redirect URL is successfully handled * @throws {Error} - Throws an error if the authorization code is not found in the redirect URL * @example * import * as contentstack from '@contentstack/management' * const client = contentstack.client(); * const oauthHandler = client.oauth({ appId: 'appId', clientId: 'clientId', redirectUri: 'http://localhost:8184' }); * await oauthHandler.handleRedirect('http://localhost:8184?code=authorization_code'); */ }, { key: "handleRedirect", value: (function () { var _handleRedirect = (0, _asyncToGenerator3["default"])(/*#__PURE__*/_regenerator2["default"].mark(function _callee6(url) { var urlParams, code, _t5; return _regenerator2["default"].wrap(function (_context6) { while (1) switch (_context6.prev = _context6.next) { case 0: urlParams = new URLSearchParams(new URL(url).search); code = urlParams.get('code'); if (!code) { _context6.next = 5; break; } _context6.prev = 1; _context6.next = 2; return this.exchangeCodeForToken(code); case 2: _context6.next = 4; break; case 3: _context6.prev = 3; _t5 = _context6["catch"](1); (0, _contentstackError2["default"])(_t5); case 4: _context6.next = 6; break; case 5: throw new Error('Authorization code not found in redirect URL.'); case 6: case "end": return _context6.stop(); } }, _callee6, this, [[1, 3]]); })); function handleRedirect(_x3) { return _handleRedirect.apply(this, arguments); } return handleRedirect; }() /** * @description Get the OAuth app authorization for the current user * @memberof OAuthHandler * @func getOauthAppAuthorization * @returns {any} */ ) }, { key: "getOauthAppAuthorization", value: (function () { var _getOauthAppAuthorization = (0, _asyncToGenerator3["default"])(/*#__PURE__*/_regenerator2["default"].mark(function _callee7() { var headers, _data$data, res, data, _data$data2, userUid, currentUserAuthorization, _t6; return _regenerator2["default"].wrap(function (_context7) { while (1) switch (_context7.prev = _context7.next) { case 0: headers = { authorization: "Bearer ".concat(this.axiosInstance.oauth.accessToken), organization_uid: this.axiosInstance.oauth.organizationUID, 'Content-type': 'application/json' }; this.axiosInstance.defaults.headers = headers; _context7.prev = 1; _context7.next = 2; return this.axiosInstance.get("".concat(this.developerHubBaseUrl, "/manifests/").concat(this.axiosInstance.oauth.appId, "/authorizations")); case 2: res = _context7.sent; data = res.data; if (!((data === null || data === void 0 || (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.length) > 0)) { _context7.next = 4; break; } userUid = this.axiosInstance.oauth.userUID; currentUserAuthorization = (data === null || data === void 0 || (_data$data2 = data.data) === null || _data$data2 === void 0 ? void 0 : _data$data2.filter(function (element) { return element.user.uid === userUid; })) || []; if (!(currentUserAuthorization.length === 0)) { _context7.next = 3; break; } throw new Error('No authorizations found for current user!'); case 3: return _context7.abrupt("return", currentUserAuthorization[0].authorization_uid); case 4: throw new Error('No authorizations found for the app!'); case 5: _context7.next = 7; break; case 6: _context7.prev = 6; _t6 = _context7["catch"](1); (0, _contentstackError2["default"])(_t6); case 7: case "end": return _context7.stop(); } }, _callee7, this, [[1, 6]]); })); function getOauthAppAuthorization() { return _getOauthAppAuthorization.apply(this, arguments); } return getOauthAppAuthorization; }() /** * @description Revoke the OAuth app authorization for the current user * @memberof OAuthHandler * @func revokeOauthAppAuthorization * @param {any} authorizationId * @returns {any} */ ) }, { key: "revokeOauthAppAuthorization", value: (function () { var _revokeOauthAppAuthorization = (0, _asyncToGenerator3["default"])(/*#__PURE__*/_regenerator2["default"].mark(function _callee8(authorizationId) { var headers, res, _t7; return _regenerator2["default"].wrap(function (_context8) { while (1) switch (_context8.prev = _context8.next) { case 0: if (!((authorizationId === null || authorizationId === void 0 ? void 0 : authorizationId.length) > 1)) { _context8.next = 4; break; } headers = { authorization: "Bearer ".concat(this.axiosInstance.oauth.accessToken), organization_uid: this.axiosInstance.oauth.organizationUID, 'Content-type': 'application/json' }; this.axiosInstance.defaults.headers = headers; _context8.prev = 1; _context8.next = 2; return this.axiosInstance["delete"]("".concat(this.developerHubBaseUrl, "/manifests/").concat(this.axiosInstance.oauth.appId, "/authorizations/").concat(authorizationId)); case 2: res = _context8.sent; return _context8.abrupt("return", res.data); case 3: _context8.prev = 3; _t7 = _context8["catch"](1); (0, _contentstackError2["default"])(_t7); case 4: case "end": return _context8.stop(); } }, _callee8, this, [[1, 3]]); })); function revokeOauthAppAuthorization(_x4) { return _revokeOauthAppAuthorization.apply(this, arguments); } return revokeOauthAppAuthorization; }()) }]); }(); exports["default"] = OAuthHandler; module.exports = exports.default;