@deephaven/app-utils 1.8.1-beta.9 → 1.9.0

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.
@@ -146,7 +146,7 @@ export function ConnectionBootstrap(_ref) {
146
146
  if (isShutdown || connectionState === 'connecting' || isNotConnecting) {
147
147
  return /*#__PURE__*/_jsx(LoadingOverlay, {
148
148
  "data-testid": "connection-bootstrap-loading",
149
- isLoading: false,
149
+ isLoading: error == null,
150
150
  errorMessage: error != null ? "".concat(error) : undefined
151
151
  });
152
152
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectionBootstrap.js","names":["React","useCallback","useEffect","useMemo","useState","BasicModal","DebouncedModal","InfoModal","LoadingOverlay","LoadingSpinner","ObjectFetcherContext","ObjectFetchManagerContext","sanitizeVariableDescriptor","useApi","useClient","Log","assertNotNull","vsDebugDisconnect","ConnectionContext","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","log","module","ConnectionBootstrap","_ref","children","api","client","error","setError","connection","setConnection","connectionState","setConnectionState","isAuthFailed","isShutdown","isReconnecting","isNotConnecting","initConnection","isCanceled","loadConnection","_loadConnection","apply","arguments","_asyncToGenerator","newConnection","getAsIdeConnection","e","listenForDisconnect","handleDisconnect","event","detail","info","concat","JSON","stringify","removerFn","addEventListener","IdeConnection","EVENT_DISCONNECT","listenForReconnect","handleReconnect","CoreClient","EVENT_RECONNECT","listenForShutdown","handleShutdown","EVENT_SHUTDOWN","listenForAuthFailed","handleAuthFailed","warn","EVENT_RECONNECT_AUTH_FAILED","objectFetcher","_ref2","descriptor","Error","getObject","_x","objectManager","subscribe","onUpdate","fetch","status","handleRefresh","window","location","reload","isLoading","errorMessage","undefined","Provider","value","isOpen","debounceMs","icon","title","subtitle","confirmButtonText","onConfirm","headerText","bodyText"],"sources":["../../src/components/ConnectionBootstrap.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport {\n BasicModal,\n DebouncedModal,\n InfoModal,\n LoadingOverlay,\n LoadingSpinner,\n} from '@deephaven/components';\nimport {\n ObjectFetcherContext,\n type ObjectFetchManager,\n ObjectFetchManagerContext,\n sanitizeVariableDescriptor,\n type UriVariableDescriptor,\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 { vsDebugDisconnect } from '@deephaven/icons';\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 const [connectionState, setConnectionState] = useState<\n | 'not_connecting'\n | 'connecting'\n | 'connected'\n | 'reconnecting'\n | 'failed'\n | 'shutdown'\n >('connecting');\n const isAuthFailed = connectionState === 'failed';\n const isShutdown = connectionState === 'shutdown';\n const isReconnecting = connectionState === 'reconnecting';\n const isNotConnecting = connectionState === 'not_connecting';\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 setConnectionState('connected');\n } catch (e) {\n if (isCanceled) {\n return;\n }\n setError(e);\n setConnectionState('not_connecting');\n }\n }\n loadConnection();\n return () => {\n isCanceled = true;\n };\n },\n [api, client]\n );\n\n useEffect(\n function listenForDisconnect() {\n if (connection == null || isShutdown) return;\n\n // handles the disconnect event\n function handleDisconnect(event: dh.Event<unknown>): void {\n const { detail } = event;\n log.info('Disconnect', `${JSON.stringify(detail)}`);\n setConnectionState('reconnecting');\n }\n const removerFn = connection.addEventListener(\n api.IdeConnection.EVENT_DISCONNECT,\n handleDisconnect\n );\n\n return removerFn;\n },\n [api, connection, isShutdown]\n );\n\n useEffect(\n function listenForReconnect() {\n if (connection == null || isShutdown) return;\n\n // handles the reconnect event\n function handleReconnect(event: dh.Event<unknown>): void {\n const { detail } = event;\n log.info('Reconnect', `${JSON.stringify(detail)}`);\n setConnectionState('connected');\n }\n const removerFn = connection.addEventListener(\n api.CoreClient.EVENT_RECONNECT,\n handleReconnect\n );\n\n return removerFn;\n },\n [api, connection, isShutdown]\n );\n\n useEffect(\n function listenForShutdown() {\n if (connection == null) return;\n\n // handles the shutdown event\n function handleShutdown(event: dh.Event<unknown>): void {\n const { detail } = event;\n log.info('Shutdown', `${JSON.stringify(detail)}`);\n setError(`Server shutdown: ${detail ?? 'Unknown reason'}`);\n setConnectionState('shutdown');\n }\n const removerFn = connection.addEventListener(\n api.IdeConnection.EVENT_SHUTDOWN,\n handleShutdown\n );\n\n return removerFn;\n },\n [api, connection]\n );\n\n useEffect(\n function listenForAuthFailed() {\n if (connection == null || isShutdown) return;\n\n // handles the auth failed event\n function handleAuthFailed(event: dh.Event<unknown>): void {\n const { detail } = event;\n log.warn(\n 'Reconnect authentication failed',\n `${JSON.stringify(detail)}`\n );\n setError(\n `Reconnect authentication failed: ${detail ?? 'Unknown reason'}`\n );\n setConnectionState('failed');\n }\n const removerFn = connection.addEventListener(\n api.CoreClient.EVENT_RECONNECT_AUTH_FAILED,\n handleAuthFailed\n );\n\n return removerFn;\n },\n [api, connection, isShutdown]\n );\n\n const objectFetcher = useCallback(\n async (descriptor: dh.ide.VariableDescriptor | UriVariableDescriptor) => {\n assertNotNull(connection, 'No connection available to fetch object with');\n if (typeof descriptor === 'string') {\n throw new Error('No URI resolvers available in Core');\n }\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 function handleRefresh(): void {\n log.info('Refreshing application');\n window.location.reload();\n }\n\n if (isShutdown || connectionState === 'connecting' || isNotConnecting) {\n return (\n <LoadingOverlay\n data-testid=\"connection-bootstrap-loading\"\n isLoading={false}\n errorMessage={error != null ? `${error}` : undefined}\n />\n );\n }\n\n return (\n <ConnectionContext.Provider value={connection ?? null}>\n <ObjectFetcherContext.Provider value={objectFetcher}>\n <ObjectFetchManagerContext.Provider value={objectManager}>\n {children}\n <DebouncedModal isOpen={isReconnecting} debounceMs={1000}>\n <InfoModal\n icon={vsDebugDisconnect}\n title={\n <>\n <LoadingSpinner /> Attempting to reconnect...\n </>\n }\n subtitle=\"Please check your network connection.\"\n />\n </DebouncedModal>\n <BasicModal\n confirmButtonText=\"Refresh\"\n onConfirm={handleRefresh}\n isOpen={isAuthFailed}\n headerText=\"Authentication failed\"\n bodyText=\"Credentials are invalid. Please refresh your browser to try and reconnect.\"\n />\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,SACEC,UAAU,EACVC,cAAc,EACdC,SAAS,EACTC,cAAc,EACdC,cAAc,QACT,uBAAuB;AAC9B,SACEC,oBAAoB,EAEpBC,yBAAyB,EACzBC,0BAA0B,EAE1BC,MAAM,EACNC,SAAS,QACJ,4BAA4B;AAEnC,OAAOC,GAAG,MAAM,gBAAgB;AAChC,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,iBAAiB,QA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;MACjBC,YAAY,EAAE3D,KAAK,IAAI,IAAI,MAAAyB,MAAA,CAAMzB,KAAK,IAAK4D;IAAU,CACtD,CAAC;EAEN;EAEA,oBACExE,IAAA,CAACF,iBAAiB,CAAC2E,QAAQ;IAACC,KAAK,EAAE5D,UAAU,aAAVA,UAAU,cAAVA,UAAU,GAAI,IAAK;IAAAL,QAAA,eACpDT,IAAA,CAACV,oBAAoB,CAACmF,QAAQ;MAACC,KAAK,EAAEnB,aAAc;MAAA9C,QAAA,eAClDL,KAAA,CAACb,yBAAyB,CAACkF,QAAQ;QAACC,KAAK,EAAEb,aAAc;QAAApD,QAAA,GACtDA,QAAQ,eACTT,IAAA,CAACd,cAAc;UAACyF,MAAM,EAAEvD,cAAe;UAACwD,UAAU,EAAE,IAAK;UAAAnE,QAAA,eACvDT,IAAA,CAACb,SAAS;YACR0F,IAAI,EAAEhF,iBAAkB;YACxBiF,KAAK,eACH1E,KAAA,CAAAF,SAAA;cAAAO,QAAA,gBACET,IAAA,CAACX,cAAc,IAAE,CAAC,+BACpB;YAAA,CAAE,CACH;YACD0F,QAAQ,EAAC;UAAuC,CACjD;QAAC,CACY,CAAC,eACjB/E,IAAA,CAACf,UAAU;UACT+F,iBAAiB,EAAC,SAAS;UAC3BC,SAAS,EAAEf,aAAc;UACzBS,MAAM,EAAEzD,YAAa;UACrBgE,UAAU,EAAC,uBAAuB;UAClCC,QAAQ,EAAC;QAA4E,CACtF,CAAC;MAAA,CACgC;IAAC,CACR;EAAC,CACN,CAAC;AAEjC;AAEA,eAAe5E,mBAAmB","ignoreList":[]}
1
+ {"version":3,"file":"ConnectionBootstrap.js","names":["React","useCallback","useEffect","useMemo","useState","BasicModal","DebouncedModal","InfoModal","LoadingOverlay","LoadingSpinner","ObjectFetcherContext","ObjectFetchManagerContext","sanitizeVariableDescriptor","useApi","useClient","Log","assertNotNull","vsDebugDisconnect","ConnectionContext","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","log","module","ConnectionBootstrap","_ref","children","api","client","error","setError","connection","setConnection","connectionState","setConnectionState","isAuthFailed","isShutdown","isReconnecting","isNotConnecting","initConnection","isCanceled","loadConnection","_loadConnection","apply","arguments","_asyncToGenerator","newConnection","getAsIdeConnection","e","listenForDisconnect","handleDisconnect","event","detail","info","concat","JSON","stringify","removerFn","addEventListener","IdeConnection","EVENT_DISCONNECT","listenForReconnect","handleReconnect","CoreClient","EVENT_RECONNECT","listenForShutdown","handleShutdown","EVENT_SHUTDOWN","listenForAuthFailed","handleAuthFailed","warn","EVENT_RECONNECT_AUTH_FAILED","objectFetcher","_ref2","descriptor","Error","getObject","_x","objectManager","subscribe","onUpdate","fetch","status","handleRefresh","window","location","reload","isLoading","errorMessage","undefined","Provider","value","isOpen","debounceMs","icon","title","subtitle","confirmButtonText","onConfirm","headerText","bodyText"],"sources":["../../src/components/ConnectionBootstrap.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport {\n BasicModal,\n DebouncedModal,\n InfoModal,\n LoadingOverlay,\n LoadingSpinner,\n} from '@deephaven/components';\nimport {\n ObjectFetcherContext,\n type ObjectFetchManager,\n ObjectFetchManagerContext,\n sanitizeVariableDescriptor,\n type UriVariableDescriptor,\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 { vsDebugDisconnect } from '@deephaven/icons';\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 const [connectionState, setConnectionState] = useState<\n | 'not_connecting'\n | 'connecting'\n | 'connected'\n | 'reconnecting'\n | 'failed'\n | 'shutdown'\n >('connecting');\n const isAuthFailed = connectionState === 'failed';\n const isShutdown = connectionState === 'shutdown';\n const isReconnecting = connectionState === 'reconnecting';\n const isNotConnecting = connectionState === 'not_connecting';\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 setConnectionState('connected');\n } catch (e) {\n if (isCanceled) {\n return;\n }\n setError(e);\n setConnectionState('not_connecting');\n }\n }\n loadConnection();\n return () => {\n isCanceled = true;\n };\n },\n [api, client]\n );\n\n useEffect(\n function listenForDisconnect() {\n if (connection == null || isShutdown) return;\n\n // handles the disconnect event\n function handleDisconnect(event: dh.Event<unknown>): void {\n const { detail } = event;\n log.info('Disconnect', `${JSON.stringify(detail)}`);\n setConnectionState('reconnecting');\n }\n const removerFn = connection.addEventListener(\n api.IdeConnection.EVENT_DISCONNECT,\n handleDisconnect\n );\n\n return removerFn;\n },\n [api, connection, isShutdown]\n );\n\n useEffect(\n function listenForReconnect() {\n if (connection == null || isShutdown) return;\n\n // handles the reconnect event\n function handleReconnect(event: dh.Event<unknown>): void {\n const { detail } = event;\n log.info('Reconnect', `${JSON.stringify(detail)}`);\n setConnectionState('connected');\n }\n const removerFn = connection.addEventListener(\n api.CoreClient.EVENT_RECONNECT,\n handleReconnect\n );\n\n return removerFn;\n },\n [api, connection, isShutdown]\n );\n\n useEffect(\n function listenForShutdown() {\n if (connection == null) return;\n\n // handles the shutdown event\n function handleShutdown(event: dh.Event<unknown>): void {\n const { detail } = event;\n log.info('Shutdown', `${JSON.stringify(detail)}`);\n setError(`Server shutdown: ${detail ?? 'Unknown reason'}`);\n setConnectionState('shutdown');\n }\n const removerFn = connection.addEventListener(\n api.IdeConnection.EVENT_SHUTDOWN,\n handleShutdown\n );\n\n return removerFn;\n },\n [api, connection]\n );\n\n useEffect(\n function listenForAuthFailed() {\n if (connection == null || isShutdown) return;\n\n // handles the auth failed event\n function handleAuthFailed(event: dh.Event<unknown>): void {\n const { detail } = event;\n log.warn(\n 'Reconnect authentication failed',\n `${JSON.stringify(detail)}`\n );\n setError(\n `Reconnect authentication failed: ${detail ?? 'Unknown reason'}`\n );\n setConnectionState('failed');\n }\n const removerFn = connection.addEventListener(\n api.CoreClient.EVENT_RECONNECT_AUTH_FAILED,\n handleAuthFailed\n );\n\n return removerFn;\n },\n [api, connection, isShutdown]\n );\n\n const objectFetcher = useCallback(\n async (descriptor: dh.ide.VariableDescriptor | UriVariableDescriptor) => {\n assertNotNull(connection, 'No connection available to fetch object with');\n if (typeof descriptor === 'string') {\n throw new Error('No URI resolvers available in Core');\n }\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 function handleRefresh(): void {\n log.info('Refreshing application');\n window.location.reload();\n }\n\n if (isShutdown || connectionState === 'connecting' || isNotConnecting) {\n return (\n <LoadingOverlay\n data-testid=\"connection-bootstrap-loading\"\n isLoading={error == null}\n errorMessage={error != null ? `${error}` : undefined}\n />\n );\n }\n\n return (\n <ConnectionContext.Provider value={connection ?? null}>\n <ObjectFetcherContext.Provider value={objectFetcher}>\n <ObjectFetchManagerContext.Provider value={objectManager}>\n {children}\n <DebouncedModal isOpen={isReconnecting} debounceMs={1000}>\n <InfoModal\n icon={vsDebugDisconnect}\n title={\n <>\n <LoadingSpinner /> Attempting to reconnect...\n </>\n }\n subtitle=\"Please check your network connection.\"\n />\n </DebouncedModal>\n <BasicModal\n confirmButtonText=\"Refresh\"\n onConfirm={handleRefresh}\n isOpen={isAuthFailed}\n headerText=\"Authentication failed\"\n bodyText=\"Credentials are invalid. Please refresh your browser to try and reconnect.\"\n />\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,SACEC,UAAU,EACVC,cAAc,EACdC,SAAS,EACTC,cAAc,EACdC,cAAc,QACT,uBAAuB;AAC9B,SACEC,oBAAoB,EAEpBC,yBAAyB,EACzBC,0BAA0B,EAE1BC,MAAM,EACNC,SAAS,QACJ,4BAA4B;AAEnC,OAAOC,GAAG,MAAM,gBAAgB;AAChC,SAASC,aAAa,QAAQ,kBAAkB;AAChD,SAASC,iBAAiB,QAAQ,kBAAkB;AAAC,OAC9CC,iBAAiB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAExB,IAAMC,GAAG,GAAGV,GAAG,CAACW,MAAM,CAAC,0CAA0C,CAAC;AAUlE;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAAAC,IAAA,EAEO;EAAA,IAFN;IAClCC;EACwB,CAAC,GAAAD,IAAA;EACzB,IAAME,GAAG,GAAGjB,MAAM,CAAC,CAAC;EACpB,IAAMkB,MAAM,GAAGjB,SAAS,CAAC,CAAC;EAC1B,IAAM,CAACkB,KAAK,EAAEC,QAAQ,CAAC,GAAG7B,QAAQ,CAAU,CAAC;EAC7C,IAAM,CAAC8B,UAAU,EAAEC,aAAa,CAAC,GAAG/B,QAAQ,CAAmB,CAAC;EAChE,IAAM,CAACgC,eAAe,EAAEC,kBAAkB,CAAC,GAAGjC,QAAQ,CAOpD,YAAY,CAAC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O,QAAA,gBACET,IAAA,CAACX,cAAc,IAAE,CAAC,+BACpB;YAAA,CAAE,CACH;YACD0F,QAAQ,EAAC;UAAuC,CACjD;QAAC,CACY,CAAC,eACjB/E,IAAA,CAACf,UAAU;UACT+F,iBAAiB,EAAC,SAAS;UAC3BC,SAAS,EAAEf,aAAc;UACzBS,MAAM,EAAEzD,YAAa;UACrBgE,UAAU,EAAC,uBAAuB;UAClCC,QAAQ,EAAC;QAA4E,CACtF,CAAC;MAAA,CACgC;IAAC,CACR;EAAC,CACN,CAAC;AAEjC;AAEA,eAAe5E,mBAAmB","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deephaven/app-utils",
3
- "version": "1.8.1-beta.9+6a3c025a",
3
+ "version": "1.9.0",
4
4
  "description": "Deephaven App Utils",
5
5
  "author": "Deephaven Data Labs LLC",
6
6
  "license": "Apache-2.0",
@@ -22,30 +22,30 @@
22
22
  "build:babel": "babel ./src --out-dir ./dist --extensions \".ts,.tsx,.js,.jsx\" --source-maps --root-mode upward"
23
23
  },
24
24
  "devDependencies": {
25
- "@deephaven/test-utils": "^1.8.1-beta.9+6a3c025a"
25
+ "@deephaven/test-utils": "^1.8.0"
26
26
  },
27
27
  "dependencies": {
28
28
  "@adobe/react-spectrum": "3.38.0",
29
- "@deephaven/auth-plugins": "^1.8.1-beta.9+6a3c025a",
30
- "@deephaven/chart": "^1.8.1-beta.9+6a3c025a",
31
- "@deephaven/components": "^1.8.1-beta.9+6a3c025a",
32
- "@deephaven/console": "^1.8.1-beta.9+6a3c025a",
33
- "@deephaven/dashboard": "^1.8.1-beta.9+6a3c025a",
34
- "@deephaven/dashboard-core-plugins": "^1.8.1-beta.9+6a3c025a",
35
- "@deephaven/file-explorer": "^1.8.1-beta.9+6a3c025a",
36
- "@deephaven/golden-layout": "^1.8.1-beta.9+6a3c025a",
37
- "@deephaven/icons": "^1.8.1-beta.9+6a3c025a",
38
- "@deephaven/iris-grid": "^1.8.1-beta.9+6a3c025a",
39
- "@deephaven/jsapi-bootstrap": "^1.8.1-beta.9+6a3c025a",
40
- "@deephaven/jsapi-components": "^1.8.1-beta.9+6a3c025a",
29
+ "@deephaven/auth-plugins": "^1.9.0",
30
+ "@deephaven/chart": "^1.9.0",
31
+ "@deephaven/components": "^1.9.0",
32
+ "@deephaven/console": "^1.9.0",
33
+ "@deephaven/dashboard": "^1.9.0",
34
+ "@deephaven/dashboard-core-plugins": "^1.9.0",
35
+ "@deephaven/file-explorer": "^1.9.0",
36
+ "@deephaven/golden-layout": "^1.9.0",
37
+ "@deephaven/icons": "^1.2.0",
38
+ "@deephaven/iris-grid": "^1.9.0",
39
+ "@deephaven/jsapi-bootstrap": "^1.9.0",
40
+ "@deephaven/jsapi-components": "^1.9.0",
41
41
  "@deephaven/jsapi-types": "^1.0.0-dev0.40.4",
42
- "@deephaven/jsapi-utils": "^1.8.1-beta.9+6a3c025a",
43
- "@deephaven/log": "^1.8.1-beta.9+6a3c025a",
44
- "@deephaven/plugin": "^1.8.1-beta.9+6a3c025a",
45
- "@deephaven/react-hooks": "^1.8.1-beta.9+6a3c025a",
46
- "@deephaven/redux": "^1.8.1-beta.9+6a3c025a",
47
- "@deephaven/storage": "^1.8.1-beta.9+6a3c025a",
48
- "@deephaven/utils": "^1.8.1-beta.9+6a3c025a",
42
+ "@deephaven/jsapi-utils": "^1.9.0",
43
+ "@deephaven/log": "^1.8.0",
44
+ "@deephaven/plugin": "^1.9.0",
45
+ "@deephaven/react-hooks": "^1.8.0",
46
+ "@deephaven/redux": "^1.9.0",
47
+ "@deephaven/storage": "^1.8.0",
48
+ "@deephaven/utils": "^1.8.0",
49
49
  "@paciolan/remote-component": "2.13.0",
50
50
  "@paciolan/remote-module-loader": "^3.0.2",
51
51
  "classnames": "^2.5.1",
@@ -68,5 +68,5 @@
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
- "gitHead": "6a3c025a15228c83354cdec46571a561f5008865"
71
+ "gitHead": "590def353bdddd4fa81dce63b150b4d15f1e50fe"
72
72
  }