@deephaven/app-utils 0.37.1-beta.0 → 0.37.1-logout.15
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/AppBootstrap.d.ts.map +1 -1
- package/dist/components/AppBootstrap.js +17 -7
- package/dist/components/AppBootstrap.js.map +1 -1
- package/dist/components/AuthBootstrap.d.ts.map +1 -1
- package/dist/components/AuthBootstrap.js +10 -25
- package/dist/components/AuthBootstrap.js.map +1 -1
- package/dist/components/ConnectionBootstrap.d.ts.map +1 -1
- package/dist/components/ConnectionBootstrap.js +6 -7
- package/dist/components/ConnectionBootstrap.js.map +1 -1
- package/dist/components/LoginNotifier.d.ts +6 -0
- package/dist/components/LoginNotifier.d.ts.map +1 -0
- package/dist/components/LoginNotifier.js +16 -0
- package/dist/components/LoginNotifier.js.map +1 -0
- package/dist/components/PluginsBootstrap.js +3 -3
- package/dist/components/PluginsBootstrap.js.map +1 -1
- package/dist/components/index.d.ts +0 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +0 -2
- package/dist/components/index.js.map +1 -1
- package/dist/components/useConnection.d.ts.map +1 -1
- package/dist/components/useConnection.js +2 -6
- package/dist/components/useConnection.js.map +1 -1
- package/dist/components/usePlugins.d.ts.map +1 -1
- package/dist/components/usePlugins.js +2 -6
- package/dist/components/usePlugins.js.map +1 -1
- package/dist/plugins/PluginUtils.js +1 -1
- package/dist/plugins/PluginUtils.js.map +1 -1
- package/package.json +10 -9
- package/dist/components/ClientBootstrap.d.ts +0 -20
- package/dist/components/ClientBootstrap.d.ts.map +0 -1
- package/dist/components/ClientBootstrap.js +0 -30
- package/dist/components/ClientBootstrap.js.map +0 -1
- package/dist/components/useClient.d.ts +0 -3
- package/dist/components/useClient.d.ts.map +0 -1
- package/dist/components/useClient.js +0 -11
- package/dist/components/useClient.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppBootstrap.d.ts","sourceRoot":"","sources":["../../src/components/AppBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AppBootstrap.d.ts","sourceRoot":"","sources":["../../src/components/AppBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAC9D,OAAO,gDAAgD,CAAC;AAaxD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IAEf,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IAEnB,gCAAgC;IAChC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,cAAc,EACd,UAAU,EACV,QAAQ,GACT,EAAE,iBAAiB,eA8BnB;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
2
2
|
import '@deephaven/components/scss/BaseStyleSheet.scss';
|
|
3
|
+
import { ClientBootstrap } from '@deephaven/jsapi-bootstrap';
|
|
4
|
+
import { RefreshTokenBootstrap, useBroadcastLoginListener } from '@deephaven/jsapi-components';
|
|
3
5
|
import FontBootstrap from "./FontBootstrap.js";
|
|
4
|
-
import ClientBootstrap from "./ClientBootstrap.js";
|
|
5
6
|
import PluginsBootstrap from "./PluginsBootstrap.js";
|
|
6
7
|
import AuthBootstrap from "./AuthBootstrap.js";
|
|
7
8
|
import ConnectionBootstrap from "./ConnectionBootstrap.js";
|
|
@@ -19,15 +20,24 @@ export function AppBootstrap(_ref) {
|
|
|
19
20
|
children
|
|
20
21
|
} = _ref;
|
|
21
22
|
var serverUrl = getBaseUrl(apiUrl).origin;
|
|
22
|
-
var clientOptions = getConnectOptions();
|
|
23
|
+
var clientOptions = useMemo(() => getConnectOptions(), []);
|
|
24
|
+
|
|
25
|
+
// On logout, we reset the client and have user login again
|
|
26
|
+
var [logoutCount, setLogoutCount] = useState(0);
|
|
27
|
+
var onLogin = useCallback(() => undefined, []);
|
|
28
|
+
var onLogout = useCallback(() => {
|
|
29
|
+
setLogoutCount(value => value + 1);
|
|
30
|
+
}, []);
|
|
31
|
+
useBroadcastLoginListener(onLogin, onLogout);
|
|
23
32
|
return /*#__PURE__*/React.createElement(FontBootstrap, {
|
|
24
33
|
fontClassNames: fontClassNames
|
|
25
|
-
}, /*#__PURE__*/React.createElement(ClientBootstrap, {
|
|
26
|
-
serverUrl: serverUrl,
|
|
27
|
-
options: clientOptions
|
|
28
34
|
}, /*#__PURE__*/React.createElement(PluginsBootstrap, {
|
|
29
35
|
pluginsUrl: pluginsUrl
|
|
30
|
-
}, /*#__PURE__*/React.createElement(
|
|
36
|
+
}, /*#__PURE__*/React.createElement(ClientBootstrap, {
|
|
37
|
+
serverUrl: serverUrl,
|
|
38
|
+
options: clientOptions,
|
|
39
|
+
key: logoutCount
|
|
40
|
+
}, /*#__PURE__*/React.createElement(RefreshTokenBootstrap, null, /*#__PURE__*/React.createElement(AuthBootstrap, null, /*#__PURE__*/React.createElement(ConnectionBootstrap, null, /*#__PURE__*/React.createElement(FontsLoaded, null, children)))))));
|
|
31
41
|
}
|
|
32
42
|
export default AppBootstrap;
|
|
33
43
|
//# sourceMappingURL=AppBootstrap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppBootstrap.js","names":["React","
|
|
1
|
+
{"version":3,"file":"AppBootstrap.js","names":["React","useCallback","useMemo","useState","ClientBootstrap","RefreshTokenBootstrap","useBroadcastLoginListener","FontBootstrap","PluginsBootstrap","AuthBootstrap","ConnectionBootstrap","getBaseUrl","getConnectOptions","FontsLoaded","AppBootstrap","apiUrl","fontClassNames","pluginsUrl","children","serverUrl","origin","clientOptions","logoutCount","setLogoutCount","onLogin","undefined","onLogout","value"],"sources":["../../src/components/AppBootstrap.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useState } from 'react';\nimport '@deephaven/components/scss/BaseStyleSheet.scss';\nimport { ClientBootstrap } from '@deephaven/jsapi-bootstrap';\nimport {\n RefreshTokenBootstrap,\n useBroadcastLoginListener,\n} from '@deephaven/jsapi-components';\nimport FontBootstrap from './FontBootstrap';\nimport PluginsBootstrap from './PluginsBootstrap';\nimport AuthBootstrap from './AuthBootstrap';\nimport ConnectionBootstrap from './ConnectionBootstrap';\nimport { getBaseUrl, getConnectOptions } from '../utils';\nimport FontsLoaded from './FontsLoaded';\n\nexport type AppBootstrapProps = {\n /** URL of the API to load. */\n apiUrl: string;\n\n /** URL of the plugins to load. */\n pluginsUrl: string;\n\n /** Font class names to load. */\n fontClassNames?: string[];\n\n /**\n * The children to render wrapped when everything is loaded and authenticated.\n */\n children: React.ReactNode;\n};\n\n/**\n * AppBootstrap component. Handles loading the fonts, client, and authentication.\n * Will display the children when everything is loaded and authenticated.\n */\nexport function AppBootstrap({\n apiUrl,\n fontClassNames,\n pluginsUrl,\n children,\n}: AppBootstrapProps) {\n const serverUrl = getBaseUrl(apiUrl).origin;\n const clientOptions = useMemo(() => getConnectOptions(), []);\n\n // On logout, we reset the client and have user login again\n const [logoutCount, setLogoutCount] = useState(0);\n const onLogin = useCallback(() => undefined, []);\n const onLogout = useCallback(() => {\n setLogoutCount(value => value + 1);\n }, []);\n useBroadcastLoginListener(onLogin, onLogout);\n return (\n <FontBootstrap fontClassNames={fontClassNames}>\n <PluginsBootstrap pluginsUrl={pluginsUrl}>\n <ClientBootstrap\n serverUrl={serverUrl}\n options={clientOptions}\n key={logoutCount}\n >\n <RefreshTokenBootstrap>\n <AuthBootstrap>\n <ConnectionBootstrap>\n <FontsLoaded>{children}</FontsLoaded>\n </ConnectionBootstrap>\n </AuthBootstrap>\n </RefreshTokenBootstrap>\n </ClientBootstrap>\n </PluginsBootstrap>\n </FontBootstrap>\n );\n}\n\nexport default AppBootst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Q,CAAe,CACjB,CACR,CACM,CACR,CACD,CACL;AAEpB;AAEA,eAAeJ,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthBootstrap.d.ts","sourceRoot":"","sources":["../../src/components/AuthBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"AuthBootstrap.d.ts","sourceRoot":"","sources":["../../src/components/AuthBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAaxE,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AASF;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAAE,kBAAkB,eA6D7D;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
2
2
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
3
|
-
import React, {
|
|
3
|
+
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
4
4
|
import { AuthPluginAnonymous, AuthPluginParent, AuthPluginPsk } from '@deephaven/auth-plugins';
|
|
5
5
|
import { LoadingOverlay } from '@deephaven/components';
|
|
6
|
+
import { useClient } from '@deephaven/jsapi-bootstrap';
|
|
6
7
|
import { PluginsContext } from "./PluginsBootstrap.js";
|
|
7
8
|
import { getAuthPluginComponent } from "../plugins/index.js";
|
|
8
|
-
import
|
|
9
|
+
import LoginNotifier from "./LoginNotifier.js";
|
|
9
10
|
/** Core auth plugins that are always loaded */
|
|
10
11
|
var CORE_AUTH_PLUGINS = new Map([['@deephaven/auth-plugins.AuthPluginPsk', AuthPluginPsk], ['@deephaven/auth-plugins.AuthPluginParent', AuthPluginParent], ['@deephaven/auth-plugins.AuthPluginAnonymous', AuthPluginAnonymous]]);
|
|
11
12
|
|
|
@@ -21,10 +22,9 @@ export function AuthBootstrap(_ref) {
|
|
|
21
22
|
// We want to load the auth config values in parallel with the plugins
|
|
22
23
|
var plugins = useContext(PluginsContext);
|
|
23
24
|
var [authConfig, setAuthConfig] = useState();
|
|
24
|
-
var [isLoggedIn, setIsLoggedIn] = useState(false);
|
|
25
25
|
var [error, setError] = useState();
|
|
26
26
|
useEffect(function initAuthConfigValues() {
|
|
27
|
-
var
|
|
27
|
+
var isCanceled = false;
|
|
28
28
|
function loadAuthConfigValues() {
|
|
29
29
|
return _loadAuthConfigValues.apply(this, arguments);
|
|
30
30
|
}
|
|
@@ -32,11 +32,11 @@ export function AuthBootstrap(_ref) {
|
|
|
32
32
|
_loadAuthConfigValues = _asyncToGenerator(function* () {
|
|
33
33
|
try {
|
|
34
34
|
var newAuthConfigValues = yield client.getAuthConfigValues();
|
|
35
|
-
if (!
|
|
35
|
+
if (!isCanceled) {
|
|
36
36
|
setAuthConfig(new Map(newAuthConfigValues));
|
|
37
37
|
}
|
|
38
38
|
} catch (e) {
|
|
39
|
-
if (!
|
|
39
|
+
if (!isCanceled) {
|
|
40
40
|
setError(e);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
@@ -45,7 +45,7 @@ export function AuthBootstrap(_ref) {
|
|
|
45
45
|
}
|
|
46
46
|
loadAuthConfigValues();
|
|
47
47
|
return () => {
|
|
48
|
-
|
|
48
|
+
isCanceled = true;
|
|
49
49
|
};
|
|
50
50
|
}, [client]);
|
|
51
51
|
var AuthComponent = useMemo(() => {
|
|
@@ -58,13 +58,6 @@ export function AuthBootstrap(_ref) {
|
|
|
58
58
|
setError(e);
|
|
59
59
|
}
|
|
60
60
|
}, [authConfig, plugins]);
|
|
61
|
-
var handleLoginSuccess = useCallback(() => {
|
|
62
|
-
setIsLoggedIn(true);
|
|
63
|
-
}, []);
|
|
64
|
-
var handleLoginFailure = useCallback(e => {
|
|
65
|
-
setIsLoggedIn(false);
|
|
66
|
-
setError(e);
|
|
67
|
-
}, []);
|
|
68
61
|
var isLoading = AuthComponent == null || authConfig == null;
|
|
69
62
|
if (isLoading || error != null) {
|
|
70
63
|
return /*#__PURE__*/React.createElement(LoadingOverlay, {
|
|
@@ -72,17 +65,9 @@ export function AuthBootstrap(_ref) {
|
|
|
72
65
|
errorMessage: error != null ? "".concat(error) : undefined
|
|
73
66
|
});
|
|
74
67
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
client: client,
|
|
79
|
-
onSuccess: handleLoginSuccess,
|
|
80
|
-
onFailure: handleLoginFailure
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
85
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
68
|
+
return /*#__PURE__*/React.createElement(AuthComponent, {
|
|
69
|
+
authConfigValues: authConfig
|
|
70
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(LoginNotifier, null), children));
|
|
86
71
|
}
|
|
87
72
|
export default AuthBootstrap;
|
|
88
73
|
//# sourceMappingURL=AuthBootstrap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthBootstrap.js","names":["React","
|
|
1
|
+
{"version":3,"file":"AuthBootstrap.js","names":["React","useContext","useEffect","useMemo","useState","AuthPluginAnonymous","AuthPluginParent","AuthPluginPsk","LoadingOverlay","useClient","PluginsContext","getAuthPluginComponent","LoginNotifier","CORE_AUTH_PLUGINS","Map","AuthBootstrap","children","client","plugins","authConfig","setAuthConfig","error","setError","initAuthConfigValues","isCanceled","loadAuthConfigValues","newAuthConfigValues","getAuthConfigValues","e","AuthComponent","undefined","isLoading"],"sources":["../../src/components/AuthBootstrap.tsx"],"sourcesContent":["import React, { useContext, useEffect, useMemo, useState } from 'react';\nimport {\n AuthConfigMap,\n AuthPluginAnonymous,\n AuthPluginParent,\n AuthPluginPsk,\n} from '@deephaven/auth-plugins';\nimport { LoadingOverlay } from '@deephaven/components';\nimport { useClient } from '@deephaven/jsapi-bootstrap';\nimport { PluginsContext } from './PluginsBootstrap';\nimport { getAuthPluginComponent } from '../plugins';\nimport LoginNotifier from './LoginNotifier';\n\nexport type AuthBootstrapProps = {\n /**\n * The children to render after authentication is completed.\n */\n children: React.ReactNode;\n};\n\n/** Core auth plugins that are always loaded */\nconst CORE_AUTH_PLUGINS = new Map([\n ['@deephaven/auth-plugins.AuthPluginPsk', AuthPluginPsk],\n ['@deephaven/auth-plugins.AuthPluginParent', AuthPluginParent],\n ['@deephaven/auth-plugins.AuthPluginAnonymous', AuthPluginAnonymous],\n]);\n\n/**\n * AuthBootstrap component. Handles displaying the auth plugin and authenticating.\n */\nexport function AuthBootstrap({ children }: AuthBootstrapProps) {\n const client = useClient();\n // `useContext` instead of `usePlugins` so that we don't have to wait for the plugins to load\n // We want to load the auth config values in parallel with the plugins\n const plugins = useContext(PluginsContext);\n const [authConfig, setAuthConfig] = useState<AuthConfigMap>();\n const [error, setError] = useState<unknown>();\n\n useEffect(\n function initAuthConfigValues() {\n let isCanceled = false;\n async function loadAuthConfigValues() {\n try {\n const newAuthConfigValues = await client.getAuthConfigValues();\n if (!isCanceled) {\n setAuthConfig(new Map(newAuthConfigValues));\n }\n } catch (e) {\n if (!isCanceled) {\n setError(e);\n }\n }\n }\n loadAuthConfigValues();\n return () => {\n isCanceled = true;\n };\n },\n [client]\n );\n\n const AuthComponent = useMemo(() => {\n if (plugins == null || authConfig == null) {\n return undefined;\n }\n\n try {\n return getAuthPluginComponent(plugins, authConfig, CORE_AUTH_PLUGINS);\n } catch (e) {\n setError(e);\n }\n }, [authConfig, plugins]);\n\n const isLoading = AuthComponent == null || authConfig == null;\n\n if (isLoading || error != null) {\n return (\n <LoadingOverlay\n isLoading={isLoading}\n errorMessage={error != null ? `${error}` : undefined}\n />\n );\n }\n return (\n <AuthComponent authConfigValues={authConfig}>\n <>\n <LoginNotifier />\n {children}\n </>\n </AuthComponent>\n );\n}\n\nexport default AuthBootstrap;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACvE,SAEEC,mBAAmB,EACnBC,gBAAgB,EAChBC,aAAa,QACR,yBAAyB;AAChC,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,SAAS,QAAQ,4BAA4B;AAAC,SAC9CC,cAAc;AAAA,SACdC,sBAAsB;AAAA,OACxBC,aAAa;AASpB;AACA,IAAMC,iBAAiB,GAAG,IAAIC,GAAG,CAAC,CAChC,CAAC,uCAAuC,EAAEP,aAAa,CAAC,EACxD,CAAC,0CAA0C,EAAED,gBAAgB,CAAC,EAC9D,CAAC,6CAA6C,EAAED,mBAAmB,CAAC,CACrE,CAAC;;AAEF;AACA;AACA;AACA,OAAO,SAASU,aAAa,OAAmC;EAAA,IAAlC;IAAEC;EAA6B,CAAC;EAC5D,IAAMC,MAAM,GAAGR,SAAS,EAAE;EAC1B;EACA;EACA,IAAMS,OAAO,GAAGjB,UAAU,CAACS,cAAc,CAAC;EAC1C,IAAM,CAACS,UAAU,EAAEC,aAAa,CAAC,GAAGhB,QAAQ,EAAiB;EAC7D,IAAM,CAACiB,KAAK,EAAEC,QAAQ,CAAC,GAAGlB,QAAQ,EAAW;EAE7CF,SAAS,CACP,SAASqB,oBAAoB,GAAG;IAC9B,IAAIC,UAAU,GAAG,KAAK;IAAC,SACRC,oBAAoB;MAAA;IAAA;IAAA;MAAA,0CAAnC,aAAsC;QACpC,IAAI;UACF,IAAMC,mBAAmB,SAAST,MAAM,CAACU,mBAAmB,EAAE;UAC9D,IAAI,CAACH,UAAU,EAAE;YACfJ,aAAa,CAAC,IAAIN,GAAG,CAACY,mBAAmB,CAAC,CAAC;UAC7C;QACF,CAAC,CAAC,OAAOE,CAAC,EAAE;UACV,IAAI,CAACJ,UAAU,EAAE;YACfF,QAAQ,CAACM,CAAC,CAAC;UACb;QACF;MACF,CAAC;MAAA;IAAA;IACDH,oBAAoB,EAAE;IACtB,OAAO,MAAM;MACXD,UAAU,GAAG,IAAI;IACnB,CAAC;EACH,CAAC,EACD,CAACP,MAAM,CAAC,CACT;EAED,IAAMY,aAAa,GAAG1B,OAAO,CAAC,MAAM;IAClC,IAAIe,OAAO,IAAI,IAAI,IAAIC,UAAU,IAAI,IAAI,EAAE;MACzC,OAAOW,SAAS;IAClB;IAEA,IAAI;MACF,OAAOnB,sBAAsB,CAACO,OAAO,EAAEC,UAAU,EAAEN,iBAAiB,CAAC;IACvE,CAAC,CAAC,OAAOe,CAAC,EAAE;MACVN,QAAQ,CAACM,CAAC,CAAC;IACb;EACF,CAAC,EAAE,CAACT,UAAU,EAAED,OAAO,CAAC,CAAC;EAEzB,IAAMa,SAAS,GAAGF,aAAa,IAAI,IAAI,IAAIV,UAAU,IAAI,IAAI;EAE7D,IAAIY,SAAS,IAAIV,KAAK,IAAI,IAAI,EAAE;IAC9B,oBACE,oBAAC,cAAc;MACb,SAAS,EAAEU,SAAU;MACrB,YAAY,EAAEV,KAAK,IAAI,IAAI,aAAMA,KAAK,IAAKS;IAAU,EACrD;EAEN;EACA,oBACE,oBAAC,aAAa;IAAC,gBAAgB,EAAEX;EAAW,gBAC1C,uDACE,oBAAC,aAAa,OAAG,EAChBH,QAAQ,CACR,CACW;AAEpB;AAEA,eAAeD,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionBootstrap.d.ts","sourceRoot":"","sources":["../../src/components/ConnectionBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAGlE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"ConnectionBootstrap.d.ts","sourceRoot":"","sources":["../../src/components/ConnectionBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAGlE,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAKvD,eAAO,MAAM,iBAAiB,qCAA4C,CAAC;AAE3E,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;OAGG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,QAAQ,EAAE,EAAE,wBAAwB,eAgEzE;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -2,9 +2,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
2
2
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
3
3
|
import React, { createContext, useEffect, useState } from 'react';
|
|
4
4
|
import { LoadingOverlay } from '@deephaven/components';
|
|
5
|
-
import { useApi } from '@deephaven/jsapi-bootstrap';
|
|
5
|
+
import { useApi, useClient } from '@deephaven/jsapi-bootstrap';
|
|
6
6
|
import Log from '@deephaven/log';
|
|
7
|
-
import useClient from "./useClient.js";
|
|
8
7
|
var log = Log.module('@deephaven/jsapi-components.ConnectionBootstrap');
|
|
9
8
|
export var ConnectionContext = /*#__PURE__*/createContext(null);
|
|
10
9
|
/**
|
|
@@ -19,7 +18,7 @@ export function ConnectionBootstrap(_ref) {
|
|
|
19
18
|
var [error, setError] = useState();
|
|
20
19
|
var [connection, setConnection] = useState();
|
|
21
20
|
useEffect(function initConnection() {
|
|
22
|
-
var
|
|
21
|
+
var isCanceled = false;
|
|
23
22
|
function loadConnection() {
|
|
24
23
|
return _loadConnection.apply(this, arguments);
|
|
25
24
|
}
|
|
@@ -27,12 +26,12 @@ export function ConnectionBootstrap(_ref) {
|
|
|
27
26
|
_loadConnection = _asyncToGenerator(function* () {
|
|
28
27
|
try {
|
|
29
28
|
var newConnection = yield client.getAsIdeConnection();
|
|
30
|
-
if (
|
|
29
|
+
if (isCanceled) {
|
|
31
30
|
return;
|
|
32
31
|
}
|
|
33
32
|
setConnection(newConnection);
|
|
34
33
|
} catch (e) {
|
|
35
|
-
if (
|
|
34
|
+
if (isCanceled) {
|
|
36
35
|
return;
|
|
37
36
|
}
|
|
38
37
|
setError(e);
|
|
@@ -42,7 +41,7 @@ export function ConnectionBootstrap(_ref) {
|
|
|
42
41
|
}
|
|
43
42
|
loadConnection();
|
|
44
43
|
return () => {
|
|
45
|
-
|
|
44
|
+
isCanceled = true;
|
|
46
45
|
};
|
|
47
46
|
}, [api, client]);
|
|
48
47
|
useEffect(function listenForShutdown() {
|
|
@@ -61,7 +60,7 @@ export function ConnectionBootstrap(_ref) {
|
|
|
61
60
|
return /*#__PURE__*/React.createElement(LoadingOverlay, {
|
|
62
61
|
"data-testid": "connection-bootstrap-loading",
|
|
63
62
|
isLoading: connection == null,
|
|
64
|
-
errorMessage: "".concat(error)
|
|
63
|
+
errorMessage: error != null ? "".concat(error) : undefined
|
|
65
64
|
});
|
|
66
65
|
}
|
|
67
66
|
return /*#__PURE__*/React.createElement(ConnectionContext.Provider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionBootstrap.js","names":["React","createContext","useEffect","useState","LoadingOverlay","useApi","
|
|
1
|
+
{"version":3,"file":"ConnectionBootstrap.js","names":["React","createContext","useEffect","useState","LoadingOverlay","useApi","useClient","Log","log","module","ConnectionContext","ConnectionBootstrap","children","api","client","error","setError","connection","setConnection","initConnection","isCanceled","loadConnection","newConnection","getAsIdeConnection","e","listenForShutdown","handleShutdown","event","detail","info","JSON","stringify","removerFn","addEventListener","IdeConnection","EVENT_SHUTDOWN","undefined"],"sources":["../../src/components/ConnectionBootstrap.tsx"],"sourcesContent":["import React, { createContext, useEffect, useState } from 'react';\nimport { LoadingOverlay } from '@deephaven/components';\nimport { useApi, useClient } from '@deephaven/jsapi-bootstrap';\nimport { IdeConnection } from '@deephaven/jsapi-types';\nimport Log from '@deephaven/log';\n\nconst log = Log.module('@deephaven/jsapi-components.ConnectionBootstrap');\n\nexport const ConnectionContext = createContext<IdeConnection | null>(null);\n\nexport type ConnectionBootstrapProps = {\n /**\n * The children to render wrapped with the ConnectionContext.\n * Will not render children until the connection is created.\n */\n children: React.ReactNode;\n};\n\n/**\n * ConnectionBootstrap component. Handles initializing the connection.\n */\nexport function ConnectionBootstrap({ children }: ConnectionBootstrapProps) {\n const api = useApi();\n const client = useClient();\n const [error, setError] = useState<unknown>();\n const [connection, setConnection] = useState<IdeConnection>();\n useEffect(\n function initConnection() {\n let isCanceled = false;\n async function loadConnection() {\n try {\n const newConnection = await client.getAsIdeConnection();\n if (isCanceled) {\n return;\n }\n setConnection(newConnection);\n } catch (e) {\n if (isCanceled) {\n return;\n }\n setError(e);\n }\n }\n loadConnection();\n return () => {\n isCanceled = true;\n };\n },\n [api, client]\n );\n\n useEffect(\n function listenForShutdown() {\n if (connection == null) return;\n\n function handleShutdown(event: CustomEvent) {\n const { detail } = event;\n log.info('Shutdown', `${JSON.stringify(detail)}`);\n setError(`Server shutdown: ${detail ?? 'Unknown reason'}`);\n }\n\n const removerFn = connection.addEventListener(\n api.IdeConnection.EVENT_SHUTDOWN,\n handleShutdown\n );\n return removerFn;\n },\n [api, connection]\n );\n\n if (connection == null || error != null) {\n return (\n <LoadingOverlay\n data-testid=\"connection-bootstrap-loading\"\n isLoading={connection == null}\n errorMessage={error != null ? `${error}` : undefined}\n />\n );\n }\n\n return (\n <ConnectionContext.Provider value={connection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G;IAC3B,IAAIR,UAAU,IAAI,IAAI,EAAE;IAExB,SAASS,cAAc,CAACC,KAAkB,EAAE;MAC1C,IAAM;QAAEC;MAAO,CAAC,GAAGD,KAAK;MACxBnB,GAAG,CAACqB,IAAI,CAAC,UAAU,YAAKC,IAAI,CAACC,SAAS,CAACH,MAAM,CAAC,EAAG;MACjDZ,QAAQ,4BAAqBY,MAAM,aAANA,MAAM,cAANA,MAAM,GAAI,gBAAgB,EAAG;IAC5D;IAEA,IAAMI,SAAS,GAAGf,UAAU,CAACgB,gBAAgB,CAC3CpB,GAAG,CAACqB,aAAa,CAACC,cAAc,EAChCT,cAAc,CACf;IACD,OAAOM,SAAS;EAClB,CAAC,EACD,CAACnB,GAAG,EAAEI,UAAU,CAAC,CAClB;EAED,IAAIA,UAAU,IAAI,IAAI,IAAIF,KAAK,IAAI,IAAI,EAAE;IACvC,oBACE,oBAAC,cAAc;MACb,eAAY,8BAA8B;MAC1C,SAAS,EAAEE,UAAU,IAAI,IAAK;MAC9B,YAAY,EAAEF,KAAK,IAAI,IAAI,aAAMA,KAAK,IAAKqB;IAAU,EACrD;EAEN;EAEA,oBACE,oBAAC,iBAAiB,CAAC,QAAQ;IAAC,KAAK,EAAEnB;EAAW,GAC3CL,QAAQ,CACkB;AAEjC;AAEA,eAAeD,mBAAmB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoginNotifier.d.ts","sourceRoot":"","sources":["../../src/components/LoginNotifier.tsx"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,aAAa,SAS5B;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useBroadcastChannel } from '@deephaven/jsapi-components';
|
|
2
|
+
import { BROADCAST_LOGIN_MESSAGE, makeMessage } from '@deephaven/jsapi-utils';
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Component that broadcasts a message when mounted. Should be mounted after the user has logged in.
|
|
7
|
+
*/
|
|
8
|
+
export function LoginNotifier() {
|
|
9
|
+
var channel = useBroadcastChannel();
|
|
10
|
+
useEffect(function notifyLogin() {
|
|
11
|
+
channel.postMessage(makeMessage(BROADCAST_LOGIN_MESSAGE));
|
|
12
|
+
}, [channel]);
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
export default LoginNotifier;
|
|
16
|
+
//# sourceMappingURL=LoginNotifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoginNotifier.js","names":["useBroadcastChannel","BROADCAST_LOGIN_MESSAGE","makeMessage","useEffect","LoginNotifier","channel","notifyLogin","postMessage"],"sources":["../../src/components/LoginNotifier.tsx"],"sourcesContent":["import { useBroadcastChannel } from '@deephaven/jsapi-components';\nimport { BROADCAST_LOGIN_MESSAGE, makeMessage } from '@deephaven/jsapi-utils';\nimport { useEffect } from 'react';\n\n/**\n * Component that broadcasts a message when mounted. Should be mounted after the user has logged in.\n */\nexport function LoginNotifier() {\n const channel = useBroadcastChannel();\n useEffect(\n function notifyLogin() {\n channel.postMessage(makeMessage(BROADCAST_LOGIN_MESSAGE));\n },\n [channel]\n );\n return null;\n}\n\nexport default LoginNotifier;\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,6BAA6B;AACjE,SAASC,uBAAuB,EAAEC,WAAW,QAAQ,wBAAwB;AAC7E,SAASC,SAAS,QAAQ,OAAO;;AAEjC;AACA;AACA;AACA,OAAO,SAASC,aAAa,GAAG;EAC9B,IAAMC,OAAO,GAAGL,mBAAmB,EAAE;EACrCG,SAAS,CACP,SAASG,WAAW,GAAG;IACrBD,OAAO,CAACE,WAAW,CAACL,WAAW,CAACD,uBAAuB,CAAC,CAAC;EAC3D,CAAC,EACD,CAACI,OAAO,CAAC,CACV;EACD,OAAO,IAAI;AACb;AAEA,eAAeD,aAAa"}
|
|
@@ -13,14 +13,14 @@ export function PluginsBootstrap(_ref) {
|
|
|
13
13
|
} = _ref;
|
|
14
14
|
var [plugins, setPlugins] = useState(null);
|
|
15
15
|
useEffect(function initPlugins() {
|
|
16
|
-
var
|
|
16
|
+
var isCanceled = false;
|
|
17
17
|
function loadPlugins() {
|
|
18
18
|
return _loadPlugins.apply(this, arguments);
|
|
19
19
|
}
|
|
20
20
|
function _loadPlugins() {
|
|
21
21
|
_loadPlugins = _asyncToGenerator(function* () {
|
|
22
22
|
var pluginModules = yield loadModulePlugins(pluginsUrl);
|
|
23
|
-
if (!
|
|
23
|
+
if (!isCanceled) {
|
|
24
24
|
setPlugins(pluginModules);
|
|
25
25
|
}
|
|
26
26
|
});
|
|
@@ -28,7 +28,7 @@ export function PluginsBootstrap(_ref) {
|
|
|
28
28
|
}
|
|
29
29
|
loadPlugins();
|
|
30
30
|
return () => {
|
|
31
|
-
|
|
31
|
+
isCanceled = true;
|
|
32
32
|
};
|
|
33
33
|
}, [pluginsUrl]);
|
|
34
34
|
return /*#__PURE__*/React.createElement(PluginsContext.Provider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginsBootstrap.js","names":["React","createContext","useEffect","useState","loadModulePlugins","PluginsContext","PluginsBootstrap","pluginsUrl","children","plugins","setPlugins","initPlugins","
|
|
1
|
+
{"version":3,"file":"PluginsBootstrap.js","names":["React","createContext","useEffect","useState","loadModulePlugins","PluginsContext","PluginsBootstrap","pluginsUrl","children","plugins","setPlugins","initPlugins","isCanceled","loadPlugins","pluginModules"],"sources":["../../src/components/PluginsBootstrap.tsx"],"sourcesContent":["import React, { createContext, useEffect, useState } from 'react';\nimport { PluginModuleMap, loadModulePlugins } from '../plugins';\n\nexport const PluginsContext = createContext<PluginModuleMap | null>(null);\n\nexport type PluginsBootstrapProps = {\n /**\n * Base URL of the plugins to load.\n */\n pluginsUrl: string;\n\n /**\n * The children to render wrapped with the PluginsContext.\n * Note that it renders the children even if the plugins aren't loaded yet.\n */\n children: React.ReactNode;\n};\n\n/**\n * PluginsBootstrap component. Handles loading the plugins.\n */\nexport function PluginsBootstrap({\n pluginsUrl,\n children,\n}: PluginsBootstrapProps) {\n const [plugins, setPlugins] = useState<PluginModuleMap | null>(null);\n useEffect(\n function initPlugins() {\n let isCanceled = false;\n async function loadPlugins() {\n const pluginModules = await loadModulePlugins(pluginsUrl);\n if (!isCanceled) {\n setPlugins(pluginModules);\n }\n }\n loadPlugins();\n return () => {\n isCanceled = true;\n };\n },\n [pluginsUrl]\n );\n\n return (\n <PluginsContext.Provider value={plugins}>\n {children}\n </PluginsContext.Provider>\n );\n}\n\nexport default PluginsBootstrap;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAAC,SACxCC,iBAAiB;AAE3C,OAAO,IAAMC,cAAc,gBAAGJ,aAAa,CAAyB,IAAI,CAAC;AAezE;AACA;AACA;AACA,OAAO,SAASK,gBAAgB,OAGN;EAAA,IAHO;IAC/BC,UAAU;IACVC;EACqB,CAAC;EACtB,IAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAGP,QAAQ,CAAyB,IAAI,CAAC;EACpED,SAAS,CACP,SAASS,WAAW,GAAG;IACrB,IAAIC,UAAU,GAAG,KAAK;IAAC,SACRC,WAAW;MAAA;IAAA;IAAA;MAAA,iCAA1B,aAA6B;QAC3B,IAAMC,aAAa,SAASV,iBAAiB,CAACG,UAAU,CAAC;QACzD,IAAI,CAACK,UAAU,EAAE;UACfF,UAAU,CAACI,aAAa,CAAC;QAC3B;MACF,CAAC;MAAA;IAAA;IACDD,WAAW,EAAE;IACb,OAAO,MAAM;MACXD,UAAU,GAAG,IAAI;IACnB,CAAC;EACH,CAAC,EACD,CAACL,UAAU,CAAC,CACb;EAED,oBACE,oBAAC,cAAc,CAAC,QAAQ;IAAC,KAAK,EAAEE;EAAQ,GACrCD,QAAQ,CACe;AAE9B;AAEA,eAAeF,gBAAgB"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
export * from './AppBootstrap';
|
|
2
2
|
export * from './AuthBootstrap';
|
|
3
|
-
export * from './ClientBootstrap';
|
|
4
3
|
export * from './ConnectionBootstrap';
|
|
5
4
|
export * from './FontBootstrap';
|
|
6
5
|
export * from './FontsLoaded';
|
|
7
6
|
export * from './PluginsBootstrap';
|
|
8
7
|
export * from './usePlugins';
|
|
9
|
-
export * from './useClient';
|
|
10
8
|
export * from './useConnection';
|
|
11
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
export * from "./AppBootstrap.js";
|
|
2
2
|
export * from "./AuthBootstrap.js";
|
|
3
|
-
export * from "./ClientBootstrap.js";
|
|
4
3
|
export * from "./ConnectionBootstrap.js";
|
|
5
4
|
export * from "./FontBootstrap.js";
|
|
6
5
|
export * from "./FontsLoaded.js";
|
|
7
6
|
export * from "./PluginsBootstrap.js";
|
|
8
7
|
export * from "./usePlugins.js";
|
|
9
|
-
export * from "./useClient.js";
|
|
10
8
|
export * from "./useConnection.js";
|
|
11
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/components/index.ts"],"sourcesContent":["export * from './AppBootstrap';\nexport * from './AuthBootstrap';\nexport * from './
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/components/index.ts"],"sourcesContent":["export * from './AppBootstrap';\nexport * from './AuthBootstrap';\nexport * from './ConnectionBootstrap';\nexport * from './FontBootstrap';\nexport * from './FontsLoaded';\nexport * from './PluginsBootstrap';\nexport * from './usePlugins';\nexport * from './useConnection';\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConnection.d.ts","sourceRoot":"","sources":["../../src/components/useConnection.ts"],"names":[],"mappings":"AAGA,wBAAgB,aAAa,
|
|
1
|
+
{"version":3,"file":"useConnection.d.ts","sourceRoot":"","sources":["../../src/components/useConnection.ts"],"names":[],"mappings":"AAGA,wBAAgB,aAAa,mDAK5B;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useContextOrThrow } from '@deephaven/react-hooks';
|
|
2
2
|
import { ConnectionContext } from "./ConnectionBootstrap.js";
|
|
3
3
|
export function useConnection() {
|
|
4
|
-
|
|
5
|
-
if (connection == null) {
|
|
6
|
-
throw new Error('No IdeConnection available in useConnection. Was code wrapped in ConnectionBootstrap or ConnectionContext.Provider?');
|
|
7
|
-
}
|
|
8
|
-
return connection;
|
|
4
|
+
return useContextOrThrow(ConnectionContext, 'No IdeConnection available in useConnection. Was code wrapped in ConnectionBootstrap or ConnectionContext.Provider?');
|
|
9
5
|
}
|
|
10
6
|
export default useConnection;
|
|
11
7
|
//# sourceMappingURL=useConnection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConnection.js","names":["
|
|
1
|
+
{"version":3,"file":"useConnection.js","names":["useContextOrThrow","ConnectionContext","useConnection"],"sources":["../../src/components/useConnection.ts"],"sourcesContent":["import { useContextOrThrow } from '@deephaven/react-hooks';\nimport { ConnectionContext } from './ConnectionBootstrap';\n\nexport function useConnection() {\n return useContextOrThrow(\n ConnectionContext,\n 'No IdeConnection available in useConnection. Was code wrapped in ConnectionBootstrap or ConnectionContext.Provider?'\n );\n}\n\nexport default useConnection;\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,wBAAwB;AAAC,SAClDC,iBAAiB;AAE1B,OAAO,SAASC,aAAa,GAAG;EAC9B,OAAOF,iBAAiB,CACtBC,iBAAiB,EACjB,qHAAqH,CACtH;AACH;AAEA,eAAeC,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePlugins.d.ts","sourceRoot":"","sources":["../../src/components/usePlugins.ts"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,
|
|
1
|
+
{"version":3,"file":"usePlugins.d.ts","sourceRoot":"","sources":["../../src/components/usePlugins.ts"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,iCAKzB;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useContextOrThrow } from '@deephaven/react-hooks';
|
|
2
2
|
import { PluginsContext } from "./PluginsBootstrap.js";
|
|
3
3
|
export function usePlugins() {
|
|
4
|
-
|
|
5
|
-
if (plugins == null) {
|
|
6
|
-
throw new Error('No Plugins available in usePlugins. Was code wrapped in PluginsBootstrap or PluginsContext.Provider?');
|
|
7
|
-
}
|
|
8
|
-
return plugins;
|
|
4
|
+
return useContextOrThrow(PluginsContext, 'No Plugins available in usePlugins. Was code wrapped in PluginsBootstrap or PluginsContext.Provider?');
|
|
9
5
|
}
|
|
10
6
|
export default usePlugins;
|
|
11
7
|
//# sourceMappingURL=usePlugins.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePlugins.js","names":["
|
|
1
|
+
{"version":3,"file":"usePlugins.js","names":["useContextOrThrow","PluginsContext","usePlugins"],"sources":["../../src/components/usePlugins.ts"],"sourcesContent":["import { useContextOrThrow } from '@deephaven/react-hooks';\nimport { PluginsContext } from './PluginsBootstrap';\n\nexport function usePlugins() {\n return useContextOrThrow(\n PluginsContext,\n 'No Plugins available in usePlugins. Was code wrapped in PluginsBootstrap or PluginsContext.Provider?'\n );\n}\n\nexport default usePlugins;\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,wBAAwB;AAAC,SAClDC,cAAc;AAEvB,OAAO,SAASC,UAAU,GAAG;EAC3B,OAAOF,iBAAiB,CACtBC,cAAc,EACd,sGAAsG,CACvG;AACH;AAEA,eAAeC,UAAU"}
|
|
@@ -167,7 +167,7 @@ export function getAuthPluginComponent(pluginMap, authConfigValues, corePlugins)
|
|
|
167
167
|
|
|
168
168
|
var availableAuthPlugins = authPlugins.filter(_ref4 => {
|
|
169
169
|
var [name, authPlugin] = _ref4;
|
|
170
|
-
return authPlugin.isAvailable(authHandlers);
|
|
170
|
+
return authPlugin.isAvailable(authHandlers, authConfigValues);
|
|
171
171
|
});
|
|
172
172
|
if (availableAuthPlugins.length === 0) {
|
|
173
173
|
throw new Error("No login plugins found, please register a login plugin for auth handlers: ".concat(authHandlers));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginUtils.js","names":["React","isAuthPlugin","Log","RemoteComponent","loadRemoteModule","log","module","loadComponentPlugin","baseURL","pluginName","pluginUrl","URL","Plugin","forwardRef","props","ref","href","err","Component","errorMessage","error","displayName","loadModulePlugin","myModule","loadJson","jsonUrl","res","fetch","ok","Error","statusText","json","loadModulePlugins","modulePluginsUrl","debug","manifest","Array","isArray","plugins","pluginPromises","i","length","name","main","pluginMainUrl","push","pluginModules","Promise","allSettled","pluginMap","Map","status","set","value","reason","info","e","getAuthHandlers","authConfigValues","get","split","getAuthPluginComponent","corePlugins","authHandlers","authPlugins","entries","filter","plugin","AuthPlugin","map","availableAuthPlugins","authPlugin","isAvailable","warn","join","loginPluginName","NewLoginPlugin"],"sources":["../../src/plugins/PluginUtils.tsx"],"sourcesContent":["import React, { ForwardRefExoticComponent } from 'react';\nimport {\n AuthPlugin,\n AuthPluginComponent,\n isAuthPlugin,\n} from '@deephaven/auth-plugins';\nimport Log from '@deephaven/log';\nimport RemoteComponent from './RemoteComponent';\nimport loadRemoteModule from './loadRemoteModule';\n\nconst log = Log.module('@deephaven/app-utils.PluginUtils');\n\n// A PluginModule. This interface should have new fields added to it from different levels of plugins.\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface PluginModule {}\n\nexport type PluginModuleMap = Map<string, PluginModule>;\n\n/**\n * Load a component plugin from the server.\n * @param baseURL Base URL of the plugin server\n * @param pluginName Name of the component plugin to load\n * @returns A lazily loaded JSX.Element from the plugin\n */\nexport function loadComponentPlugin(\n baseURL: URL,\n pluginName: string\n): ForwardRefExoticComponent<React.RefAttributes<unknown>> {\n const pluginUrl = new URL(`${pluginName}.js`, baseURL);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const Plugin: any = React.forwardRef((props, ref) => (\n <RemoteComponent\n url={pluginUrl.href}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n render={({ err, Component }: { err: unknown; Component: any }) => {\n if (err != null && err !== '') {\n const errorMessage = `Error loading plugin ${pluginName} from ${pluginUrl} due to ${err}`;\n log.error(errorMessage);\n return <div className=\"error-message\">{`${errorMessage}`}</div>;\n }\n // eslint-disable-next-line react/jsx-props-no-spreading\n return <Component ref={ref} {...props} />;\n }}\n />\n ));\n Plugin.pluginName = pluginName;\n Plugin.displayName = 'Plugin';\n return Plugin;\n}\n\n/**\n * Imports a commonjs plugin module from the provided URL\n * @param pluginUrl The URL of the plugin to load\n * @returns The loaded module\n */\nexport async function loadModulePlugin(pluginUrl: string): Promise<unknown> {\n const myModule = await loadRemoteModule(pluginUrl);\n return myModule;\n}\n\n/**\n * Loads a JSON file and returns the JSON object\n * @param jsonUrl The URL of the JSON file to load\n * @returns The JSON object of the manifest file\n */\nexport async function loadJson(\n jsonUrl: string\n): Promise<{ plugins: { name: string; main: string }[] }> {\n const res = await fetch(jsonUrl);\n if (!res.ok) {\n throw new Error(res.statusText);\n }\n try {\n return await res.json();\n } catch {\n throw new Error('Could not be parsed as JSON');\n }\n}\n\n/**\n * Load all plugin modules available.\n * @param modulePluginsUrl The base URL of the module plugins to load\n * @returns A map from the name of the plugin to the plugin module that was loaded\n */\nexport async function loadModulePlugins(\n modulePluginsUrl: string\n): Promise<PluginModuleMap> {\n log.debug('Loading plugins...');\n try {\n const manifest = await loadJson(`${modulePluginsUrl}/manifest.json`);\n\n if (!Array.isArray(manifest.plugins)) {\n throw new Error('Plugin manifest JSON does not contain plugins array');\n }\n\n log.debug('Plugin manifest loaded:', manifest);\n const pluginPromises: Promise<unknown>[] = [];\n for (let i = 0; i < manifest.plugins.length; i += 1) {\n const { name, main } = manifest.plugins[i];\n const pluginMainUrl = `${modulePluginsUrl}/${name}/${main}`;\n pluginPromises.push(loadModulePlugin(pluginMainUrl));\n }\n const pluginModules = await Promise.allSettled(pluginPromises);\n\n const pluginMap: PluginModuleMap = new Map();\n for (let i = 0; i < pluginModules.length; i += 1) {\n const module = pluginModules[i];\n const { name } = manifest.plugins[i];\n if (module.status === 'fulfilled') {\n pluginMap.set(name, module.value as PluginModule);\n } else {\n log.error(`Unable to load plugin ${name}`, module.reason);\n }\n }\n log.info('Plugins loaded:', pluginMap);\n\n return pluginMap;\n } catch (e) {\n log.error('Unable to load plugins:', e);\n return new Map();\n }\n}\n\nexport function getAuthHandlers(\n authConfigValues: Map<string, string>\n): string[] {\n return authConfigValues.get('AuthHandlers')?.split(',') ?? [];\n}\n\n/**\n * Get the auth plugin component from the plugin map and current configuration\n * Throws if no auth plugin is available\n *\n * @param pluginMap Map of plugins loaded from the server\n * @param authConfigValues Auth config values from the server\n * @param corePlugins Map of core auth plugins to include in the list. They are added after the loaded plugins\n * @returns The auth plugin component to render\n */\nexport function getAuthPluginComponent(\n pluginMap: PluginModuleMap,\n authConfigValues: Map<string, string>,\n corePlugins?: Map<string, AuthPlugin>\n): AuthPluginComponent {\n const authHandlers = getAuthHandlers(authConfigValues);\n // Filter out all the plugins that are auth plugins, and then map them to [pluginName, AuthPlugin] pairs\n // Uses some pretty disgusting casting, because TypeScript wants to treat it as an (string | AuthPlugin)[] array instead\n const authPlugins = ([\n ...pluginMap.entries(),\n ].filter(([, plugin]: [string, { AuthPlugin?: AuthPlugin }]) =>\n isAuthPlugin(plugin.AuthPlugin)\n ) as [string, { AuthPlugin: AuthPlugin }][]).map(([name, plugin]) => [\n name,\n plugin.AuthPlugin,\n ]) as [string, AuthPlugin][];\n\n // Add all the core plugins in priority\n authPlugins.push(...(corePlugins ?? []));\n\n // Filter the available auth plugins\n\n const availableAuthPlugins = authPlugins.filter(([name, authPlugin]) =>\n authPlugin.isAvailable(authHandlers)\n );\n\n if (availableAuthPlugins.length === 0) {\n throw new Error(\n `No login plugins found, please register a login plugin for auth handlers: ${authHandlers}`\n );\n } else if (availableAuthPlugins.length > 1) {\n log.warn(\n 'More than one login plugin available, will use the first one: ',\n availableAuthPlugins.map(([name]) => name).join(', ')\n );\n }\n\n const [loginPluginName, NewLoginPlugin] = availableAuthPlugins[0];\n log.info('Using LoginPlugin', loginPluginName);\n\n return NewLoginPlugin.Component;\n}\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAqC,OAAO;AACxD,SAGEC,YAAY,QACP,yBAAyB;AAChC,OAAOC,GAAG,MAAM,gBAAgB;AAAC,OAC1BC,eAAe;AAAA,OACfC,gBAAgB;AAEvB,IAAMC,GAAG,GAAGH,GAAG,CAACI,MAAM,CAAC,kCAAkC,CAAC;;AAE1D;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmB,CACjCC,OAAY,EACZC,UAAkB,EACuC;EACzD,IAAMC,SAAS,GAAG,IAAIC,GAAG,WAAIF,UAAU,UAAOD,OAAO,CAAC;EACtD;EACA,IAAMI,MAAW,gBAAGZ,KAAK,CAACa,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,kBAC9C,oBAAC,eAAe;IACd,GAAG,EAAEL,SAAS,CAACM;IACf;IAAA;IACA,MA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,oBAAoB,CAAC7B,MAAM,KAAK,CAAC,EAAE;IACrC,MAAM,IAAIZ,KAAK,qFACgEkC,YAAY,EAC1F;EACH,CAAC,MAAM,IAAIO,oBAAoB,CAAC7B,MAAM,GAAG,CAAC,EAAE;IAC1CpC,GAAG,CAACoE,IAAI,CACN,gEAAgE,EAChEH,oBAAoB,CAACD,GAAG,CAAC;MAAA,IAAC,CAAC3B,IAAI,CAAC;MAAA,OAAKA,IAAI;IAAA,EAAC,CAACgC,IAAI,CAAC,IAAI,CAAC,CACtD;EACH;EAEA,IAAM,CAACC,eAAe,EAAEC,cAAc,CAAC,GAAGN,oBAAoB,CAAC,CAAC,CAAC;EACjEjE,GAAG,CAACkD,IAAI,CAAC,mBAAmB,EAAEoB,eAAe,CAAC;EAE9C,OAAOC,cAAc,CAAC1D,SAAS;AACjC"}
|
|
1
|
+
{"version":3,"file":"PluginUtils.js","names":["React","isAuthPlugin","Log","RemoteComponent","loadRemoteModule","log","module","loadComponentPlugin","baseURL","pluginName","pluginUrl","URL","Plugin","forwardRef","props","ref","href","err","Component","errorMessage","error","displayName","loadModulePlugin","myModule","loadJson","jsonUrl","res","fetch","ok","Error","statusText","json","loadModulePlugins","modulePluginsUrl","debug","manifest","Array","isArray","plugins","pluginPromises","i","length","name","main","pluginMainUrl","push","pluginModules","Promise","allSettled","pluginMap","Map","status","set","value","reason","info","e","getAuthHandlers","authConfigValues","get","split","getAuthPluginComponent","corePlugins","authHandlers","authPlugins","entries","filter","plugin","AuthPlugin","map","availableAuthPlugins","authPlugin","isAvailable","warn","join","loginPluginName","NewLoginPlugin"],"sources":["../../src/plugins/PluginUtils.tsx"],"sourcesContent":["import React, { ForwardRefExoticComponent } from 'react';\nimport {\n AuthPlugin,\n AuthPluginComponent,\n isAuthPlugin,\n} from '@deephaven/auth-plugins';\nimport Log from '@deephaven/log';\nimport RemoteComponent from './RemoteComponent';\nimport loadRemoteModule from './loadRemoteModule';\n\nconst log = Log.module('@deephaven/app-utils.PluginUtils');\n\n// A PluginModule. This interface should have new fields added to it from different levels of plugins.\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface PluginModule {}\n\nexport type PluginModuleMap = Map<string, PluginModule>;\n\n/**\n * Load a component plugin from the server.\n * @param baseURL Base URL of the plugin server\n * @param pluginName Name of the component plugin to load\n * @returns A lazily loaded JSX.Element from the plugin\n */\nexport function loadComponentPlugin(\n baseURL: URL,\n pluginName: string\n): ForwardRefExoticComponent<React.RefAttributes<unknown>> {\n const pluginUrl = new URL(`${pluginName}.js`, baseURL);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const Plugin: any = React.forwardRef((props, ref) => (\n <RemoteComponent\n url={pluginUrl.href}\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n render={({ err, Component }: { err: unknown; Component: any }) => {\n if (err != null && err !== '') {\n const errorMessage = `Error loading plugin ${pluginName} from ${pluginUrl} due to ${err}`;\n log.error(errorMessage);\n return <div className=\"error-message\">{`${errorMessage}`}</div>;\n }\n // eslint-disable-next-line react/jsx-props-no-spreading\n return <Component ref={ref} {...props} />;\n }}\n />\n ));\n Plugin.pluginName = pluginName;\n Plugin.displayName = 'Plugin';\n return Plugin;\n}\n\n/**\n * Imports a commonjs plugin module from the provided URL\n * @param pluginUrl The URL of the plugin to load\n * @returns The loaded module\n */\nexport async function loadModulePlugin(pluginUrl: string): Promise<unknown> {\n const myModule = await loadRemoteModule(pluginUrl);\n return myModule;\n}\n\n/**\n * Loads a JSON file and returns the JSON object\n * @param jsonUrl The URL of the JSON file to load\n * @returns The JSON object of the manifest file\n */\nexport async function loadJson(\n jsonUrl: string\n): Promise<{ plugins: { name: string; main: string }[] }> {\n const res = await fetch(jsonUrl);\n if (!res.ok) {\n throw new Error(res.statusText);\n }\n try {\n return await res.json();\n } catch {\n throw new Error('Could not be parsed as JSON');\n }\n}\n\n/**\n * Load all plugin modules available.\n * @param modulePluginsUrl The base URL of the module plugins to load\n * @returns A map from the name of the plugin to the plugin module that was loaded\n */\nexport async function loadModulePlugins(\n modulePluginsUrl: string\n): Promise<PluginModuleMap> {\n log.debug('Loading plugins...');\n try {\n const manifest = await loadJson(`${modulePluginsUrl}/manifest.json`);\n\n if (!Array.isArray(manifest.plugins)) {\n throw new Error('Plugin manifest JSON does not contain plugins array');\n }\n\n log.debug('Plugin manifest loaded:', manifest);\n const pluginPromises: Promise<unknown>[] = [];\n for (let i = 0; i < manifest.plugins.length; i += 1) {\n const { name, main } = manifest.plugins[i];\n const pluginMainUrl = `${modulePluginsUrl}/${name}/${main}`;\n pluginPromises.push(loadModulePlugin(pluginMainUrl));\n }\n const pluginModules = await Promise.allSettled(pluginPromises);\n\n const pluginMap: PluginModuleMap = new Map();\n for (let i = 0; i < pluginModules.length; i += 1) {\n const module = pluginModules[i];\n const { name } = manifest.plugins[i];\n if (module.status === 'fulfilled') {\n pluginMap.set(name, module.value as PluginModule);\n } else {\n log.error(`Unable to load plugin ${name}`, module.reason);\n }\n }\n log.info('Plugins loaded:', pluginMap);\n\n return pluginMap;\n } catch (e) {\n log.error('Unable to load plugins:', e);\n return new Map();\n }\n}\n\nexport function getAuthHandlers(\n authConfigValues: Map<string, string>\n): string[] {\n return authConfigValues.get('AuthHandlers')?.split(',') ?? [];\n}\n\n/**\n * Get the auth plugin component from the plugin map and current configuration\n * Throws if no auth plugin is available\n *\n * @param pluginMap Map of plugins loaded from the server\n * @param authConfigValues Auth config values from the server\n * @param corePlugins Map of core auth plugins to include in the list. They are added after the loaded plugins\n * @returns The auth plugin component to render\n */\nexport function getAuthPluginComponent(\n pluginMap: PluginModuleMap,\n authConfigValues: Map<string, string>,\n corePlugins?: Map<string, AuthPlugin>\n): AuthPluginComponent {\n const authHandlers = getAuthHandlers(authConfigValues);\n // Filter out all the plugins that are auth plugins, and then map them to [pluginName, AuthPlugin] pairs\n // Uses some pretty disgusting casting, because TypeScript wants to treat it as an (string | AuthPlugin)[] array instead\n const authPlugins = ([\n ...pluginMap.entries(),\n ].filter(([, plugin]: [string, { AuthPlugin?: AuthPlugin }]) =>\n isAuthPlugin(plugin.AuthPlugin)\n ) as [string, { AuthPlugin: AuthPlugin }][]).map(([name, plugin]) => [\n name,\n plugin.AuthPlugin,\n ]) as [string, AuthPlugin][];\n\n // Add all the core plugins in priority\n authPlugins.push(...(corePlugins ?? []));\n\n // Filter the available auth plugins\n\n const availableAuthPlugins = authPlugins.filter(([name, authPlugin]) =>\n authPlugin.isAvailable(authHandlers, authConfigValues)\n );\n\n if (availableAuthPlugins.length === 0) {\n throw new Error(\n `No login plugins found, please register a login plugin for auth handlers: ${authHandlers}`\n );\n } else if (availableAuthPlugins.length > 1) {\n log.warn(\n 'More than one login plugin available, will use the first one: ',\n availableAuthPlugins.map(([name]) => name).join(', ')\n );\n }\n\n const [loginPluginName, NewLoginPlugin] = availableAuthPlugins[0];\n log.info('Using LoginPlugin', loginPluginName);\n\n return NewLoginPlugin.Component;\n}\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAqC,OAAO;AACxD,SAGEC,YAAY,QACP,yBAAyB;AAChC,OAAOC,GAAG,MAAM,gBAAgB;AAAC,OAC1BC,eAAe;AAAA,OACfC,gBAAgB;AAEvB,IAAMC,GAAG,GAAGH,GAAG,CAACI,MAAM,CAAC,kCAAkC,CAAC;;AAE1D;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmB,CACjCC,OAAY,EACZC,UAAkB,EACuC;EACzD,IAAMC,SAAS,GAAG,IAAIC,GAAG,WAAIF,UAAU,UAAOD,OAAO,CAAC;EACtD;EACA,IAAMI,MAAW,gBAAGZ,KAAK,CAACa,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,kBAC9C,oBAAC,eAAe;IACd,GAAG,EAAEL,SAAS,CAACM;IACf;IAAA;IACA,MAAM,EAAE,QAA0D;MAAA,IAAzD;QAAEC,GAAG;QAAEC;MAA4C,CAAC;MAC3D,IAAID,GAAG,IAAI,IAAI,IAAIA,GAAG,KAAK,EAAE,EAAE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AAIO,oBAAoB,CAAC7B,MAAM,GAAG,CAAC,EAAE;IAC1CpC,GAAG,CAACoE,IAAI,CACN,gEAAgE,EAChEH,oBAAoB,CAACD,GAAG,CAAC;MAAA,IAAC,CAAC3B,IAAI,CAAC;MAAA,OAAKA,IAAI;IAAA,EAAC,CAACgC,IAAI,CAAC,IAAI,CAAC,CACtD;EACH;EAEA,IAAM,CAACC,eAAe,EAAEC,cAAc,CAAC,GAAGN,oBAAoB,CAAC,CAAC,CAAC;EACjEjE,GAAG,CAACkD,IAAI,CAAC,mBAAmB,EAAEoB,eAAe,CAAC;EAE9C,OAAOC,cAAc,CAAC1D,SAAS;AACjC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deephaven/app-utils",
|
|
3
|
-
"version": "0.37.1-
|
|
3
|
+
"version": "0.37.1-logout.15+df14a9d3",
|
|
4
4
|
"description": "Deephaven App Utils",
|
|
5
5
|
"author": "Deephaven Data Labs LLC",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -22,24 +22,25 @@
|
|
|
22
22
|
"build:babel": "babel ./src --out-dir ./dist --extensions \".ts,.tsx,.js,.jsx\" --source-maps --root-mode upward"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@deephaven/redux": "^0.37.1-beta.0+de7a110e",
|
|
26
25
|
"react": "^17.x",
|
|
27
26
|
"react-dom": "^17.x",
|
|
28
27
|
"react-redux": "^7.x",
|
|
29
28
|
"redux": "^4.x"
|
|
30
29
|
},
|
|
31
30
|
"dependencies": {
|
|
32
|
-
"@deephaven/auth-plugins": "^0.37.1-
|
|
33
|
-
"@deephaven/components": "^0.37.1-
|
|
34
|
-
"@deephaven/jsapi-bootstrap": "^0.37.1-
|
|
35
|
-
"@deephaven/jsapi-
|
|
36
|
-
"@deephaven/
|
|
31
|
+
"@deephaven/auth-plugins": "^0.37.1-logout.15+df14a9d3",
|
|
32
|
+
"@deephaven/components": "^0.37.1-logout.15+df14a9d3",
|
|
33
|
+
"@deephaven/jsapi-bootstrap": "^0.37.1-logout.15+df14a9d3",
|
|
34
|
+
"@deephaven/jsapi-components": "^0.37.1-logout.15+df14a9d3",
|
|
35
|
+
"@deephaven/jsapi-types": "^0.37.1-logout.15+df14a9d3",
|
|
36
|
+
"@deephaven/jsapi-utils": "^0.37.1-logout.15+df14a9d3",
|
|
37
|
+
"@deephaven/log": "^0.37.1-logout.15+df14a9d3",
|
|
38
|
+
"@deephaven/react-hooks": "^0.37.1-logout.15+df14a9d3",
|
|
37
39
|
"@paciolan/remote-component": "2.13.0",
|
|
38
40
|
"@paciolan/remote-module-loader": "^3.0.2",
|
|
39
41
|
"fira": "mozilla/fira#4.202"
|
|
40
42
|
},
|
|
41
43
|
"peerDependencies": {
|
|
42
|
-
"@deephaven/redux": "file:../redux",
|
|
43
44
|
"react": "^17.x",
|
|
44
45
|
"react-dom": "^17.x",
|
|
45
46
|
"react-redux": "^7.x",
|
|
@@ -54,5 +55,5 @@
|
|
|
54
55
|
"publishConfig": {
|
|
55
56
|
"access": "public"
|
|
56
57
|
},
|
|
57
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "df14a9d3dc09337b4996df635d1ba83151a60b6e"
|
|
58
59
|
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ConnectOptions, CoreClient } from '@deephaven/jsapi-types';
|
|
3
|
-
export declare const ClientContext: React.Context<CoreClient | null>;
|
|
4
|
-
export type ClientBootstrapProps = {
|
|
5
|
-
/** URL of the server to connect to */
|
|
6
|
-
serverUrl: string;
|
|
7
|
-
/** Connection options to pass to CoreClient when connecting */
|
|
8
|
-
options?: ConnectOptions;
|
|
9
|
-
/**
|
|
10
|
-
* The children to render wrapped with the ClientContext.
|
|
11
|
-
* Will not render children until the client is created.
|
|
12
|
-
*/
|
|
13
|
-
children: React.ReactNode;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* ClientBootstrap component. Handles creating the client.
|
|
17
|
-
*/
|
|
18
|
-
export declare function ClientBootstrap({ serverUrl, options, children, }: ClientBootstrapProps): JSX.Element | null;
|
|
19
|
-
export default ClientBootstrap;
|
|
20
|
-
//# sourceMappingURL=ClientBootstrap.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClientBootstrap.d.ts","sourceRoot":"","sources":["../../src/components/ClientBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAElE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpE,eAAO,MAAM,aAAa,kCAAyC,CAAC;AAEpE,MAAM,MAAM,oBAAoB,GAAG;IACjC,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAElB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,cAAc,CAAC;IAEzB;;;OAGG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,OAAO,EACP,QAAQ,GACT,EAAE,oBAAoB,sBAoBtB;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React, { createContext, useEffect, useState } from 'react';
|
|
2
|
-
import { useApi } from '@deephaven/jsapi-bootstrap';
|
|
3
|
-
export var ClientContext = /*#__PURE__*/createContext(null);
|
|
4
|
-
/**
|
|
5
|
-
* ClientBootstrap component. Handles creating the client.
|
|
6
|
-
*/
|
|
7
|
-
export function ClientBootstrap(_ref) {
|
|
8
|
-
var {
|
|
9
|
-
serverUrl,
|
|
10
|
-
options,
|
|
11
|
-
children
|
|
12
|
-
} = _ref;
|
|
13
|
-
var api = useApi();
|
|
14
|
-
var [client, setClient] = useState();
|
|
15
|
-
useEffect(function initClient() {
|
|
16
|
-
var newClient = new api.CoreClient(serverUrl, options);
|
|
17
|
-
setClient(newClient);
|
|
18
|
-
return () => {
|
|
19
|
-
newClient.disconnect();
|
|
20
|
-
};
|
|
21
|
-
}, [api, options, serverUrl]);
|
|
22
|
-
if (client == null) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
return /*#__PURE__*/React.createElement(ClientContext.Provider, {
|
|
26
|
-
value: client
|
|
27
|
-
}, children);
|
|
28
|
-
}
|
|
29
|
-
export default ClientBootstrap;
|
|
30
|
-
//# sourceMappingURL=ClientBootstrap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClientBootstrap.js","names":["React","createContext","useEffect","useState","useApi","ClientContext","ClientBootstrap","serverUrl","options","children","api","client","setClient","initClient","newClient","CoreClient","disconnect"],"sources":["../../src/components/ClientBootstrap.tsx"],"sourcesContent":["import React, { createContext, useEffect, useState } from 'react';\nimport { useApi } from '@deephaven/jsapi-bootstrap';\nimport { ConnectOptions, CoreClient } from '@deephaven/jsapi-types';\n\nexport const ClientContext = createContext<CoreClient | null>(null);\n\nexport type ClientBootstrapProps = {\n /** URL of the server to connect to */\n serverUrl: string;\n\n /** Connection options to pass to CoreClient when connecting */\n options?: ConnectOptions;\n\n /**\n * The children to render wrapped with the ClientContext.\n * Will not render children until the client is created.\n */\n children: React.ReactNode;\n};\n\n/**\n * ClientBootstrap component. Handles creating the client.\n */\nexport function ClientBootstrap({\n serverUrl,\n options,\n children,\n}: ClientBootstrapProps) {\n const api = useApi();\n const [client, setClient] = useState<CoreClient>();\n useEffect(\n function initClient() {\n const newClient = new api.CoreClient(serverUrl, options);\n setClient(newClient);\n return () => {\n newClient.disconnect();\n };\n },\n [api, options, serverUrl]\n );\n\n if (client == null) {\n return null;\n }\n return (\n <ClientContext.Provider value={client}>{children}</ClientContext.Provider>\n );\n}\n\nexport default ClientBootstrap;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACjE,SAASC,MAAM,QAAQ,4BAA4B;AAGnD,OAAO,IAAMC,aAAa,gBAAGJ,aAAa,CAAoB,IAAI,CAAC;AAgBnE;AACA;AACA;AACA,OAAO,SAASK,eAAe,OAIN;EAAA,IAJO;IAC9BC,SAAS;IACTC,OAAO;IACPC;EACoB,CAAC;EACrB,IAAMC,GAAG,GAAGN,MAAM,EAAE;EACpB,IAAM,CAACO,MAAM,EAAEC,SAAS,CAAC,GAAGT,QAAQ,EAAc;EAClDD,SAAS,CACP,SAASW,UAAU,GAAG;IACpB,IAAMC,SAAS,GAAG,IAAIJ,GAAG,CAACK,UAAU,CAACR,SAAS,EAAEC,OAAO,CAAC;IACxDI,SAAS,CAACE,SAAS,CAAC;IACpB,OAAO,MAAM;MACXA,SAAS,CAACE,UAAU,EAAE;IACxB,CAAC;EACH,CAAC,EACD,CAACN,GAAG,EAAEF,OAAO,EAAED,SAAS,CAAC,CAC1B;EAED,IAAII,MAAM,IAAI,IAAI,EAAE;IAClB,OAAO,IAAI;EACb;EACA,oBACE,oBAAC,aAAa,CAAC,QAAQ;IAAC,KAAK,EAAEA;EAAO,GAAEF,QAAQ,CAA0B;AAE9E;AAEA,eAAeH,eAAe"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useClient.d.ts","sourceRoot":"","sources":["../../src/components/useClient.ts"],"names":[],"mappings":"AAGA,wBAAgB,SAAS,gDAQxB;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { ClientContext } from "./ClientBootstrap.js";
|
|
3
|
-
export function useClient() {
|
|
4
|
-
var client = useContext(ClientContext);
|
|
5
|
-
if (client == null) {
|
|
6
|
-
throw new Error('No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?');
|
|
7
|
-
}
|
|
8
|
-
return client;
|
|
9
|
-
}
|
|
10
|
-
export default useClient;
|
|
11
|
-
//# sourceMappingURL=useClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useClient.js","names":["useContext","ClientContext","useClient","client","Error"],"sources":["../../src/components/useClient.ts"],"sourcesContent":["import { useContext } from 'react';\nimport { ClientContext } from './ClientBootstrap';\n\nexport function useClient() {\n const client = useContext(ClientContext);\n if (client == null) {\n throw new Error(\n 'No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?'\n );\n }\n return client;\n}\n\nexport default useClient;\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,OAAO;AAAC,SAC1BC,aAAa;AAEtB,OAAO,SAASC,SAAS,GAAG;EAC1B,IAAMC,MAAM,GAAGH,UAAU,CAACC,aAAa,CAAC;EACxC,IAAIE,MAAM,IAAI,IAAI,EAAE;IAClB,MAAM,IAAIC,KAAK,CACb,kGAAkG,CACnG;EACH;EACA,OAAOD,MAAM;AACf;AAEA,eAAeD,SAAS"}
|