@deephaven/app-utils 0.80.1 → 0.80.2-alpha-radio-props.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionBootstrap.d.ts","sourceRoot":"","sources":["../../src/components/ConnectionBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ConnectionBootstrap.d.ts","sourceRoot":"","sources":["../../src/components/ConnectionBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAiBzE,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;OAGG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,GACT,EAAE,wBAAwB,GAAG,GAAG,CAAC,OAAO,CA+FxC;AAED,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
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, { useCallback, useEffect, useState } from 'react';
|
|
3
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4
4
|
import { LoadingOverlay } from '@deephaven/components';
|
|
5
|
-
import { ObjectFetcherContext, sanitizeVariableDescriptor, useApi, useClient } from '@deephaven/jsapi-bootstrap';
|
|
5
|
+
import { ObjectFetcherContext, ObjectFetchManagerContext, sanitizeVariableDescriptor, useApi, useClient } from '@deephaven/jsapi-bootstrap';
|
|
6
6
|
import Log from '@deephaven/log';
|
|
7
7
|
import { assertNotNull } from '@deephaven/utils';
|
|
8
8
|
import ConnectionContext from "./ConnectionContext.js";
|
|
@@ -67,6 +67,21 @@ export function ConnectionBootstrap(_ref) {
|
|
|
67
67
|
return _ref2.apply(this, arguments);
|
|
68
68
|
};
|
|
69
69
|
}(), [connection]);
|
|
70
|
+
|
|
71
|
+
/** We don't really need to do anything fancy in Core to manage an object, just fetch it */
|
|
72
|
+
var objectManager = useMemo(() => ({
|
|
73
|
+
subscribe: (descriptor, onUpdate) => {
|
|
74
|
+
// We send an update with the fetch right away
|
|
75
|
+
onUpdate({
|
|
76
|
+
fetch: () => objectFetcher(descriptor),
|
|
77
|
+
status: 'ready'
|
|
78
|
+
});
|
|
79
|
+
return () => {
|
|
80
|
+
// no-op
|
|
81
|
+
// For Core, if the server dies then we can't reconnect anyway, so no need to bother listening for subscription or cleaning up
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}), [objectFetcher]);
|
|
70
85
|
if (connection == null || error != null) {
|
|
71
86
|
return /*#__PURE__*/_jsx(LoadingOverlay, {
|
|
72
87
|
"data-testid": "connection-bootstrap-loading",
|
|
@@ -78,7 +93,10 @@ export function ConnectionBootstrap(_ref) {
|
|
|
78
93
|
value: connection,
|
|
79
94
|
children: /*#__PURE__*/_jsx(ObjectFetcherContext.Provider, {
|
|
80
95
|
value: objectFetcher,
|
|
81
|
-
children:
|
|
96
|
+
children: /*#__PURE__*/_jsx(ObjectFetchManagerContext.Provider, {
|
|
97
|
+
value: objectManager,
|
|
98
|
+
children: children
|
|
99
|
+
})
|
|
82
100
|
})
|
|
83
101
|
});
|
|
84
102
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionBootstrap.js","names":["React","useCallback","useEffect","useState","LoadingOverlay","ObjectFetcherContext","sanitizeVariableDescriptor","useApi","useClient","Log","assertNotNull","ConnectionContext","jsx","_jsx","log","module","ConnectionBootstrap","_ref","children","api","client","error","setError","connection","setConnection","initConnection","isCanceled","loadConnection","_loadConnection","apply","arguments","_asyncToGenerator","newConnection","getAsIdeConnection","e","listenForShutdown","handleShutdown","event","detail","info","concat","JSON","stringify","removerFn","addEventListener","IdeConnection","EVENT_SHUTDOWN","objectFetcher","_ref2","descriptor","getObject","_x","isLoading","errorMessage","undefined","Provider","value"],"sources":["../../src/components/ConnectionBootstrap.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useState } from 'react';\nimport { LoadingOverlay } from '@deephaven/components';\nimport {\n ObjectFetcherContext,\n sanitizeVariableDescriptor,\n useApi,\n useClient,\n} from '@deephaven/jsapi-bootstrap';\nimport type { dh } from '@deephaven/jsapi-types';\nimport Log from '@deephaven/log';\nimport { assertNotNull } from '@deephaven/utils';\nimport ConnectionContext from './ConnectionContext';\n\nconst log = Log.module('@deephaven/app-utils.ConnectionBootstrap');\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({\n children,\n}: ConnectionBootstrapProps): JSX.Element {\n const api = useApi();\n const client = useClient();\n const [error, setError] = useState<unknown>();\n const [connection, setConnection] = useState<dh.IdeConnection>();\n useEffect(\n function initConnection() {\n let isCanceled = false;\n async function loadConnection(): Promise<void> {\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): void {\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 const objectFetcher = useCallback(\n async (descriptor: dh.ide.VariableDescriptor) => {\n assertNotNull(connection, 'No connection available to fetch object with');\n return connection.getObject(sanitizeVariableDescriptor(descriptor));\n },\n [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 <ObjectFetcherContext.Provider value={objectFetcher}>\n {children}\n </ObjectFetcherContext.Provider>\n </ConnectionContext.Provider>\n );\n}\n\nexport default ConnectionBootstrap;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;
|
|
1
|
+
{"version":3,"file":"ConnectionBootstrap.js","names":["React","useCallback","useEffect","useMemo","useState","LoadingOverlay","ObjectFetcherContext","ObjectFetchManagerContext","sanitizeVariableDescriptor","useApi","useClient","Log","assertNotNull","ConnectionContext","jsx","_jsx","log","module","ConnectionBootstrap","_ref","children","api","client","error","setError","connection","setConnection","initConnection","isCanceled","loadConnection","_loadConnection","apply","arguments","_asyncToGenerator","newConnection","getAsIdeConnection","e","listenForShutdown","handleShutdown","event","detail","info","concat","JSON","stringify","removerFn","addEventListener","IdeConnection","EVENT_SHUTDOWN","objectFetcher","_ref2","descriptor","getObject","_x","objectManager","subscribe","onUpdate","fetch","status","isLoading","errorMessage","undefined","Provider","value"],"sources":["../../src/components/ConnectionBootstrap.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport { LoadingOverlay } from '@deephaven/components';\nimport {\n ObjectFetcherContext,\n ObjectFetchManager,\n ObjectFetchManagerContext,\n sanitizeVariableDescriptor,\n useApi,\n useClient,\n} from '@deephaven/jsapi-bootstrap';\nimport type { dh } from '@deephaven/jsapi-types';\nimport Log from '@deephaven/log';\nimport { assertNotNull } from '@deephaven/utils';\nimport ConnectionContext from './ConnectionContext';\n\nconst log = Log.module('@deephaven/app-utils.ConnectionBootstrap');\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({\n children,\n}: ConnectionBootstrapProps): JSX.Element {\n const api = useApi();\n const client = useClient();\n const [error, setError] = useState<unknown>();\n const [connection, setConnection] = useState<dh.IdeConnection>();\n\n useEffect(\n function initConnection() {\n let isCanceled = false;\n async function loadConnection(): Promise<void> {\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): void {\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 const objectFetcher = useCallback(\n async (descriptor: dh.ide.VariableDescriptor) => {\n assertNotNull(connection, 'No connection available to fetch object with');\n return connection.getObject(sanitizeVariableDescriptor(descriptor));\n },\n [connection]\n );\n\n /** We don't really need to do anything fancy in Core to manage an object, just fetch it */\n const objectManager: ObjectFetchManager = useMemo(\n () => ({\n subscribe: (descriptor, onUpdate) => {\n // We send an update with the fetch right away\n onUpdate({\n fetch: () => objectFetcher(descriptor),\n status: 'ready',\n });\n return () => {\n // no-op\n // For Core, if the server dies then we can't reconnect anyway, so no need to bother listening for subscription or cleaning up\n };\n },\n }),\n [objectFetcher]\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 <ObjectFetcherContext.Provider value={objectFetcher}>\n <ObjectFetchManagerContext.Provider value={objectManager}>\n {children}\n </ObjectFetchManagerContext.Provider>\n </ObjectFetcherContext.Provider>\n </ConnectionContext.Provider>\n );\n}\n\nexport default ConnectionBootstrap;\n"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACxE,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SACEC,oBAAoB,EAEpBC,yBAAyB,EACzBC,0BAA0B,EAC1BC,MAAM,EACNC,SAAS,QACJ,4BAA4B;AAEnC,OAAOC,GAAG,MAAM,gBAAgB;AAChC,SAASC,aAAa,QAAQ,kBAAkB;AAAC,OAC1CC,iBAAiB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAExB,IAAMC,GAAG,GAAGL,GAAG,CAACM,MAAM,CAAC,0CAA0C,CAAC;AAUlE;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAAAC,IAAA,EAEO;EAAA,IAFN;IAClCC;EACwB,CAAC,GAAAD,IAAA;EACzB,IAAME,GAAG,GAAGZ,MAAM,CAAC,CAAC;EACpB,IAAMa,MAAM,GAAGZ,SAAS,CAAC,CAAC;EAC1B,IAAM,CAACa,KAAK,EAAEC,QAAQ,CAAC,GAAGpB,QAAQ,CAAU,CAAC;EAC7C,IAAM,CAACqB,UAAU,EAAEC,aAAa,CAAC,GAAGtB,QAAQ,CAAmB,CAAC;EAEhEF,SAAS,CACP,SAASyB,cAAcA,CAAA,EAAG;IACxB,IAAIC,UAAU,GAAG,KAAK;IAAC,SACRC,cAAcA,CAAA;MAAA,OAAAC,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|
|
3
|
+
"version": "0.80.2-alpha-radio-props.1+450a7e36",
|
|
4
4
|
"description": "Deephaven App Utils",
|
|
5
5
|
"author": "Deephaven Data Labs LLC",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,24 +29,24 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@adobe/react-spectrum": "3.33.1",
|
|
32
|
-
"@deephaven/auth-plugins": "^0.80.1",
|
|
33
|
-
"@deephaven/chart": "^0.80.1",
|
|
34
|
-
"@deephaven/components": "^0.80.1",
|
|
35
|
-
"@deephaven/console": "^0.80.1",
|
|
36
|
-
"@deephaven/dashboard": "^0.80.1",
|
|
37
|
-
"@deephaven/dashboard-core-plugins": "^0.80.1",
|
|
38
|
-
"@deephaven/golden-layout": "^0.80.1",
|
|
39
|
-
"@deephaven/icons": "^0.80.
|
|
40
|
-
"@deephaven/iris-grid": "^0.80.1",
|
|
41
|
-
"@deephaven/jsapi-bootstrap": "^0.80.1",
|
|
42
|
-
"@deephaven/jsapi-components": "^0.80.1",
|
|
32
|
+
"@deephaven/auth-plugins": "^0.80.2-alpha-radio-props.1+450a7e36",
|
|
33
|
+
"@deephaven/chart": "^0.80.2-alpha-radio-props.1+450a7e36",
|
|
34
|
+
"@deephaven/components": "^0.80.2-alpha-radio-props.1+450a7e36",
|
|
35
|
+
"@deephaven/console": "^0.80.2-alpha-radio-props.1+450a7e36",
|
|
36
|
+
"@deephaven/dashboard": "^0.80.2-alpha-radio-props.1+450a7e36",
|
|
37
|
+
"@deephaven/dashboard-core-plugins": "^0.80.2-alpha-radio-props.1+450a7e36",
|
|
38
|
+
"@deephaven/golden-layout": "^0.80.2-alpha-radio-props.1+450a7e36",
|
|
39
|
+
"@deephaven/icons": "^0.80.2-alpha-radio-props.1+450a7e36",
|
|
40
|
+
"@deephaven/iris-grid": "^0.80.2-alpha-radio-props.1+450a7e36",
|
|
41
|
+
"@deephaven/jsapi-bootstrap": "^0.80.2-alpha-radio-props.1+450a7e36",
|
|
42
|
+
"@deephaven/jsapi-components": "^0.80.2-alpha-radio-props.1+450a7e36",
|
|
43
43
|
"@deephaven/jsapi-types": "1.0.0-dev0.34.0",
|
|
44
|
-
"@deephaven/jsapi-utils": "^0.80.
|
|
45
|
-
"@deephaven/log": "^0.80.
|
|
46
|
-
"@deephaven/plugin": "^0.80.1",
|
|
47
|
-
"@deephaven/react-hooks": "^0.80.
|
|
48
|
-
"@deephaven/redux": "^0.80.1",
|
|
49
|
-
"@deephaven/utils": "^0.80.
|
|
44
|
+
"@deephaven/jsapi-utils": "^0.80.2-alpha-radio-props.1+450a7e36",
|
|
45
|
+
"@deephaven/log": "^0.80.2-alpha-radio-props.1+450a7e36",
|
|
46
|
+
"@deephaven/plugin": "^0.80.2-alpha-radio-props.1+450a7e36",
|
|
47
|
+
"@deephaven/react-hooks": "^0.80.2-alpha-radio-props.1+450a7e36",
|
|
48
|
+
"@deephaven/redux": "^0.80.2-alpha-radio-props.1+450a7e36",
|
|
49
|
+
"@deephaven/utils": "^0.80.2-alpha-radio-props.1+450a7e36",
|
|
50
50
|
"@fontsource/fira-mono": "5.0.13",
|
|
51
51
|
"@fontsource/fira-sans": "5.0.20",
|
|
52
52
|
"@paciolan/remote-component": "2.13.0",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "450a7e36aa7262b82a67ff99eb4e5c8a4d4593ee"
|
|
72
72
|
}
|