@atlaskit/outbound-auth-flow-client 3.3.3 → 3.4.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/outbound-auth-flow-client
2
2
 
3
+ ## 3.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`41fae2c6f68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/41fae2c6f68) - Upgrade Typescript from `4.5.5` to `4.9.5`
8
+
9
+ ## 3.4.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`56507598609`](https://bitbucket.org/atlassian/atlassian-frontend/commits/56507598609) - Skip minor dependency bump
14
+
3
15
  ## 3.3.3
4
16
 
5
17
  ### Patch Changes
package/dist/cjs/error.js CHANGED
@@ -1,36 +1,23 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.AuthError = void 0;
9
-
10
8
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
-
12
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
-
14
10
  var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
-
16
11
  var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
17
-
18
12
  var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
19
-
20
13
  var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
21
-
22
14
  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); }; }
23
-
24
15
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
25
-
26
16
  var AuthError = /*#__PURE__*/function (_Error) {
27
17
  (0, _inherits2.default)(AuthError, _Error);
28
-
29
18
  var _super = _createSuper(AuthError);
30
-
31
19
  function AuthError(message, type) {
32
20
  var _this;
33
-
34
21
  (0, _classCallCheck2.default)(this, AuthError);
35
22
  _this = _super.call(this, message);
36
23
  _this.message = message;
@@ -40,8 +27,6 @@ var AuthError = /*#__PURE__*/function (_Error) {
40
27
  _this.message = message;
41
28
  return _this;
42
29
  }
43
-
44
30
  return (0, _createClass2.default)(AuthError);
45
31
  }( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
46
-
47
32
  exports.AuthError = AuthError;
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -12,72 +11,56 @@ Object.defineProperty(exports, "AuthError", {
12
11
  }
13
12
  });
14
13
  exports.auth = auth;
15
-
16
14
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
17
-
18
15
  var _error = require("./error");
19
-
20
16
  var _types = require("./types");
21
-
22
17
  function auth(startUrl, windowFeatures) {
23
18
  return new Promise(function (resolve, reject) {
24
19
  var authWindow = null;
25
20
  var authWindowInterval;
26
-
27
21
  var handleAuthWindowMessage = function handleAuthWindowMessage(event) {
28
22
  if (event.source !== authWindow) {
29
23
  return;
30
24
  }
31
-
32
25
  var data = event.data;
33
-
34
26
  if ((0, _typeof2.default)(data) !== 'object') {
35
27
  return;
36
28
  }
37
-
38
29
  switch (data.type) {
39
30
  case 'outbound-auth:success':
40
31
  finish();
41
32
  resolve();
42
33
  break;
43
-
44
34
  case 'outbound-auth:failure':
45
35
  finish();
46
36
  var errorType = data.errorType.toLowerCase();
47
-
48
37
  if ((0, _types.isOfTypeAuthError)(errorType)) {
49
38
  reject(new _error.AuthError(data.message, errorType));
50
39
  } else {
51
40
  reject(new _error.AuthError(data.message));
52
41
  }
53
-
54
42
  break;
55
43
  }
56
44
  };
57
-
58
45
  var handleAuthWindowInterval = function handleAuthWindowInterval() {
59
46
  if (authWindow && authWindow.closed) {
60
47
  finish();
61
48
  reject(new _error.AuthError('The auth window was closed', 'auth_window_closed'));
62
49
  }
63
50
  };
64
-
65
51
  var start = function start() {
66
52
  window.addEventListener('message', handleAuthWindowMessage);
67
53
  authWindow = window.open(startUrl, startUrl, windowFeatures);
68
54
  authWindowInterval = window.setInterval(handleAuthWindowInterval, 500);
69
55
  };
70
-
71
56
  var finish = function finish() {
72
57
  clearInterval(authWindowInterval);
73
58
  window.removeEventListener('message', handleAuthWindowMessage);
74
-
75
59
  if (authWindow) {
76
60
  authWindow.close();
77
61
  authWindow = null;
78
62
  }
79
63
  };
80
-
81
64
  start();
82
65
  });
83
66
  }
package/dist/cjs/types.js CHANGED
@@ -4,14 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isOfTypeAuthError = void 0;
7
-
8
7
  // See https://tools.ietf.org/html/rfc6749#section-4.1.2.1
9
8
  // 'auth_window_closed' is returned in addition to types from this RFC,
10
9
  // representing when the authentication window is closed by the user
11
10
  // 'authclientoauth2.autherror' is added to represent errors from
12
11
  // outbound-auth
12
+
13
13
  var isOfTypeAuthError = function isOfTypeAuthError(inputString) {
14
14
  return ['auth_window_closed', 'invalid_request', 'unauthorized_client', 'access_denied', 'unsupported_response_type', 'invalid_scope', 'server_error', 'temporarily_unavailable', 'authclientoauth2.autherror'].includes(inputString);
15
15
  };
16
-
17
16
  exports.isOfTypeAuthError = isOfTypeAuthError;
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/outbound-auth-flow-client",
3
- "version": "3.3.3"
3
+ "version": "3.4.1"
4
4
  }
