@deephaven-enterprise/query-utils 1.20240723.62-alpha-fix-dependencies.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/LICENSE.md ADDED
@@ -0,0 +1,136 @@
1
+ Deephaven Data Labs is dedicated to developing Deephaven's software in the open
2
+ and is making software available under the following licenses:
3
+
4
+ - **Deephaven Open Source** is made available under the Apache 2.0 License
5
+ - **Deephaven Community** is provided under a source-available license, the
6
+ Deephaven Community License Agreement
7
+
8
+ To request a commercial license for software or uses not covered by these
9
+ licenses or to ask any license-related question, please contact us at:
10
+ [license@deephaven.io](mailto:license@deephaven.io)
11
+
12
+
13
+ # Deephaven Community License Agreement Version 1.0
14
+
15
+ 1. **ACCEPTANCE.** This Deephaven Community License Agreement is entered into by
16
+ and between Deephaven Data Labs LLC, a Delaware Limited Liability Company, with
17
+ an address of 2800 Niagara Lane North, Plymouth, MN 55447 ("Deephaven") and
18
+ “You” (a) in your individual capacity, or (b) on behalf of your company if you
19
+ are licensing the Software for a company for which or with which you work. By
20
+ using the Software, You agree to all of the terms and conditions in this
21
+ Deephaven Community License Agreement (the "Agreement").
22
+
23
+ 2. **THE SOFTWARE.** The "Software" means the version of the Deephaven Community
24
+ Software provided to the original licensee with this Agreement. The Software may
25
+ include third party owned code. Each third party module is subject to the terms
26
+ of its respective license; the details of which can be found in the notices
27
+ served at [https://github.com/deephaven/deephaven-core](https://github.com/deephaven/deephaven-core).
28
+ Since licensees may contribute back to the Software as provided for in Section
29
+ 3(b), the Software may include any such contributions.
30
+
31
+ 3. **GRANT OF LICENSE.** Subject to the terms and conditions of this Agreement,
32
+ Deephaven hereby grants You a royalty-free, worldwide, non-exclusive,
33
+ non-transferable license to the Software (the "License"), subject, in all of the
34
+ cases, to applicable laws and regulations, but not for the Prohibited Use (as
35
+ provided for in Section 4), solely as follows:
36
+
37
+ - a. **Internal Use.** A license to use, copy, compile, and install the
38
+ Software for Your internal use;
39
+
40
+ - b. **Derivative Works.** A license to (i) prepare, develop, compile, and test
41
+ Derivative Works of the Software, (ii) use Your Derivative Works for Your
42
+ internal use solely as expressly permitted in Section 3(a), and (iii) distribute
43
+ Your Derivative Works back to Deephaven under a separate Deephaven Contributor
44
+ Agreement for potential incorporation into the Software at Deephaven's sole
45
+ discretion. A "Derivative Work" means any work that (A) is based on or derived
46
+ from the Software including any modifications to the Software, or (B) meets the
47
+ definition of derivative work under the United States Copyright Act of 1976, 17
48
+ U.S.C. Section 101; and
49
+
50
+ - c. **Distribution and redistribution.** A license to distribute or
51
+ redistribute the Software and Your Derivative Works, and copies of the Software
52
+ and Your Derivative Works, to customers and other third parties for their use
53
+ pursuant to this Agreement subject to the prohibitions in Section 4 and
54
+ Agreement requirement as provided for in Section 5.
55
+
56
+ 4. **PROHIBITED USE.** Notwithstanding any provision of this Agreement to the
57
+ contrary, the original licensee is prohibited from using, distributing, or
58
+ deploying the Software or Derivative Works in such a way that a third party
59
+ (including any recipient under Section 3(c)) can, directly or indirectly
60
+ through the original licensee, its agents, its technology, or solutions made
61
+ available to them, add, define, redefine, or modify the schema for any input
62
+ tables (including source tables, or other input objects) that the Software or
63
+ Derivative Works access. For clarification, every recipient of the Software or
64
+ Derivative Works after the original licensee of the Software is prohibited from
65
+ adding, defining, redefining, or modifying the schema for any input tables
66
+ (including source tables, or other input objects) that the Software or
67
+ Derivative Works access. This prohibition in no way affects the ability of a
68
+ third party to add, define, redefine, or modify the schema of output tables
69
+ (including output tables that are interim or derived). Further, this
70
+ prohibition in no way affects the ability of a third party to add, define,
71
+ redefine, or modify data (as opposed to schema), nor does it cause You to be
72
+ limited in any capacity for Your internal use as permitted in Section 3(a). If
73
+ You have any questions on this prohibition, please contact us at:
74
+ [license@deephaven.io](mailto:license@deephaven.io)
75
+
76
+ 5. **AGREEMENT.** If You distribute the Software, whether directly, as a copy,
77
+ or via Your Derivative Works you must provide recipients a copy of this
78
+ Agreement (which will bind each recipient directly) and You must ensure that all
79
+ copyright, patent, trademark, and attribution notices from the Software are
80
+ retained.
81
+
82
+ 6. **AFFILIATES.** You may permit Your affiliates to exercise the License,
83
+ provided that such exercise must be solely for Your benefit and/or the benefit
84
+ of Your affiliate, and You shall be responsible for all acts and omissions of
85
+ such affiliates in connection with such exercise of the License, including but
86
+ not limited to breach of any terms of this Agreement.
87
+
88
+ 7. **SUBLICENSE.** The License is sublicensable only to Your third-party
89
+ subcontractors and contractors performing services on Your or Your affiliates'
90
+ behalf, subject to the terms and conditions of this Agreement. The License is
91
+ not sublicensable to any other third party nor is it further sublicensable. You
92
+ shall be responsible for all acts and omissions of such subcontractor and
93
+ contractors in connection with such exercise of the sublicense, including but
94
+ not limited to breach of any terms of this Agreement.
95
+
96
+ 8. **PATENTS.** Rights to use the Software do not give You any right to
97
+ implement or use Deephaven's patents independently of the permitted use of the
98
+ Software.
99
+
100
+ 9. **RESERVATION OF RIGHTS.** Deephaven reserves all rights not granted in this
101
+ Agreement. You have no right to use Deephaven trade names, trademarks, service
102
+ marks, or product names except as required for reasonable and customary use in
103
+ describing the origin of the Software.
104
+
105
+ 10. **DISCLAIMER OF WARRANTY.** THE SOFTWARE IS LICENSED ON AN "AS IS" BASIS
106
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND. DEEPHAVEN DISCLAIMS ALL
107
+ WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF
108
+ TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
109
+ You are solely responsible for determining the appropriateness of using,
110
+ distributing or redistributing the Software and Derivative Works and assume all
111
+ risks associated with Your exercise of the License.
112
+
113
+ 11. **INDEMNIFICATION.** If You distribute or redistribute the Software or
114
+ Derivative Works, You agree to defend on request, and indemnify, Deephaven and
115
+ its affiliates, officers, directors, employees and agents from and against any
116
+ and all losses, damages, liabilities, claims, costs and expenses (including
117
+ reasonable attorney’s fees and expenses) incurred or arising from the
118
+ exploitation of the Software or Derivative Works.
119
+
120
+ 12. **LIMITATION OF LIABILITY.** THE LICENSE IS GRANTED FOR NO FEE. IN NO EVENT
121
+ AND UNDER NO LEGAL THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR
122
+ OTHERWISE, SHALL DEEPHAVEN BE LIABLE FOR ANY DAMAGES ARISING OUT OF OR AS A
123
+ RESULT OF THIS AGREEMENT, INCLUDING ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL,
124
+ OR CONSEQUENTIAL DAMAGES (INCLUDING BUT NOT LIMITED TO DAMAGES FOR LOSS OF
125
+ GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR LOSS OR CORRUPTION
126
+ OF DATA), EVEN IF DEEPHAVEN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
127
+
128
+ 13. **TERMINATION.** The License will automatically terminate if You violate the
129
+ use rights or prohibitions in this Agreement.
130
+
131
+ 14. **GOVERNING LAW.** This Agreement will be interpreted, construed and
132
+ enforced in all respects in accordance with the laws of the State of Delaware,
133
+ USA without reference to its choice of law rules to the contrary.
134
+
135
+
136
+ # END OF AGREEMENT
@@ -0,0 +1,137 @@
1
+ import type { EditableQueryInfo, TypeSpecificFields } from '@deephaven-enterprise/jsapi-types';
2
+ import QueryScheduler from './QueryScheduler';
3
+ export type ScriptDraftQuery = IDraftQuery & {
4
+ scriptLanguage: string;
5
+ };
6
+ /**
7
+ * TypeScript `type` aliases have implicit index signatures, but `interface`
8
+ * types do not. It is important that all of the types composed into `IDraftQuery`
9
+ * are `type` aliases so that the index signature is implicitly included. Otherwise,
10
+ * it causes issues upstream where `Record<string, unknown>` generics are expected.
11
+ * e.g. `WorkspaceStorageItem<IDraftQuery>`
12
+ */
13
+ export type IDraftQuery = EditableQueryInfo & {
14
+ isClientSide: boolean;
15
+ draftOwner: string;
16
+ };
17
+ export type DraftQueryConstructorObject = Partial<IDraftQuery> & Pick<IDraftQuery, 'name' | 'owner' | 'draftOwner' | 'dbServerName'>;
18
+ /**
19
+ * A Draft Query is a client side object that contains mutable data for a Peristent Query along with some metadata.
20
+ */
21
+ export declare class DraftQuery implements IDraftQuery {
22
+ static NO_SERIAL: null;
23
+ static INVALID_SCRIPT_PATH: string;
24
+ static RESTART_MODE: Readonly<{
25
+ ADMIN: 1;
26
+ ADMIN_AND_VIEWERS: 2;
27
+ ADMIN_AND_VIEWERS_WHEN_DOWN: 4;
28
+ }>;
29
+ static FIELDS: Readonly<{
30
+ readonly SERIAL: "serial";
31
+ readonly NAME: "name";
32
+ readonly OWNER: "owner";
33
+ readonly TYPE: "type";
34
+ readonly ENABLED: "enabled";
35
+ readonly ENABLED_GC_LOGS: "enableGcLogs";
36
+ readonly ENV_VARS: "envVars";
37
+ readonly HEAP_SIZE: "heapSize";
38
+ readonly ADDITIONAL_MEMORY: "additionalMemory";
39
+ readonly DATA_MEMORY_RATIO: "dataMemoryRatio";
40
+ readonly JVM_ARGS: "jvmArgs";
41
+ readonly EXTRA_CLASSPATHS: "extraClasspaths";
42
+ readonly JVM_PROFILE: "jvmProfile";
43
+ readonly DB_SERVER_NAME: "dbServerName";
44
+ readonly SCRIPT_CODE: "scriptCode";
45
+ readonly SCRIPT_LANGUAGE: "scriptLanguage";
46
+ readonly SCRIPT_PATH: "scriptPath";
47
+ readonly ADMIN_GROUPS: "adminGroups";
48
+ readonly VIEWER_GROUPS: "viewerGroups";
49
+ readonly RESTART_USERS: "restartUsers";
50
+ readonly SCHEDULER: "scheduler";
51
+ readonly TIMEOUT: "timeout";
52
+ readonly WORKER_KIND: "workerKind";
53
+ readonly KUBERNETES_CONTROL: "kubernetesControl";
54
+ readonly PYTHON_CONTROL: "pythonControl";
55
+ readonly GENERIC_WORKER_CONTROL: "genericWorkerControl";
56
+ readonly TYPE_SPECIFIC_FIELDS: "typeSpecificFields";
57
+ readonly REPLICA_COUNT: "replicaCount";
58
+ readonly SPARE_COUNT: "spareCount";
59
+ readonly ASSIGNMENT_POLICY: "assignmentPolicy";
60
+ readonly ASSIGNMENT_POLICY_PARAMS: "assignmentPolicyParams";
61
+ }>;
62
+ /**
63
+ * Checks if a serial id from the server is actually a draft id
64
+ *
65
+ * @param serial
66
+ */
67
+ static isDraftId(serial: string): boolean;
68
+ /**
69
+ * Removes the draft markings from a client side serial and returns the draft id.
70
+ *
71
+ * @param serial a serial that contains a draft id
72
+ */
73
+ static serialToDraftId(serial: string): string;
74
+ constructor({ isClientSide, draftOwner, serial, name, owner, type, enabled, enableGcLogs, envVars, heapSize, additionalMemory, dataMemoryRatio, jvmArgs, extraClasspaths, jvmProfile, dbServerName, scriptLanguage, scriptPath, scriptCode, scheduling, adminGroups, viewerGroups, restartUsers, timeout, workerKind, kubernetesControl, pythonControl, genericWorkerControl, typeSpecificFields, replicaCount, spareCount, assignmentPolicy, assignmentPolicyParams, }: DraftQueryConstructorObject);
75
+ id: string;
76
+ isModified: boolean;
77
+ isClientSide: boolean;
78
+ draftOwner: string;
79
+ serial: string | null;
80
+ name: string;
81
+ owner: string;
82
+ type: string;
83
+ enabled: boolean;
84
+ enableGcLogs: boolean;
85
+ envVars: string;
86
+ heapSize: number;
87
+ additionalMemory: number;
88
+ dataMemoryRatio: number;
89
+ jvmArgs: string;
90
+ extraClasspaths: string;
91
+ jvmProfile: string;
92
+ dbServerName: string;
93
+ scriptLanguage: string | null;
94
+ scriptPath: string | null;
95
+ scriptCode: string;
96
+ scheduling: readonly string[];
97
+ adminGroups: readonly string[];
98
+ viewerGroups: readonly string[];
99
+ restartUsers: number;
100
+ timeout: number;
101
+ scheduler: QueryScheduler;
102
+ kubernetesControl?: string | null;
103
+ pythonControl?: string | null;
104
+ genericWorkerControl?: string | null;
105
+ /**
106
+ * Should be the name (not title) of the workerKind
107
+ * The server gives null if it should be the default
108
+ * Not sure if the value will be set if the PQ is from pre-vermilion and the customer upgrades
109
+ * Treat both null and undefined as server default (not necessarily 1st option in the UI)
110
+ */
111
+ workerKind: string | null | undefined;
112
+ typeSpecificFields: TypeSpecificFields | null;
113
+ replicaCount: number;
114
+ spareCount: number;
115
+ assignmentPolicy: string | null;
116
+ assignmentPolicyParams: string | null;
117
+ updateSchedule(): void;
118
+ /**
119
+ * Creates a deep copy of this draft query.
120
+ *
121
+ * @param id the id for the copy
122
+ * @returns a copy of this draft query
123
+ */
124
+ deepCopy(id?: string | null): DraftQuery;
125
+ /**
126
+ * Saves a Draft Query into an Editable Query.
127
+ *
128
+ * @param editableQuery the Editable Query from the Server
129
+ */
130
+ saveDraftToQuery(editableQuery: Partial<EditableQueryInfo>): void;
131
+ toEditableQueryInfo(): {
132
+ serial: string | null;
133
+ };
134
+ toRowMap(queryTypes: Map<string, string>): Map<string, string>;
135
+ formatIdForSerialColumn(): string;
136
+ }
137
+ export default DraftQuery;
@@ -0,0 +1,208 @@
1
+ /* eslint-disable no-param-reassign */
2
+ import shortid from 'shortid';
3
+ import QueryColumns from './QueryColumns';
4
+ import QueryScheduler from './QueryScheduler';
5
+ import { QueryType } from './QueryType';
6
+ const DRAFT_SERIAL_PREFIX = 'Draft ID: ';
7
+ /**
8
+ * A Draft Query is a client side object that contains mutable data for a Peristent Query along with some metadata.
9
+ */
10
+ export class DraftQuery {
11
+ /**
12
+ * Checks if a serial id from the server is actually a draft id
13
+ *
14
+ * @param serial
15
+ */
16
+ static isDraftId(serial) {
17
+ return serial === null || serial === void 0 ? void 0 : serial.startsWith(DRAFT_SERIAL_PREFIX);
18
+ }
19
+ /**
20
+ * Removes the draft markings from a client side serial and returns the draft id.
21
+ *
22
+ * @param serial a serial that contains a draft id
23
+ */
24
+ static serialToDraftId(serial) {
25
+ // Remove the 'Draft ID: ' marking
26
+ return serial === null || serial === void 0 ? void 0 : serial.substring(DRAFT_SERIAL_PREFIX.length);
27
+ }
28
+ constructor({ isClientSide = false, draftOwner, serial = DraftQuery.NO_SERIAL, name, owner, type = QueryType.SCRIPT, enabled = true, enableGcLogs = true, envVars = '', heapSize = 4.0, additionalMemory = 0.0, dataMemoryRatio = 0.25, jvmArgs = '', extraClasspaths = '', jvmProfile = 'Default', dbServerName, scriptLanguage = 'Groovy', scriptPath = null, scriptCode = '', scheduling, adminGroups = [], viewerGroups = [], restartUsers = DraftQuery.RESTART_MODE.ADMIN, timeout = 0, workerKind, kubernetesControl, pythonControl, genericWorkerControl, typeSpecificFields = null, replicaCount = 1, spareCount = 0, assignmentPolicy = null, assignmentPolicyParams = null, }) {
29
+ this.scheduling = [];
30
+ // Meta Data
31
+ this.id = shortid.generate();
32
+ this.isModified = false;
33
+ this.isClientSide = isClientSide;
34
+ this.draftOwner = draftOwner;
35
+ // Query Data
36
+ this.serial = serial;
37
+ this.name = name;
38
+ this.owner = owner;
39
+ this.type = type;
40
+ this.enabled = enabled;
41
+ this.enableGcLogs = enableGcLogs;
42
+ this.envVars = envVars;
43
+ this.heapSize = heapSize;
44
+ this.replicaCount = replicaCount;
45
+ this.spareCount = spareCount;
46
+ this.additionalMemory = additionalMemory;
47
+ this.dataMemoryRatio = dataMemoryRatio;
48
+ this.jvmArgs = jvmArgs;
49
+ this.extraClasspaths = extraClasspaths;
50
+ this.jvmProfile = jvmProfile;
51
+ this.dbServerName = dbServerName;
52
+ this.scriptLanguage = scriptLanguage;
53
+ this.scriptPath = scriptPath;
54
+ this.scriptCode = scriptCode;
55
+ this.adminGroups = adminGroups;
56
+ this.viewerGroups = viewerGroups;
57
+ this.restartUsers = restartUsers;
58
+ this.timeout = timeout;
59
+ this.workerKind = workerKind;
60
+ this.kubernetesControl = kubernetesControl;
61
+ this.pythonControl = pythonControl;
62
+ this.genericWorkerControl = genericWorkerControl;
63
+ this.replicaCount = replicaCount;
64
+ this.spareCount = spareCount;
65
+ this.assignmentPolicy = assignmentPolicy;
66
+ this.assignmentPolicyParams = assignmentPolicyParams;
67
+ // The scheduling array is parsed into a scheduler object
68
+ this.scheduling = [];
69
+ this.scheduler = new QueryScheduler(scheduling);
70
+ this.typeSpecificFields = typeSpecificFields;
71
+ }
72
+ updateSchedule() {
73
+ if (this.scheduler != null) {
74
+ this.scheduling = this.scheduler.toStringArray();
75
+ }
76
+ }
77
+ /**
78
+ * Creates a deep copy of this draft query.
79
+ *
80
+ * @param id the id for the copy
81
+ * @returns a copy of this draft query
82
+ */
83
+ deepCopy(id) {
84
+ const copy = new DraftQuery(this);
85
+ // Use the given id if defined, otherwise keep the generated one from the constructor
86
+ if (id != null) {
87
+ copy.id = id;
88
+ }
89
+ copy.adminGroups = this.adminGroups.slice();
90
+ copy.viewerGroups = this.viewerGroups.slice();
91
+ copy.scheduler = this.scheduler.deepCopy();
92
+ return copy;
93
+ }
94
+ /**
95
+ * Saves a Draft Query into an Editable Query.
96
+ *
97
+ * @param editableQuery the Editable Query from the Server
98
+ */
99
+ saveDraftToQuery(editableQuery) {
100
+ var _a, _b;
101
+ editableQuery.name = this.name;
102
+ editableQuery.owner = this.owner;
103
+ editableQuery.type = this.type;
104
+ editableQuery.enabled = this.enabled;
105
+ editableQuery.enableGcLogs = this.enableGcLogs;
106
+ editableQuery.envVars = this.envVars;
107
+ editableQuery.heapSize = this.heapSize;
108
+ editableQuery.dataMemoryRatio = this.dataMemoryRatio;
109
+ editableQuery.additionalMemory = this.additionalMemory;
110
+ editableQuery.jvmArgs = this.jvmArgs;
111
+ editableQuery.extraClasspaths = this.extraClasspaths;
112
+ editableQuery.jvmProfile = this.jvmProfile;
113
+ editableQuery.dbServerName = this.dbServerName;
114
+ editableQuery.scriptLanguage = this.scriptLanguage;
115
+ editableQuery.scriptPath = (_a = this.scriptPath) !== null && _a !== void 0 ? _a : undefined;
116
+ editableQuery.scriptCode = this.scriptCode;
117
+ editableQuery.scheduling = this.scheduler.toStringArray();
118
+ editableQuery.adminGroups = this.adminGroups;
119
+ editableQuery.viewerGroups = this.viewerGroups;
120
+ editableQuery.restartUsers = this.restartUsers;
121
+ editableQuery.timeout = this.timeout;
122
+ editableQuery.workerKind = (_b = this.workerKind) !== null && _b !== void 0 ? _b : undefined;
123
+ editableQuery.kubernetesControl = this.kubernetesControl;
124
+ editableQuery.pythonControl = this.pythonControl;
125
+ editableQuery.genericWorkerControl = this.genericWorkerControl;
126
+ editableQuery.typeSpecificFields = this.typeSpecificFields;
127
+ editableQuery.replicaCount = this.replicaCount;
128
+ editableQuery.spareCount = this.spareCount;
129
+ editableQuery.assignmentPolicy = this.assignmentPolicy;
130
+ editableQuery.assignmentPolicyParams = this.assignmentPolicyParams;
131
+ }
132
+ toEditableQueryInfo() {
133
+ const editableQuery = { serial: this.serial };
134
+ this.saveDraftToQuery(editableQuery);
135
+ return editableQuery;
136
+ }
137
+ toRowMap(queryTypes) {
138
+ var _a, _b, _c, _d, _e, _f;
139
+ const row = new Map();
140
+ // Note there are holes in this map which will show up as blank cells in the table
141
+ // Also note that not every piece of data is displayed in the table
142
+ row.set(QueryColumns.NAME.name, `Draft, ${this.name}`);
143
+ row.set(QueryColumns.OWNER.name, this.owner);
144
+ row.set(QueryColumns.STATUS.name, 'Draft');
145
+ row.set(QueryColumns.QUERY_TYPE.name, queryTypes.get(this.type));
146
+ row.set(QueryColumns.ENABLED.name, this.enabled.toString());
147
+ row.set(QueryColumns.HEAP_SIZE.name, (_b = (_a = this.heapSize) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : '');
148
+ row.set(QueryColumns.ADDITIONAL_MEMORY.name, (_d = (_c = this.additionalMemory) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : '');
149
+ row.set(QueryColumns.DATA_RATIO.name, (_f = (_e = this.dataMemoryRatio) === null || _e === void 0 ? void 0 : _e.toString()) !== null && _f !== void 0 ? _f : '');
150
+ row.set(QueryColumns.LANGUAGE.name, this.scriptLanguage);
151
+ row.set(QueryColumns.JVM_PROFILE.name, this.jvmProfile);
152
+ row.set(QueryColumns.DB_SERVER_NAME.name, this.dbServerName);
153
+ const adminGroupsString = this.adminGroups.length > 0 ? `[${this.adminGroups.toString()}]` : '';
154
+ row.set(QueryColumns.ADMIN_GROUPS.name, adminGroupsString);
155
+ const viewerGroupsString = this.viewerGroups.length > 0 ? `[${this.viewerGroups.toString()}]` : '';
156
+ row.set(QueryColumns.VIEWER_GROUPS.name, viewerGroupsString);
157
+ // Draft queries have a null serial
158
+ // This puts the draft ID in the serial column so that keyed selection will work
159
+ row.set(QueryColumns.SERIAL.name, this.formatIdForSerialColumn());
160
+ row.set(QueryColumns.ID.name, this.id);
161
+ row.set(QueryColumns.PARENT_ID.name, null);
162
+ return row;
163
+ }
164
+ formatIdForSerialColumn() {
165
+ return `${DRAFT_SERIAL_PREFIX}${this.id}`;
166
+ }
167
+ }
168
+ DraftQuery.NO_SERIAL = null;
169
+ DraftQuery.INVALID_SCRIPT_PATH = '';
170
+ DraftQuery.RESTART_MODE = Object.freeze({
171
+ ADMIN: 1,
172
+ ADMIN_AND_VIEWERS: 2,
173
+ ADMIN_AND_VIEWERS_WHEN_DOWN: 4,
174
+ });
175
+ DraftQuery.FIELDS = Object.freeze({
176
+ SERIAL: 'serial',
177
+ NAME: 'name',
178
+ OWNER: 'owner',
179
+ TYPE: 'type',
180
+ ENABLED: 'enabled',
181
+ ENABLED_GC_LOGS: 'enableGcLogs',
182
+ ENV_VARS: 'envVars',
183
+ HEAP_SIZE: 'heapSize',
184
+ ADDITIONAL_MEMORY: 'additionalMemory',
185
+ DATA_MEMORY_RATIO: 'dataMemoryRatio',
186
+ JVM_ARGS: 'jvmArgs',
187
+ EXTRA_CLASSPATHS: 'extraClasspaths',
188
+ JVM_PROFILE: 'jvmProfile',
189
+ DB_SERVER_NAME: 'dbServerName',
190
+ SCRIPT_CODE: 'scriptCode',
191
+ SCRIPT_LANGUAGE: 'scriptLanguage',
192
+ SCRIPT_PATH: 'scriptPath',
193
+ ADMIN_GROUPS: 'adminGroups',
194
+ VIEWER_GROUPS: 'viewerGroups',
195
+ RESTART_USERS: 'restartUsers',
196
+ SCHEDULER: 'scheduler',
197
+ TIMEOUT: 'timeout',
198
+ WORKER_KIND: 'workerKind',
199
+ KUBERNETES_CONTROL: 'kubernetesControl',
200
+ PYTHON_CONTROL: 'pythonControl',
201
+ GENERIC_WORKER_CONTROL: 'genericWorkerControl',
202
+ TYPE_SPECIFIC_FIELDS: 'typeSpecificFields',
203
+ REPLICA_COUNT: 'replicaCount',
204
+ SPARE_COUNT: 'spareCount',
205
+ ASSIGNMENT_POLICY: `assignmentPolicy`,
206
+ ASSIGNMENT_POLICY_PARAMS: `assignmentPolicyParams`,
207
+ });
208
+ export default DraftQuery;