Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@atlaskit/outbound-auth-flow-client

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atlaskit/outbound-auth-flow-client - npm Package Compare versions

Comparing version 3.2.0 to 3.2.1

6

CHANGELOG.md
# @atlaskit/outbound-auth-flow-client
## 3.2.1
### Patch Changes
- [`d3265f19be`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d3265f19be) - Transpile packages using babel rather than tsc
## 3.2.0

@@ -4,0 +10,0 @@

60

dist/cjs/error.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.AuthError = void 0;
var tslib_1 = require("tslib");
var AuthError = /** @class */ (function (_super) {
tslib_1.__extends(AuthError, _super);
function AuthError(message, type) {
var _this = _super.call(this, message) || this;
_this.message = message;
_this.type = type;
_this.name = 'AuthError';
_this.type = type;
_this.message = message;
return _this;
}
return AuthError;
}(Error));
exports.AuthError = AuthError;
//# sourceMappingURL=error.js.map
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
var AuthError = /*#__PURE__*/function (_Error) {
(0, _inherits2.default)(AuthError, _Error);
var _super = _createSuper(AuthError);
function AuthError(message, type) {
var _this;
(0, _classCallCheck2.default)(this, AuthError);
_this = _super.call(this, message);
_this.message = message;
_this.type = type;
_this.name = 'AuthError';
_this.type = type;
_this.message = message;
return _this;
}
return AuthError;
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
exports.AuthError = AuthError;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.auth = void 0;
var error_1 = require("./error");
var types_1 = require("./types");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.auth = auth;
Object.defineProperty(exports, "AuthError", {
enumerable: true,
get: function get() {
return _error.AuthError;
}
});
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
var _error = require("./error");
var _types = require("./types");
function auth(startUrl, windowFeatures) {
return new Promise(function (resolve, reject) {
var authWindow = null;
var authWindowInterval;
var handleAuthWindowMessage = function (event) {
if (event.source !== authWindow) {
return;
}
var data = event.data;
if (typeof data !== 'object') {
return;
}
switch (data.type) {
case 'outbound-auth:success':
finish();
resolve();
break;
case 'outbound-auth:failure':
finish();
var errorType = data.errorType.toLowerCase();
if (types_1.isOfTypeAuthError(errorType)) {
reject(new error_1.AuthError(data.message, errorType));
}
else {
reject(new error_1.AuthError(data.message));
}
break;
}
};
var handleAuthWindowInterval = function () {
if (authWindow && authWindow.closed) {
finish();
reject(new error_1.AuthError('The auth window was closed', 'auth_window_closed'));
}
};
var start = function () {
window.addEventListener('message', handleAuthWindowMessage);
authWindow = window.open(startUrl, startUrl, windowFeatures);
authWindowInterval = window.setInterval(handleAuthWindowInterval, 500);
};
var finish = function () {
clearInterval(authWindowInterval);
window.removeEventListener('message', handleAuthWindowMessage);
if (authWindow) {
authWindow.close();
authWindow = null;
}
};
start();
});
}
exports.auth = auth;
var error_2 = require("./error");
Object.defineProperty(exports, "AuthError", { enumerable: true, get: function () { return error_2.AuthError; } });
//# sourceMappingURL=index.js.map
return new Promise(function (resolve, reject) {
var authWindow = null;
var authWindowInterval;
var handleAuthWindowMessage = function handleAuthWindowMessage(event) {
if (event.source !== authWindow) {
return;
}
var data = event.data;
if ((0, _typeof2.default)(data) !== 'object') {
return;
}
switch (data.type) {
case 'outbound-auth:success':
finish();
resolve();
break;
case 'outbound-auth:failure':
finish();
var errorType = data.errorType.toLowerCase();
if ((0, _types.isOfTypeAuthError)(errorType)) {
reject(new _error.AuthError(data.message, errorType));
} else {
reject(new _error.AuthError(data.message));
}
break;
}
};
var handleAuthWindowInterval = function handleAuthWindowInterval() {
if (authWindow && authWindow.closed) {
finish();
reject(new _error.AuthError('The auth window was closed', 'auth_window_closed'));
}
};
var start = function start() {
window.addEventListener('message', handleAuthWindowMessage);
authWindow = window.open(startUrl, startUrl, windowFeatures);
authWindowInterval = window.setInterval(handleAuthWindowInterval, 500);
};
var finish = function finish() {
clearInterval(authWindowInterval);
window.removeEventListener('message', handleAuthWindowMessage);
if (authWindow) {
authWindow.close();
authWindow = null;
}
};
start();
});
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isOfTypeAuthError = void 0;
exports.isOfTypeAuthError = function (inputString) {
return [
'auth_window_closed',
'invalid_request',
'unauthorized_client',
'access_denied',
'unsupported_response_type',
'invalid_scope',
'server_error',
'temporarily_unavailable',
].includes(inputString);
// See https://tools.ietf.org/html/rfc6749#section-4.1.2.1
// 'auth_window_closed' is returned in addition to types from this RFC,
// representing when the authentication window is closed by the user
var isOfTypeAuthError = function isOfTypeAuthError(inputString) {
return ['auth_window_closed', 'invalid_request', 'unauthorized_client', 'access_denied', 'unsupported_response_type', 'invalid_scope', 'server_error', 'temporarily_unavailable'].includes(inputString);
};
//# sourceMappingURL=types.js.map
exports.isOfTypeAuthError = isOfTypeAuthError;
{
"name": "@atlaskit/outbound-auth-flow-client",
"version": "3.2.0"
"version": "3.2.1"
}
export class AuthError extends Error {
constructor(message, type) {
super(message);
this.message = message;
this.type = type;
this.name = 'AuthError';
this.type = type;
this.message = message;
}
}
//# sourceMappingURL=error.js.map
constructor(message, type) {
super(message);
this.message = message;
this.type = type;
this.name = 'AuthError';
this.type = type;
this.message = message;
}
}
import { AuthError } from './error';
import { isOfTypeAuthError } from './types';
export function auth(startUrl, windowFeatures) {
return new Promise((resolve, reject) => {
let authWindow = null;
let authWindowInterval;
const handleAuthWindowMessage = (event) => {
if (event.source !== authWindow) {
return;
}
const { data } = event;
if (typeof data !== 'object') {
return;
}
switch (data.type) {
case 'outbound-auth:success':
finish();
resolve();
break;
case 'outbound-auth:failure':
finish();
const errorType = data.errorType.toLowerCase();
if (isOfTypeAuthError(errorType)) {
reject(new AuthError(data.message, errorType));
}
else {
reject(new AuthError(data.message));
}
break;
}
};
const handleAuthWindowInterval = () => {
if (authWindow && authWindow.closed) {
finish();
reject(new AuthError('The auth window was closed', 'auth_window_closed'));
}
};
const start = () => {
window.addEventListener('message', handleAuthWindowMessage);
authWindow = window.open(startUrl, startUrl, windowFeatures);
authWindowInterval = window.setInterval(handleAuthWindowInterval, 500);
};
const finish = () => {
clearInterval(authWindowInterval);
window.removeEventListener('message', handleAuthWindowMessage);
if (authWindow) {
authWindow.close();
authWindow = null;
}
};
start();
});
return new Promise((resolve, reject) => {
let authWindow = null;
let authWindowInterval;
const handleAuthWindowMessage = event => {
if (event.source !== authWindow) {
return;
}
const {
data
} = event;
if (typeof data !== 'object') {
return;
}
switch (data.type) {
case 'outbound-auth:success':
finish();
resolve();
break;
case 'outbound-auth:failure':
finish();
const errorType = data.errorType.toLowerCase();
if (isOfTypeAuthError(errorType)) {
reject(new AuthError(data.message, errorType));
} else {
reject(new AuthError(data.message));
}
break;
}
};
const handleAuthWindowInterval = () => {
if (authWindow && authWindow.closed) {
finish();
reject(new AuthError('The auth window was closed', 'auth_window_closed'));
}
};
const start = () => {
window.addEventListener('message', handleAuthWindowMessage);
authWindow = window.open(startUrl, startUrl, windowFeatures);
authWindowInterval = window.setInterval(handleAuthWindowInterval, 500);
};
const finish = () => {
clearInterval(authWindowInterval);
window.removeEventListener('message', handleAuthWindowMessage);
if (authWindow) {
authWindow.close();
authWindow = null;
}
};
start();
});
}
export { AuthError } from './error';
//# sourceMappingURL=index.js.map
export { AuthError } from './error';

@@ -1,13 +0,6 @@

export const isOfTypeAuthError = (inputString) => {
return [
'auth_window_closed',
'invalid_request',
'unauthorized_client',
'access_denied',
'unsupported_response_type',
'invalid_scope',
'server_error',
'temporarily_unavailable',
].includes(inputString);
};
//# sourceMappingURL=types.js.map
// See https://tools.ietf.org/html/rfc6749#section-4.1.2.1
// 'auth_window_closed' is returned in addition to types from this RFC,
// representing when the authentication window is closed by the user
export const isOfTypeAuthError = inputString => {
return ['auth_window_closed', 'invalid_request', 'unauthorized_client', 'access_denied', 'unsupported_response_type', 'invalid_scope', 'server_error', 'temporarily_unavailable'].includes(inputString);
};
{
"name": "@atlaskit/outbound-auth-flow-client",
"version": "3.2.0"
"version": "3.2.1"
}

@@ -1,16 +0,31 @@

import { __extends } from "tslib";
var AuthError = /** @class */ (function (_super) {
__extends(AuthError, _super);
function AuthError(message, type) {
var _this = _super.call(this, message) || this;
_this.message = message;
_this.type = type;
_this.name = 'AuthError';
_this.type = type;
_this.message = message;
return _this;
}
return AuthError;
}(Error));
export { AuthError };
//# sourceMappingURL=error.js.map
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _inherits from "@babel/runtime/helpers/inherits";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
export var AuthError = /*#__PURE__*/function (_Error) {
_inherits(AuthError, _Error);
var _super = _createSuper(AuthError);
function AuthError(message, type) {
var _this;
_classCallCheck(this, AuthError);
_this = _super.call(this, message);
_this.message = message;
_this.type = type;
_this.name = 'AuthError';
_this.type = type;
_this.message = message;
return _this;
}
return AuthError;
}( /*#__PURE__*/_wrapNativeSuper(Error));

@@ -0,55 +1,66 @@

import _typeof from "@babel/runtime/helpers/typeof";
import { AuthError } from './error';
import { isOfTypeAuthError } from './types';
export function auth(startUrl, windowFeatures) {
return new Promise(function (resolve, reject) {
var authWindow = null;
var authWindowInterval;
var handleAuthWindowMessage = function (event) {
if (event.source !== authWindow) {
return;
}
var data = event.data;
if (typeof data !== 'object') {
return;
}
switch (data.type) {
case 'outbound-auth:success':
finish();
resolve();
break;
case 'outbound-auth:failure':
finish();
var errorType = data.errorType.toLowerCase();
if (isOfTypeAuthError(errorType)) {
reject(new AuthError(data.message, errorType));
}
else {
reject(new AuthError(data.message));
}
break;
}
};
var handleAuthWindowInterval = function () {
if (authWindow && authWindow.closed) {
finish();
reject(new AuthError('The auth window was closed', 'auth_window_closed'));
}
};
var start = function () {
window.addEventListener('message', handleAuthWindowMessage);
authWindow = window.open(startUrl, startUrl, windowFeatures);
authWindowInterval = window.setInterval(handleAuthWindowInterval, 500);
};
var finish = function () {
clearInterval(authWindowInterval);
window.removeEventListener('message', handleAuthWindowMessage);
if (authWindow) {
authWindow.close();
authWindow = null;
}
};
start();
});
return new Promise(function (resolve, reject) {
var authWindow = null;
var authWindowInterval;
var handleAuthWindowMessage = function handleAuthWindowMessage(event) {
if (event.source !== authWindow) {
return;
}
var data = event.data;
if (_typeof(data) !== 'object') {
return;
}
switch (data.type) {
case 'outbound-auth:success':
finish();
resolve();
break;
case 'outbound-auth:failure':
finish();
var errorType = data.errorType.toLowerCase();
if (isOfTypeAuthError(errorType)) {
reject(new AuthError(data.message, errorType));
} else {
reject(new AuthError(data.message));
}
break;
}
};
var handleAuthWindowInterval = function handleAuthWindowInterval() {
if (authWindow && authWindow.closed) {
finish();
reject(new AuthError('The auth window was closed', 'auth_window_closed'));
}
};
var start = function start() {
window.addEventListener('message', handleAuthWindowMessage);
authWindow = window.open(startUrl, startUrl, windowFeatures);
authWindowInterval = window.setInterval(handleAuthWindowInterval, 500);
};
var finish = function finish() {
clearInterval(authWindowInterval);
window.removeEventListener('message', handleAuthWindowMessage);
if (authWindow) {
authWindow.close();
authWindow = null;
}
};
start();
});
}
export { AuthError } from './error';
//# sourceMappingURL=index.js.map
export { AuthError } from './error';

@@ -1,13 +0,6 @@

export var isOfTypeAuthError = function (inputString) {
return [
'auth_window_closed',
'invalid_request',
'unauthorized_client',
'access_denied',
'unsupported_response_type',
'invalid_scope',
'server_error',
'temporarily_unavailable',
].includes(inputString);
};
//# sourceMappingURL=types.js.map
// See https://tools.ietf.org/html/rfc6749#section-4.1.2.1
// 'auth_window_closed' is returned in addition to types from this RFC,
// representing when the authentication window is closed by the user
export var isOfTypeAuthError = function isOfTypeAuthError(inputString) {
return ['auth_window_closed', 'invalid_request', 'unauthorized_client', 'access_denied', 'unsupported_response_type', 'invalid_scope', 'server_error', 'temporarily_unavailable'].includes(inputString);
};
{
"name": "@atlaskit/outbound-auth-flow-client",
"version": "3.2.0"
"version": "3.2.1"
}
{
"name": "@atlaskit/outbound-auth-flow-client",
"version": "3.2.0",
"version": "3.2.1",
"description": "Front-end library for starting outbound auth flows",

@@ -25,3 +25,3 @@ "publishConfig": {

"dependencies": {
"tslib": "^2.0.0"
"@babel/runtime": "^7.0.0"
},

@@ -28,0 +28,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc