@deephaven/app-utils 0.33.1-auth-plugins.25
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/LICENSE +176 -0
- package/README.md +9 -0
- package/dist/components/AppBootstrap.d.ts +21 -0
- package/dist/components/AppBootstrap.d.ts.map +1 -0
- package/dist/components/AppBootstrap.js +33 -0
- package/dist/components/AppBootstrap.js.map +1 -0
- package/dist/components/AuthBootstrap.d.ts +13 -0
- package/dist/components/AuthBootstrap.d.ts.map +1 -0
- package/dist/components/AuthBootstrap.js +82 -0
- package/dist/components/AuthBootstrap.js.map +1 -0
- package/dist/components/ClientBootstrap.d.ts +20 -0
- package/dist/components/ClientBootstrap.d.ts.map +1 -0
- package/dist/components/ClientBootstrap.js +30 -0
- package/dist/components/ClientBootstrap.js.map +1 -0
- package/dist/components/ConnectionBootstrap.d.ts +16 -0
- package/dist/components/ConnectionBootstrap.d.ts.map +1 -0
- package/dist/components/ConnectionBootstrap.js +71 -0
- package/dist/components/ConnectionBootstrap.js.map +1 -0
- package/dist/components/FontBootstrap.d.ts +20 -0
- package/dist/components/FontBootstrap.d.ts.map +1 -0
- package/dist/components/FontBootstrap.js +33 -0
- package/dist/components/FontBootstrap.js.map +1 -0
- package/dist/components/FontsLoaded.d.ts +8 -0
- package/dist/components/FontsLoaded.d.ts.map +1 -0
- package/dist/components/FontsLoaded.js +17 -0
- package/dist/components/FontsLoaded.js.map +1 -0
- package/dist/components/PluginsBootstrap.d.ts +20 -0
- package/dist/components/PluginsBootstrap.d.ts.map +1 -0
- package/dist/components/PluginsBootstrap.js +39 -0
- package/dist/components/PluginsBootstrap.js.map +1 -0
- package/dist/components/index.d.ts +11 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +11 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/useClient.d.ts +3 -0
- package/dist/components/useClient.d.ts.map +1 -0
- package/dist/components/useClient.js +11 -0
- package/dist/components/useClient.js.map +1 -0
- package/dist/components/useConnection.d.ts +3 -0
- package/dist/components/useConnection.d.ts.map +1 -0
- package/dist/components/useConnection.js +11 -0
- package/dist/components/useConnection.js.map +1 -0
- package/dist/components/usePlugins.d.ts +3 -0
- package/dist/components/usePlugins.d.ts.map +1 -0
- package/dist/components/usePlugins.js +11 -0
- package/dist/components/usePlugins.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/PluginUtils.d.ts +48 -0
- package/dist/plugins/PluginUtils.d.ts.map +1 -0
- package/dist/plugins/PluginUtils.js +184 -0
- package/dist/plugins/PluginUtils.js.map +1 -0
- package/dist/plugins/RemoteComponent.d.ts +3 -0
- package/dist/plugins/RemoteComponent.d.ts.map +1 -0
- package/dist/plugins/RemoteComponent.js +8 -0
- package/dist/plugins/RemoteComponent.js.map +1 -0
- package/dist/plugins/index.d.ts +3 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +3 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/loadRemoteModule.d.ts +5 -0
- package/dist/plugins/loadRemoteModule.d.ts.map +1 -0
- package/dist/plugins/loadRemoteModule.js +8 -0
- package/dist/plugins/loadRemoteModule.js.map +1 -0
- package/dist/plugins/remote-component.config.d.ts +16 -0
- package/dist/plugins/remote-component.config.d.ts.map +1 -0
- package/dist/plugins/remote-component.config.js +19 -0
- package/dist/plugins/remote-component.config.js.map +1 -0
- package/dist/utils/ConnectUtils.d.ts +14 -0
- package/dist/utils/ConnectUtils.d.ts.map +1 -0
- package/dist/utils/ConnectUtils.js +28 -0
- package/dist/utils/ConnectUtils.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { LoadingOverlay } from '@deephaven/components';
|
|
3
|
+
import { FontsLoadedContext } from "./FontBootstrap.js";
|
|
4
|
+
export function FontsLoaded(_ref) {
|
|
5
|
+
var {
|
|
6
|
+
children
|
|
7
|
+
} = _ref;
|
|
8
|
+
var isFontsLoaded = useContext(FontsLoadedContext);
|
|
9
|
+
if (!isFontsLoaded) {
|
|
10
|
+
return /*#__PURE__*/React.createElement(LoadingOverlay, null);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
14
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, children);
|
|
15
|
+
}
|
|
16
|
+
export default FontsLoaded;
|
|
17
|
+
//# sourceMappingURL=FontsLoaded.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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 />;\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,OAAG;EAC3B;;EAEA;EACA,oBAAO,0CAAGD,QAAQ,CAAI;AACxB;AAEA,eAAeD,WAAW"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PluginModuleMap } from '../plugins';
|
|
3
|
+
export declare const PluginsContext: React.Context<PluginModuleMap | null>;
|
|
4
|
+
export type PluginsBootstrapProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Base URL of the plugins to load.
|
|
7
|
+
*/
|
|
8
|
+
pluginsUrl: string;
|
|
9
|
+
/**
|
|
10
|
+
* The children to render wrapped with the PluginsContext.
|
|
11
|
+
* Note that it renders the children even if the plugins aren't loaded yet.
|
|
12
|
+
*/
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* PluginsBootstrap component. Handles loading the plugins.
|
|
17
|
+
*/
|
|
18
|
+
export declare function PluginsBootstrap({ pluginsUrl, children, }: PluginsBootstrapProps): JSX.Element;
|
|
19
|
+
export default PluginsBootstrap;
|
|
20
|
+
//# sourceMappingURL=PluginsBootstrap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginsBootstrap.d.ts","sourceRoot":"","sources":["../../src/components/PluginsBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,eAAe,EAAqB,MAAM,YAAY,CAAC;AAEhE,eAAO,MAAM,cAAc,uCAA8C,CAAC;AAE1E,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,UAAU,EACV,QAAQ,GACT,EAAE,qBAAqB,eAwBvB;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
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, { createContext, useEffect, useState } from 'react';
|
|
4
|
+
import { loadModulePlugins } from "../plugins/index.js";
|
|
5
|
+
export var PluginsContext = /*#__PURE__*/createContext(null);
|
|
6
|
+
/**
|
|
7
|
+
* PluginsBootstrap component. Handles loading the plugins.
|
|
8
|
+
*/
|
|
9
|
+
export function PluginsBootstrap(_ref) {
|
|
10
|
+
var {
|
|
11
|
+
pluginsUrl,
|
|
12
|
+
children
|
|
13
|
+
} = _ref;
|
|
14
|
+
var [plugins, setPlugins] = useState(null);
|
|
15
|
+
useEffect(function initPlugins() {
|
|
16
|
+
var isCancelled = false;
|
|
17
|
+
function loadPlugins() {
|
|
18
|
+
return _loadPlugins.apply(this, arguments);
|
|
19
|
+
}
|
|
20
|
+
function _loadPlugins() {
|
|
21
|
+
_loadPlugins = _asyncToGenerator(function* () {
|
|
22
|
+
var pluginModules = yield loadModulePlugins(pluginsUrl);
|
|
23
|
+
if (!isCancelled) {
|
|
24
|
+
setPlugins(pluginModules);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return _loadPlugins.apply(this, arguments);
|
|
28
|
+
}
|
|
29
|
+
loadPlugins();
|
|
30
|
+
return () => {
|
|
31
|
+
isCancelled = true;
|
|
32
|
+
};
|
|
33
|
+
}, [pluginsUrl]);
|
|
34
|
+
return /*#__PURE__*/React.createElement(PluginsContext.Provider, {
|
|
35
|
+
value: plugins
|
|
36
|
+
}, children);
|
|
37
|
+
}
|
|
38
|
+
export default PluginsBootstrap;
|
|
39
|
+
//# sourceMappingURL=PluginsBootstrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginsBootstrap.js","names":["React","createContext","useEffect","useState","loadModulePlugins","PluginsContext","PluginsBootstrap","pluginsUrl","children","plugins","setPlugins","initPlugins","isCancelled","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 isCancelled = false;\n async function loadPlugins() {\n const pluginModules = await loadModulePlugins(pluginsUrl);\n if (!isCancelled) {\n setPlugins(pluginModules);\n }\n }\n loadPlugins();\n return () => {\n isCancelled = 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,WAAW,GAAG,KAAK;IAAC,SACTC,WAAW;MAAA;IAAA;IAAA;MAAA,iCAA1B,aAA6B;QAC3B,IAAMC,aAAa,SAASV,iBAAiB,CAACG,UAAU,CAAC;QACzD,IAAI,CAACK,WAAW,EAAE;UAChBF,UAAU,CAACI,aAAa,CAAC;QAC3B;MACF,CAAC;MAAA;IAAA;IACDD,WAAW,EAAE;IACb,OAAO,MAAM;MACXD,WAAW,GAAG,IAAI;IACpB,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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './AppBootstrap';
|
|
2
|
+
export * from './AuthBootstrap';
|
|
3
|
+
export * from './ClientBootstrap';
|
|
4
|
+
export * from './ConnectionBootstrap';
|
|
5
|
+
export * from './FontBootstrap';
|
|
6
|
+
export * from './FontsLoaded';
|
|
7
|
+
export * from './PluginsBootstrap';
|
|
8
|
+
export * from './usePlugins';
|
|
9
|
+
export * from './useClient';
|
|
10
|
+
export * from './useConnection';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./AppBootstrap.js";
|
|
2
|
+
export * from "./AuthBootstrap.js";
|
|
3
|
+
export * from "./ClientBootstrap.js";
|
|
4
|
+
export * from "./ConnectionBootstrap.js";
|
|
5
|
+
export * from "./FontBootstrap.js";
|
|
6
|
+
export * from "./FontsLoaded.js";
|
|
7
|
+
export * from "./PluginsBootstrap.js";
|
|
8
|
+
export * from "./usePlugins.js";
|
|
9
|
+
export * from "./useClient.js";
|
|
10
|
+
export * from "./useConnection.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/components/index.ts"],"sourcesContent":["export * from './AppBootstrap';\nexport * from './AuthBootstrap';\nexport * from './ClientBootstrap';\nexport * from './ConnectionBootstrap';\nexport * from './FontBootstrap';\nexport * from './FontsLoaded';\nexport * from './PluginsBootstrap';\nexport * from './usePlugins';\nexport * from './useClient';\nexport * from './useConnection';\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useClient.d.ts","sourceRoot":"","sources":["../../src/components/useClient.ts"],"names":[],"mappings":"AAGA,wBAAgB,SAAS,gDAQxB;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConnection.d.ts","sourceRoot":"","sources":["../../src/components/useConnection.ts"],"names":[],"mappings":"AAGA,wBAAgB,aAAa,mDAQ5B;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { ConnectionContext } from "./ConnectionBootstrap.js";
|
|
3
|
+
export function useConnection() {
|
|
4
|
+
var connection = useContext(ConnectionContext);
|
|
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;
|
|
9
|
+
}
|
|
10
|
+
export default useConnection;
|
|
11
|
+
//# sourceMappingURL=useConnection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConnection.js","names":["useContext","ConnectionContext","useConnection","connection","Error"],"sources":["../../src/components/useConnection.ts"],"sourcesContent":["import { useContext } from 'react';\nimport { ConnectionContext } from './ConnectionBootstrap';\n\nexport function useConnection() {\n const connection = useContext(ConnectionContext);\n if (connection == null) {\n throw new Error(\n 'No IdeConnection available in useConnection. Was code wrapped in ConnectionBootstrap or ConnectionContext.Provider?'\n );\n }\n return connection;\n}\n\nexport default useConnection;\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,OAAO;AAAC,SAC1BC,iBAAiB;AAE1B,OAAO,SAASC,aAAa,GAAG;EAC9B,IAAMC,UAAU,GAAGH,UAAU,CAACC,iBAAiB,CAAC;EAChD,IAAIE,UAAU,IAAI,IAAI,EAAE;IACtB,MAAM,IAAIC,KAAK,CACb,qHAAqH,CACtH;EACH;EACA,OAAOD,UAAU;AACnB;AAEA,eAAeD,aAAa"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePlugins.d.ts","sourceRoot":"","sources":["../../src/components/usePlugins.ts"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,iCAQzB;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { PluginsContext } from "./PluginsBootstrap.js";
|
|
3
|
+
export function usePlugins() {
|
|
4
|
+
var plugins = useContext(PluginsContext);
|
|
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;
|
|
9
|
+
}
|
|
10
|
+
export default usePlugins;
|
|
11
|
+
//# sourceMappingURL=usePlugins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePlugins.js","names":["useContext","PluginsContext","usePlugins","plugins","Error"],"sources":["../../src/components/usePlugins.ts"],"sourcesContent":["import { useContext } from 'react';\nimport { PluginsContext } from './PluginsBootstrap';\n\nexport function usePlugins() {\n const plugins = useContext(PluginsContext);\n if (plugins == null) {\n throw new Error(\n 'No Plugins available in usePlugins. Was code wrapped in PluginsBootstrap or PluginsContext.Provider?'\n );\n }\n return plugins;\n}\n\nexport default usePlugins;\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,OAAO;AAAC,SAC1BC,cAAc;AAEvB,OAAO,SAASC,UAAU,GAAG;EAC3B,IAAMC,OAAO,GAAGH,UAAU,CAACC,cAAc,CAAC;EAC1C,IAAIE,OAAO,IAAI,IAAI,EAAE;IACnB,MAAM,IAAIC,KAAK,CACb,sGAAsG,CACvG;EACH;EACA,OAAOD,OAAO;AAChB;AAEA,eAAeD,UAAU"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["export * from './components';\nexport * from './plugins';\nexport * from './utils';\n"],"mappings":""}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, { ForwardRefExoticComponent } from 'react';
|
|
2
|
+
import { AuthPlugin, AuthPluginComponent } from '@deephaven/auth-plugins';
|
|
3
|
+
import { CoreClient } from '@deephaven/jsapi-types';
|
|
4
|
+
export interface PluginModule {
|
|
5
|
+
}
|
|
6
|
+
export type PluginModuleMap = Map<string, PluginModule>;
|
|
7
|
+
/**
|
|
8
|
+
* Load a component plugin from the server.
|
|
9
|
+
* @param baseURL Base URL of the plugin server
|
|
10
|
+
* @param pluginName Name of the component plugin to load
|
|
11
|
+
* @returns A lazily loaded JSX.Element from the plugin
|
|
12
|
+
*/
|
|
13
|
+
export declare function loadComponentPlugin(baseURL: URL, pluginName: string): ForwardRefExoticComponent<React.RefAttributes<unknown>>;
|
|
14
|
+
/**
|
|
15
|
+
* Imports a commonjs plugin module from the provided URL
|
|
16
|
+
* @param pluginUrl The URL of the plugin to load
|
|
17
|
+
* @returns The loaded module
|
|
18
|
+
*/
|
|
19
|
+
export declare function loadModulePlugin(pluginUrl: string): Promise<unknown>;
|
|
20
|
+
/**
|
|
21
|
+
* Loads a JSON file and returns the JSON object
|
|
22
|
+
* @param jsonUrl The URL of the JSON file to load
|
|
23
|
+
* @returns The JSON object of the manifest file
|
|
24
|
+
*/
|
|
25
|
+
export declare function loadJson(jsonUrl: string): Promise<{
|
|
26
|
+
plugins: {
|
|
27
|
+
name: string;
|
|
28
|
+
main: string;
|
|
29
|
+
}[];
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Load all plugin modules available.
|
|
33
|
+
* @param modulePluginsUrl The base URL of the module plugins to load
|
|
34
|
+
* @returns A map from the name of the plugin to the plugin module that was loaded
|
|
35
|
+
*/
|
|
36
|
+
export declare function loadModulePlugins(modulePluginsUrl: string): Promise<PluginModuleMap>;
|
|
37
|
+
export declare function getAuthHandlers(authConfigValues: Map<string, string>): string[];
|
|
38
|
+
/**
|
|
39
|
+
* Get the auth plugin component from the plugin map and current configuration
|
|
40
|
+
* Throws if no auth plugin is available
|
|
41
|
+
*
|
|
42
|
+
* @param pluginMap Map of plugins loaded from the server
|
|
43
|
+
* @param authConfigValues Auth config values from the server
|
|
44
|
+
* @param corePlugins Map of core auth plugins to include in the list. They are added after the loaded plugins
|
|
45
|
+
* @returns The auth plugin component to render
|
|
46
|
+
*/
|
|
47
|
+
export declare function getAuthPluginComponent(client: CoreClient, pluginMap: PluginModuleMap, authConfigValues: Map<string, string>, corePlugins?: Map<string, AuthPlugin>): AuthPluginComponent;
|
|
48
|
+
//# sourceMappingURL=PluginUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginUtils.d.ts","sourceRoot":"","sources":["../../src/plugins/PluginUtils.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,yBAAyB,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EACL,UAAU,EACV,mBAAmB,EAEpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AASpD,MAAM,WAAW,YAAY;CAAG;AAEhC,MAAM,MAAM,eAAe,GAAG,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAExD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,GAAG,EACZ,UAAU,EAAE,MAAM,GACjB,yBAAyB,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAqBzD;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAG1E;AAED;;;;GAIG;AACH,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC;IAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,CAAC,CAUxD;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,eAAe,CAAC,CAmC1B;AAED,wBAAgB,eAAe,CAC7B,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACpC,MAAM,EAAE,CAEV;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,eAAe,EAC1B,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACrC,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,GACpC,mBAAmB,CAqCrB"}
|
|
@@ -0,0 +1,184 @@
|
|
|
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
|
+
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
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { isAuthPlugin } from '@deephaven/auth-plugins';
|
|
6
|
+
import Log from '@deephaven/log';
|
|
7
|
+
import RemoteComponent from "./RemoteComponent.js";
|
|
8
|
+
import loadRemoteModule from "./loadRemoteModule.js";
|
|
9
|
+
var log = Log.module('@deephaven/app-utils.PluginUtils');
|
|
10
|
+
|
|
11
|
+
// A PluginModule. This interface should have new fields added to it from different levels of plugins.
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Load a component plugin from the server.
|
|
16
|
+
* @param baseURL Base URL of the plugin server
|
|
17
|
+
* @param pluginName Name of the component plugin to load
|
|
18
|
+
* @returns A lazily loaded JSX.Element from the plugin
|
|
19
|
+
*/
|
|
20
|
+
export function loadComponentPlugin(baseURL, pluginName) {
|
|
21
|
+
var pluginUrl = new URL("".concat(pluginName, ".js"), baseURL);
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
+
var Plugin = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(RemoteComponent, {
|
|
24
|
+
url: pluginUrl.href
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
+
,
|
|
27
|
+
render: _ref => {
|
|
28
|
+
var {
|
|
29
|
+
err,
|
|
30
|
+
Component
|
|
31
|
+
} = _ref;
|
|
32
|
+
if (err != null && err !== '') {
|
|
33
|
+
var errorMessage = "Error loading plugin ".concat(pluginName, " from ").concat(pluginUrl, " due to ").concat(err);
|
|
34
|
+
log.error(errorMessage);
|
|
35
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
36
|
+
className: "error-message"
|
|
37
|
+
}, "".concat(errorMessage));
|
|
38
|
+
}
|
|
39
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
40
|
+
return /*#__PURE__*/React.createElement(Component, _extends({
|
|
41
|
+
ref: ref
|
|
42
|
+
}, props));
|
|
43
|
+
}
|
|
44
|
+
}));
|
|
45
|
+
Plugin.pluginName = pluginName;
|
|
46
|
+
Plugin.displayName = 'Plugin';
|
|
47
|
+
return Plugin;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Imports a commonjs plugin module from the provided URL
|
|
52
|
+
* @param pluginUrl The URL of the plugin to load
|
|
53
|
+
* @returns The loaded module
|
|
54
|
+
*/
|
|
55
|
+
export function loadModulePlugin(_x) {
|
|
56
|
+
return _loadModulePlugin.apply(this, arguments);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Loads a JSON file and returns the JSON object
|
|
61
|
+
* @param jsonUrl The URL of the JSON file to load
|
|
62
|
+
* @returns The JSON object of the manifest file
|
|
63
|
+
*/
|
|
64
|
+
function _loadModulePlugin() {
|
|
65
|
+
_loadModulePlugin = _asyncToGenerator(function* (pluginUrl) {
|
|
66
|
+
var myModule = yield loadRemoteModule(pluginUrl);
|
|
67
|
+
return myModule;
|
|
68
|
+
});
|
|
69
|
+
return _loadModulePlugin.apply(this, arguments);
|
|
70
|
+
}
|
|
71
|
+
export function loadJson(_x2) {
|
|
72
|
+
return _loadJson.apply(this, arguments);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Load all plugin modules available.
|
|
77
|
+
* @param modulePluginsUrl The base URL of the module plugins to load
|
|
78
|
+
* @returns A map from the name of the plugin to the plugin module that was loaded
|
|
79
|
+
*/
|
|
80
|
+
function _loadJson() {
|
|
81
|
+
_loadJson = _asyncToGenerator(function* (jsonUrl) {
|
|
82
|
+
var res = yield fetch(jsonUrl);
|
|
83
|
+
if (!res.ok) {
|
|
84
|
+
throw new Error(res.statusText);
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
return yield res.json();
|
|
88
|
+
} catch (_unused) {
|
|
89
|
+
throw new Error('Could not be parsed as JSON');
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
return _loadJson.apply(this, arguments);
|
|
93
|
+
}
|
|
94
|
+
export function loadModulePlugins(_x3) {
|
|
95
|
+
return _loadModulePlugins.apply(this, arguments);
|
|
96
|
+
}
|
|
97
|
+
function _loadModulePlugins() {
|
|
98
|
+
_loadModulePlugins = _asyncToGenerator(function* (modulePluginsUrl) {
|
|
99
|
+
log.debug('Loading plugins...');
|
|
100
|
+
try {
|
|
101
|
+
var manifest = yield loadJson("".concat(modulePluginsUrl, "/manifest.json"));
|
|
102
|
+
if (!Array.isArray(manifest.plugins)) {
|
|
103
|
+
throw new Error('Plugin manifest JSON does not contain plugins array');
|
|
104
|
+
}
|
|
105
|
+
log.debug('Plugin manifest loaded:', manifest);
|
|
106
|
+
var pluginPromises = [];
|
|
107
|
+
for (var i = 0; i < manifest.plugins.length; i += 1) {
|
|
108
|
+
var {
|
|
109
|
+
name,
|
|
110
|
+
main
|
|
111
|
+
} = manifest.plugins[i];
|
|
112
|
+
var pluginMainUrl = "".concat(modulePluginsUrl, "/").concat(name, "/").concat(main);
|
|
113
|
+
pluginPromises.push(loadModulePlugin(pluginMainUrl));
|
|
114
|
+
}
|
|
115
|
+
var pluginModules = yield Promise.allSettled(pluginPromises);
|
|
116
|
+
var pluginMap = new Map();
|
|
117
|
+
for (var _i = 0; _i < pluginModules.length; _i += 1) {
|
|
118
|
+
var module = pluginModules[_i];
|
|
119
|
+
var {
|
|
120
|
+
name: _name
|
|
121
|
+
} = manifest.plugins[_i];
|
|
122
|
+
if (module.status === 'fulfilled') {
|
|
123
|
+
pluginMap.set(_name, module.value);
|
|
124
|
+
} else {
|
|
125
|
+
log.error("Unable to load plugin ".concat(_name), module.reason);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
log.info('Plugins loaded:', pluginMap);
|
|
129
|
+
return pluginMap;
|
|
130
|
+
} catch (e) {
|
|
131
|
+
log.error('Unable to load plugins:', e);
|
|
132
|
+
return new Map();
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
return _loadModulePlugins.apply(this, arguments);
|
|
136
|
+
}
|
|
137
|
+
export function getAuthHandlers(authConfigValues) {
|
|
138
|
+
var _authConfigValues$get, _authConfigValues$get2;
|
|
139
|
+
return (_authConfigValues$get = (_authConfigValues$get2 = authConfigValues.get('AuthHandlers')) === null || _authConfigValues$get2 === void 0 ? void 0 : _authConfigValues$get2.split(',')) !== null && _authConfigValues$get !== void 0 ? _authConfigValues$get : [];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Get the auth plugin component from the plugin map and current configuration
|
|
144
|
+
* Throws if no auth plugin is available
|
|
145
|
+
*
|
|
146
|
+
* @param pluginMap Map of plugins loaded from the server
|
|
147
|
+
* @param authConfigValues Auth config values from the server
|
|
148
|
+
* @param corePlugins Map of core auth plugins to include in the list. They are added after the loaded plugins
|
|
149
|
+
* @returns The auth plugin component to render
|
|
150
|
+
*/
|
|
151
|
+
export function getAuthPluginComponent(client, pluginMap, authConfigValues, corePlugins) {
|
|
152
|
+
var authHandlers = getAuthHandlers(authConfigValues);
|
|
153
|
+
// Filter out all the plugins that are auth plugins, and then map them to [pluginName, AuthPlugin] pairs
|
|
154
|
+
// Uses some pretty disgusting casting, because TypeScript wants to treat it as an (string | AuthPlugin)[] array instead
|
|
155
|
+
var authPlugins = [...pluginMap.entries()].filter(_ref2 => {
|
|
156
|
+
var [, plugin] = _ref2;
|
|
157
|
+
return isAuthPlugin(plugin.AuthPlugin);
|
|
158
|
+
}).map(_ref3 => {
|
|
159
|
+
var [name, plugin] = _ref3;
|
|
160
|
+
return [name, plugin.AuthPlugin];
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
// Add all the core plugins in priority
|
|
164
|
+
authPlugins.push(...(corePlugins !== null && corePlugins !== void 0 ? corePlugins : []));
|
|
165
|
+
|
|
166
|
+
// Filter the available auth plugins
|
|
167
|
+
|
|
168
|
+
var availableAuthPlugins = authPlugins.filter(_ref4 => {
|
|
169
|
+
var [name, authPlugin] = _ref4;
|
|
170
|
+
return authPlugin.isAvailable(authHandlers);
|
|
171
|
+
});
|
|
172
|
+
if (availableAuthPlugins.length === 0) {
|
|
173
|
+
throw new Error("No login plugins found, please register a login plugin for auth handlers: ".concat(authHandlers));
|
|
174
|
+
} else if (availableAuthPlugins.length > 1) {
|
|
175
|
+
log.warn('More than one login plugin available, will use the first one: ', availableAuthPlugins.map(_ref5 => {
|
|
176
|
+
var [name] = _ref5;
|
|
177
|
+
return name;
|
|
178
|
+
}).join(', '));
|
|
179
|
+
}
|
|
180
|
+
var [loginPluginName, NewLoginPlugin] = availableAuthPlugins[0];
|
|
181
|
+
log.info('Using LoginPlugin', loginPluginName);
|
|
182
|
+
return NewLoginPlugin.Component;
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=PluginUtils.js.map
|
|
@@ -0,0 +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","client","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 { CoreClient } from '@deephaven/jsapi-types';\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 client: CoreClient,\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;AAEhC,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,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B;EACAJ,WAAW,CAACpB,IAAI,CAAC,IAAIkB,WAAW,aAAXA,WAAW,cAAXA,WAAW,GAAI,EAAE,CAAC,CAAC;;EAExC;;EAEA,IAAMQ,oBAAoB,GAAGN,WAAW,CAACE,MAAM,CAAC;IAAA,IAAC,CAACzB,IAAI,EAAE8B,UAAU,CAAC;IAAA,OACjEA,UAAU,CAACC,WAAW,CAACT,YAAY,CAAC;EAAA,EACrC;EAED,IAAIO,oBAAoB,CAAC9B,MAAM,KAAK,CAAC,EAAE;IACrC,MAAM,IAAIZ,KAAK,qFACgEmC,YAAY,EAC1F;EACH,CAAC,MAAM,IAAIO,oBAAoB,CAAC9B,MAAM,GAAG,CAAC,EAAE;IAC1CpC,GAAG,CAACqE,IAAI,CACN,gEAAgE,EAChEH,oBAAoB,CAACD,GAAG,CAAC;MAAA,IAAC,CAAC5B,IAAI,CAAC;MAAA,OAAKA,IAAI;IAAA,EAAC,CAACiC,IAAI,CAAC,IAAI,CAAC,CACtD;EACH;EAEA,IAAM,CAACC,eAAe,EAAEC,cAAc,CAAC,GAAGN,oBAAoB,CAAC,CAAC,CAAC;EACjElE,GAAG,CAACkD,IAAI,CAAC,mBAAmB,EAAEqB,eAAe,CAAC;EAE9C,OAAOC,cAAc,CAAC3D,SAAS;AACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoteComponent.d.ts","sourceRoot":"","sources":["../../src/plugins/RemoteComponent.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,iFAAsC,CAAC;AACnE,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRemoteComponent, createRequires } from '@paciolan/remote-component';
|
|
2
|
+
import { resolve } from "./remote-component.config.js";
|
|
3
|
+
var requires = createRequires(() => resolve);
|
|
4
|
+
export var RemoteComponent = createRemoteComponent({
|
|
5
|
+
requires
|
|
6
|
+
});
|
|
7
|
+
export default RemoteComponent;
|
|
8
|
+
//# sourceMappingURL=RemoteComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoteComponent.js","names":["createRemoteComponent","createRequires","resolve","requires","RemoteComponent"],"sources":["../../src/plugins/RemoteComponent.ts"],"sourcesContent":["import {\n createRemoteComponent,\n createRequires,\n} from '@paciolan/remote-component';\nimport { resolve } from './remote-component.config';\n\nconst requires = createRequires(() => resolve);\n\nexport const RemoteComponent = createRemoteComponent({ requires });\nexport default RemoteComponent;\n"],"mappings":"AAAA,SACEA,qBAAqB,EACrBC,cAAc,QACT,4BAA4B;AAAC,SAC3BC,OAAO;AAEhB,IAAMC,QAAQ,GAAGF,cAAc,CAAC,MAAMC,OAAO,CAAC;AAE9C,OAAO,IAAME,eAAe,GAAGJ,qBAAqB,CAAC;EAAEG;AAAS,CAAC,CAAC;AAClE,eAAeC,eAAe"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/plugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","RemoteComponent"],"sources":["../../src/plugins/index.ts"],"sourcesContent":["export * from './PluginUtils';\nexport { default as RemoteComponent } from './RemoteComponent';\n"],"mappings":";SACSA,OAAO,IAAIC,eAAe"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadRemoteModule.d.ts","sourceRoot":"","sources":["../../src/plugins/loadRemoteModule.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB,EAAE;IAE7B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CAG5B,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import createLoadRemoteModule, { createRequires } from '@paciolan/remote-module-loader';
|
|
2
|
+
import { resolve } from "./remote-component.config.js";
|
|
3
|
+
var requires = createRequires(resolve);
|
|
4
|
+
export var loadRemoteModule = createLoadRemoteModule({
|
|
5
|
+
requires
|
|
6
|
+
});
|
|
7
|
+
export default loadRemoteModule;
|
|
8
|
+
//# sourceMappingURL=loadRemoteModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadRemoteModule.js","names":["createLoadRemoteModule","createRequires","resolve","requires","loadRemoteModule"],"sources":["../../src/plugins/loadRemoteModule.ts"],"sourcesContent":["import createLoadRemoteModule, {\n createRequires,\n} from '@paciolan/remote-module-loader';\nimport { resolve } from './remote-component.config';\n\nconst requires = createRequires(resolve);\n\nexport const loadRemoteModule: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (url: string): Promise<any>;\n} = createLoadRemoteModule({\n requires,\n});\n\nexport default loadRemoteModule;\n"],"mappings":"AAAA,OAAOA,sBAAsB,IAC3BC,cAAc,QACT,gCAAgC;AAAC,SAC/BC,OAAO;AAEhB,IAAMC,QAAQ,GAAGF,cAAc,CAACC,OAAO,CAAC;AAExC,OAAO,IAAME,gBAGZ,GAAGJ,sBAAsB,CAAC;EACzBG;AACF,CAAC,CAAC;AAEF,eAAeC,gBAAgB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* remote-component.config.js
|
|
3
|
+
*
|
|
4
|
+
* Dependencies for Remote Components
|
|
5
|
+
*/
|
|
6
|
+
import react from 'react';
|
|
7
|
+
import * as redux from 'redux';
|
|
8
|
+
import * as reactRedux from 'react-redux';
|
|
9
|
+
import ReactDOM from 'react-dom';
|
|
10
|
+
export declare const resolve: {
|
|
11
|
+
react: typeof react;
|
|
12
|
+
'react-dom': typeof ReactDOM;
|
|
13
|
+
redux: typeof redux;
|
|
14
|
+
'react-redux': typeof reactRedux;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=remote-component.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-component.config.d.ts","sourceRoot":"","sources":["../../src/plugins/remote-component.config.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,UAAU,MAAM,aAAa,CAAC;AAC1C,OAAO,QAAQ,MAAM,WAAW,CAAC;AAGjC,eAAO,MAAM,OAAO;;;;;CAKnB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* eslint-disable global-require */
|
|
2
|
+
/**
|
|
3
|
+
* remote-component.config.js
|
|
4
|
+
*
|
|
5
|
+
* Dependencies for Remote Components
|
|
6
|
+
*/
|
|
7
|
+
import react from 'react';
|
|
8
|
+
import * as redux from 'redux';
|
|
9
|
+
import * as reactRedux from 'react-redux';
|
|
10
|
+
import ReactDOM from 'react-dom';
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line import/prefer-default-export
|
|
13
|
+
export var resolve = {
|
|
14
|
+
react,
|
|
15
|
+
'react-dom': ReactDOM,
|
|
16
|
+
redux,
|
|
17
|
+
'react-redux': reactRedux
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=remote-component.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-component.config.js","names":["react","redux","reactRedux","ReactDOM","resolve"],"sources":["../../src/plugins/remote-component.config.ts"],"sourcesContent":["/* eslint-disable global-require */\n/**\n * remote-component.config.js\n *\n * Dependencies for Remote Components\n */\nimport react from 'react';\nimport * as redux from 'redux';\nimport * as reactRedux from 'react-redux';\nimport ReactDOM from 'react-dom';\n\n// eslint-disable-next-line import/prefer-default-export\nexport const resolve = {\n react,\n 'react-dom': ReactDOM,\n redux,\n 'react-redux': reactRedux,\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,OAAO,KAAKC,UAAU,MAAM,aAAa;AACzC,OAAOC,QAAQ,MAAM,WAAW;;AAEhC;AACA,OAAO,IAAMC,OAAO,GAAG;EACrBJ,KAAK;EACL,WAAW,EAAEG,QAAQ;EACrBF,KAAK;EACL,aAAa,EAAEC;AACjB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ConnectOptions } from '@deephaven/jsapi-types';
|
|
2
|
+
/**
|
|
3
|
+
* Get the base URL of the API
|
|
4
|
+
* @param apiUrl API URL
|
|
5
|
+
* @returns URL for the base of the API
|
|
6
|
+
*/
|
|
7
|
+
export declare function getBaseUrl(apiUrl: string): URL;
|
|
8
|
+
/**
|
|
9
|
+
* Get the Envoy prefix header value
|
|
10
|
+
* @returns Envoy prefix header value
|
|
11
|
+
*/
|
|
12
|
+
export declare function getEnvoyPrefix(): string | null;
|
|
13
|
+
export declare function getConnectOptions(): ConnectOptions;
|
|
14
|
+
//# sourceMappingURL=ConnectUtils.d.ts.map
|