Skip to content

Commit

Permalink
Moved ent jsapi-types directory (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Sep 20, 2024
1 parent cfa27fd commit 6a9e0cf
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 14 deletions.
33 changes: 27 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions packages/enterprise-jsapi-types/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "@deephaven-enterprise/jsapi-types",
"version": "0.0.1",
"description": "Deephaven Enterprise Jsapi Types",
"author": "Deephaven Data Labs LLC",
"license": "SEE LICENSE IN LICENSE.md",
"type": "module",
"private": false,
"types": "types/index.d.ts",
"files": [
"types"
],
"sideEffects": false,
"dependencies": {
"@deephaven/jsapi-types": "^1.0.0-dev0.34.3"
}
}
10 changes: 10 additions & 0 deletions packages/enterprise-jsapi-types/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "types",
"noEmit": true,
"skipLibCheck": false
},
"include": ["types/**/*.ts"],
"exclude": ["node_modules"]
}
3 changes: 3 additions & 0 deletions packages/require-jsapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@
"sideEffects": false,
"scripts": {
"build": "tsc --build"
},
"dependencies": {
"@deephaven-enterprise/jsapi-types": "file:../enterprise-jsapi-types"
}
}
16 changes: 10 additions & 6 deletions packages/require-jsapi/src/dhe.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { hasStatusCode } from './serverUtils';
import { downloadFromURL, hasStatusCode } from './serverUtils';
import * as fs from 'node:fs';
import * as path from 'node:path';
import type {
EnterpriseDhType as DheType,
EnterpriseClient,
} from '@deephaven-enterprise/jsapi-types';
import { polyfillDh } from './polyfill';

/**
* Check if a given server is running by checking if the `irisapi/irisapi.nocache.js`
Expand Down Expand Up @@ -39,9 +40,12 @@ export async function createDheClient(
});
}

export async function initDheApi(serverUrl: URL): Promise<DheType> {
export async function initDheApi(
serverUrl: URL,
storageDir: string
): Promise<DheType> {
polyfillDh();
return getDhe(serverUrl, true);
return getDhe(serverUrl, true, storageDir);
}

declare global {
Expand All @@ -50,10 +54,10 @@ declare global {

export async function getDhe(
serverUrl: URL,
download: boolean
download: boolean,
storageDir: string
): Promise<DheType> {
const tmpDir = getTempDir(false, urlToDirectoryName(serverUrl));
const dheFilePath = path.join(tmpDir, 'irisapi.nocache.js');
const dheFilePath = path.join(storageDir, 'irisapi.nocache.js');

if (download) {
const dhe = await downloadFromURL(
Expand Down
7 changes: 5 additions & 2 deletions src/controllers/ExtensionController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
Logger,
OutputChannelWithHistory,
Toaster,
urlToDirectoryName,
} from '../util';
import {
RunCommandCodeLensProvider,
Expand Down Expand Up @@ -60,7 +61,7 @@ import { ServerConnectionTreeDragAndDropController } from './ServerConnectionTre
import { ConnectionController } from './ConnectionController';
import { PipServerController } from './PipServerController';
import { PanelController } from './PanelController';
import { initDheApi } from '../dh/dhe';
import { initDheApi } from '@deephaven/require-jsapi';

const logger = new Logger('ExtensionController');

Expand Down Expand Up @@ -268,7 +269,9 @@ export class ExtensionController implements Disposable {
this._toaster
);

this._dheJsApiCache = new CacheByUrlService(initDheApi);
this._dheJsApiCache = new CacheByUrlService(url =>
initDheApi(url, getTempDir({ subDirectory: urlToDirectoryName(url) }))
);
this._context.subscriptions.push(this._dheJsApiCache);

this._serverManager = new ServerManager(
Expand Down

0 comments on commit 6a9e0cf

Please sign in to comment.