@@ -7,5 +7,4 @@ export class AuthError extends Error {
7
7
  this.type = type;
8
8
  this.message = message;
9
9
  }
10
-
11
10
  }
@@ -4,63 +4,51 @@ export function auth(startUrl, windowFeatures) {
4
4
  return new Promise((resolve, reject) => {
5
5
  let authWindow = null;
6
6
  let authWindowInterval;
7
-
8
7
  const handleAuthWindowMessage = event => {
9
8
  if (event.source !== authWindow) {
10
9
  return;
11
10
  }
12
-
13
11
  const {
14
12
  data
15
13
  } = event;
16
-
17
14
  if (typeof data !== 'object') {
18
15
  return;
19
16
  }
20
-
21
17
  switch (data.type) {
22
18
  case 'outbound-auth:success':
23
19
  finish();
24
20
  resolve();
25
21
  break;
26
-
27
22
  case 'outbound-auth:failure':
28
23
  finish();
29
24
  const errorType = data.errorType.toLowerCase();
30
-
31
25
  if (isOfTypeAuthError(errorType)) {
32
26
  reject(new AuthError(data.message, errorType));
33
27
  } else {
34
28
  reject(new AuthError(data.message));
35
29
  }
36
-
37
30
  break;
38
31
  }
39
32
  };
40
-
41
33
  const handleAuthWindowInterval = () => {
42
34
  if (authWindow && authWindow.closed) {
43
35
  finish();
44
36
  reject(new AuthError('The auth window was closed', 'auth_window_closed'));
45
37
  }
46
38
  };
47
-
48
39
  const start = () => {
49
40
  window.addEventListener('message', handleAuthWindowMessage);
50
41
  authWindow = window.open(startUrl, startUrl, windowFeatures);
51
42
  authWindowInterval = window.setInterval(handleAuthWindowInterval, 500);
52
43
  };
53
-
54
44
  const finish = () => {
55
45
  clearInterval(authWindowInterval);
56
46
  window.removeEventListener('message', handleAuthWindowMessage);
57
-
58
47
  if (authWindow) {
59
48
  authWindow.close();
60
49
  authWindow = null;
61
50
  }
62
51
  };
63
-
64
52
  start();
65
53
  });
66
54
  }
@@ -3,6 +3,7 @@
3
3
  // representing when the authentication window is closed by the user
4
4
  // 'authclientoauth2.autherror' is added to represent errors from
5
5
  // outbound-auth
6
+
6
7
  export const isOfTypeAuthError = inputString => {
7
8
  return ['auth_window_closed', 'invalid_request', 'unauthorized_client', 'access_denied', 'unsupported_response_type', 'invalid_scope', 'server_error', 'temporarily_unavailable', 'authclientoauth2.autherror'].includes(inputString);
8
9
  };
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/outbound-auth-flow-client",
3
- "version": "3.3.3"
3
+ "version": "3.4.1"
4
4
  }
package/dist/esm/error.js CHANGED
@@ -4,21 +4,14 @@ import _inherits from "@babel/runtime/helpers/inherits";
4
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
6
  import _wrapNativeSuper from "@babel/runtime/helpers/wrapNativeSuper";
7
-
8
7
  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); }; }
