@pb33f/cowboy-components 0.7.5 → 0.7.7
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/dist/components/auth/login-button.d.ts +3 -0
- package/dist/components/auth/login-button.js +29 -8
- package/dist/components/auth/login-panel.d.ts +2 -1
- package/dist/components/auth/login-panel.js +3 -2
- package/dist/components/auth/oauth-login.d.ts +1 -0
- package/dist/components/auth/oauth-login.js +11 -5
- package/dist/components/editor/editor-breadcrumb.css.js +1 -1
- package/dist/components/model-renderer/rendered-node.d.ts +2 -0
- package/dist/components/model-renderer/rendered-node.js +18 -0
- package/dist/components/model-renderer/responses.d.ts +11 -0
- package/dist/components/model-renderer/responses.js +46 -0
- package/dist/components/model-tree/tree.js +1 -1
- package/dist/components/paginator/paginator.css.js +1 -1
- package/dist/components/paginator/paginator.d.ts +2 -0
- package/dist/components/paginator/paginator.js +6 -6
- package/dist/components/problems-overview/problems-overview.js +6 -0
- package/dist/components/rodeo/rodeo.js +1 -1
- package/dist/components/the-doctor/sparks.d.ts +1 -0
- package/dist/components/the-doctor/sparks.js +36 -21
- package/dist/components/the-doctor/status-bar.css.js +10 -8
- package/dist/components/the-doctor/status-bar.d.ts +2 -0
- package/dist/components/the-doctor/status-bar.js +18 -8
- package/dist/components/the-doctor/the-doctor.css.js +1 -1
- package/dist/components/the-doctor/the-doctor.d.ts +113 -120
- package/dist/components/the-doctor/the-doctor.js +141 -1735
- package/dist/components/the-doctor/upload-archive.d.ts +1 -0
- package/dist/components/the-doctor/upload-archive.js +29 -12
- package/dist/controllers/{auth.d.ts → auth-controller.d.ts} +11 -6
- package/dist/controllers/auth-controller.js +165 -0
- package/dist/controllers/broker-controller.d.ts +22 -0
- package/dist/controllers/broker-controller.js +107 -0
- package/dist/controllers/diagnostic-controller.d.ts +6 -0
- package/dist/controllers/diagnostic-controller.js +262 -0
- package/dist/controllers/docs-controller.d.ts +8 -0
- package/dist/controllers/docs-controller.js +144 -0
- package/dist/controllers/model-controller.d.ts +8 -0
- package/dist/controllers/model-controller.js +87 -0
- package/dist/controllers/node-clicker-controller.d.ts +11 -0
- package/dist/controllers/node-clicker-controller.js +362 -0
- package/dist/controllers/problem-controller.d.ts +7 -0
- package/dist/controllers/problem-controller.js +46 -0
- package/dist/controllers/rolodex-controller.d.ts +10 -0
- package/dist/controllers/rolodex-controller.js +126 -0
- package/dist/controllers/rule-controller.d.ts +19 -0
- package/dist/controllers/rule-controller.js +264 -0
- package/dist/controllers/spec-controller.d.ts +8 -0
- package/dist/controllers/spec-controller.js +78 -0
- package/dist/controllers/state-controller.d.ts +9 -0
- package/dist/controllers/state-controller.js +279 -0
- package/dist/cowboy-components.umd.cjs +768 -736
- package/dist/css/pb33f-theme.css +1 -0
- package/dist/css/shared.css.js +5 -0
- package/dist/events/doctor.d.ts +12 -0
- package/dist/events/doctor.js +4 -0
- package/dist/model/api-response.d.ts +7 -0
- package/dist/model/api-response.js +2 -0
- package/dist/services/auth-service.d.ts +1 -0
- package/dist/services/auth-service.js +28 -0
- package/dist/services/linting-service.js +11 -2
- package/dist/services/model-service.d.ts +2 -1
- package/dist/services/model-service.js +31 -5
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/controllers/auth.js +0 -101
package/package.json
CHANGED
package/dist/controllers/auth.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { AuthenticationGithubRequested, LogoutRequested } from "../events/doctor.js";
|
|
2
|
-
import { AuthService } from "../services/auth-service.js";
|
|
3
|
-
import { HeaderService } from "../services/header-service";
|
|
4
|
-
const PreAuthURL = "pb33f-preauth-url";
|
|
5
|
-
export class AuthController {
|
|
6
|
-
constructor(host, sessionCallback, autoStart = false) {
|
|
7
|
-
this.host = host;
|
|
8
|
-
this.host.addController(this);
|
|
9
|
-
this.doctorEndpoint = 'https://doctor.pb33f.io';
|
|
10
|
-
const sessionEndpoint = sessionStorage.getItem("doctor-endpoint");
|
|
11
|
-
if (sessionEndpoint) {
|
|
12
|
-
this.doctorEndpoint = sessionEndpoint;
|
|
13
|
-
}
|
|
14
|
-
AuthService.doctorEndpoint = this.doctorEndpoint;
|
|
15
|
-
if (sessionCallback) {
|
|
16
|
-
this.sessionCallback = sessionCallback;
|
|
17
|
-
}
|
|
18
|
-
this.startSessionAutomatically = autoStart;
|
|
19
|
-
}
|
|
20
|
-
hostConnected() {
|
|
21
|
-
window.addEventListener(AuthenticationGithubRequested, this.authGithub.bind(this));
|
|
22
|
-
window.addEventListener(LogoutRequested, this.logout.bind(this));
|
|
23
|
-
// check for urlcapture
|
|
24
|
-
const urlState = sessionStorage.getItem(PreAuthURL);
|
|
25
|
-
if (urlState) {
|
|
26
|
-
this.urlCapture = urlState;
|
|
27
|
-
sessionStorage.removeItem(PreAuthURL);
|
|
28
|
-
}
|
|
29
|
-
const startBroker = () => {
|
|
30
|
-
this.startSession().then((session) => {
|
|
31
|
-
this.session = session;
|
|
32
|
-
if (this.sessionCallback) {
|
|
33
|
-
// call back if defined.
|
|
34
|
-
this.sessionCallback.call(this.host, session);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
this.checkState().then((state) => {
|
|
39
|
-
this.authenticated = true;
|
|
40
|
-
this.state = state;
|
|
41
|
-
this.host.requestUpdate();
|
|
42
|
-
startBroker();
|
|
43
|
-
if (this.urlCapture) {
|
|
44
|
-
const c = this.urlCapture;
|
|
45
|
-
this.urlCapture = null;
|
|
46
|
-
window.location.href = c;
|
|
47
|
-
}
|
|
48
|
-
}).catch(() => {
|
|
49
|
-
if (this.startSessionAutomatically) {
|
|
50
|
-
startBroker();
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
async startSession() {
|
|
55
|
-
return new Promise(async (resolve, reject) => {
|
|
56
|
-
try {
|
|
57
|
-
const sessionJSON = await fetch(this.doctorEndpoint + '/start-session', {
|
|
58
|
-
method: 'GET',
|
|
59
|
-
credentials: 'include',
|
|
60
|
-
});
|
|
61
|
-
const session = await sessionJSON.json();
|
|
62
|
-
if (session.type && session.title && session.status) {
|
|
63
|
-
reject();
|
|
64
|
-
}
|
|
65
|
-
resolve(session);
|
|
66
|
-
}
|
|
67
|
-
catch (e) {
|
|
68
|
-
reject({ detail: "the pb33f platform is unresponsive" });
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
async associateBroker(brokerId) {
|
|
73
|
-
return new Promise(async (resolve, reject) => {
|
|
74
|
-
try {
|
|
75
|
-
const headers = HeaderService.buildDefaultHeaders(brokerId);
|
|
76
|
-
const sessionJSON = await fetch(this.doctorEndpoint + '/associate-broker', {
|
|
77
|
-
method: 'GET',
|
|
78
|
-
credentials: 'include',
|
|
79
|
-
headers: headers
|
|
80
|
-
});
|
|
81
|
-
if (!sessionJSON.ok) {
|
|
82
|
-
reject(false);
|
|
83
|
-
}
|
|
84
|
-
resolve(true);
|
|
85
|
-
}
|
|
86
|
-
catch (e) {
|
|
87
|
-
reject({ detail: "cannot associate broker with session" });
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
authGithub() {
|
|
92
|
-
sessionStorage.setItem(PreAuthURL, window.location.toString());
|
|
93
|
-
window.location.href = this.doctorEndpoint + '/auth/github/start';
|
|
94
|
-
}
|
|
95
|
-
logout() {
|
|
96
|
-
window.location.href = this.doctorEndpoint + '/auth/logout';
|
|
97
|
-
}
|
|
98
|
-
checkState() {
|
|
99
|
-
return AuthService.checkAuth();
|
|
100
|
-
}
|
|
101
|
-
}
|