@deephaven/app-utils 0.37.4-logout.17 → 0.37.4-logout.21
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.js.map +1 -1
- package/dist/components/AuthBootstrap.js.map +1 -1
- package/dist/components/ConnectionBootstrap.js.map +1 -1
- package/dist/components/FontBootstrap.js.map +1 -1
- package/dist/components/FontsLoaded.js.map +1 -1
- package/dist/components/LoginNotifier.js.map +1 -1
- package/dist/components/PluginsBootstrap.js.map +1 -1
- package/dist/components/useConnection.js.map +1 -1
- package/dist/components/usePlugins.js.map +1 -1
- package/dist/plugins/PluginUtils.js +1 -0
- package/dist/plugins/PluginUtils.js.map +1 -1
- package/dist/utils/ConnectUtils.js.map +1 -1
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppBootstrap.js","names":["React","useCallback","useMemo","useState","ClientBootstrap","RefreshTokenBootstrap","useBroadcastLoginListener","FontBootstrap","PluginsBootstrap","AuthBootstrap","ConnectionBootstrap","getBaseUrl","getConnectOptions","FontsLoaded","AppBootstrap","
|
|
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 AppBootstrap;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC7D,OAAO,gDAAgD;AACvD,SAASC,eAAe,QAAQ,4BAA4B;AAC5D,SACEC,qBAAqB,EACrBC,yBAAyB,QACpB,6BAA6B;AAAC,OAC9BC,aAAa;AAAA,OACbC,gBAAgB;AAAA,OAChBC,aAAa;AAAA,OACbC,mBAAmB;AAAA,SACjBC,UAAU,EAAEC,iBAAiB;AAAA,OAC/BC,WAAW;AAkBlB;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAY,OAKN;EAAA,IALO;IAC3BC,MAAM;IACNC,cAAc;IACdC,UAAU;IACVC;EACiB,CAAC;EAClB,IAAMC,SAAS,GAAGR,UAAU,CAACI,MAAM,CAAC,CAACK,MAAM;EAC3C,IAAMC,aAAa,GAAGnB,OAAO,CAAC,MAAMU,iBAAiB,EAAE,EAAE,EAAE,CAAC;;EAE5D;EACA,IAAM,CAACU,WAAW,EAAEC,cAAc,CAAC,GAAGpB,QAAQ,CAAC,CAAC,CAAC;EACjD,IAAMqB,OAAO,GAAGvB,WAAW,CAAC,MAAMwB,SAAS,EAAE,EAAE,CAAC;EAChD,IAAMC,QAAQ,GAAGzB,WAAW,CAAC,MAAM;IACjCsB,cAAc,CAACI,KAAK,IAAIA,KAAK,GAAG,CAAC,CAAC;EACpC,CAAC,EAAE,EAAE,CAAC;EACNrB,yBAAyB,CAACkB,OAAO,EAAEE,QAAQ,CAAC;EAC5C,oBACE,oBAAC,aAAa;IAAC,cAAc,EAAEV;EAAe,gBAC5C,oBAAC,gBAAgB;IAAC,UAAU,EAAEC;EAAW,gBACvC,oBAAC,eAAe;IACd,SAAS,EAAEE,SAAU;IACrB,OAAO,EAAEE,aAAc;IACvB,GAAG,EAAEC;EAAY,gBAEjB,oBAAC,qBAAqB,qBACpB,oBAAC,aAAa,qBACZ,oBAAC,mBAAmB,qBAClB,oBAAC,WAAW,QAAEJ,QAAQ,CAAe,CACjB,CACR,CACM,CACR,CACD,CACL;AAEpB;AAEA,eAAeJ,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
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","
|
|
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,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W,gBAC1C,uDACE,oBAAC,aAAa,OAAG,EAChBH,QAAQ,CACR,CACW;AAEpB;AAEA,eAAeD,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionBootstrap.js","names":["React","createContext","useEffect","useState","LoadingOverlay","useApi","useClient","Log","log","module","ConnectionContext","ConnectionBootstrap","
|
|
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}>\n {children}\n </ConnectionContext.Provider>\n );\n}\n\nexport default ConnectionBootstrap;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACjE,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,MAAM,EAAEC,SAAS,QAAQ,4BAA4B;AAE9D,OAAOC,GAAG,MAAM,gBAAgB;AAEhC,IAAMC,GAAG,GAAGD,GAAG,CAACE,MAAM,CAAC,iDAAiD,CAAC;AAEzE,OAAO,IAAMC,iBAAiB,gBAAGT,aAAa,CAAuB,IAAI,CAAC;AAU1E;AACA;AACA;AACA,OAAO,SAASU,mBAAmB,OAAyC;EAAA,IAAxC;IAAEC;EAAmC,CAAC;EACxE,IAAMC,GAAG,GAAGR,MAAM,EAAE;EACpB,IAAMS,MAAM,GAAGR,SAAS,EAAE;EAC1B,IAAM,CAACS,KAAK,EAAEC,QAAQ,CAAC,GAAGb,QAAQ,EAAW;EAC7C,IAAM,CAACc,UAAU,EAAEC,aAAa,CAAC,GAAGf,QAAQ,EAAiB;EAC7DD,SAAS,CACP,SAASiB,cAAc,GAAG;IACxB,IAAIC,UAAU,GAAG,KAAK;IAAC,SACRC,cAAc;MAAA;IAAA;IAAA;MAAA,oCAA7B,aAAgC;QAC9B,IAAI;UACF,IAAMC,aAAa,SAASR,MAAM,CAACS,kBAAkB,EA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ontBootstrap.js","names":["React","createContext","useEffect","useState","FontsLoadedContext","FontBootstrap","
|
|
1
|
+
{"version":3,"file":"FontBootstrap.js","names":["React","createContext","useEffect","useState","FontsLoadedContext","FontBootstrap","fontClassNames","children","isLoaded","setIsLoaded","initFonts","document","fonts","ready","then","visibility","position","top","map","className"],"sources":["../../src/components/FontBootstrap.tsx"],"sourcesContent":["import React, { createContext, useEffect, useState } from 'react';\nimport 'fira';\n\nexport const FontsLoadedContext = createContext<boolean>(false);\n\nexport type FontBootstrapProps = {\n /**\n * Class names of the font elements to pre load\n */\n fontClassNames?: string[];\n\n /**\n * The children to render wrapped with the FontsLoadedContext.\n * Note that it renders the children even if the fonts aren't loaded yet.\n */\n children: React.ReactNode;\n};\n\n/**\n * FontBootstrap component. Handles preloading fonts.\n */\nexport function FontBootstrap({\n fontClassNames = ['fira-sans-regular', 'fira-sans-bold', 'fira-mono'],\n children,\n}: FontBootstrapProps) {\n const [isLoaded, setIsLoaded] = useState(false);\n useEffect(function initFonts() {\n document.fonts.ready.then(() => {\n setIsLoaded(true);\n });\n }, []);\n\n return (\n <>\n <FontsLoadedContext.Provider value={isLoaded}>\n {children}\n </FontsLoadedContext.Provider>\n {/*\n Need to preload any monaco and Deephaven grid fonts.\n We hide text with all the fonts we need on the root app.jsx page\n Load the Fira Mono font so that Monaco calculates word wrapping properly.\n This element doesn't need to be visible, just load the font and stay hidden.\n https://github.com/microsoft/vscode/issues/88689\n Can be replaced with a rel=\"preload\" when firefox adds support\n https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content\n */}\n <div\n id=\"preload-fonts\"\n style={{ visibility: 'hidden', position: 'absolute', top: -10000 }}\n >\n {/* trigger loading of fonts needed by monaco and iris grid */}\n {fontClassNames.map(className => (\n <p key={className} className={className}>\n preload\n </p>\n ))}\n </div>\n </>\n );\n}\n\nexport default FontBootstrap;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACjE,OAAO,MAAM;AAEb,OAAO,IAAMC,kBAAkB,gBAAGH,aAAa,CAAU,KAAK,CAAC;AAe/D;AACA;AACA;AACA,OAAO,SAASI,aAAa,OAGN;EAAA,IAHO;IAC5BC,cAAc,GAAG,CAAC,mBAAmB,EAAE,gBAAgB,EAAE,WAAW,CAAC;IACrEC;EACkB,CAAC;EACnB,IAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGN,QAAQ,CAAC,KAAK,CAAC;EAC/CD,SAAS,CAAC,SAASQ,SAAS,GAAG;IAC7BC,QAAQ,CAACC,KAAK,CAACC,KAAK,CAACC,IAAI,CAAC,MAAM;MAC9BL,WAAW,CAAC,IAAI,CAAC;IACnB,CAAC,CAAC;EACJ,CAAC,EAAE,EAAE,CAAC;EAEN,oBACE,uDACE,oBAAC,kBAAkB,CAAC,QAAQ;IAAC,KAAK,EAAED;EAAS,GAC1CD,QAAQ,CACmB,eAU9B;IACE,EAAE,EAAC,eAAe;IAClB,KAAK,EAAE;MAAEQ,UAAU,EAAE,QAAQ;MAAEC,QAAQ,EAAE,UAAU;MAAEC,GAAG,EAAE,CAAC;IAAM;EAAE,GAGlEX,cAAc,CAACY,GAAG,CAACC,SAAS,iBAC3B;IAAG,GAAG,EAAEA,SAAU;IAAC,SAAS,EAAEA;EAAU,GAAC,SAEzC,CACD,CAAC,CACE,CACL;AAEP;AAEA,eAAed,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FontsLoaded.js","names":["React","useContext","LoadingOverlay","FontsLoadedContext","FontsLoaded","
|
|
1
|
+
{"version":3,"file":"FontsLoaded.js","names":["React","useContext","LoadingOverlay","FontsLoadedContext","FontsLoaded","children","isFontsLoaded"],"sources":["../../src/components/FontsLoaded.tsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport { LoadingOverlay } from '@deephaven/components';\nimport { FontsLoadedContext } from './FontBootstrap';\n\nexport type FontsLoadedProps = {\n /** Children to show when the fonts have completed loading */\n children: React.ReactNode;\n};\n\nexport function FontsLoaded({ children }: FontsLoadedProps) {\n const isFontsLoaded = useContext(FontsLoadedContext);\n\n if (!isFontsLoaded) {\n return <LoadingOverlay data-testid=\"fonts-loaded-loading\" />;\n }\n\n // eslint-disable-next-line react/jsx-no-useless-fragment\n return <>{children}</>;\n}\n\nexport default FontsLoaded;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,cAAc,QAAQ,uBAAuB;AAAC,SAC9CC,kBAAkB;AAO3B,OAAO,SAASC,WAAW,OAAiC;EAAA,IAAhC;IAAEC;EAA2B,CAAC;EACxD,IAAMC,aAAa,GAAGL,UAAU,CAACE,kBAAkB,CAAC;EAEpD,IAAI,CAACG,aAAa,EAAE;IAClB,oBAAO,oBAAC,cAAc;MAAC,eAAY;IAAsB,EAAG;EAC9D;;EAEA;EACA,oBAAO,0CAAGD,QAAQ,CAAI;AACxB;AAEA,eAAeD,WAAW"}
|
|
@@ -1 +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,
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginsBootstrap.js","names":["React","createContext","useEffect","useState","loadModulePlugins","PluginsContext","PluginsBootstrap","
|
|
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 +1 @@
|
|
|
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,
|
|
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.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,
|
|
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"}
|
|
@@ -10,6 +10,7 @@ var log = Log.module('@deephaven/app-utils.PluginUtils');
|
|
|
10
10
|
|
|
11
11
|
// A PluginModule. This interface should have new fields added to it from different levels of plugins.
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
13
|
+
|
|
13
14
|
/**
|
|
14
15
|
* Load a component plugin from the server.
|
|
15
16
|
* @param baseURL Base URL of the plugin server
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginUtils.js","names":["React","isAuthPlugin","Log","RemoteComponent","loadRemoteModule","log","module","loadComponentPlugin","baseURL","pluginName","pluginUrl","URL","concat","Plugin","forwardRef","props","ref","createElement","url","href","render","_ref","err","Component","errorMessage","error","className","_extends","displayName","loadModulePlugin","_x","_loadModulePlugin","apply","arguments","_asyncToGenerator","myModule","loadJson","_x2","_loadJson","jsonUrl","res","fetch","ok","Error","statusText","json","_unused","loadModulePlugins","_x3","_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","_authConfigValues$get","_authConfigValues$get2","get","split","getAuthPluginComponent","corePlugins","authHandlers","authPlugins","entries","filter","_ref2","plugin","AuthPlugin","map","_ref3","availableAuthPlugins","_ref4","authPlugin","isAvailable","warn","_ref5","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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AAU,CAAC,GAAAD,KAAA;IAAA,OACjEC,UAAU,CAACC,WAAW,CAACZ,YAAY,EAAEP,gBAAgB,CAAC;EAAA,CACxD,CAAC;EAED,IAAIgB,oBAAoB,CAACjC,MAAM,KAAK,CAAC,EAAE;IACrC,MAAM,IAAIf,KAAK,8EAAA/B,MAAA,CACgEsE,YAAY,CAC3F,CAAC;EACH,CAAC,MAAM,IAAIS,oBAAoB,CAACjC,MAAM,GAAG,CAAC,EAAE;IAC1CrD,GAAG,CAAC0F,IAAI,CACN,gEAAgE,EAChEJ,oBAAoB,CAACF,GAAG,CAACO,KAAA;MAAA,IAAC,CAACrC,IAAI,CAAC,GAAAqC,KAAA;MAAA,OAAKrC,IAAI;IAAA,EAAC,CAACsC,IAAI,CAAC,IAAI,CACtD,CAAC;EACH;EAEA,IAAM,CAACC,eAAe,EAAEC,cAAc,CAAC,GAAGR,oBAAoB,CAAC,CAAC,CAAC;EACjEtF,GAAG,CAACmE,IAAI,CAAC,mBAAmB,EAAE0B,eAAe,CAAC;EAE9C,OAAOC,cAAc,CAAC5E,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,EA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YAAY,EAAEL,gBAAgB,CAAC;EAAA,EACvD;EAED,IAAIY,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectUtils.js","names":["getBaseUrl","apiUrl","URL","
|
|
1
|
+
{"version":3,"file":"ConnectUtils.js","names":["getBaseUrl","apiUrl","URL","window","location","getEnvoyPrefix","searchParams","URLSearchParams","search","get","getConnectOptions","envoyPrefix","headers"],"sources":["../../src/utils/ConnectUtils.ts"],"sourcesContent":["import { ConnectOptions } from '@deephaven/jsapi-types';\n\n/**\n * Get the base URL of the API\n * @param apiUrl API URL\n * @returns URL for the base of the API\n */\nexport function getBaseUrl(apiUrl: string): URL {\n return new URL(apiUrl, `${window.location}`);\n}\n\n/**\n * Get the Envoy prefix header value\n * @returns Envoy prefix header value\n */\nexport function getEnvoyPrefix(): string | null {\n const searchParams = new URLSearchParams(window.location.search);\n return searchParams.get('envoyPrefix');\n}\n\nexport function getConnectOptions(): ConnectOptions {\n const envoyPrefix = getEnvoyPrefix();\n return envoyPrefix != null\n ? { headers: { 'envoy-prefix': envoyPrefix } }\n : { headers: {} };\n}\n"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,UAAU,CAACC,MAAc,EAAO;EAC9C,OAAO,IAAIC,GAAG,CAACD,MAAM,YAAKE,MAAM,CAACC,QAAQ,EAAG;AAC9C;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAc,GAAkB;EAC9C,IAAMC,YAAY,GAAG,IAAIC,eAAe,CAACJ,MAAM,CAACC,QAAQ,CAACI,MAAM,CAAC;EAChE,OAAOF,YAAY,CAACG,GAAG,CAAC,aAAa,CAAC;AACxC;AAEA,OAAO,SAASC,iBAAiB,GAAmB;EAClD,IAAMC,WAAW,GAAGN,cAAc,EAAE;EACpC,OAAOM,WAAW,IAAI,IAAI,GACtB;IAAEC,OAAO,EAAE;MAAE,cAAc,EAAED;IAAY;EAAE,CAAC,GAC5C;IAAEC,OAAO,EAAE,CAAC;EAAE,CAAC;AACrB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deephaven/app-utils",
|
|
3
|
-
"version": "0.37.4-logout.
|
|
3
|
+
"version": "0.37.4-logout.21+ae439be8",
|
|
4
4
|
"description": "Deephaven App Utils",
|
|
5
5
|
"author": "Deephaven Data Labs LLC",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"redux": "^4.x"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@deephaven/auth-plugins": "^0.37.4-logout.
|
|
32
|
-
"@deephaven/components": "^0.37.4-logout.
|
|
33
|
-
"@deephaven/jsapi-bootstrap": "^0.37.4-logout.
|
|
34
|
-
"@deephaven/jsapi-components": "^0.37.4-logout.
|
|
35
|
-
"@deephaven/jsapi-types": "^0.37.4-logout.
|
|
36
|
-
"@deephaven/jsapi-utils": "^0.37.4-logout.
|
|
37
|
-
"@deephaven/log": "^0.37.4-logout.
|
|
38
|
-
"@deephaven/react-hooks": "^0.37.4-logout.
|
|
31
|
+
"@deephaven/auth-plugins": "^0.37.4-logout.21+ae439be8",
|
|
32
|
+
"@deephaven/components": "^0.37.4-logout.21+ae439be8",
|
|
33
|
+
"@deephaven/jsapi-bootstrap": "^0.37.4-logout.21+ae439be8",
|
|
34
|
+
"@deephaven/jsapi-components": "^0.37.4-logout.21+ae439be8",
|
|
35
|
+
"@deephaven/jsapi-types": "^0.37.4-logout.21+ae439be8",
|
|
36
|
+
"@deephaven/jsapi-utils": "^0.37.4-logout.21+ae439be8",
|
|
37
|
+
"@deephaven/log": "^0.37.4-logout.21+ae439be8",
|
|
38
|
+
"@deephaven/react-hooks": "^0.37.4-logout.21+ae439be8",
|
|
39
39
|
"@paciolan/remote-component": "2.13.0",
|
|
40
40
|
"@paciolan/remote-module-loader": "^3.0.2",
|
|
41
41
|
"fira": "mozilla/fira#4.202"
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "ae439be89da6d61abc3e6f86ec734ddda74e67e3"
|
|
59
59
|
}
|