Skip to content

Commit d03fdce

Browse files
committed
Hiding internal settings from types
1 parent 5e1ddcf commit d03fdce

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

src/connection/base.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,15 @@ export abstract class Connection {
8181
const strSettings = Object.entries(settings ?? {}).reduce<
8282
Record<string, string>
8383
>((acc, [key, value]) => {
84-
if (value !== undefined) {
84+
if (key === "internal") {
85+
// Unwrap internal settings from array
86+
const internalSettings = value as Record<string, string | number>[];
87+
internalSettings.forEach(setting => {
88+
Object.entries(setting).forEach(([internalKey, internalValue]) => {
89+
acc[internalKey] = internalValue.toString();
90+
});
91+
});
92+
} else if (value !== undefined) {
8593
acc[key] = value.toString();
8694
}
8795
return acc;

src/core/index.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import { makeConnection } from "../connection";
22
import { Authenticator } from "../auth";
3-
import {
4-
Context,
5-
ConnectionOptions,
6-
FireboltClientOptions,
7-
SettingValues
8-
} from "../types";
3+
import { Context, ConnectionOptions, FireboltClientOptions } from "../types";
94
import { ResourceManager } from "../service";
105

116
export class FireboltCore {
@@ -38,7 +33,7 @@ export class FireboltCore {
3833
await connection.resolveEngineEndpoint();
3934
// auto_start_stop_control is only available for v2
4035
const settings = auth.isServiceAccount()
41-
? { auto_start_stop_control: SettingValues.IGNORE }
36+
? { internal: [{ auto_start_stop_control: "ignore" }] }
4237
: {};
4338
await connection.execute("select 1", { settings });
4439
}

src/types.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,12 @@ export enum OutputFormat {
2929
JSON = "JSON"
3030
}
3131

32-
export enum SettingValues {
33-
IGNORE = "ignore"
34-
}
35-
3632
export type QuerySettings = Record<
3733
string,
38-
string | number | boolean | undefined
34+
string | number | boolean | undefined | Record<string, string | number>[]
3935
> & {
4036
output_format?: OutputFormat;
41-
auto_start_stop_control?: SettingValues;
37+
internal?: Record<string, string | number>[];
4238
};
4339

4440
export type RowParser = (row: string, isLastRow: boolean) => any;

0 commit comments

Comments
 (0)