@atlaskit/outbound-auth-flow-client 4.0.0 → 4.1.0
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 +7 -0
- package/auth/package.json +7 -0
- package/compass.yml +38 -0
- package/dist/cjs/auth.js +60 -0
- package/dist/cjs/index.js +8 -55
- package/dist/es2019/auth.js +54 -0
- package/dist/es2019/index.js +1 -54
- package/dist/esm/auth.js +53 -0
- package/dist/esm/index.js +1 -53
- package/dist/types/auth.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/outbound-auth-flow-client
|
|
2
2
|
|
|
3
|
+
## 4.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`c98e0cf5cc4f6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c98e0cf5cc4f6) -
|
|
8
|
+
Autofix: add explicit package exports (barrel removal)
|
|
9
|
+
|
|
3
10
|
## 4.0.0
|
|
4
11
|
|
|
5
12
|
### Major Changes
|
package/compass.yml
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
configVersion: 1
|
|
2
|
+
id: ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:component/c5751cc6-3513-4070-9deb-af31e86aed34/4cfc0a69-dee3-46aa-b062-5c90ca40cfb5
|
|
3
|
+
name: '@atlaskit/outbound-auth-flow-client'
|
|
4
|
+
ownerId: ari:cloud:identity::team/248e452a-058e-426f-8cc3-fdd7022ae84f # Eng - Ecosystem - Enterprise (Robert Massaioli)
|
|
5
|
+
labels:
|
|
6
|
+
- platform-code
|
|
7
|
+
- platform-afm
|
|
8
|
+
typeId: OTHER
|
|
9
|
+
fields:
|
|
10
|
+
tier: 4
|
|
11
|
+
lifecycle: Active
|
|
12
|
+
isMonorepoProject: true
|
|
13
|
+
links:
|
|
14
|
+
- name: Root Repository
|
|
15
|
+
type: REPOSITORY
|
|
16
|
+
url: https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master
|
|
17
|
+
- name: Slack Channel
|
|
18
|
+
type: CHAT_CHANNEL
|
|
19
|
+
url: https://atlassian.enterprise.slack.com/archives/CP01WF9AM # #help-eco-capabilities
|
|
20
|
+
- name: Outbound Auth Flow Client
|
|
21
|
+
type: REPOSITORY
|
|
22
|
+
url: https://bitbucket.org/atlassian/atlassian-frontend-monorepo/src/master/platform/packages/teamwork-ecosystem/outbound-auth-flow-client
|
|
23
|
+
customFields:
|
|
24
|
+
- name: Department
|
|
25
|
+
type: text
|
|
26
|
+
value: Eng - Ecosystem - OneCloud Build
|
|
27
|
+
- name: Technical Owner
|
|
28
|
+
type: user
|
|
29
|
+
value: ari:cloud:identity::user/557057:9eb9edaf-b755-4dd1-ab28-5c3f68948790 # Robert Massaioli
|
|
30
|
+
- name: Required Reviewers Opt In
|
|
31
|
+
type: boolean
|
|
32
|
+
value: true
|
|
33
|
+
- name: Reviewer Selection Mechanism
|
|
34
|
+
type: text
|
|
35
|
+
value: random(2)
|
|
36
|
+
- name: Required Reviewer Approvals
|
|
37
|
+
type: number
|
|
38
|
+
value: 1
|
package/dist/cjs/auth.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.auth = auth;
|
|
8
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
+
var _error = require("./error");
|
|
10
|
+
var _types = require("./types");
|
|
11
|
+
function auth(startUrl, windowFeatures) {
|
|
12
|
+
return new Promise(function (resolve, reject) {
|
|
13
|
+
var authWindow = null;
|
|
14
|
+
var authWindowInterval;
|
|
15
|
+
var handleAuthWindowMessage = function handleAuthWindowMessage(event) {
|
|
16
|
+
if (event.source !== authWindow) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
var data = event.data;
|
|
20
|
+
if ((0, _typeof2.default)(data) !== 'object') {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
switch (data.type) {
|
|
24
|
+
case 'outbound-auth:success':
|
|
25
|
+
finish();
|
|
26
|
+
resolve();
|
|
27
|
+
break;
|
|
28
|
+
case 'outbound-auth:failure':
|
|
29
|
+
finish();
|
|
30
|
+
var errorType = data.errorType.toLowerCase();
|
|
31
|
+
if ((0, _types.isOfTypeAuthError)(errorType)) {
|
|
32
|
+
reject(new _error.AuthError(data.message, errorType));
|
|
33
|
+
} else {
|
|
34
|
+
reject(new _error.AuthError(data.message));
|
|
35
|
+
}
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var handleAuthWindowInterval = function handleAuthWindowInterval() {
|
|
40
|
+
if (authWindow && authWindow.closed) {
|
|
41
|
+
finish();
|
|
42
|
+
reject(new _error.AuthError('The auth window was closed', 'auth_window_closed'));
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
var start = function start() {
|
|
46
|
+
window.addEventListener('message', handleAuthWindowMessage);
|
|
47
|
+
authWindow = window.open(startUrl, startUrl, windowFeatures);
|
|
48
|
+
authWindowInterval = window.setInterval(handleAuthWindowInterval, 500);
|
|
49
|
+
};
|
|
50
|
+
var finish = function finish() {
|
|
51
|
+
clearInterval(authWindowInterval);
|
|
52
|
+
window.removeEventListener('message', handleAuthWindowMessage);
|
|
53
|
+
if (authWindow) {
|
|
54
|
+
authWindow.close();
|
|
55
|
+
authWindow = null;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
start();
|
|
59
|
+
});
|
|
60
|
+
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -10,57 +9,11 @@ Object.defineProperty(exports, "AuthError", {
|
|
|
10
9
|
return _error.AuthError;
|
|
11
10
|
}
|
|
12
11
|
});
|
|
13
|
-
exports
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var handleAuthWindowMessage = function handleAuthWindowMessage(event) {
|
|
22
|
-
if (event.source !== authWindow) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
var data = event.data;
|
|
26
|
-
if ((0, _typeof2.default)(data) !== 'object') {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
switch (data.type) {
|
|
30
|
-
case 'outbound-auth:success':
|
|
31
|
-
finish();
|
|
32
|
-
resolve();
|
|
33
|
-
break;
|
|
34
|
-
case 'outbound-auth:failure':
|
|
35
|
-
finish();
|
|
36
|
-
var errorType = data.errorType.toLowerCase();
|
|
37
|
-
if ((0, _types.isOfTypeAuthError)(errorType)) {
|
|
38
|
-
reject(new _error.AuthError(data.message, errorType));
|
|
39
|
-
} else {
|
|
40
|
-
reject(new _error.AuthError(data.message));
|
|
41
|
-
}
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
var handleAuthWindowInterval = function handleAuthWindowInterval() {
|
|
46
|
-
if (authWindow && authWindow.closed) {
|
|
47
|
-
finish();
|
|
48
|
-
reject(new _error.AuthError('The auth window was closed', 'auth_window_closed'));
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
var start = function start() {
|
|
52
|
-
window.addEventListener('message', handleAuthWindowMessage);
|
|
53
|
-
authWindow = window.open(startUrl, startUrl, windowFeatures);
|
|
54
|
-
authWindowInterval = window.setInterval(handleAuthWindowInterval, 500);
|
|
55
|
-
};
|
|
56
|
-
var finish = function finish() {
|
|
57
|
-
clearInterval(authWindowInterval);
|
|
58
|
-
window.removeEventListener('message', handleAuthWindowMessage);
|
|
59
|
-
if (authWindow) {
|
|
60
|
-
authWindow.close();
|
|
61
|
-
authWindow = null;
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
start();
|
|
65
|
-
});
|
|
66
|
-
}
|
|
12
|
+
Object.defineProperty(exports, "auth", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _auth.auth;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _auth = require("./auth");
|
|
19
|
+
var _error = require("./error");
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { AuthError } from './error';
|
|
2
|
+
import { isOfTypeAuthError } from './types';
|
|
3
|
+
export function auth(startUrl, windowFeatures) {
|
|
4
|
+
return new Promise((resolve, reject) => {
|
|
5
|
+
let authWindow = null;
|
|
6
|
+
let authWindowInterval;
|
|
7
|
+
const handleAuthWindowMessage = event => {
|
|
8
|
+
if (event.source !== authWindow) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const {
|
|
12
|
+
data
|
|
13
|
+
} = event;
|
|
14
|
+
if (typeof data !== 'object') {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
switch (data.type) {
|
|
18
|
+
case 'outbound-auth:success':
|
|
19
|
+
finish();
|
|
20
|
+
resolve();
|
|
21
|
+
break;
|
|
22
|
+
case 'outbound-auth:failure':
|
|
23
|
+
finish();
|
|
24
|
+
const errorType = data.errorType.toLowerCase();
|
|
25
|
+
if (isOfTypeAuthError(errorType)) {
|
|
26
|
+
reject(new AuthError(data.message, errorType));
|
|
27
|
+
} else {
|
|
28
|
+
reject(new AuthError(data.message));
|
|
29
|
+
}
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const handleAuthWindowInterval = () => {
|
|
34
|
+
if (authWindow && authWindow.closed) {
|
|
35
|
+
finish();
|
|
36
|
+
reject(new AuthError('The auth window was closed', 'auth_window_closed'));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const start = () => {
|
|
40
|
+
window.addEventListener('message', handleAuthWindowMessage);
|
|
41
|
+
authWindow = window.open(startUrl, startUrl, windowFeatures);
|
|
42
|
+
authWindowInterval = window.setInterval(handleAuthWindowInterval, 500);
|
|
43
|
+
};
|
|
44
|
+
const finish = () => {
|
|
45
|
+
clearInterval(authWindowInterval);
|
|
46
|
+
window.removeEventListener('message', handleAuthWindowMessage);
|
|
47
|
+
if (authWindow) {
|
|
48
|
+
authWindow.close();
|
|
49
|
+
authWindow = null;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
start();
|
|
53
|
+
});
|
|
54
|
+
}
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,55 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { isOfTypeAuthError } from './types';
|
|
3
|
-
export function auth(startUrl, windowFeatures) {
|
|
4
|
-
return new Promise((resolve, reject) => {
|
|
5
|
-
let authWindow = null;
|
|
6
|
-
let authWindowInterval;
|
|
7
|
-
const handleAuthWindowMessage = event => {
|
|
8
|
-
if (event.source !== authWindow) {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
const {
|
|
12
|
-
data
|
|
13
|
-
} = event;
|
|
14
|
-
if (typeof data !== 'object') {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
switch (data.type) {
|
|
18
|
-
case 'outbound-auth:success':
|
|
19
|
-
finish();
|
|
20
|
-
resolve();
|
|
21
|
-
break;
|
|
22
|
-
case 'outbound-auth:failure':
|
|
23
|
-
finish();
|
|
24
|
-
const errorType = data.errorType.toLowerCase();
|
|
25
|
-
if (isOfTypeAuthError(errorType)) {
|
|
26
|
-
reject(new AuthError(data.message, errorType));
|
|
27
|
-
} else {
|
|
28
|
-
reject(new AuthError(data.message));
|
|
29
|
-
}
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
const handleAuthWindowInterval = () => {
|
|
34
|
-
if (authWindow && authWindow.closed) {
|
|
35
|
-
finish();
|
|
36
|
-
reject(new AuthError('The auth window was closed', 'auth_window_closed'));
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const start = () => {
|
|
40
|
-
window.addEventListener('message', handleAuthWindowMessage);
|
|
41
|
-
authWindow = window.open(startUrl, startUrl, windowFeatures);
|
|
42
|
-
authWindowInterval = window.setInterval(handleAuthWindowInterval, 500);
|
|
43
|
-
};
|
|
44
|
-
const finish = () => {
|
|
45
|
-
clearInterval(authWindowInterval);
|
|
46
|
-
window.removeEventListener('message', handleAuthWindowMessage);
|
|
47
|
-
if (authWindow) {
|
|
48
|
-
authWindow.close();
|
|
49
|
-
authWindow = null;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
start();
|
|
53
|
-
});
|
|
54
|
-
}
|
|
1
|
+
export { auth } from './auth';
|
|
55
2
|
export { AuthError } from './error';
|
package/dist/esm/auth.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
+
import { AuthError } from './error';
|
|
3
|
+
import { isOfTypeAuthError } from './types';
|
|
4
|
+
export function auth(startUrl, windowFeatures) {
|
|
5
|
+
return new Promise(function (resolve, reject) {
|
|
6
|
+
var authWindow = null;
|
|
7
|
+
var authWindowInterval;
|
|
8
|
+
var handleAuthWindowMessage = function handleAuthWindowMessage(event) {
|
|
9
|
+
if (event.source !== authWindow) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
var data = event.data;
|
|
13
|
+
if (_typeof(data) !== 'object') {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
switch (data.type) {
|
|
17
|
+
case 'outbound-auth:success':
|
|
18
|
+
finish();
|
|
19
|
+
resolve();
|
|
20
|
+
break;
|
|
21
|
+
case 'outbound-auth:failure':
|
|
22
|
+
finish();
|
|
23
|
+
var errorType = data.errorType.toLowerCase();
|
|
24
|
+
if (isOfTypeAuthError(errorType)) {
|
|
25
|
+
reject(new AuthError(data.message, errorType));
|
|
26
|
+
} else {
|
|
27
|
+
reject(new AuthError(data.message));
|
|
28
|
+
}
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var handleAuthWindowInterval = function handleAuthWindowInterval() {
|
|
33
|
+
if (authWindow && authWindow.closed) {
|
|
34
|
+
finish();
|
|
35
|
+
reject(new AuthError('The auth window was closed', 'auth_window_closed'));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var start = function start() {
|
|
39
|
+
window.addEventListener('message', handleAuthWindowMessage);
|
|
40
|
+
authWindow = window.open(startUrl, startUrl, windowFeatures);
|
|
41
|
+
authWindowInterval = window.setInterval(handleAuthWindowInterval, 500);
|
|
42
|
+
};
|
|
43
|
+
var finish = function finish() {
|
|
44
|
+
clearInterval(authWindowInterval);
|
|
45
|
+
window.removeEventListener('message', handleAuthWindowMessage);
|
|
46
|
+
if (authWindow) {
|
|
47
|
+
authWindow.close();
|
|
48
|
+
authWindow = null;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
start();
|
|
52
|
+
});
|
|
53
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,54 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { AuthError } from './error';
|
|
3
|
-
import { isOfTypeAuthError } from './types';
|
|
4
|
-
export function auth(startUrl, windowFeatures) {
|
|
5
|
-
return new Promise(function (resolve, reject) {
|
|
6
|
-
var authWindow = null;
|
|
7
|
-
var authWindowInterval;
|
|
8
|
-
var handleAuthWindowMessage = function handleAuthWindowMessage(event) {
|
|
9
|
-
if (event.source !== authWindow) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
var data = event.data;
|
|
13
|
-
if (_typeof(data) !== 'object') {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
switch (data.type) {
|
|
17
|
-
case 'outbound-auth:success':
|
|
18
|
-
finish();
|
|
19
|
-
resolve();
|
|
20
|
-
break;
|
|
21
|
-
case 'outbound-auth:failure':
|
|
22
|
-
finish();
|
|
23
|
-
var errorType = data.errorType.toLowerCase();
|
|
24
|
-
if (isOfTypeAuthError(errorType)) {
|
|
25
|
-
reject(new AuthError(data.message, errorType));
|
|
26
|
-
} else {
|
|
27
|
-
reject(new AuthError(data.message));
|
|
28
|
-
}
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
var handleAuthWindowInterval = function handleAuthWindowInterval() {
|
|
33
|
-
if (authWindow && authWindow.closed) {
|
|
34
|
-
finish();
|
|
35
|
-
reject(new AuthError('The auth window was closed', 'auth_window_closed'));
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var start = function start() {
|
|
39
|
-
window.addEventListener('message', handleAuthWindowMessage);
|
|
40
|
-
authWindow = window.open(startUrl, startUrl, windowFeatures);
|
|
41
|
-
authWindowInterval = window.setInterval(handleAuthWindowInterval, 500);
|
|
42
|
-
};
|
|
43
|
-
var finish = function finish() {
|
|
44
|
-
clearInterval(authWindowInterval);
|
|
45
|
-
window.removeEventListener('message', handleAuthWindowMessage);
|
|
46
|
-
if (authWindow) {
|
|
47
|
-
authWindow.close();
|
|
48
|
-
authWindow = null;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
start();
|
|
52
|
-
});
|
|
53
|
-
}
|
|
1
|
+
export { auth } from './auth';
|
|
54
2
|
export { AuthError } from './error';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function auth(startUrl: string, windowFeatures?: string): Promise<void>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { auth } from './auth';
|
|
2
2
|
export { AuthError } from './error';
|