diff --git a/package-lock.json b/package-lock.json index 178e2703..8e1f572b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,7 @@ "dependencies": { "@deephaven-enterprise/auth-nodejs": "^1.20240723.113-beta", "@deephaven-enterprise/query-utils": "^1.20240723.113-beta", + "@deephaven/jsapi-nodejs": "^0.97.0", "@deephaven/require-jsapi": "file:./packages/require-jsapi", "nanoid": "^5.0.7" }, @@ -466,6 +467,18 @@ "shortid": "^2.2.16" } }, + "node_modules/@deephaven/jsapi-nodejs": { + "version": "0.97.0", + "resolved": "https://registry.npmjs.org/@deephaven/jsapi-nodejs/-/jsapi-nodejs-0.97.0.tgz", + "integrity": "sha512-wSG3Rima8ECbITS49hccZ0G4YcIB+jkGcquRRBBX7fUFKKEXrxP15Azebn60e30orrYF/puP9lr2VoTQWMojdg==", + "dependencies": { + "esbuild": "^0.24.0", + "ws": "^8.18.0" + }, + "engines": { + "node": ">=16" + } + }, "node_modules/@deephaven/jsapi-types": { "version": "1.0.0-dev0.36.1", "resolved": "https://registry.npmjs.org/@deephaven/jsapi-types/-/jsapi-types-1.0.0-dev0.36.1.tgz", @@ -501,7 +514,6 @@ "cpu": [ "ppc64" ], - "dev": true, "optional": true, "os": [ "aix" @@ -517,7 +529,6 @@ "cpu": [ "arm" ], - "dev": true, "optional": true, "os": [ "android" @@ -533,7 +544,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "android" @@ -549,7 +559,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "android" @@ -565,7 +574,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "darwin" @@ -581,7 +589,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "darwin" @@ -597,7 +604,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "freebsd" @@ -613,7 +619,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "freebsd" @@ -629,7 +634,6 @@ "cpu": [ "arm" ], - "dev": true, "optional": true, "os": [ "linux" @@ -645,7 +649,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -661,7 +664,6 @@ "cpu": [ "ia32" ], - "dev": true, "optional": true, "os": [ "linux" @@ -677,7 +679,6 @@ "cpu": [ "loong64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -693,7 +694,6 @@ "cpu": [ "mips64el" ], - "dev": true, "optional": true, "os": [ "linux" @@ -709,7 +709,6 @@ "cpu": [ "ppc64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -725,7 +724,6 @@ "cpu": [ "riscv64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -741,7 +739,6 @@ "cpu": [ "s390x" ], - "dev": true, "optional": true, "os": [ "linux" @@ -757,7 +754,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "linux" @@ -773,7 +769,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "netbsd" @@ -789,7 +784,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "openbsd" @@ -805,7 +799,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "openbsd" @@ -821,7 +814,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "sunos" @@ -837,7 +829,6 @@ "cpu": [ "arm64" ], - "dev": true, "optional": true, "os": [ "win32" @@ -853,7 +844,6 @@ "cpu": [ "ia32" ], - "dev": true, "optional": true, "os": [ "win32" @@ -869,7 +859,6 @@ "cpu": [ "x64" ], - "dev": true, "optional": true, "os": [ "win32" @@ -6198,7 +6187,6 @@ "version": "0.24.0", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.0.tgz", "integrity": "sha512-FuLPevChGDshgSicjisSooU0cemp/sGXR841D5LHMB7mTVOmsEHcAxaH3irL53+8YDIeVNQEySh4DaYU/iuPqQ==", - "dev": true, "hasInstallScript": true, "bin": { "esbuild": "bin/esbuild" @@ -15909,6 +15897,15 @@ "shortid": "^2.2.16" } }, + "@deephaven/jsapi-nodejs": { + "version": "0.97.0", + "resolved": "https://registry.npmjs.org/@deephaven/jsapi-nodejs/-/jsapi-nodejs-0.97.0.tgz", + "integrity": "sha512-wSG3Rima8ECbITS49hccZ0G4YcIB+jkGcquRRBBX7fUFKKEXrxP15Azebn60e30orrYF/puP9lr2VoTQWMojdg==", + "requires": { + "esbuild": "^0.24.0", + "ws": "^8.18.0" + } + }, "@deephaven/jsapi-types": { "version": "1.0.0-dev0.36.1", "resolved": "https://registry.npmjs.org/@deephaven/jsapi-types/-/jsapi-types-1.0.0-dev0.36.1.tgz", @@ -15938,168 +15935,144 @@ "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.24.0.tgz", "integrity": "sha512-WtKdFM7ls47zkKHFVzMz8opM7LkcsIp9amDUBIAWirg70RM71WRSjdILPsY5Uv1D42ZpUfaPILDlfactHgsRkw==", - "dev": true, "optional": true }, "@esbuild/android-arm": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.24.0.tgz", "integrity": "sha512-arAtTPo76fJ/ICkXWetLCc9EwEHKaeya4vMrReVlEIUCAUncH7M4bhMQ+M9Vf+FFOZJdTNMXNBrWwW+OXWpSew==", - "dev": true, "optional": true }, "@esbuild/android-arm64": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.24.0.tgz", "integrity": "sha512-Vsm497xFM7tTIPYK9bNTYJyF/lsP590Qc1WxJdlB6ljCbdZKU9SY8i7+Iin4kyhV/KV5J2rOKsBQbB77Ab7L/w==", - "dev": true, "optional": true }, "@esbuild/android-x64": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.24.0.tgz", "integrity": "sha512-t8GrvnFkiIY7pa7mMgJd7p8p8qqYIz1NYiAoKc75Zyv73L3DZW++oYMSHPRarcotTKuSs6m3hTOa5CKHaS02TQ==", - "dev": true, "optional": true }, "@esbuild/darwin-arm64": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.0.tgz", "integrity": "sha512-CKyDpRbK1hXwv79soeTJNHb5EiG6ct3efd/FTPdzOWdbZZfGhpbcqIpiD0+vwmpu0wTIL97ZRPZu8vUt46nBSw==", - "dev": true, "optional": true }, "@esbuild/darwin-x64": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.24.0.tgz", "integrity": "sha512-rgtz6flkVkh58od4PwTRqxbKH9cOjaXCMZgWD905JOzjFKW+7EiUObfd/Kav+A6Gyud6WZk9w+xu6QLytdi2OA==", - "dev": true, "optional": true }, "@esbuild/freebsd-arm64": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.0.tgz", "integrity": "sha512-6Mtdq5nHggwfDNLAHkPlyLBpE5L6hwsuXZX8XNmHno9JuL2+bg2BX5tRkwjyfn6sKbxZTq68suOjgWqCicvPXA==", - "dev": true, "optional": true }, "@esbuild/freebsd-x64": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.24.0.tgz", "integrity": "sha512-D3H+xh3/zphoX8ck4S2RxKR6gHlHDXXzOf6f/9dbFt/NRBDIE33+cVa49Kil4WUjxMGW0ZIYBYtaGCa2+OsQwQ==", - "dev": true, "optional": true }, "@esbuild/linux-arm": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.24.0.tgz", "integrity": "sha512-gJKIi2IjRo5G6Glxb8d3DzYXlxdEj2NlkixPsqePSZMhLudqPhtZ4BUrpIuTjJYXxvF9njql+vRjB2oaC9XpBw==", - "dev": true, "optional": true }, "@esbuild/linux-arm64": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.24.0.tgz", "integrity": "sha512-TDijPXTOeE3eaMkRYpcy3LarIg13dS9wWHRdwYRnzlwlA370rNdZqbcp0WTyyV/k2zSxfko52+C7jU5F9Tfj1g==", - "dev": true, "optional": true }, "@esbuild/linux-ia32": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.24.0.tgz", "integrity": "sha512-K40ip1LAcA0byL05TbCQ4yJ4swvnbzHscRmUilrmP9Am7//0UjPreh4lpYzvThT2Quw66MhjG//20mrufm40mA==", - "dev": true, "optional": true }, "@esbuild/linux-loong64": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.24.0.tgz", "integrity": "sha512-0mswrYP/9ai+CU0BzBfPMZ8RVm3RGAN/lmOMgW4aFUSOQBjA31UP8Mr6DDhWSuMwj7jaWOT0p0WoZ6jeHhrD7g==", - "dev": true, "optional": true }, "@esbuild/linux-mips64el": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.24.0.tgz", "integrity": "sha512-hIKvXm0/3w/5+RDtCJeXqMZGkI2s4oMUGj3/jM0QzhgIASWrGO5/RlzAzm5nNh/awHE0A19h/CvHQe6FaBNrRA==", - "dev": true, "optional": true }, "@esbuild/linux-ppc64": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.24.0.tgz", "integrity": "sha512-HcZh5BNq0aC52UoocJxaKORfFODWXZxtBaaZNuN3PUX3MoDsChsZqopzi5UupRhPHSEHotoiptqikjN/B77mYQ==", - "dev": true, "optional": true }, "@esbuild/linux-riscv64": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.24.0.tgz", "integrity": "sha512-bEh7dMn/h3QxeR2KTy1DUszQjUrIHPZKyO6aN1X4BCnhfYhuQqedHaa5MxSQA/06j3GpiIlFGSsy1c7Gf9padw==", - "dev": true, "optional": true }, "@esbuild/linux-s390x": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.24.0.tgz", "integrity": "sha512-ZcQ6+qRkw1UcZGPyrCiHHkmBaj9SiCD8Oqd556HldP+QlpUIe2Wgn3ehQGVoPOvZvtHm8HPx+bH20c9pvbkX3g==", - "dev": true, "optional": true }, "@esbuild/linux-x64": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.24.0.tgz", "integrity": "sha512-vbutsFqQ+foy3wSSbmjBXXIJ6PL3scghJoM8zCL142cGaZKAdCZHyf+Bpu/MmX9zT9Q0zFBVKb36Ma5Fzfa8xA==", - "dev": true, "optional": true }, "@esbuild/netbsd-x64": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.24.0.tgz", "integrity": "sha512-hjQ0R/ulkO8fCYFsG0FZoH+pWgTTDreqpqY7UnQntnaKv95uP5iW3+dChxnx7C3trQQU40S+OgWhUVwCjVFLvg==", - "dev": true, "optional": true }, "@esbuild/openbsd-arm64": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.0.tgz", "integrity": "sha512-MD9uzzkPQbYehwcN583yx3Tu5M8EIoTD+tUgKF982WYL9Pf5rKy9ltgD0eUgs8pvKnmizxjXZyLt0z6DC3rRXg==", - "dev": true, "optional": true }, "@esbuild/openbsd-x64": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.24.0.tgz", "integrity": "sha512-4ir0aY1NGUhIC1hdoCzr1+5b43mw99uNwVzhIq1OY3QcEwPDO3B7WNXBzaKY5Nsf1+N11i1eOfFcq+D/gOS15Q==", - "dev": true, "optional": true }, "@esbuild/sunos-x64": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.24.0.tgz", "integrity": "sha512-jVzdzsbM5xrotH+W5f1s+JtUy1UWgjU0Cf4wMvffTB8m6wP5/kx0KiaLHlbJO+dMgtxKV8RQ/JvtlFcdZ1zCPA==", - "dev": true, "optional": true }, "@esbuild/win32-arm64": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.24.0.tgz", "integrity": "sha512-iKc8GAslzRpBytO2/aN3d2yb2z8XTVfNV0PjGlCxKo5SgWmNXx82I/Q3aG1tFfS+A2igVCY97TJ8tnYwpUWLCA==", - "dev": true, "optional": true }, "@esbuild/win32-ia32": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.24.0.tgz", "integrity": "sha512-vQW36KZolfIudCcTnaTpmLQ24Ha1RjygBo39/aLkM2kmjkWmZGEJ5Gn9l5/7tzXA42QGIoWbICfg6KLLkIw6yw==", - "dev": true, "optional": true }, "@esbuild/win32-x64": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.0.tgz", "integrity": "sha512-7IAFPrjSQIJrGsK6flwg7NFmwBoSTyF3rl7If0hNUFQU4ilTsEPL6GuMuU9BfIWVVGuRnuIidkSMC+c0Otu8IA==", - "dev": true, "optional": true }, "@eslint-community/eslint-utils": { @@ -20020,7 +19993,6 @@ "version": "0.24.0", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.0.tgz", "integrity": "sha512-FuLPevChGDshgSicjisSooU0cemp/sGXR841D5LHMB7mTVOmsEHcAxaH3irL53+8YDIeVNQEySh4DaYU/iuPqQ==", - "dev": true, "requires": { "@esbuild/aix-ppc64": "0.24.0", "@esbuild/android-arm": "0.24.0", diff --git a/package.json b/package.json index 8c06ee2a..e7930434 100644 --- a/package.json +++ b/package.json @@ -821,6 +821,7 @@ "dependencies": { "@deephaven-enterprise/auth-nodejs": "^1.20240723.113-beta", "@deephaven-enterprise/query-utils": "^1.20240723.113-beta", + "@deephaven/jsapi-nodejs": "^0.97.0", "@deephaven/require-jsapi": "file:./packages/require-jsapi", "nanoid": "^5.0.7" }, diff --git a/scripts/esbuild.js b/scripts/esbuild.js index a28bbc63..a0f69e02 100644 --- a/scripts/esbuild.js +++ b/scripts/esbuild.js @@ -44,7 +44,7 @@ async function main() { sourcesContent: false, platform: 'node', outfile: 'out/extension.js', - external: ['vscode'], + external: ['esbuild', 'vscode'], logLevel: 'silent', plugins: [ /* add to the end of plugins array */ diff --git a/src/controllers/PipServerController.ts b/src/controllers/PipServerController.ts index 14858ec5..303c281c 100644 --- a/src/controllers/PipServerController.ts +++ b/src/controllers/PipServerController.ts @@ -1,6 +1,5 @@ import * as vscode from 'vscode'; import * as fs from 'node:fs'; -import { isDhcServerRunning } from '@deephaven/require-jsapi'; import { getPipServerUrl, getPipStatusFilePath, @@ -15,6 +14,7 @@ import { PYTHON_ENV_WAIT, } from '../common'; import { pollUntilTrue, waitFor } from '../util/promiseUtils'; +import { isDhcServerRunning } from '../dh/dhc'; const logger = new Logger('PipServerController'); diff --git a/src/dh/dhc.ts b/src/dh/dhc.ts index 0dc40ffc..c2808674 100644 --- a/src/dh/dhc.ts +++ b/src/dh/dhc.ts @@ -4,6 +4,7 @@ import type { CoreAuthenticatedClient, CoreUnauthenticatedClient, } from '../types'; +import { hasStatusCode, loadModules } from '@deephaven/jsapi-nodejs'; export const AUTH_HANDLER_TYPE_ANONYMOUS = 'io.deephaven.auth.AnonymousAuthenticationHandler'; @@ -19,6 +20,33 @@ export type ConnectionAndSession = { session: TSession; }; +// TODO: https://github.com/deephaven/deephaven-core/issues/5911 to address the +// underlying issue of jsapi-types being unaware of `dhinternal`. Once that is +// addressed, this can be removed. +declare global { + // eslint-disable-next-line no-unused-vars + namespace dhinternal.io.deephaven.proto.ticket_pb { + export type TypedTicket = unknown; + } +} + +export async function getDhc( + serverUrl: URL, + storageDir: string +): Promise { + // Download jsapi `ESM` files from DH Community server. + const coreModule = await loadModules<{ default: typeof DhType }>({ + serverUrl, + serverPaths: ['jsapi/dh-core.js', 'jsapi/dh-internal.js'], + download: true, + storageDir, + sourceModuleType: 'esm', + targetModuleType: 'cjs', + }); + + return coreModule.default; +} + /** * Get embed widget url for a widget. * @param serverUrl Server URL @@ -77,6 +105,22 @@ export async function initDhcSession( return { cn, session }; } +/** + * Check if a given server is running by checking if the `dh-core.js` file is + * accessible. + * @param serverUrl + */ +export async function isDhcServerRunning(serverUrl: URL): Promise { + try { + return await hasStatusCode( + new URL('jsapi/dh-core.js', serverUrl.toString()), + [200, 204] + ); + } catch { + return false; + } +} + /** * Login a given unauthenticated client with the given credentials. * @param client The client to login. diff --git a/src/dh/dhe.ts b/src/dh/dhe.ts index c891e6ed..96409939 100644 --- a/src/dh/dhe.ts +++ b/src/dh/dhe.ts @@ -6,6 +6,8 @@ import type { TypeSpecificFields, } from '@deephaven-enterprise/jsapi-types'; import { DraftQuery, QueryScheduler } from '@deephaven-enterprise/query-utils'; +import type { AuthenticatedClient as DheAuthenticatedClient } from '@deephaven-enterprise/auth-nodejs'; +import { hasStatusCode, loadModules } from '@deephaven/jsapi-nodejs'; import type { ConsoleType, IdeURL, @@ -21,13 +23,37 @@ import { INTERACTIVE_CONSOLE_QUERY_TYPE, INTERACTIVE_CONSOLE_TEMPORARY_QUEUE_NAME, } from '../common'; -import type { AuthenticatedClient as DheAuthenticatedClient } from '@deephaven-enterprise/auth-nodejs'; export type IDraftQuery = EditableQueryInfo & { isClientSide: boolean; draftOwner: string; }; +declare global { + // This gets added by the DHE jsapi. + // eslint-disable-next-line no-unused-vars + const iris: DheType; +} + +export async function getDhe( + serverUrl: URL, + storageDir: string +): Promise { + polyfill(); + + // Download jsapi `ESM` files from DH Community server. + await loadModules({ + serverUrl, + serverPaths: ['irisapi/irisapi.nocache.js'], + download: true, + storageDir, + sourceModuleType: 'cjs', + }); + + // DHE currently exposes the jsapi via the global `iris` object. + return iris; +} + /** * Get credentials for a Core+ worker associated with a given DHE client. * @param client The DHE client. @@ -65,6 +91,22 @@ export async function hasInteractivePermission( return isSuperUser || isInteractive; } +/** + * Check if a given server is running by checking if the `irisapi/irisapi.nocache.js` + * file is accessible. + * @param serverUrl + */ +export async function isDheServerRunning(serverUrl: URL): Promise { + try { + return await hasStatusCode( + new URL('irisapi/irisapi.nocache.js', serverUrl.toString()), + [200, 204] + ); + } catch { + return false; + } +} + /** * Create a query of type `InteractiveConsole`. * @param tagId Unique tag id to include in the query name. @@ -234,3 +276,18 @@ export async function getWorkerInfoFromQuery( workerName, }; } + +export function polyfill(): void { + // These will eventually not be needed once JSAPI is updated to not rely on `window` and `self`. + // @ts-ignore + globalThis.self = globalThis; + // @ts-ignore + globalThis.window = globalThis; + + // This is needed to mimic running in a local http browser environment when + // making requests to the server. This at least impacts websocket connections. + // Not sure if it is needed for other requests. The url is an arbitrary + // non-https url just to make it stand out in logs. + // @ts-ignore + global.window.location = new URL('http://vscode-deephaven.localhost/'); +} diff --git a/src/services/DhcService.ts b/src/services/DhcService.ts index 3ea133ca..e9ebd02a 100644 --- a/src/services/DhcService.ts +++ b/src/services/DhcService.ts @@ -1,6 +1,5 @@ import * as vscode from 'vscode'; import type { dh as DhcType } from '@deephaven/jsapi-types'; -import { isAggregateError } from '@deephaven/require-jsapi'; import { formatTimestamp, getCombinedSelectedLinesText, Logger } from '../util'; import { initDhcSession, type ConnectionAndSession } from '../dh/dhc'; import type { @@ -26,6 +25,7 @@ import { } from '../common'; import { NoConsoleTypesError, parseServerError } from '../dh/errorUtils'; import { hasErrorCode } from '../util/typeUtils'; +import { isAggregateError } from '@deephaven/jsapi-nodejs'; const logger = new Logger('DhcService'); diff --git a/src/services/ServerManager.ts b/src/services/ServerManager.ts index cac841df..de13a235 100644 --- a/src/services/ServerManager.ts +++ b/src/services/ServerManager.ts @@ -2,10 +2,6 @@ import * as vscode from 'vscode'; import { randomUUID } from 'node:crypto'; import type { dh as DhcType } from '@deephaven/jsapi-types'; import type { AuthenticatedClient as DheAuthenticatedClient } from '@deephaven-enterprise/auth-nodejs'; -import { - isDhcServerRunning, - isDheServerRunning, -} from '@deephaven/require-jsapi'; import { UnsupportedConsoleTypeError } from '../common'; import type { ConsoleType, @@ -34,7 +30,8 @@ import { import { URLMap } from './URLMap'; import { URIMap } from './URIMap'; import { DhcService } from './DhcService'; -import { getWorkerCredentials } from '../dh/dhe'; +import { getWorkerCredentials, isDheServerRunning } from '../dh/dhe'; +import { isDhcServerRunning } from '../dh/dhc'; const logger = new Logger('ServerManager'); diff --git a/src/services/cache/CoreJsApiCache.ts b/src/services/cache/CoreJsApiCache.ts index 5adb54f4..a85c90ff 100644 --- a/src/services/cache/CoreJsApiCache.ts +++ b/src/services/cache/CoreJsApiCache.ts @@ -1,7 +1,7 @@ -import { initDhcApi } from '@deephaven/require-jsapi'; import type { dh as DhcType } from '@deephaven/jsapi-types'; import { getTempDir, urlToDirectoryName } from '../../util'; import { ByURLAsyncCache } from './ByURLAsyncCache'; +import { getDhc } from '../../dh/dhc'; /** * Cache Core jsapi instances by URL. @@ -9,7 +9,7 @@ import { ByURLAsyncCache } from './ByURLAsyncCache'; export class CoreJsApiCache extends ByURLAsyncCache { constructor() { super(async url => - initDhcApi(url, getTempDir({ subDirectory: urlToDirectoryName(url) })) + getDhc(url, getTempDir({ subDirectory: urlToDirectoryName(url) })) ); } } diff --git a/src/services/cache/DheJsApiCache.ts b/src/services/cache/DheJsApiCache.ts index 2fd3f82f..bb89fdae 100644 --- a/src/services/cache/DheJsApiCache.ts +++ b/src/services/cache/DheJsApiCache.ts @@ -1,7 +1,7 @@ -import { initDheApi } from '@deephaven/require-jsapi'; import type { EnterpriseDhType as DheType } from '@deephaven-enterprise/jsapi-types'; import { getTempDir, urlToDirectoryName } from '../../util'; import { ByURLAsyncCache } from './ByURLAsyncCache'; +import { getDhe } from '../../dh/dhe'; /** * Cache DHE jsapi instances by URL. @@ -9,7 +9,7 @@ import { ByURLAsyncCache } from './ByURLAsyncCache'; export class DheJsApiCache extends ByURLAsyncCache { constructor() { super(async url => - initDheApi(url, getTempDir({ subDirectory: urlToDirectoryName(url) })) + getDhe(url, getTempDir({ subDirectory: urlToDirectoryName(url) })) ); } }