Skip to content

Commit

Permalink
Removing old types
Browse files Browse the repository at this point in the history
  • Loading branch information
poffdeluxe committed Mar 29, 2021
1 parent 10239a3 commit 10c23ba
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions x-pack/plugins/canvas/server/lib/essql_strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,6 @@ import { EssqlSearchStrategyRequest, EssqlSearchStrategyResponse } from '../../t
import { buildBoolArray } from '../../common/lib/request/build_bool_array';
import { sanitizeName } from '../../common/lib/request/sanitize_name';
import { normalizeType } from '../../common/lib/request/normalize_type';
interface CursorResponse {
cursor?: string;
rows: string[][];
}

type QueryResponse = CursorResponse & {
columns: Array<{
name: string;
type: string;
}>;
};

export const essqlSearchStrategyProvider = (
data: PluginStart
Expand All @@ -35,10 +24,11 @@ export const essqlSearchStrategyProvider = (
const { count, query, filter, timezone, params } = request;

const searchUntilEnd = async () => {
let response = await esClient.asCurrentUser.sql.query<QueryResponse>({
let response = await esClient.asCurrentUser.sql.query({
format: 'json',
body: {
query,
// @ts-expect-error `params` missing from `QuerySqlRequest` type
params,
time_zone: timezone,
fetch_size: count,
Expand All @@ -53,7 +43,7 @@ export const essqlSearchStrategyProvider = (

let body = response.body;

const columns = body.columns.map(({ name, type }) => {
const columns = body.columns!.map(({ name, type }) => {
return {
id: sanitizeName(name),
name: sanitizeName(name),
Expand All @@ -73,7 +63,7 @@ export const essqlSearchStrategyProvider = (
},
});

body = response.body as QueryResponse;
body = response.body;

rows = [...rows, ...body.rows.map((row) => zipObject(columnNames, row))];
}
Expand Down

0 comments on commit 10c23ba

Please sign in to comment.