9
-
10
8
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
11
-
12
9
  export var AuthError = /*#__PURE__*/function (_Error) {
13
10
  _inherits(AuthError, _Error);
14
-
15
11
  var _super = _createSuper(AuthError);
16
-
17
12
  function AuthError(message, type) {
18
13
  var _this;
19
-
20
14
  _classCallCheck(this, AuthError);
21
-
22
15
  _this = _super.call(this, message);
23
16
  _this.message = message;
24
17
  _this.type = type;
@@ -27,6 +20,5 @@ export var AuthError = /*#__PURE__*/function (_Error) {
27
20
  _this.message = message;
28
21
  return _this;
29
22
  }
30
-
31
23
  return _createClass(AuthError);
32
24
  }( /*#__PURE__*/_wrapNativeSuper(Error));
package/dist/esm/index.js CHANGED
@@ -5,61 +5,49 @@ export function auth(startUrl, windowFeatures) {
5
5
  return new Promise(function (resolve, reject) {
6
6
  var authWindow = null;
7
7
  var authWindowInterval;
8
-
9
8
  var handleAuthWindowMessage = function handleAuthWindowMessage(event) {
10
9
  if (event.source !== authWindow) {
11
10
  return;
12
11
  }
13
-
14
12
  var data = event.data;
15
-
16
13
  if (_typeof(data) !== 'object') {
17
14
  return;
18
15
  }
19
-
20
16
  switch (data.type) {
21
17
  case 'outbound-auth:success':
22
18
  finish();
23
19
  resolve();
24
20
  break;
25
-
26
21
  case 'outbound-auth:failure':
27
22
  finish();
28
23
  var errorType = data.errorType.toLowerCase();
29
-
30
24
  if (isOfTypeAuthError(errorType)) {
31
25
  reject(new AuthError(data.message, errorType));
32
26
  } else {
33
27
  reject(new AuthError(data.message));
34
28
  }
35
-
36
29
  break;
37
30
  }
38
31
  };
39
-
40
32
  var handleAuthWindowInterval = function handleAuthWindowInterval() {
41
33
  if (authWindow && authWindow.closed) {
42
34
  finish();
43
35
  reject(new AuthError('The auth window was closed', 'auth_window_closed'));
44
36
  }
45
37
  };
46
-
47
38
  var start = function start() {
48
39
  window.addEventListener('message', handleAuthWindowMessage);
49
40
  authWindow = window.open(startUrl, startUrl, windowFeatures);
50
41
  authWindowInterval = window.setInterval(handleAuthWindowInterval, 500);
51
42
  };
52
-
53
43
  var finish = function finish() {
54
44
  clearInterval(authWindowInterval);
55
45
  window.removeEventListener('message', handleAuthWindowMessage);
56
-
57
46
  if (authWindow) {
58
47
  authWindow.close();
59
48
  authWindow = null;
60
49
  }
61
50
  };
62
-
63
51
  start();
64
52
  });
65
53
  }
package/dist/esm/types.js CHANGED
@@ -3,6 +3,7 @@
3
3
  // representing when the authentication window is closed by the user
4
4
  // 'authclientoauth2.autherror' is added to represent errors from
5
5
  // outbound-auth
6
+
6
7
  export var isOfTypeAuthError = function isOfTypeAuthError(inputString) {
7
8
  return ['auth_window_closed', 'invalid_request', 'unauthorized_client', 'access_denied', 'unsupported_response_type', 'invalid_scope', 'server_error', 'temporarily_unavailable', 'authclientoauth2.autherror'].includes(inputString);
8
9
  };
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/outbound-auth-flow-client",
3
- "version": "3.3.3"
3
+ "version": "3.4.1"
4
4
  }
@@ -1,2 +1,2 @@
1
- export declare type AuthErrorType = 'auth_window_closed' | 'invalid_request' | 'unauthorized_client' | 'access_denied' | 'unsupported_response_type' | 'invalid_scope' | 'server_error' | 'temporarily_unavailable' | 'authclientoauth2.autherror';
1
+ export type AuthErrorType = 'auth_window_closed' | 'invalid_request' | 'unauthorized_client' | 'access_denied' | 'unsupported_response_type' | 'invalid_scope' | 'server_error' | 'temporarily_unavailable' | 'authclientoauth2.autherror';
2
2
  export declare const isOfTypeAuthError: (inputString: string) => inputString is AuthErrorType;
@@ -5,9 +5,9 @@
5
5
  "module:es2019": "../dist/es2019/error.js",
6
6
  "types": "../dist/types/error.d.ts",
