@deephaven-enterprise/query-utils 2026.1.42 → 2026.1.44
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/README.md +7 -0
- package/dist/DraftQuery.d.ts +1 -1
- package/dist/DraftQuery.js +5 -5
- package/dist/EditableQueryInfoUtils.d.ts +2 -2
- package/dist/QueryPermissions.d.ts +1 -1
- package/dist/QueryPermissions.js +4 -4
- package/dist/QuerySchedulerValidation.d.ts +1 -1
- package/dist/QuerySchedulerValidation.js +1 -1
- package/dist/QueryStateUtils.d.ts +3 -1
- package/dist/QueryStateUtils.js +19 -12
- package/dist/QueryUtils.d.ts +63 -3
- package/dist/QueryUtils.js +123 -4
- package/dist/index.d.ts +21 -15
- package/dist/index.js +14 -15
- package/package.json +4 -3
- package/dist/CorePlusManager.d.ts +0 -47
- package/dist/CorePlusManager.js +0 -1
package/README.md
ADDED
package/dist/DraftQuery.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PlainEditableQueryInfo, TypeSpecificFields } from '@deephaven-enterprise/jsapi-types';
|
|
2
|
-
import QueryScheduler from './QueryScheduler';
|
|
2
|
+
import QueryScheduler from './QueryScheduler.ts';
|
|
3
3
|
export type ScriptDraftQuery = IDraftQuery & {
|
|
4
4
|
scriptLanguage: string;
|
|
5
5
|
};
|
package/dist/DraftQuery.js
CHANGED
|
@@ -12,11 +12,11 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
12
12
|
var _DraftQuery_envVarEntries, _DraftQuery_jvmArguments, _DraftQuery_classpathAdditions;
|
|
13
13
|
/* eslint-disable no-param-reassign */
|
|
14
14
|
import { nanoid } from 'nanoid';
|
|
15
|
-
import { joinClasspathAdditions, joinEnvVarEntries, splitClasspathAdditions, splitEnvVarEntries, tokenizeArgs, } from
|
|
16
|
-
import QueryColumns from
|
|
17
|
-
import QueryScheduler from
|
|
18
|
-
import { QueryType } from
|
|
19
|
-
import WorkerThreadUtils from
|
|
15
|
+
import { joinClasspathAdditions, joinEnvVarEntries, splitClasspathAdditions, splitEnvVarEntries, tokenizeArgs, } from "./ArgumentUtils.js";
|
|
16
|
+
import QueryColumns from "./QueryColumns.js";
|
|
17
|
+
import QueryScheduler from "./QueryScheduler.js";
|
|
18
|
+
import { QueryType } from "./QueryType.js";
|
|
19
|
+
import WorkerThreadUtils from "./WorkerThreadUtils.js";
|
|
20
20
|
const DRAFT_SERIAL_PREFIX = 'Draft ID: ';
|
|
21
21
|
/**
|
|
22
22
|
* A Draft Query is a client side object that contains mutable data for a Peristent Query along with some metadata.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EditableQueryInfo, PlainEditableQueryInfo } from '@deephaven-enterprise/jsapi-types';
|
|
2
|
-
import type DraftQuery from './DraftQuery';
|
|
3
|
-
import type { ScriptDraftQuery } from './DraftQuery';
|
|
2
|
+
import type DraftQuery from './DraftQuery.ts';
|
|
3
|
+
import type { ScriptDraftQuery } from './DraftQuery.ts';
|
|
4
4
|
declare const FIELDS: {
|
|
5
5
|
readonly SCRIPT_LANGUAGE: "scriptLanguage";
|
|
6
6
|
readonly SCRIPT_PATH: "scriptPath";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { EnterpriseUser, QueryConfigurationType, QueryInfo, QuerySelectionPermissions } from '@deephaven-enterprise/jsapi-types';
|
|
2
|
-
import DraftQuery from './DraftQuery';
|
|
2
|
+
import DraftQuery from './DraftQuery.ts';
|
|
3
3
|
export declare const RESTART_USERS: Readonly<{
|
|
4
4
|
readonly RESTARTUSERS_ADMIN: 1;
|
|
5
5
|
readonly RESTARTUSERS_ADMINANDVIEWERS: 2;
|
package/dist/QueryPermissions.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import DraftQuery from
|
|
2
|
-
import { QueryScheduler } from
|
|
3
|
-
import { checkAllReplicas, isRunningForRestart, isStoppedForPermissions, } from
|
|
4
|
-
import { getQuerySchedulerType } from
|
|
1
|
+
import DraftQuery from "./DraftQuery.js";
|
|
2
|
+
import { QueryScheduler } from "./QueryScheduler.js";
|
|
3
|
+
import { checkAllReplicas, isRunningForRestart, isStoppedForPermissions, } from "./QueryStateUtils.js";
|
|
4
|
+
import { getQuerySchedulerType } from "./QueryUtils.js";
|
|
5
5
|
export const RESTART_USERS = Object.freeze({
|
|
6
6
|
RESTARTUSERS_ADMIN: 1,
|
|
7
7
|
RESTARTUSERS_ADMINANDVIEWERS: 2,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { dh } from '@deephaven/jsapi-types';
|
|
2
2
|
import type { QueryInfo } from '@deephaven-enterprise/jsapi-types';
|
|
3
|
-
import type DraftQuery from './DraftQuery';
|
|
3
|
+
import type DraftQuery from './DraftQuery.ts';
|
|
4
4
|
export type QueryInfoMap = Map<string, QueryInfo>;
|
|
5
5
|
export declare const NON_RUNNING_STATUSES: Set<string>;
|
|
6
6
|
/**
|
|
@@ -13,6 +13,8 @@ export declare function isEnableable(queryInfoMap: QueryInfoMap, serial: string)
|
|
|
13
13
|
export declare function isDisableable(queryInfoMap: QueryInfoMap, serial: string): boolean;
|
|
14
14
|
export declare function isRestartable(queryInfoMap: QueryInfoMap | undefined, serial: string): boolean;
|
|
15
15
|
export declare function isStartable(queryInfoMap: QueryInfoMap | undefined, serial: string): boolean;
|
|
16
|
+
export declare function isQueryStartable(query: QueryInfo): boolean;
|
|
17
|
+
export declare function isQueryRestartable(query: QueryInfo): boolean;
|
|
16
18
|
export declare function isStoppable(queryInfoMap: QueryInfoMap | undefined, serial: string): boolean;
|
|
17
19
|
export declare function isRunning(query: QueryInfo): boolean;
|
|
18
20
|
export declare function isWebClient(query: QueryInfo): boolean;
|
package/dist/QueryStateUtils.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { QueryColumns } from
|
|
2
|
-
import { QueryScheduler } from
|
|
3
|
-
import { QueryStatus } from
|
|
4
|
-
import { QueryType } from
|
|
5
|
-
import { WEB_CLIENT_DATA_CORE_CONFIG_TYPE } from
|
|
1
|
+
import { QueryColumns } from "./QueryColumns.js";
|
|
2
|
+
import { QueryScheduler } from "./QueryScheduler.js";
|
|
3
|
+
import { QueryStatus } from "./QueryStatus.js";
|
|
4
|
+
import { QueryType } from "./QueryType.js";
|
|
5
|
+
import { WEB_CLIENT_DATA_CORE_CONFIG_TYPE } from "./QueryUtils.js";
|
|
6
6
|
export const NON_RUNNING_STATUSES = new Set([
|
|
7
7
|
QueryStatus.uninitialized,
|
|
8
8
|
QueryStatus.stopped,
|
|
@@ -43,16 +43,23 @@ export function isRestartable(queryInfoMap, serial) {
|
|
|
43
43
|
const query = queryInfoMap === null || queryInfoMap === void 0 ? void 0 : queryInfoMap.get(serial);
|
|
44
44
|
if (query == null)
|
|
45
45
|
return false;
|
|
46
|
-
return (query
|
|
47
|
-
query.type !== QueryType.INTERACTIVE_CONSOLE &&
|
|
48
|
-
query.type !== QueryType.SCHEMA_API);
|
|
46
|
+
return isQueryRestartable(query);
|
|
49
47
|
}
|
|
50
48
|
export function isStartable(queryInfoMap, serial) {
|
|
51
|
-
var _a, _b;
|
|
52
49
|
const query = queryInfoMap === null || queryInfoMap === void 0 ? void 0 : queryInfoMap.get(serial);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
if (query == null)
|
|
51
|
+
return false;
|
|
52
|
+
return isQueryStartable(query);
|
|
53
|
+
}
|
|
54
|
+
export function isQueryStartable(query) {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
return (isQueryRestartable(query) &&
|
|
57
|
+
NON_RUNNING_STATUSES.has((_b = (_a = query.designated) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : QueryStatus.none));
|
|
58
|
+
}
|
|
59
|
+
export function isQueryRestartable(query) {
|
|
60
|
+
return (query.enabled === true &&
|
|
61
|
+
query.type !== QueryType.INTERACTIVE_CONSOLE &&
|
|
62
|
+
query.type !== QueryType.SCHEMA_API);
|
|
56
63
|
}
|
|
57
64
|
export function isStoppable(queryInfoMap, serial) {
|
|
58
65
|
var _a, _b;
|
package/dist/QueryUtils.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { dh } from '@deephaven/jsapi-types';
|
|
2
|
-
import type { EnterpriseClient, EnterpriseDhType, QueryConfigurationType, QueryInfo, QueryVariableDescriptor, ReplicaStatus, UserInfo } from '@deephaven-enterprise/jsapi-types';
|
|
2
|
+
import type { EnterpriseClient, EnterpriseDhType, EnterpriseUser, QueryConfigurationType, QueryInfo, QueryVariableDescriptor, ReplicaStatus, UserInfo } from '@deephaven-enterprise/jsapi-types';
|
|
3
3
|
import { type Brand } from '@deephaven/utils';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import { type AuthenticatedEnterpriseClient, type CorePlusManager } from '@deephaven-enterprise/client-utils';
|
|
5
|
+
import DraftQuery, { type DraftQueryConstructorObject } from './DraftQuery.ts';
|
|
6
|
+
import { QueryType } from './index.ts';
|
|
6
7
|
export type ConsoleType = 'groovy' | 'python';
|
|
8
|
+
export type InteractiveConsoleConfig = {
|
|
9
|
+
type?: typeof QueryType.INTERACTIVE_CONSOLE;
|
|
10
|
+
name: string;
|
|
11
|
+
} & Partial<Omit<TemporaryDraftQueryConfig, 'type' | 'name'>>;
|
|
7
12
|
export type QuerySerial = Brand<'QuerySerial', string>;
|
|
8
13
|
export type UriVariableDescriptor = string;
|
|
9
14
|
export declare const DEFAULT_TEMPORARY_QUERY_AUTO_DELETE_TIMEOUT_MS: 600000;
|
|
@@ -36,6 +41,40 @@ export type WebClientData2Response = {
|
|
|
36
41
|
export type WebClientData2WriteResponse = WebClientData2Response & {
|
|
37
42
|
uuids: string[];
|
|
38
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* Creates an interactive console query and returns the Core+ connection for it.
|
|
46
|
+
* @param corePlusManager The Core+ manager instance
|
|
47
|
+
* @param config Configuration for the interactive console query
|
|
48
|
+
* @returns A promise that resolves to the Core+ connection + query info for the
|
|
49
|
+
* interactive console query
|
|
50
|
+
*/
|
|
51
|
+
export declare function createInteractiveConsoleQuery(corePlusManager: CorePlusManager, config: InteractiveConsoleConfig): Promise<{
|
|
52
|
+
cn: dh.IdeConnection;
|
|
53
|
+
query: QueryInfo;
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* Creates a temporary draft query for an interactive console.
|
|
57
|
+
* @param dheClient Authenticated Core+ client
|
|
58
|
+
* @param config Configuration object for the temporary draft query
|
|
59
|
+
* @returns A configured DraftQuery instance ready to be created
|
|
60
|
+
*/
|
|
61
|
+
export declare function createInteractiveConsoleDraftQuery(dheClient: AuthenticatedEnterpriseClient, config: InteractiveConsoleConfig): Promise<DraftQuery>;
|
|
62
|
+
/**
|
|
63
|
+
* Create a viewport subscription to the WebClientData QueryInfo table.
|
|
64
|
+
* @param columnNames Names of the columns to fetch
|
|
65
|
+
* @param corePlusManager CorePlus manager for worker connections
|
|
66
|
+
* @param rows Rows to fetch (optional, will fetch all if not provided)
|
|
67
|
+
* @param userInfo User information (optional, will fetch if not provided)
|
|
68
|
+
* @param tableName Table name to get (default: QUERY_CONFIG_TABLE)
|
|
69
|
+
* @returns A Promise that resolves to the fetched viewport subscription
|
|
70
|
+
*/
|
|
71
|
+
export declare function createQueryConfigViewportSubscription({ columnNames, corePlusManager, rows, userInfo, tableName, }: {
|
|
72
|
+
columnNames: string[];
|
|
73
|
+
corePlusManager: CorePlusManager;
|
|
74
|
+
rows?: dh.RangeSet | dh.SimpleRange;
|
|
75
|
+
userInfo?: UserInfo;
|
|
76
|
+
tableName?: string;
|
|
77
|
+
}): Promise<dh.TableViewportSubscription>;
|
|
39
78
|
/**
|
|
40
79
|
* Creates a temporary draft query with auto-delete enabled.
|
|
41
80
|
*
|
|
@@ -55,6 +94,18 @@ export type WebClientData2WriteResponse = WebClientData2Response & {
|
|
|
55
94
|
* @returns A configured DraftQuery instance ready to be created
|
|
56
95
|
*/
|
|
57
96
|
export declare function createTemporaryDraftQuery({ additionalMemory, engine, heapSize, isClientSide, isCommunityWorker, initializationThreads, updateThreads, timeout, ...config }: TemporaryDraftQueryConfig): DraftQuery;
|
|
97
|
+
/**
|
|
98
|
+
* Fetch the WebClientData QueryInfo table from the WebClientTableFactory widget.
|
|
99
|
+
* @param corePlusManager CorePlus manager for worker connections
|
|
100
|
+
* @param userInfo User information (optional, will fetch if not provided)
|
|
101
|
+
* @param tableName Table name to get (default: QUERY_CONFIG_TABLE)
|
|
102
|
+
* @returns A Promise that resolves to the fetched table
|
|
103
|
+
*/
|
|
104
|
+
export declare function fetchQueryConfigTable({ corePlusManager, userInfo, tableName, }: {
|
|
105
|
+
corePlusManager: CorePlusManager;
|
|
106
|
+
userInfo?: UserInfo;
|
|
107
|
+
tableName?: string;
|
|
108
|
+
}): Promise<dh.Table>;
|
|
58
109
|
/**
|
|
59
110
|
* Gets the Core+ connection for a given query.
|
|
60
111
|
*
|
|
@@ -89,6 +140,13 @@ export declare function getQueryInfoForNameOrSerial({ client, dh, queryNameOrSer
|
|
|
89
140
|
* @returns Resolves to the object definition
|
|
90
141
|
*/
|
|
91
142
|
export declare function getQueryObjectDefinitionByName(query: QueryInfo, name: string): dh.ide.VariableDefinition;
|
|
143
|
+
/**
|
|
144
|
+
* Check whether the user has permission to start (or restart) the given query.
|
|
145
|
+
* @param user The user to check permissions for
|
|
146
|
+
* @param query The query to check
|
|
147
|
+
* @returns True if the user is permitted to start/restart the query
|
|
148
|
+
*/
|
|
149
|
+
export declare function hasPermissionToStart(user: EnterpriseUser, query: QueryInfo): boolean;
|
|
92
150
|
/**
|
|
93
151
|
* Get replica or spare worker for a given slot. If slot is null, returns the designated worker.
|
|
94
152
|
* @param query Query to get the worker from
|
|
@@ -133,6 +191,8 @@ export declare function makeDescriptorFromUri({ client, dh, uri, }: {
|
|
|
133
191
|
}): Promise<QueryVariableDescriptor>;
|
|
134
192
|
/**
|
|
135
193
|
* Get a table from the WebClientData Core+ WebClientTableFactoryService
|
|
194
|
+
* @deprecated Use fetchQueryConfigTable instead. This function will be removed in
|
|
195
|
+
* a future release.
|
|
136
196
|
* @param params Function parameters
|
|
137
197
|
* @param params.client Enterprise client
|
|
138
198
|
* @param params.corePlusManager CorePlus manager for worker connections
|
package/dist/QueryUtils.js
CHANGED
|
@@ -9,12 +9,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { InvalidMetadataError } from '@deephaven/utils';
|
|
12
|
+
import { assertNotNull, InvalidMetadataError, } from '@deephaven/utils';
|
|
13
13
|
import Log from '@deephaven/log';
|
|
14
14
|
import { nanoid } from 'nanoid';
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
15
|
+
import { isCommunityWorkerKind, } from '@deephaven-enterprise/client-utils';
|
|
16
|
+
import QueryScheduler from "./QueryScheduler.js";
|
|
17
|
+
import DraftQuery from "./DraftQuery.js";
|
|
18
|
+
import { QueryStatus } from "./QueryStatus.js";
|
|
19
|
+
import { QueryType } from "./index.js";
|
|
20
|
+
import { getQuerySelectionPermissions } from "./QueryPermissions.js";
|
|
18
21
|
const log = Log.module('QueryUtils');
|
|
19
22
|
// 600 seconds is based on default `auto_delete_timeout` in
|
|
20
23
|
// `ControllerClient.make_temporary_config`
|
|
@@ -42,6 +45,79 @@ export const FACTORY_SERVICE_TABLES = new Set([
|
|
|
42
45
|
SCOPE_CONFIG_TABLE,
|
|
43
46
|
CATALOG_TABLE,
|
|
44
47
|
]);
|
|
48
|
+
/**
|
|
49
|
+
* Creates an interactive console query and returns the Core+ connection for it.
|
|
50
|
+
* @param corePlusManager The Core+ manager instance
|
|
51
|
+
* @param config Configuration for the interactive console query
|
|
52
|
+
* @returns A promise that resolves to the Core+ connection + query info for the
|
|
53
|
+
* interactive console query
|
|
54
|
+
*/
|
|
55
|
+
export async function createInteractiveConsoleQuery(corePlusManager, config) {
|
|
56
|
+
const { dhe, dheClient } = corePlusManager;
|
|
57
|
+
const draftQuery = await createInteractiveConsoleDraftQuery(dheClient, config);
|
|
58
|
+
const query = await startQuery(dhe, dheClient, draftQuery);
|
|
59
|
+
const cn = await getCoreConnection({
|
|
60
|
+
query,
|
|
61
|
+
corePlusManager,
|
|
62
|
+
});
|
|
63
|
+
return {
|
|
64
|
+
cn,
|
|
65
|
+
query,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Creates a temporary draft query for an interactive console.
|
|
70
|
+
* @param dheClient Authenticated Core+ client
|
|
71
|
+
* @param config Configuration object for the temporary draft query
|
|
72
|
+
* @returns A configured DraftQuery instance ready to be created
|
|
73
|
+
*/
|
|
74
|
+
export async function createInteractiveConsoleDraftQuery(dheClient, config) {
|
|
75
|
+
var _a, _b, _c;
|
|
76
|
+
let { dbServerName, draftOwner, engine, owner } = config,
|
|
77
|
+
// eslint-disable-next-line prefer-const
|
|
78
|
+
rest = __rest(config, ["dbServerName", "draftOwner", "engine", "owner"]);
|
|
79
|
+
if (draftOwner == null || owner == null) {
|
|
80
|
+
const userInfo = await dheClient.getUserInfo();
|
|
81
|
+
draftOwner = draftOwner !== null && draftOwner !== void 0 ? draftOwner : userInfo.operateAs;
|
|
82
|
+
owner = owner !== null && owner !== void 0 ? owner : userInfo.operateAs;
|
|
83
|
+
}
|
|
84
|
+
if (dbServerName == null) {
|
|
85
|
+
const dbServers = await dheClient.getDbServers();
|
|
86
|
+
// eslint-disable-next-line no-param-reassign
|
|
87
|
+
dbServerName = (_b = (_a = dbServers[0]) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : 'Query 1';
|
|
88
|
+
}
|
|
89
|
+
if (engine == null) {
|
|
90
|
+
const { workerKinds } = await dheClient.getServerConfigValues();
|
|
91
|
+
// eslint-disable-next-line no-param-reassign
|
|
92
|
+
engine = (_c = workerKinds.find(isCommunityWorkerKind)) === null || _c === void 0 ? void 0 : _c.name;
|
|
93
|
+
assertNotNull(engine, 'No community worker kind found');
|
|
94
|
+
}
|
|
95
|
+
return createTemporaryDraftQuery(Object.assign({ type: QueryType.INTERACTIVE_CONSOLE, dbServerName,
|
|
96
|
+
draftOwner,
|
|
97
|
+
engine, isCommunityWorker: true, owner, scriptLanguage: 'Python' }, rest));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Create a viewport subscription to the WebClientData QueryInfo table.
|
|
101
|
+
* @param columnNames Names of the columns to fetch
|
|
102
|
+
* @param corePlusManager CorePlus manager for worker connections
|
|
103
|
+
* @param rows Rows to fetch (optional, will fetch all if not provided)
|
|
104
|
+
* @param userInfo User information (optional, will fetch if not provided)
|
|
105
|
+
* @param tableName Table name to get (default: QUERY_CONFIG_TABLE)
|
|
106
|
+
* @returns A Promise that resolves to the fetched viewport subscription
|
|
107
|
+
*/
|
|
108
|
+
export async function createQueryConfigViewportSubscription({ columnNames, corePlusManager, rows, userInfo, tableName = QUERY_CONFIG_TABLE, }) {
|
|
109
|
+
const queryConfigTable = await fetchQueryConfigTable({
|
|
110
|
+
corePlusManager,
|
|
111
|
+
userInfo,
|
|
112
|
+
tableName,
|
|
113
|
+
});
|
|
114
|
+
const columns = columnNames.map(name => queryConfigTable.findColumn(name));
|
|
115
|
+
const subscription = queryConfigTable.createViewportSubscription({
|
|
116
|
+
rows: rows !== null && rows !== void 0 ? rows : { first: 0, last: queryConfigTable.size },
|
|
117
|
+
columns,
|
|
118
|
+
});
|
|
119
|
+
return subscription;
|
|
120
|
+
}
|
|
45
121
|
/**
|
|
46
122
|
* Creates a temporary draft query with auto-delete enabled.
|
|
47
123
|
*
|
|
@@ -77,6 +153,38 @@ export function createTemporaryDraftQuery(_a) {
|
|
|
77
153
|
draftQuery.updateSchedule();
|
|
78
154
|
return draftQuery;
|
|
79
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Fetch the WebClientData QueryInfo table from the WebClientTableFactory widget.
|
|
158
|
+
* @param corePlusManager CorePlus manager for worker connections
|
|
159
|
+
* @param userInfo User information (optional, will fetch if not provided)
|
|
160
|
+
* @param tableName Table name to get (default: QUERY_CONFIG_TABLE)
|
|
161
|
+
* @returns A Promise that resolves to the fetched table
|
|
162
|
+
*/
|
|
163
|
+
export async function fetchQueryConfigTable({ corePlusManager, userInfo, tableName = QUERY_CONFIG_TABLE, }) {
|
|
164
|
+
const { dhe, dheClient } = corePlusManager;
|
|
165
|
+
// This message id is used to correlate the message sent to the workspace widget
|
|
166
|
+
const messageId = nanoid();
|
|
167
|
+
const { operateAs } = userInfo !== null && userInfo !== void 0 ? userInfo : (await dheClient.getUserInfo());
|
|
168
|
+
const message = JSON.stringify({
|
|
169
|
+
id: messageId,
|
|
170
|
+
user: operateAs,
|
|
171
|
+
tableNames: [tableName],
|
|
172
|
+
});
|
|
173
|
+
const [, eventDetail] = await sendWebClientData2Message({
|
|
174
|
+
client: dheClient,
|
|
175
|
+
corePlusManager,
|
|
176
|
+
dh: dhe,
|
|
177
|
+
messageId,
|
|
178
|
+
message,
|
|
179
|
+
type: WEB_CLIENT_TABLE_FACTORY_TYPE,
|
|
180
|
+
name: WEB_CLIENT_TABLE_FACTORY_NAME,
|
|
181
|
+
});
|
|
182
|
+
if (eventDetail.exportedObjects.length < 1) {
|
|
183
|
+
throw new Error('No objects exported from the widget');
|
|
184
|
+
}
|
|
185
|
+
const table = await eventDetail.exportedObjects[0].fetch();
|
|
186
|
+
return table;
|
|
187
|
+
}
|
|
80
188
|
/**
|
|
81
189
|
* Gets the Core+ connection for a given query.
|
|
82
190
|
*
|
|
@@ -146,6 +254,15 @@ export function getQueryObjectDefinitionByName(query, name) {
|
|
|
146
254
|
}
|
|
147
255
|
return objectDefinition;
|
|
148
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* Check whether the user has permission to start (or restart) the given query.
|
|
259
|
+
* @param user The user to check permissions for
|
|
260
|
+
* @param query The query to check
|
|
261
|
+
* @returns True if the user is permitted to start/restart the query
|
|
262
|
+
*/
|
|
263
|
+
export function hasPermissionToStart(user, query) {
|
|
264
|
+
return getQuerySelectionPermissions(user, [query]).allRestartable;
|
|
265
|
+
}
|
|
149
266
|
/**
|
|
150
267
|
* Get replica or spare worker for a given slot. If slot is null, returns the designated worker.
|
|
151
268
|
* @param query Query to get the worker from
|
|
@@ -240,6 +357,8 @@ export async function makeDescriptorFromUri({ client, dh, uri, }) {
|
|
|
240
357
|
}
|
|
241
358
|
/**
|
|
242
359
|
* Get a table from the WebClientData Core+ WebClientTableFactoryService
|
|
360
|
+
* @deprecated Use fetchQueryConfigTable instead. This function will be removed in
|
|
361
|
+
* a future release.
|
|
243
362
|
* @param params Function parameters
|
|
244
363
|
* @param params.client Enterprise client
|
|
245
364
|
* @param params.corePlusManager CorePlus manager for worker connections
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export * from './
|
|
9
|
-
export * from './
|
|
10
|
-
export * from './
|
|
11
|
-
export * from './
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './
|
|
14
|
-
export * from './
|
|
15
|
-
export * from './
|
|
1
|
+
export type {
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated Import `CorePlusManager` from
|
|
4
|
+
* `@deephaven-enterprise/client-utils` instead. This re-export exists only for
|
|
5
|
+
* backwards compatibility and may be removed in a future release.
|
|
6
|
+
*/
|
|
7
|
+
CorePlusManager, } from '@deephaven-enterprise/client-utils';
|
|
8
|
+
export * from './ArgumentUtils.ts';
|
|
9
|
+
export * from './DraftQuery.ts';
|
|
10
|
+
export * from './EditableQueryInfoUtils.ts';
|
|
11
|
+
export * from './QueryFinders.ts';
|
|
12
|
+
export * from './QueryPermissions.ts';
|
|
13
|
+
export * from './QueryStateUtils.ts';
|
|
14
|
+
export * from './QueryColumns.ts';
|
|
15
|
+
export * from './QueryDisplayType.ts';
|
|
16
|
+
export * from './QueryScheduler.ts';
|
|
17
|
+
export * from './QuerySchedulerValidation.ts';
|
|
18
|
+
export * from './QueryStatus.ts';
|
|
19
|
+
export * from './QueryType.ts';
|
|
20
|
+
export * from './QueryUtils.ts';
|
|
21
|
+
export * from './WorkerThreadUtils.ts';
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from './WorkerThreadUtils';
|
|
1
|
+
export * from "./ArgumentUtils.js";
|
|
2
|
+
export * from "./DraftQuery.js";
|
|
3
|
+
export * from "./EditableQueryInfoUtils.js";
|
|
4
|
+
export * from "./QueryFinders.js";
|
|
5
|
+
export * from "./QueryPermissions.js";
|
|
6
|
+
export * from "./QueryStateUtils.js";
|
|
7
|
+
export * from "./QueryColumns.js";
|
|
8
|
+
export * from "./QueryDisplayType.js";
|
|
9
|
+
export * from "./QueryScheduler.js";
|
|
10
|
+
export * from "./QuerySchedulerValidation.js";
|
|
11
|
+
export * from "./QueryStatus.js";
|
|
12
|
+
export * from "./QueryType.js";
|
|
13
|
+
export * from "./QueryUtils.js";
|
|
14
|
+
export * from "./WorkerThreadUtils.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deephaven-enterprise/query-utils",
|
|
3
|
-
"version": "2026.1.
|
|
3
|
+
"version": "2026.1.44",
|
|
4
4
|
"description": "Deephaven Enterprise Query Utils",
|
|
5
5
|
"author": "Deephaven Data Labs LLC",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
"build": "tsc --build"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@deephaven-enterprise/
|
|
21
|
-
"@deephaven/jsapi-types": "
|
|
20
|
+
"@deephaven-enterprise/client-utils": "2026.1.44",
|
|
21
|
+
"@deephaven-enterprise/jsapi-types": "2026.1.44",
|
|
22
|
+
"@deephaven/jsapi-types": "1.0.0-dev0.40.5",
|
|
22
23
|
"@deephaven/log": "^0.97.0",
|
|
23
24
|
"@deephaven/utils": "^0.97.0",
|
|
24
25
|
"@internationalized/date": "^3.12.2",
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { EnterpriseClient, WorkerKind } from '@deephaven-enterprise/jsapi-types';
|
|
2
|
-
import type { dh as DhType } from '@deephaven/jsapi-types';
|
|
3
|
-
/**
|
|
4
|
-
* Interface defining a connection manager for fetching APIs from and creating connections to CorePlus workers. Implementation may cache values.
|
|
5
|
-
*/
|
|
6
|
-
export interface CorePlusManager {
|
|
7
|
-
/** The DHE JS API client */
|
|
8
|
-
get dheClient(): EnterpriseClient;
|
|
9
|
-
/** Whether this has been disposed. */
|
|
10
|
-
get isDisposed(): boolean;
|
|
11
|
-
/** Dispose resources. */
|
|
12
|
-
dispose(): Promise<void>;
|
|
13
|
-
/**
|
|
14
|
-
* Get the API for the specified worker kind.
|
|
15
|
-
* @param engine The engine to get the API for
|
|
16
|
-
* @param jsApiUrl The URL to load the API from
|
|
17
|
-
* @return The API for the specified worker kind
|
|
18
|
-
*/
|
|
19
|
-
getApi(engine: string, jsApiUrl: string): Promise<typeof DhType>;
|
|
20
|
-
/**
|
|
21
|
-
* Get the CoreClient for the specified worker.
|
|
22
|
-
* @param dh The Core API to create the CoreClient with.
|
|
23
|
-
* @param grpcUrl The gRPC URL
|
|
24
|
-
* @param envoyPrefix The envoy prefix
|
|
25
|
-
* @return The CoreClient for the specified worker kind
|
|
26
|
-
*/
|
|
27
|
-
getClient(dh: typeof DhType, grpcUrl: string, envoyPrefix?: string | null): Promise<DhType.CoreClient>;
|
|
28
|
-
/**
|
|
29
|
-
* Get the IDE connection for the specified worker.
|
|
30
|
-
* @param dh The Core API to create the CoreClient with.
|
|
31
|
-
* @param grpcUrl The gRPC URL
|
|
32
|
-
* @param envoyPrefix The envoy prefix
|
|
33
|
-
* @return The IDE connection for the specified worker kind
|
|
34
|
-
*/
|
|
35
|
-
getConnection(dh: typeof DhType, grpcUrl: string, envoyPrefix?: string | null): Promise<DhType.IdeConnection>;
|
|
36
|
-
/**
|
|
37
|
-
* Get the worker kind or null for the specified engine.
|
|
38
|
-
* @param engine The engine to get the worker kind for
|
|
39
|
-
*/
|
|
40
|
-
getEngineWorkerKind(engine: string): WorkerKind | null;
|
|
41
|
-
/**
|
|
42
|
-
* Check if an engine is a community worker kind.
|
|
43
|
-
* @param engine The engine name to check
|
|
44
|
-
*/
|
|
45
|
-
isCommunityWorkerKind(engine: string | null): boolean;
|
|
46
|
-
}
|
|
47
|
-
export default CorePlusManager;
|
package/dist/CorePlusManager.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|