Skip to content

Commit

Permalink
linter fix
Browse files Browse the repository at this point in the history
Signed-off-by: sumukhswamy <[email protected]>
  • Loading branch information
sumukhswamy committed May 16, 2024
1 parent 6d86381 commit 35f4eaf
Showing 1 changed file with 115 additions and 51 deletions.
166 changes: 115 additions & 51 deletions server/routes/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
* SPDX-License-Identifier: Apache-2.0
*/


import { schema } from '@osd/config-schema';
import { IOpenSearchDashboardsResponse, IRouter, OpenSearchServiceSetup, ResponseError } from '../../../../src/core/server';
import {
IOpenSearchDashboardsResponse,
IRouter,
OpenSearchServiceSetup,
ResponseError,
} from '../../../../src/core/server';
import QueryService from '../services/QueryService';
import {
ROUTE_PATH_GET_DATASOURCES,
Expand All @@ -18,21 +22,29 @@ import {
ROUTE_PATH_SQL_CSV,
ROUTE_PATH_SQL_JSON,
ROUTE_PATH_SQL_QUERY,
ROUTE_PATH_SQL_TEXT
ROUTE_PATH_SQL_TEXT,
} from '../utils/constants';

export default function query(server: IRouter, service: QueryService, openSearchServiceSetup: OpenSearchServiceSetup) {
export default function query(

Check failure on line 28 in server/routes/query.ts

View workflow job for this annotation

GitHub Actions / Lint

Prefer named exports
server: IRouter,
service: QueryService,
openSearchServiceSetup: OpenSearchServiceSetup

Check failure on line 31 in server/routes/query.ts

View workflow job for this annotation

GitHub Actions / Lint

'openSearchServiceSetup' is defined but never used. Allowed unused args must match /^_/u
) {
server.post(
{
path: ROUTE_PATH_SQL_QUERY,
validate: {
body: schema.any(),
query: schema.object({
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' }))
})
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' })),
}),
},
},
async (context, request, response): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {
async (
context,
request,
response
): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {

Check warning on line 47 in server/routes/query.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const retVal = await service.describeSQLQuery(context, request);
return response.ok({
body: retVal,
Expand All @@ -46,11 +58,15 @@ export default function query(server: IRouter, service: QueryService, openSearch
validate: {
body: schema.any(),
query: schema.object({
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' }))
})
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' })),
}),
},
},
async (context, request, response): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {
async (
context,
request,
response
): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {

Check warning on line 69 in server/routes/query.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const retVal = await service.describePPLQuery(context, request);
return response.ok({
body: retVal,
Expand All @@ -64,11 +80,15 @@ export default function query(server: IRouter, service: QueryService, openSearch
validate: {
body: schema.any(),
query: schema.object({
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' }))
})
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' })),
}),
},
},
async (context, request, response): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {
async (
context,
request,
response
): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {

Check warning on line 91 in server/routes/query.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const retVal = await service.describeSQLCsv(context, request);
return response.ok({
body: retVal,
Expand All @@ -82,11 +102,15 @@ export default function query(server: IRouter, service: QueryService, openSearch
validate: {
body: schema.any(),
query: schema.object({
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' }))
})
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' })),
}),
},
},
async (context, request, response): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {
async (
context,
request,
response
): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {

Check warning on line 113 in server/routes/query.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const retVal = await service.describePPLCsv(context, request);
return response.ok({
body: retVal,
Expand All @@ -100,11 +124,15 @@ export default function query(server: IRouter, service: QueryService, openSearch
validate: {
body: schema.any(),
query: schema.object({
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' }))
})
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' })),
}),
},
},
async (context, request, response): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {
async (
context,
request,
response
): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {

Check warning on line 135 in server/routes/query.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const retVal = await service.describeSQLJson(context, request);
return response.ok({
body: retVal,
Expand All @@ -118,11 +146,15 @@ export default function query(server: IRouter, service: QueryService, openSearch
validate: {
body: schema.any(),
query: schema.object({
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' }))
})
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' })),
}),
},
},
async (context, request, response): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {
async (
context,
request,
response
): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {

Check warning on line 157 in server/routes/query.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const retVal = await service.describePPLJson(context, request);
return response.ok({
body: retVal,
Expand All @@ -136,11 +168,15 @@ export default function query(server: IRouter, service: QueryService, openSearch
validate: {
body: schema.any(),
query: schema.object({
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' }))
})
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' })),
}),
},
},
async (context, request, response): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {
async (
context,
request,
response
): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {

Check warning on line 179 in server/routes/query.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const retVal = await service.describeSQLText(context, request);
return response.ok({
body: retVal,
Expand All @@ -154,11 +190,15 @@ export default function query(server: IRouter, service: QueryService, openSearch
validate: {
body: schema.any(),
query: schema.object({
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' }))
})
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' })),
}),
},
},
async (context, request, response): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {
async (
context,
request,
response
): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {

Check warning on line 201 in server/routes/query.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const retVal = await service.describePPLText(context, request);
return response.ok({
body: retVal,
Expand All @@ -172,73 +212,97 @@ export default function query(server: IRouter, service: QueryService, openSearch
validate: {
body: schema.any(),
query: schema.object({
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' }))
})
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' })),
}),
},
},
async (context, request, response): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {
async (
context,
request,
response
): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {

Check warning on line 223 in server/routes/query.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const retVal = await service.describeSQLAsyncQuery(context, request);
return response.ok({
body: retVal,
});
}
)
);

server.get(
{
path: ROUTE_PATH_SPARK_SQL_JOB_QUERY + "/{id}" + "/{dataSourceMDSId?}",
path: ROUTE_PATH_SPARK_SQL_JOB_QUERY + '/{id}' + '/{dataSourceMDSId?}',
validate: {
params: schema.object({
id: schema.string(),
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' }))
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' })),
}),
},
},
async (context, request, response): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {
const retVal = await service.describeSQLAsyncGetQuery(context, request, request.params.id, request.params.dataSourceMDSId);
async (
context,
request,
response
): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {

Check warning on line 245 in server/routes/query.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const retVal = await service.describeSQLAsyncGetQuery(
context,
request,
request.params.id,
request.params.dataSourceMDSId
);
return response.ok({
body: retVal,
});
}
)
);

server.delete(
{
path: ROUTE_PATH_SPARK_SQL_JOB_QUERY + "/{id}" + "/{dataSourceMDSId?}",
path: ROUTE_PATH_SPARK_SQL_JOB_QUERY + '/{id}' + '/{dataSourceMDSId?}',
validate: {
params: schema.object({
id: schema.string(),
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' }))
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' })),
}),
query: schema.object({
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' }))
})
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' })),
}),
},
},
async (context, request, response): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {
const retVal = await service.describeAsyncDeleteQuery(context, request, request.params.id, request.params.dataSourceMDSId);
async (
context,
request,
response
): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {
const retVal = await service.describeAsyncDeleteQuery(
context,
request,
request.params.id,
request.params.dataSourceMDSId
);
return response.ok({
body: retVal,
});
}
)
);

server.get(
{
path: `${ROUTE_PATH_GET_DATASOURCES}/{dataSourceMDSId?}`,
validate: {
params: schema.object({
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' }))
dataSourceMDSId: schema.maybe(schema.string({ defaultValue: '' })),
}),
},
},
async (context, request, response): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {
async (
context,
request,
response
): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {
const retVal = await service.describeSyncQueryDataSources(context, request);
return response.ok({
body: retVal,
});
}
)


}
);
}

0 comments on commit 35f4eaf

Please sign in to comment.