7
7
  "typesVersions": {
8
- ">=4.0 <4.5": {
8
+ ">=4.5 <4.9": {
9
9
  "*": [
10
- "../dist/types-ts4.0/error.d.ts"
10
+ "../dist/types-ts4.5/error.d.ts"
11
11
  ]
12
12
  }
13
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/outbound-auth-flow-client",
3
- "version": "3.3.3",
3
+ "version": "3.4.1",
4
4
  "description": "Front-end library for starting outbound auth flows",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -13,9 +13,10 @@
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
15
  "typesVersions": {
16
- ">=4.0 <4.5": {
16
+ ">=4.5 <4.9": {
17
17
  "*": [
18
- "dist/types-ts4.0/*"
18
+ "dist/types-ts4.5/*",
19
+ "dist/types-ts4.5/index.d.ts"
19
20
  ]
20
21
  }
21
22
  },
@@ -34,7 +35,7 @@
34
35
  "devDependencies": {
35
36
  "@atlaskit/docs": "*",
36
37
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
37
- "typescript": "4.5.5"
38
+ "typescript": "~4.9.5"
38
39
  },
39
40
  "keywords": [
40
41
  "fabric",
package/report.api.md CHANGED
@@ -1,12 +1,18 @@
1
+ <!-- API Report Version: 2.3 -->
2
+
1
3
  ## API Report File for "@atlaskit/outbound-auth-flow-client"
2
4
 
3
- > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
5
+ > Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
6
+ > [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
7
+
8
+ ### Table of contents
4
9
 
5
- <!--
6
- Generated API Report version: 2.0
7
- -->
10
+ - [Main Entry Types](#main-entry-types)
11
+ - [Peer Dependencies](#peer-dependencies)
8
12
 
9
- [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
13
+ ### Main Entry Types
14
+
15
+ <!--SECTION START: Main Entry Types-->
10
16
 
11
17
  ```ts
12
18
  // @public (undocumented)
@@ -23,15 +29,27 @@ export class AuthError extends Error {
23
29
 
24
30
  // @public (undocumented)
25
31
  type AuthErrorType =
32
+ | 'access_denied'
26
33
  | 'auth_window_closed'
34
+ | 'authclientoauth2.autherror'
27
35
  | 'invalid_request'
28
- | 'unauthorized_client'
29
- | 'access_denied'
30
- | 'unsupported_response_type'
31
36
  | 'invalid_scope'
32
37
  | 'server_error'
33
38
  | 'temporarily_unavailable'
34
- | 'authclientoauth2.autherror';
39
+ | 'unauthorized_client'
40
+ | 'unsupported_response_type';
35
41
 
36
42
  // (No @packageDocumentation comment for this package)
37
43
  ```
44
+
45
+ <!--SECTION END: Main Entry Types-->
46
+
47
+ ### Peer Dependencies
48
+
49
+ <!--SECTION START: Peer Dependencies-->
50
+
51
+ ```json
52
+ {}
53
+ ```
54
+
55
+ <!--SECTION END: Peer Dependencies-->
@@ -0,0 +1,24 @@
1
+ ## API Report File for "@atlaskit/outbound-auth-flow-client"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ // @public (undocumented)
8
+ export function auth(startUrl: string, windowFeatures?: string): Promise<void>;
9
+
10
+ // @public (undocumented)
11
+ export class AuthError extends Error {
12
+ constructor(message: string, type?: AuthErrorType | undefined);
13
+ // (undocumented)
14
+ readonly message: string;
15
+ // (undocumented)
16
+ readonly type?: AuthErrorType | undefined;
17
+ }
18
+
19
+ // @public (undocumented)
20
+ type AuthErrorType = 'access_denied' | 'auth_window_closed' | 'authclientoauth2.autherror' | 'invalid_request' | 'invalid_scope' | 'server_error' | 'temporarily_unavailable' | 'unauthorized_client' | 'unsupported_response_type';
21
+
22
+ // (No @packageDocumentation comment for this package)
23
+
24
+ ```
@@ -5,9 +5,9 @@
5
5
  "module:es2019": "../dist/es2019/types.js",
6
6
  "types": "../dist/types/types.d.ts",
7
7
  "typesVersions": {
8
- ">=4.0 <4.5": {
8
+ ">=4.5 <4.9": {
9
9
  "*": [
10
- "../dist/types-ts4.0/types.d.ts"
10
+ "../dist/types-ts4.5/types.d.ts"
11
11
  ]
12
12
  }
13
13
  }
@@ -1,6 +0,0 @@
1
- import { AuthErrorType } from './types';
2
- export declare class AuthError extends Error {
3
- readonly message: string;
4
- readonly type?: AuthErrorType | undefined;
5
- constructor(message: string, type?: AuthErrorType | undefined);
6
- }
@@ -1,2 +0,0 @@
1
- export declare function auth(startUrl: string, windowFeatures?: string): Promise<void>;
2
- export { AuthError } from './error';
@@ -1,2 +0,0 @@
1
- export declare type AuthErrorType = 'auth_window_closed' | 'invalid_request' | 'unauthorized_client' | 'access_denied' | 'unsupported_response_type' | 'invalid_scope' | 'server_error' | 'temporarily_unavailable' | 'authclientoauth2.autherror';
2
- export declare const isOfTypeAuthError: (inputString: string) => inputString is AuthErrorType;