@deephaven/jsapi-bootstrap 0.67.0 → 0.67.1-beta.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.
- package/dist/ApiBootstrap.d.ts +1 -1
- package/dist/ApiBootstrap.d.ts.map +1 -1
- package/dist/ApiBootstrap.js.map +1 -1
- package/dist/ClientBootstrap.d.ts +3 -3
- package/dist/ClientBootstrap.d.ts.map +1 -1
- package/dist/ClientBootstrap.js.map +1 -1
- package/dist/DeferredApiBootstrap.d.ts +2 -2
- package/dist/DeferredApiBootstrap.d.ts.map +1 -1
- package/dist/DeferredApiBootstrap.js.map +1 -1
- package/dist/useApi.d.ts +2 -2
- package/dist/useApi.d.ts.map +1 -1
- package/dist/useApi.js.map +1 -1
- package/dist/useClient.d.ts +2 -2
- package/dist/useClient.d.ts.map +1 -1
- package/dist/useClient.js.map +1 -1
- package/dist/useCreateClient.d.ts +2 -2
- package/dist/useCreateClient.d.ts.map +1 -1
- package/dist/useCreateClient.js.map +1 -1
- package/dist/useDeferredApi.d.ts +4 -4
- package/dist/useDeferredApi.d.ts.map +1 -1
- package/dist/useDeferredApi.js.map +1 -1
- package/dist/useObjectFetcher.d.ts +7 -5
- package/dist/useObjectFetcher.d.ts.map +1 -1
- package/dist/useObjectFetcher.js.map +1 -1
- package/package.json +6 -6
package/dist/ApiBootstrap.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import type { dh as DhType } from '@deephaven/jsapi-types';
|
|
3
|
-
export declare const ApiContext: import("react").Context<DhType | null>;
|
|
3
|
+
export declare const ApiContext: import("react").Context<typeof DhType | null>;
|
|
4
4
|
export type ApiBootstrapProps = {
|
|
5
5
|
/** URL of the API to load */
|
|
6
6
|
apiUrl: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiBootstrap.d.ts","sourceRoot":"","sources":["../src/ApiBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAuB,MAAM,OAAO,CAAC;AAOtE,OAAO,KAAK,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAK3D,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"ApiBootstrap.d.ts","sourceRoot":"","sources":["../src/ApiBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAuB,MAAM,OAAO,CAAC;AAOtE,OAAO,KAAK,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAK3D,eAAO,MAAM,UAAU,+CAA4C,CAAC;AAEpE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IAEf,iDAAiD;IACjD,QAAQ,EAAE,SAAS,CAAC;IAEpB,+DAA+D;IAC/D,cAAc,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAE7B,sEAAsE;IACtE,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,QAAQ,EACR,cAAc,EACd,WAAmB,GACpB,EAAE,iBAAiB,GAAG,GAAG,CAAC,OAAO,CA+CjC;AAED,eAAe,YAAY,CAAC"}
|
package/dist/ApiBootstrap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiBootstrap.js","names":["createContext","useEffect","useState","LoadingOverlay","Modal","ModalBody","ModalHeader","Log","jsx","_jsx","jsxs","_jsxs","log","module","ApiContext","ApiBootstrap","_ref","apiUrl","children","failureElement","setGlobally","isLoading","setIsLoading","api","setApi","loadApi","_loadApi","apply","arguments","_asyncToGenerator","dh","default","info","debug","globalThis","e","error","isOpen","className","closeButton","Provider","value"],"sources":["../src/ApiBootstrap.tsx"],"sourcesContent":["import { createContext, ReactNode, useEffect, useState } from 'react';\nimport {\n LoadingOverlay,\n Modal,\n ModalBody,\n ModalHeader,\n} from '@deephaven/components';\nimport type { dh as DhType } from '@deephaven/jsapi-types';\nimport Log from '@deephaven/log';\n\nconst log = Log.module('@deephaven/jsapi-bootstrap.ApiBootstrap');\n\nexport const ApiContext = createContext<DhType | null>(null);\n\nexport type ApiBootstrapProps = {\n /** URL of the API to load */\n apiUrl: string;\n\n /** Children to render when the API has loaded */\n children: ReactNode;\n\n /** Element to display if there is a failure loading the API */\n failureElement?: JSX.Element;\n\n /** Whether to set the API globally on window.dh when it has loaded */\n setGlobally?: boolean;\n};\n\n/**\n * ApiBootstrap loads the API from the provided URL, rendering the children once loaded.\n */\nexport function ApiBootstrap({\n apiUrl,\n children,\n failureElement,\n setGlobally = false,\n}: ApiBootstrapProps): JSX.Element {\n const [isLoading, setIsLoading] = useState(true);\n const [api, setApi] = useState<DhType>();\n useEffect(() => {\n async function loadApi(): Promise<void> {\n try {\n const dh: DhType =\n // Ignore the warning about dynamic import in both Vite and Webpack.\n // We use Vite, but some clients may use Webpack.\n (await import(/* @vite-ignore */ /* webpackIgnore: true */ apiUrl))\n .default;\n log.info('API bootstrapped from', apiUrl);\n setApi(dh);\n if (setGlobally) {\n log.debug('API set globally');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (globalThis as any).dh = dh;\n }\n } catch (e) {\n log.error('Unable to bootstrap API', e);\n }\n setIsLoading(false);\n }\n loadApi();\n }, [apiUrl, setGlobally]);\n\n if (isLoading) {\n return <LoadingOverlay />;\n }\n if (api == null) {\n return (\n failureElement ?? (\n <Modal isOpen className=\"modal-dialog-centered\">\n <ModalHeader closeButton={false}>\n Error: Unable to load API\n </ModalHeader>\n <ModalBody>\n <p className=\"text-break\">\n Ensure the server is running and you are able to reach {apiUrl},\n then refresh the page.\n </p>\n </ModalBody>\n </Modal>\n )\n );\n }\n return <ApiContext.Provider value={api}>{children}</ApiContext.Provider>;\n}\n\nexport default ApiBootstrap;\n"],"mappings":";;AAAA,SAASA,aAAa,EAAaC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACrE,SACEC,cAAc,EACdC,KAAK,EACLC,SAAS,EACTC,WAAW,QACN,uBAAuB;AAE9B,OAAOC,GAAG,MAAM,gBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEjC,IAAMC,GAAG,GAAGL,GAAG,CAACM,MAAM,CAAC,yCAAyC,CAAC;AAEjE,OAAO,IAAMC,UAAU,gBAAGd,aAAa,
|
|
1
|
+
{"version":3,"file":"ApiBootstrap.js","names":["createContext","useEffect","useState","LoadingOverlay","Modal","ModalBody","ModalHeader","Log","jsx","_jsx","jsxs","_jsxs","log","module","ApiContext","ApiBootstrap","_ref","apiUrl","children","failureElement","setGlobally","isLoading","setIsLoading","api","setApi","loadApi","_loadApi","apply","arguments","_asyncToGenerator","dh","default","info","debug","globalThis","e","error","isOpen","className","closeButton","Provider","value"],"sources":["../src/ApiBootstrap.tsx"],"sourcesContent":["import { createContext, ReactNode, useEffect, useState } from 'react';\nimport {\n LoadingOverlay,\n Modal,\n ModalBody,\n ModalHeader,\n} from '@deephaven/components';\nimport type { dh as DhType } from '@deephaven/jsapi-types';\nimport Log from '@deephaven/log';\n\nconst log = Log.module('@deephaven/jsapi-bootstrap.ApiBootstrap');\n\nexport const ApiContext = createContext<typeof DhType | null>(null);\n\nexport type ApiBootstrapProps = {\n /** URL of the API to load */\n apiUrl: string;\n\n /** Children to render when the API has loaded */\n children: ReactNode;\n\n /** Element to display if there is a failure loading the API */\n failureElement?: JSX.Element;\n\n /** Whether to set the API globally on window.dh when it has loaded */\n setGlobally?: boolean;\n};\n\n/**\n * ApiBootstrap loads the API from the provided URL, rendering the children once loaded.\n */\nexport function ApiBootstrap({\n apiUrl,\n children,\n failureElement,\n setGlobally = false,\n}: ApiBootstrapProps): JSX.Element {\n const [isLoading, setIsLoading] = useState(true);\n const [api, setApi] = useState<typeof DhType>();\n useEffect(() => {\n async function loadApi(): Promise<void> {\n try {\n const dh: typeof DhType =\n // Ignore the warning about dynamic import in both Vite and Webpack.\n // We use Vite, but some clients may use Webpack.\n (await import(/* @vite-ignore */ /* webpackIgnore: true */ apiUrl))\n .default;\n log.info('API bootstrapped from', apiUrl);\n setApi(dh);\n if (setGlobally) {\n log.debug('API set globally');\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (globalThis as any).dh = dh;\n }\n } catch (e) {\n log.error('Unable to bootstrap API', e);\n }\n setIsLoading(false);\n }\n loadApi();\n }, [apiUrl, setGlobally]);\n\n if (isLoading) {\n return <LoadingOverlay />;\n }\n if (api == null) {\n return (\n failureElement ?? (\n <Modal isOpen className=\"modal-dialog-centered\">\n <ModalHeader closeButton={false}>\n Error: Unable to load API\n </ModalHeader>\n <ModalBody>\n <p className=\"text-break\">\n Ensure the server is running and you are able to reach {apiUrl},\n then refresh the page.\n </p>\n </ModalBody>\n </Modal>\n )\n );\n }\n return <ApiContext.Provider value={api}>{children}</ApiContext.Provider>;\n}\n\nexport default ApiBootstrap;\n"],"mappings":";;AAAA,SAASA,aAAa,EAAaC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AACrE,SACEC,cAAc,EACdC,KAAK,EACLC,SAAS,EACTC,WAAW,QACN,uBAAuB;AAE9B,OAAOC,GAAG,MAAM,gBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEjC,IAAMC,GAAG,GAAGL,GAAG,CAACM,MAAM,CAAC,yCAAyC,CAAC;AAEjE,OAAO,IAAMC,UAAU,gBAAGd,aAAa,CAAuB,IAAI,CAAC;AAgBnE;AACA;AACA;AACA,OAAO,SAASe,YAAYA,CAAAC,IAAA,EAKO;EAAA,IALN;IAC3BC,MAAM;IACNC,QAAQ;IACRC,cAAc;IACdC,WAAW,GAAG;EACG,CAAC,GAAAJ,IAAA;EAClB,IAAM,CAACK,SAAS,EAAEC,YAAY,CAAC,GAAGpB,QAAQ,CAAC,IAAI,CAAC;EAChD,IAAM,CAACqB,GAAG,EAAEC,MAAM,CAAC,GAAGtB,QAAQ,CAAgB,CAAC;EAC/CD,SAAS,CAAC,MAAM;IAAA,SACCwB,OAAOA,CAAA;MAAA,OAAAC,QAAA,CAAAC,KAAA,OAAAC,SAAA;IAAA;IAAA,SAAAF,SAAA;MAAAA,QAAA,GAAAG,iBAAA,CAAtB,aAAwC;QACtC,IAAI;UACF,IAAMC,EAAiB;UACrB;UACA;UACA,OAAO,MAAM,EAAC,mBAAmB,yBAA0Bb,MAAM,CAAC,EAC/Dc,OAAO;UACZnB,GAAG,CAACoB,IAAI,CAAC,uBAAuB,EAAEf,MAAM,CAAC;UACzCO,MAAM,CAACM,EAAE,CAAC;UACV,IAAIV,WAAW,EAAE;YACfR,GAAG,CAACqB,KAAK,CAAC,kBAAkB,CAAC;YAC7B;YACCC,UAAU,CAASJ,EAAE,GAAGA,EAAE;UAC7B;QACF,CAAC,CAAC,OAAOK,CAAC,EAAE;UACVvB,GAAG,CAACwB,KAAK,CAAC,yBAAyB,EAAED,CAAC,CAAC;QACzC;QACAb,YAAY,CAAC,KAAK,CAAC;MACrB,CAAC;MAAA,OAAAI,QAAA,CAAAC,KAAA,OAAAC,SAAA;IAAA;IACDH,OAAO,CAAC,CAAC;EACX,CAAC,EAAE,CAACR,MAAM,EAAEG,WAAW,CAAC,CAAC;EAEzB,IAAIC,SAAS,EAAE;IACb,oBAAOZ,IAAA,CAACN,cAAc,IAAE,CAAC;EAC3B;EACA,IAAIoB,GAAG,IAAI,IAAI,EAAE;IACf,OACEJ,cAAc,aAAdA,cAAc,cAAdA,cAAc,gBACZR,KAAA,CAACP,KAAK;MAACiC,MAAM;MAACC,SAAS,EAAC,uBAAuB;MAAApB,QAAA,gBAC7CT,IAAA,CAACH,WAAW;QAACiC,WAAW,EAAE,KAAM;QAAArB,QAAA,EAAC;MAEjC,CAAa,CAAC,eACdT,IAAA,CAACJ,SAAS;QAAAa,QAAA,eACRP,KAAA;UAAG2B,SAAS,EAAC,YAAY;UAAApB,QAAA,GAAC,yDAC+B,EAACD,MAAM,EAAC,0BAEjE;QAAA,CAAG;MAAC,CACK,CAAC;IAAA,CACP,CAAC;EAGd;EACA,oBAAOR,IAAA,CAACK,UAAU,CAAC0B,QAAQ;IAACC,KAAK,EAAElB,GAAI;IAAAL,QAAA,EAAEA;EAAQ,CAAsB,CAAC;AAC1E;AAEA,eAAeH,YAAY"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
export declare const ClientContext: React.Context<CoreClient | null>;
|
|
2
|
+
import type { dh } from '@deephaven/jsapi-types';
|
|
3
|
+
export declare const ClientContext: React.Context<dh.CoreClient | null>;
|
|
4
4
|
export type ClientBootstrapProps = {
|
|
5
5
|
/** URL of the server to connect to */
|
|
6
6
|
serverUrl: string;
|
|
7
7
|
/** Connection options to pass to CoreClient when connecting */
|
|
8
|
-
options?: ConnectOptions;
|
|
8
|
+
options?: dh.ConnectOptions;
|
|
9
9
|
/**
|
|
10
10
|
* The children to render wrapped with the ClientContext.
|
|
11
11
|
* Will not render children until the client is created.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientBootstrap.d.ts","sourceRoot":"","sources":["../src/ClientBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ClientBootstrap.d.ts","sourceRoot":"","sources":["../src/ClientBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAGjD,eAAO,MAAM,aAAa,qCAA4C,CAAC;AAEvE,MAAM,MAAM,oBAAoB,GAAG;IACjC,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAElB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC;IAE5B;;;OAGG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,OAAO,EACP,QAAQ,GACT,EAAE,oBAAoB,GAAG,GAAG,CAAC,OAAO,CAKpC;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientBootstrap.js","names":["React","createContext","useCreateClient","jsx","_jsx","ClientContext","ClientBootstrap","_ref","serverUrl","options","children","client","Provider","value"],"sources":["../src/ClientBootstrap.tsx"],"sourcesContent":["import React, { createContext } from 'react';\nimport type {
|
|
1
|
+
{"version":3,"file":"ClientBootstrap.js","names":["React","createContext","useCreateClient","jsx","_jsx","ClientContext","ClientBootstrap","_ref","serverUrl","options","children","client","Provider","value"],"sources":["../src/ClientBootstrap.tsx"],"sourcesContent":["import React, { createContext } from 'react';\nimport type { dh } from '@deephaven/jsapi-types';\nimport useCreateClient from './useCreateClient';\n\nexport const ClientContext = createContext<dh.CoreClient | null>(null);\n\nexport type ClientBootstrapProps = {\n /** URL of the server to connect to */\n serverUrl: string;\n\n /** Connection options to pass to CoreClient when connecting */\n options?: dh.ConnectOptions;\n\n /**\n * The children to render wrapped with the ClientContext.\n * Will not render children until the client is created.\n */\n children: React.ReactNode;\n};\n\n/**\n * ClientBootstrap component. Handles creating the client.\n */\nexport function ClientBootstrap({\n serverUrl,\n options,\n children,\n}: ClientBootstrapProps): JSX.Element {\n const client = useCreateClient(serverUrl, options);\n return (\n <ClientContext.Provider value={client}>{children}</ClientContext.Provider>\n );\n}\n\nexport default ClientBootstrap;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,QAAQ,OAAO;AAAC,OAEtCC,eAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEtB,OAAO,IAAMC,aAAa,gBAAGJ,aAAa,CAAuB,IAAI,CAAC;AAgBtE;AACA;AACA;AACA,OAAO,SAASK,eAAeA,CAAAC,IAAA,EAIO;EAAA,IAJN;IAC9BC,SAAS;IACTC,OAAO;IACPC;EACoB,CAAC,GAAAH,IAAA;EACrB,IAAMI,MAAM,GAAGT,eAAe,CAACM,SAAS,EAAEC,OAAO,CAAC;EAClD,oBACEL,IAAA,CAACC,aAAa,CAACO,QAAQ;IAACC,KAAK,EAAEF,MAAO;IAAAD,QAAA,EAAEA;EAAQ,CAAyB,CAAC;AAE9E;AAEA,eAAeJ,eAAe"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { dh } from '@deephaven/jsapi-types';
|
|
3
3
|
type DeferredApiBootstrapProps = React.PropsWithChildren<{
|
|
4
4
|
onError?: (error: unknown) => void;
|
|
5
5
|
/**
|
|
@@ -7,7 +7,7 @@ type DeferredApiBootstrapProps = React.PropsWithChildren<{
|
|
|
7
7
|
* The descriptor may be extended to include session information or other data required to identify the widget.
|
|
8
8
|
* The surrounding `ObjectFetcherContext` will then be able to use that information to correctly load the widget.
|
|
9
9
|
*/
|
|
10
|
-
widget: VariableDescriptor;
|
|
10
|
+
widget: dh.ide.VariableDescriptor;
|
|
11
11
|
}>;
|
|
12
12
|
/**
|
|
13
13
|
* Does not render children until the deferred API is resolved.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeferredApiBootstrap.d.ts","sourceRoot":"","sources":["../src/DeferredApiBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"DeferredApiBootstrap.d.ts","sourceRoot":"","sources":["../src/DeferredApiBootstrap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAIjD,KAAK,yBAAyB,GAAG,KAAK,CAAC,iBAAiB,CAAC;IACvD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC;;;;OAIG;IACH,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,kBAAkB,CAAC;CACnC,CAAC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,oBAAoB,6DAK5B,yBAAyB,KAAG,WAAW,GAAG,IAAI,CAYlD,CAAC;AAIF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeferredApiBootstrap.js","names":["React","useDeferredApi","ApiContext","jsx","_jsx","DeferredApiBootstrap","memo","_ref","children","onError","widget","api","apiError","Provider","value","displayName"],"sources":["../src/DeferredApiBootstrap.tsx"],"sourcesContent":["import React from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"DeferredApiBootstrap.js","names":["React","useDeferredApi","ApiContext","jsx","_jsx","DeferredApiBootstrap","memo","_ref","children","onError","widget","api","apiError","Provider","value","displayName"],"sources":["../src/DeferredApiBootstrap.tsx"],"sourcesContent":["import React from 'react';\nimport type { dh } from '@deephaven/jsapi-types';\nimport useDeferredApi from './useDeferredApi';\nimport { ApiContext } from './ApiBootstrap';\n\ntype DeferredApiBootstrapProps = React.PropsWithChildren<{\n onError?: (error: unknown) => void;\n /**\n * Descriptor for the widget to load. Passed into an `ObjectFetcher` to load the widget.\n * The descriptor may be extended to include session information or other data required to identify the widget.\n * The surrounding `ObjectFetcherContext` will then be able to use that information to correctly load the widget.\n */\n widget: dh.ide.VariableDescriptor;\n}>;\n\n/**\n * Does not render children until the deferred API is resolved.\n */\nexport const DeferredApiBootstrap = React.memo(\n ({\n children,\n onError,\n widget,\n }: DeferredApiBootstrapProps): JSX.Element | null => {\n const [api, apiError] = useDeferredApi(widget);\n if (apiError != null) {\n onError?.(apiError);\n return null;\n }\n if (api == null) {\n // Still waiting for the API to load\n return null;\n }\n return <ApiContext.Provider value={api}>{children}</ApiContext.Provider>;\n }\n);\n\nDeferredApiBootstrap.displayName = 'DeferredApiBootstrap';\n\nexport default DeferredApiBootstrap;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAAC,OAEnBC,cAAc;AAAA,SACZC,UAAU;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAYnB;AACA;AACA;AACA,OAAO,IAAMC,oBAAoB,gBAAGL,KAAK,CAACM,IAAI,CAC5CC,IAAA,IAIqD;EAAA,IAJpD;IACCC,QAAQ;IACRC,OAAO;IACPC;EACyB,CAAC,GAAAH,IAAA;EAC1B,IAAM,CAACI,GAAG,EAAEC,QAAQ,CAAC,GAAGX,cAAc,CAACS,MAAM,CAAC;EAC9C,IAAIE,QAAQ,IAAI,IAAI,EAAE;IACpBH,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAGG,QAAQ,CAAC;IACnB,OAAO,IAAI;EACb;EACA,IAAID,GAAG,IAAI,IAAI,EAAE;IACf;IACA,OAAO,IAAI;EACb;EACA,oBAAOP,IAAA,CAACF,UAAU,CAACW,QAAQ;IAACC,KAAK,EAAEH,GAAI;IAAAH,QAAA,EAAEA;EAAQ,CAAsB,CAAC;AAC1E,CACF,CAAC;AAEDH,oBAAoB,CAACU,WAAW,GAAG,sBAAsB;AAEzD,eAAeV,oBAAoB"}
|
package/dist/useApi.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { dh
|
|
1
|
+
import type { dh } from '@deephaven/jsapi-types';
|
|
2
2
|
/**
|
|
3
3
|
* Retrieve the API for the current context.
|
|
4
4
|
* @returns The API instance from the nearest ApiContext.Provider, or throws if none is set
|
|
5
5
|
*/
|
|
6
|
-
export declare function useApi():
|
|
6
|
+
export declare function useApi(): typeof dh;
|
|
7
7
|
export default useApi;
|
|
8
8
|
//# sourceMappingURL=useApi.d.ts.map
|
package/dist/useApi.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useApi.d.ts","sourceRoot":"","sources":["../src/useApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"useApi.d.ts","sourceRoot":"","sources":["../src/useApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAIjD;;;GAGG;AACH,wBAAgB,MAAM,IAAI,OAAO,EAAE,CAKlC;AAED,eAAe,MAAM,CAAC"}
|
package/dist/useApi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useApi.js","names":["useContextOrThrow","ApiContext","useApi"],"sources":["../src/useApi.ts"],"sourcesContent":["import type { dh
|
|
1
|
+
{"version":3,"file":"useApi.js","names":["useContextOrThrow","ApiContext","useApi"],"sources":["../src/useApi.ts"],"sourcesContent":["import type { dh } from '@deephaven/jsapi-types';\nimport { useContextOrThrow } from '@deephaven/react-hooks';\nimport { ApiContext } from './ApiBootstrap';\n\n/**\n * Retrieve the API for the current context.\n * @returns The API instance from the nearest ApiContext.Provider, or throws if none is set\n */\nexport function useApi(): typeof dh {\n return useContextOrThrow(\n ApiContext,\n 'No API available in useApi. Was code wrapped in ApiBootstrap or ApiContext.Provider?'\n );\n}\n\nexport default useApi;\n"],"mappings":"AACA,SAASA,iBAAiB,QAAQ,wBAAwB;AAAC,SAClDC,UAAU;AAEnB;AACA;AACA;AACA;AACA,OAAO,SAASC,MAAMA,CAAA,EAAc;EAClC,OAAOF,iBAAiB,CACtBC,UAAU,EACV,sFACF,CAAC;AACH;AAEA,eAAeC,MAAM"}
|
package/dist/useClient.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function useClient(): CoreClient;
|
|
1
|
+
import type { dh } from '@deephaven/jsapi-types';
|
|
2
|
+
export declare function useClient(): dh.CoreClient;
|
|
3
3
|
export default useClient;
|
|
4
4
|
//# sourceMappingURL=useClient.d.ts.map
|
package/dist/useClient.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useClient.d.ts","sourceRoot":"","sources":["../src/useClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"useClient.d.ts","sourceRoot":"","sources":["../src/useClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAIjD,wBAAgB,SAAS,IAAI,EAAE,CAAC,UAAU,CAKzC;AAED,eAAe,SAAS,CAAC"}
|
package/dist/useClient.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useClient.js","names":["useContextOrThrow","ClientContext","useClient"],"sources":["../src/useClient.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"useClient.js","names":["useContextOrThrow","ClientContext","useClient"],"sources":["../src/useClient.ts"],"sourcesContent":["import type { dh } from '@deephaven/jsapi-types';\nimport { useContextOrThrow } from '@deephaven/react-hooks';\nimport { ClientContext } from './ClientBootstrap';\n\nexport function useClient(): dh.CoreClient {\n return useContextOrThrow(\n ClientContext,\n 'No Client available in useClient. Was code wrapped in ClientBootstrap or ClientContext.Provider?'\n );\n}\n\nexport default useClient;\n"],"mappings":"AACA,SAASA,iBAAiB,QAAQ,wBAAwB;AAAC,SAClDC,aAAa;AAEtB,OAAO,SAASC,SAASA,CAAA,EAAkB;EACzC,OAAOF,iBAAiB,CACtBC,aAAa,EACb,kGACF,CAAC;AACH;AAEA,eAAeC,SAAS"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function useCreateClient(serverUrl: string, options?: ConnectOptions): CoreClient;
|
|
1
|
+
import type { dh } from '@deephaven/jsapi-types';
|
|
2
|
+
export declare function useCreateClient(serverUrl: string, options?: dh.ConnectOptions): dh.CoreClient;
|
|
3
3
|
export default useCreateClient;
|
|
4
4
|
//# sourceMappingURL=useCreateClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateClient.d.ts","sourceRoot":"","sources":["../src/useCreateClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"useCreateClient.d.ts","sourceRoot":"","sources":["../src/useCreateClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAIjD,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,EAAE,CAAC,cAAc,GAC1B,EAAE,CAAC,UAAU,CAaf;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCreateClient.js","names":["useEffect","useMemo","useApi","useCreateClient","serverUrl","options","api","client","CoreClient","disconnect"],"sources":["../src/useCreateClient.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"useCreateClient.js","names":["useEffect","useMemo","useApi","useCreateClient","serverUrl","options","api","client","CoreClient","disconnect"],"sources":["../src/useCreateClient.ts"],"sourcesContent":["import type { dh } from '@deephaven/jsapi-types';\nimport { useEffect, useMemo } from 'react';\nimport useApi from './useApi';\n\nexport function useCreateClient(\n serverUrl: string,\n options?: dh.ConnectOptions\n): dh.CoreClient {\n const api = useApi();\n const client = useMemo(\n () => new api.CoreClient(serverUrl, options),\n [api, serverUrl, options]\n );\n useEffect(\n () => () => {\n client.disconnect();\n },\n [client]\n );\n return client;\n}\n\nexport default useCreateClient;\n"],"mappings":"AACA,SAASA,SAAS,EAAEC,OAAO,QAAQ,OAAO;AAAC,OACpCC,MAAM;AAEb,OAAO,SAASC,eAAeA,CAC7BC,SAAiB,EACjBC,OAA2B,EACZ;EACf,IAAMC,GAAG,GAAGJ,MAAM,CAAC,CAAC;EACpB,IAAMK,MAAM,GAAGN,OAAO,CACpB,MAAM,IAAIK,GAAG,CAACE,UAAU,CAACJ,SAAS,EAAEC,OAAO,CAAC,EAC5C,CAACC,GAAG,EAAEF,SAAS,EAAEC,OAAO,CAC1B,CAAC;EACDL,SAAS,CACP,MAAM,MAAM;IACVO,MAAM,CAACE,UAAU,CAAC,CAAC;EACrB,CAAC,EACD,CAACF,MAAM,CACT,CAAC;EACD,OAAOA,MAAM;AACf;AAEA,eAAeJ,eAAe"}
|
package/dist/useDeferredApi.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { dh as DhType
|
|
2
|
+
import type { dh as DhType } from '@deephaven/jsapi-types';
|
|
3
3
|
/**
|
|
4
4
|
* Function to fetch an API based on a provided descriptor object.
|
|
5
5
|
* Depending on the context there may be more properties on the descriptor,
|
|
@@ -7,14 +7,14 @@ import type { dh as DhType, VariableDescriptor } from '@deephaven/jsapi-types';
|
|
|
7
7
|
* @param descriptor Descriptor object to fetch the API from.
|
|
8
8
|
* @returns A promise that resolves to the API instance for the provided variable descriptor.
|
|
9
9
|
*/
|
|
10
|
-
export type DeferredApiFetcher = (descriptor: VariableDescriptor) => Promise<DhType>;
|
|
11
|
-
export declare const DeferredApiContext: import("react").Context<DhType | DeferredApiFetcher | null>;
|
|
10
|
+
export type DeferredApiFetcher = (descriptor: DhType.ide.VariableDescriptor) => Promise<typeof DhType>;
|
|
11
|
+
export declare const DeferredApiContext: import("react").Context<typeof DhType | DeferredApiFetcher | null>;
|
|
12
12
|
/**
|
|
13
13
|
* Retrieve the API for the current context, given the widget provided.
|
|
14
14
|
* The API may need to be loaded, and will return `null` until it is ready.
|
|
15
15
|
* @param widget The widget descriptor to use to fetch the API
|
|
16
16
|
* @returns A tuple with the API instance, and an error if one occurred.
|
|
17
17
|
*/
|
|
18
|
-
export declare function useDeferredApi(widget: VariableDescriptor): [DhType | null, unknown | null];
|
|
18
|
+
export declare function useDeferredApi(widget: DhType.ide.VariableDescriptor): [typeof DhType | null, unknown | null];
|
|
19
19
|
export default useDeferredApi;
|
|
20
20
|
//# sourceMappingURL=useDeferredApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDeferredApi.d.ts","sourceRoot":"","sources":["../src/useDeferredApi.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,EAAE,IAAI,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"useDeferredApi.d.ts","sourceRoot":"","sources":["../src/useDeferredApi.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAG3D;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAC/B,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,kBAAkB,KACtC,OAAO,CAAC,OAAO,MAAM,CAAC,CAAC;AAE5B,eAAO,MAAM,kBAAkB,oEAExB,CAAC;AAER;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,kBAAkB,GACpC,CAAC,OAAO,MAAM,GAAG,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC,CAkDxC;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDeferredApi.js","names":["createContext","useContext","useEffect","useState","ApiContext","DeferredApiContext","useDeferredApi","widget","api","setApi","error","setError","deferredApi","contextApi","Error","isCancelled","loadApi","_loadApi","apply","arguments","_asyncToGenerator","newApi","e"],"sources":["../src/useDeferredApi.ts"],"sourcesContent":["import { createContext, useContext, useEffect, useState } from 'react';\nimport type { dh as DhType
|
|
1
|
+
{"version":3,"file":"useDeferredApi.js","names":["createContext","useContext","useEffect","useState","ApiContext","DeferredApiContext","useDeferredApi","widget","api","setApi","error","setError","deferredApi","contextApi","Error","isCancelled","loadApi","_loadApi","apply","arguments","_asyncToGenerator","newApi","e"],"sources":["../src/useDeferredApi.ts"],"sourcesContent":["import { createContext, useContext, useEffect, useState } from 'react';\nimport type { dh as DhType } from '@deephaven/jsapi-types';\nimport { ApiContext } from './ApiBootstrap';\n\n/**\n * Function to fetch an API based on a provided descriptor object.\n * Depending on the context there may be more properties on the descriptor,\n * providing more information about the object, such as a session ID.\n * @param descriptor Descriptor object to fetch the API from.\n * @returns A promise that resolves to the API instance for the provided variable descriptor.\n */\nexport type DeferredApiFetcher = (\n descriptor: DhType.ide.VariableDescriptor\n) => Promise<typeof DhType>;\n\nexport const DeferredApiContext = createContext<\n typeof DhType | DeferredApiFetcher | null\n>(null);\n\n/**\n * Retrieve the API for the current context, given the widget provided.\n * The API may need to be loaded, and will return `null` until it is ready.\n * @param widget The widget descriptor to use to fetch the API\n * @returns A tuple with the API instance, and an error if one occurred.\n */\nexport function useDeferredApi(\n widget: DhType.ide.VariableDescriptor\n): [typeof DhType | null, unknown | null] {\n const [api, setApi] = useState<typeof DhType | null>(null);\n const [error, setError] = useState<unknown | null>(null);\n const deferredApi = useContext(DeferredApiContext);\n const contextApi = useContext(ApiContext);\n\n useEffect(() => {\n if (deferredApi == null) {\n if (contextApi != null) {\n setApi(contextApi);\n setError(null);\n return;\n }\n setApi(null);\n setError(\n new Error(\n 'No API available in useDeferredApi. Was code wrapped in ApiBootstrap or DeferredApiContext.Provider?'\n )\n );\n return;\n }\n let isCancelled = false;\n\n async function loadApi() {\n if (typeof deferredApi === 'function') {\n try {\n const newApi = await deferredApi(widget);\n if (!isCancelled) {\n setApi(newApi);\n setError(null);\n }\n } catch (e) {\n if (!isCancelled) {\n setApi(null);\n setError(e);\n }\n }\n } else {\n setApi(deferredApi);\n }\n }\n\n loadApi();\n\n return () => {\n isCancelled = true;\n };\n }, [contextApi, deferredApi, widget]);\n\n return [api, error];\n}\n\nexport default useDeferredApi;\n"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,UAAU,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAAC,SAE9DC,UAAU;AAEnB;AACA;AACA;AACA;AACA;AACA;AACA;AAKA,OAAO,IAAMC,kBAAkB,gBAAGL,aAAa,CAE7C,IAAI,CAAC;;AAEP;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,cAAcA,CAC5BC,MAAqC,EACG;EACxC,IAAM,CAACC,GAAG,EAAEC,MAAM,CAAC,GAAGN,QAAQ,CAAuB,IAAI,CAAC;EAC1D,IAAM,CAACO,KAAK,EAAEC,QAAQ,CAAC,GAAGR,QAAQ,CAAiB,IAAI,CAAC;EACxD,IAAMS,WAAW,GAAGX,UAAU,CAACI,kBAAkB,CAAC;EAClD,IAAMQ,UAAU,GAAGZ,UAAU,CAACG,UAAU,CAAC;EAEzCF,SAAS,CAAC,MAAM;IACd,IAAIU,WAAW,IAAI,IAAI,EAAE;MACvB,IAAIC,UAAU,IAAI,IAAI,EAAE;QACtBJ,MAAM,CAACI,UAAU,CAAC;QAClBF,QAAQ,CAAC,IAAI,CAAC;QACd;MACF;MACAF,MAAM,CAAC,IAAI,CAAC;MACZE,QAAQ,CACN,IAAIG,KAAK,CACP,sGACF,CACF,CAAC;MACD;IACF;IACA,IAAIC,WAAW,GAAG,KAAK;IAAC,SAETC,OAAOA,CAAA;MAAA,OAAAC,QAAA,CAAAC,KAAA,OAAAC,SAAA;IAAA;IAAA,SAAAF,SAAA;MAAAA,QAAA,GAAAG,iBAAA,CAAtB,aAAyB;QACvB,IAAI,OAAOR,WAAW,KAAK,UAAU,EAAE;UACrC,IAAI;YACF,IAAMS,MAAM,SAAST,WAAW,CAACL,MAAM,CAAC;YACxC,IAAI,CAACQ,WAAW,EAAE;cAChBN,MAAM,CAACY,MAAM,CAAC;cACdV,QAAQ,CAAC,IAAI,CAAC;YAChB;UACF,CAAC,CAAC,OAAOW,CAAC,EAAE;YACV,IAAI,CAACP,WAAW,EAAE;cAChBN,MAAM,CAAC,IAAI,CAAC;cACZE,QAAQ,CAACW,CAAC,CAAC;YACb;UACF;QACF,CAAC,MAAM;UACLb,MAAM,CAACG,WAAW,CAAC;QACrB;MACF,CAAC;MAAA,OAAAK,QAAA,CAAAC,KAAA,OAAAC,SAAA;IAAA;IAEDH,OAAO,CAAC,CAAC;IAET,OAAO,MAAM;MACXD,WAAW,GAAG,IAAI;IACpB,CAAC;EACH,CAAC,EAAE,CAACF,UAAU,EAAED,WAAW,EAAEL,MAAM,CAAC,CAAC;EAErC,OAAO,CAACC,GAAG,EAAEE,KAAK,CAAC;AACrB;AAEA,eAAeJ,cAAc"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import type { dh } from '@deephaven/jsapi-types';
|
|
3
3
|
/**
|
|
4
4
|
* Descriptor for a variable by name. Used when needed to fetch an object.
|
|
5
5
|
*/
|
|
@@ -20,13 +20,13 @@ export type IdVariableDescriptor = {
|
|
|
20
20
|
};
|
|
21
21
|
export declare function isNameVariableDescriptor(value: unknown): value is NameVariableDescriptor;
|
|
22
22
|
export declare function isIdVariableDescriptor(value: unknown): value is IdVariableDescriptor;
|
|
23
|
-
export declare function isVariableDescriptor(value: unknown): value is VariableDescriptor;
|
|
23
|
+
export declare function isVariableDescriptor(value: unknown): value is dh.ide.VariableDescriptor;
|
|
24
24
|
/**
|
|
25
25
|
* Function to fetch an object based on a provided descriptor object.
|
|
26
26
|
* @param descriptor Descriptor object to fetch the object from. Can be extended by a specific implementation to
|
|
27
27
|
* include additional fields (such as a session ID) to uniquely identify an object.
|
|
28
28
|
*/
|
|
29
|
-
export type ObjectFetcher = <T = unknown>(descriptor: VariableDescriptor) => Promise<T>;
|
|
29
|
+
export type ObjectFetcher = <T = unknown>(descriptor: dh.ide.VariableDescriptor) => Promise<T>;
|
|
30
30
|
export declare const ObjectFetcherContext: import("react").Context<ObjectFetcher | null>;
|
|
31
31
|
/**
|
|
32
32
|
* Gets a descriptor that only has the ID or name set, but not both.
|
|
@@ -34,13 +34,15 @@ export declare const ObjectFetcherContext: import("react").Context<ObjectFetcher
|
|
|
34
34
|
* @param descriptor Variable descriptor to sanitize
|
|
35
35
|
* @returns Descriptor object that has either the ID or name set, but not both.
|
|
36
36
|
*/
|
|
37
|
-
export declare function sanitizeVariableDescriptor(descriptor: Partial<VariableDescriptor>): NameVariableDescriptor | IdVariableDescriptor;
|
|
37
|
+
export declare function sanitizeVariableDescriptor(descriptor: Partial<dh.ide.VariableDescriptor>): NameVariableDescriptor | IdVariableDescriptor;
|
|
38
38
|
/**
|
|
39
39
|
* Get the variable descriptor for a definition.
|
|
40
40
|
* @param definition Definition to get the variable descriptor from
|
|
41
41
|
* @returns Serializable VariableDescriptor object
|
|
42
42
|
*/
|
|
43
|
-
export declare function getVariableDescriptor(definition:
|
|
43
|
+
export declare function getVariableDescriptor(definition: dh.ide.VariableDescriptor & {
|
|
44
|
+
title?: string;
|
|
45
|
+
}): dh.ide.VariableDescriptor;
|
|
44
46
|
/**
|
|
45
47
|
* Use a function to fetch an object based on provided metadata
|
|
46
48
|
* @returns Function to asynchronously fetch an object based on provided metadata
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useObjectFetcher.d.ts","sourceRoot":"","sources":["../src/useObjectFetcher.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useObjectFetcher.d.ts","sourceRoot":"","sources":["../src/useObjectFetcher.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAIjD;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,yBAAyB;IACzB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,sBAAsB,CAOjC;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,oBAAoB,CAO/B;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,EAAE,CAAC,GAAG,CAAC,kBAAkB,CAEpC;AAED;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,GAAG,OAAO,EACtC,UAAU,EAAE,EAAE,CAAC,GAAG,CAAC,kBAAkB,KAClC,OAAO,CAAC,CAAC,CAAC,CAAC;AAEhB,eAAO,MAAM,oBAAoB,+CAA4C,CAAC;AAE9E;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,kBAAkB,CAAC,GAC7C,sBAAsB,GAAG,oBAAoB,CAe/C;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,EAAE,CAAC,GAAG,CAAC,kBAAkB,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GACzD,EAAE,CAAC,GAAG,CAAC,kBAAkB,CAM3B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CAKhD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useObjectFetcher.js","names":["useContextOrThrow","createContext","isNameVariableDescriptor","value","type","name","isIdVariableDescriptor","id","isVariableDescriptor","ObjectFetcherContext","sanitizeVariableDescriptor","descriptor","_descriptor$name","Error","concat","getVariableDescriptor","definition","_definition$type","_definition$title","title","useObjectFetcher"],"sources":["../src/useObjectFetcher.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"useObjectFetcher.js","names":["useContextOrThrow","createContext","isNameVariableDescriptor","value","type","name","isIdVariableDescriptor","id","isVariableDescriptor","ObjectFetcherContext","sanitizeVariableDescriptor","descriptor","_descriptor$name","Error","concat","getVariableDescriptor","definition","_definition$type","_definition$title","title","useObjectFetcher"],"sources":["../src/useObjectFetcher.ts"],"sourcesContent":["import type { dh } from '@deephaven/jsapi-types';\nimport { useContextOrThrow } from '@deephaven/react-hooks';\nimport { createContext } from 'react';\n\n/**\n * Descriptor for a variable by name. Used when needed to fetch an object.\n */\nexport type NameVariableDescriptor = {\n /** Type of the variable */\n type: string;\n /** Name of the variable */\n name: string;\n};\n\n/**\n * Descriptor for a variable by id. Used when needed to fetch an object.\n */\nexport type IdVariableDescriptor = {\n /** Type of the variable */\n type: string;\n /** Id of the variable */\n id: string;\n};\n\nexport function isNameVariableDescriptor(\n value: unknown\n): value is NameVariableDescriptor {\n return (\n typeof value === 'object' &&\n value != null &&\n typeof (value as NameVariableDescriptor).type === 'string' &&\n (value as NameVariableDescriptor).name != null\n );\n}\n\nexport function isIdVariableDescriptor(\n value: unknown\n): value is IdVariableDescriptor {\n return (\n typeof value === 'object' &&\n value != null &&\n typeof (value as IdVariableDescriptor).type === 'string' &&\n (value as IdVariableDescriptor).id != null\n );\n}\n\nexport function isVariableDescriptor(\n value: unknown\n): value is dh.ide.VariableDescriptor {\n return isNameVariableDescriptor(value) || isIdVariableDescriptor(value);\n}\n\n/**\n * Function to fetch an object based on a provided descriptor object.\n * @param descriptor Descriptor object to fetch the object from. Can be extended by a specific implementation to\n * include additional fields (such as a session ID) to uniquely identify an object.\n */\nexport type ObjectFetcher = <T = unknown>(\n descriptor: dh.ide.VariableDescriptor\n) => Promise<T>;\n\nexport const ObjectFetcherContext = createContext<ObjectFetcher | null>(null);\n\n/**\n * Gets a descriptor that only has the ID or name set, but not both.\n * API will throw an error if both are set when fetching from the connection.\n * @param descriptor Variable descriptor to sanitize\n * @returns Descriptor object that has either the ID or name set, but not both.\n */\nexport function sanitizeVariableDescriptor(\n descriptor: Partial<dh.ide.VariableDescriptor>\n): NameVariableDescriptor | IdVariableDescriptor {\n // Can't use a spread operator because of how the GWT compiled code defines properties on the object: https://github.com/gwtproject/gwt/issues/9913\n if (isIdVariableDescriptor(descriptor)) {\n return {\n id: descriptor.id,\n type: descriptor.type,\n };\n }\n if (isNameVariableDescriptor(descriptor)) {\n return {\n name: descriptor.name ?? '',\n type: descriptor.type,\n };\n }\n throw new Error(`Invalid descriptor: ${descriptor}`);\n}\n\n/**\n * Get the variable descriptor for a definition.\n * @param definition Definition to get the variable descriptor from\n * @returns Serializable VariableDescriptor object\n */\nexport function getVariableDescriptor(\n definition: dh.ide.VariableDescriptor & { title?: string }\n): dh.ide.VariableDescriptor {\n return {\n type: definition.type ?? '',\n name: definition.title ?? definition.name,\n id: definition.id,\n };\n}\n\n/**\n * Use a function to fetch an object based on provided metadata\n * @returns Function to asynchronously fetch an object based on provided metadata\n */\nexport function useObjectFetcher(): ObjectFetcher {\n return useContextOrThrow(\n ObjectFetcherContext,\n 'No ObjectFetcher available in useObjectFetcher. Was code wrapped in ObjectFetcherContext.Provider?'\n );\n}\n"],"mappings":"AACA,SAASA,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,aAAa,QAAQ,OAAO;;AAErC;AACA;AACA;;AAQA;AACA;AACA;;AAQA,OAAO,SAASC,wBAAwBA,CACtCC,KAAc,EACmB;EACjC,OACE,OAAOA,KAAK,KAAK,QAAQ,IACzBA,KAAK,IAAI,IAAI,IACb,OAAQA,KAAK,CAA4BC,IAAI,KAAK,QAAQ,IACzDD,KAAK,CAA4BE,IAAI,IAAI,IAAI;AAElD;AAEA,OAAO,SAASC,sBAAsBA,CACpCH,KAAc,EACiB;EAC/B,OACE,OAAOA,KAAK,KAAK,QAAQ,IACzBA,KAAK,IAAI,IAAI,IACb,OAAQA,KAAK,CAA0BC,IAAI,KAAK,QAAQ,IACvDD,KAAK,CAA0BI,EAAE,IAAI,IAAI;AAE9C;AAEA,OAAO,SAASC,oBAAoBA,CAClCL,KAAc,EACsB;EACpC,OAAOD,wBAAwB,CAACC,KAAK,CAAC,IAAIG,sBAAsB,CAACH,KAAK,CAAC;AACzE;;AAEA;AACA;AACA;AACA;AACA;;AAKA,OAAO,IAAMM,oBAAoB,gBAAGR,aAAa,CAAuB,IAAI,CAAC;;AAE7E;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASS,0BAA0BA,CACxCC,UAA8C,EACC;EAC/C;EACA,IAAIL,sBAAsB,CAACK,UAAU,CAAC,EAAE;IACtC,OAAO;MACLJ,EAAE,EAAEI,UAAU,CAACJ,EAAE;MACjBH,IAAI,EAAEO,UAAU,CAACP;IACnB,CAAC;EACH;EACA,IAAIF,wBAAwB,CAACS,UAAU,CAAC,EAAE;IAAA,IAAAC,gBAAA;IACxC,OAAO;MACLP,IAAI,GAAAO,gBAAA,GAAED,UAAU,CAACN,IAAI,cAAAO,gBAAA,cAAAA,gBAAA,GAAI,EAAE;MAC3BR,IAAI,EAAEO,UAAU,CAACP;IACnB,CAAC;EACH;EACA,MAAM,IAAIS,KAAK,wBAAAC,MAAA,CAAwBH,UAAU,CAAE,CAAC;AACtD;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,qBAAqBA,CACnCC,UAA0D,EAC/B;EAAA,IAAAC,gBAAA,EAAAC,iBAAA;EAC3B,OAAO;IACLd,IAAI,GAAAa,gBAAA,GAAED,UAAU,CAACZ,IAAI,cAAAa,gBAAA,cAAAA,gBAAA,GAAI,EAAE;IAC3BZ,IAAI,GAAAa,iBAAA,GAAEF,UAAU,CAACG,KAAK,cAAAD,iBAAA,cAAAA,iBAAA,GAAIF,UAAU,CAACX,IAAI;IACzCE,EAAE,EAAES,UAAU,CAACT;EACjB,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASa,gBAAgBA,CAAA,EAAkB;EAChD,OAAOpB,iBAAiB,CACtBS,oBAAoB,EACpB,oGACF,CAAC;AACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deephaven/jsapi-bootstrap",
|
|
3
|
-
"version": "0.67.
|
|
3
|
+
"version": "0.67.1-beta.1+1ce6aac8",
|
|
4
4
|
"description": "Deephaven JSAPI Bootstrap",
|
|
5
5
|
"author": "Deephaven Data Labs LLC",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"build:sass": "sass --embed-sources --load-path=../../node_modules ./src:./dist"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@deephaven/components": "^0.67.
|
|
26
|
-
"@deephaven/jsapi-types": "
|
|
27
|
-
"@deephaven/log": "^0.67.
|
|
28
|
-
"@deephaven/react-hooks": "^0.67.
|
|
25
|
+
"@deephaven/components": "^0.67.1-beta.1+1ce6aac8",
|
|
26
|
+
"@deephaven/jsapi-types": "1.0.0-dev0.33.1",
|
|
27
|
+
"@deephaven/log": "^0.67.1-beta.1+1ce6aac8",
|
|
28
|
+
"@deephaven/react-hooks": "^0.67.1-beta.1+1ce6aac8"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"react": "^17.x"
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "1ce6aac82071303fdbed064e8b71b54f741d0a87"
|
|
44
44
|
}
|