Skip to content

Commit

Permalink
Remove code after refactoring (#1986)
Browse files Browse the repository at this point in the history
  • Loading branch information
melikhov-dev authored Dec 27, 2024
1 parent 63b48ff commit c6b7ead
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type {IncomingHttpHeaders, OutgoingHttpHeaders} from 'http';
import querystring from 'querystring';
import url from 'url';

import type {Request} from '@gravity-ui/expresskit';
import type {AppContext} from '@gravity-ui/nodekit';
import {REQUEST_ID_PARAM_NAME} from '@gravity-ui/nodekit';
import {isObject, isString} from 'lodash';
Expand Down Expand Up @@ -60,10 +59,6 @@ type PromiseWithAbortController = [Promise<unknown>, AbortController];
type DataFetcherOptions = {
chartsEngine: ChartsEngine;
sources: Record<string, Source | string>;
/**
* @deprecated will be removed
*/
req?: Request;
ctx: AppContext;
postprocess?:
| ((
Expand All @@ -78,8 +73,8 @@ type DataFetcherOptions = {
workbookId?: WorkbookId;
isEmbed?: boolean;
zitadelParams?: ZitadelParams | undefined;
originalReqHeaders?: DataFetcherOriginalReqHeaders;
adapterContext?: AdapterContext;
originalReqHeaders: DataFetcherOriginalReqHeaders;
adapterContext: AdapterContext;
};

export type DataFetcherOriginalReqHeaders = {
Expand Down Expand Up @@ -190,7 +185,6 @@ export class DataFetcher {
static fetch({
chartsEngine,
sources,
req,
ctx,
postprocess = null,
subrequestHeaders,
Expand Down Expand Up @@ -223,31 +217,6 @@ export class DataFetcher {
const queue = new PQueue({concurrency: CONCURRENT_REQUESTS_LIMIT});
const fetchPromisesList: (() => unknown)[] = [];

// TODO: will be removed after migrations
if (req) {
isEmbed = req.headers[DL_EMBED_TOKEN_HEADER] !== undefined;

zitadelParams = ctx.config.isZitadelEnabled
? {
accessToken: req.user?.accessToken,
serviceUserAccessToken: req.serviceUserAccessToken,
}
: undefined;

originalReqHeaders = {
xRealIP: req.headers['x-real-ip'],
xForwardedFor: req.headers['x-forwarded-for'],
xChartsFetcherVia: req.headers['x-charts-fetcher-via'],
referer: req.headers.referer,
};
adapterContext = {
headers: {
['x-forwarded-for']: req.headers['x-forwarded-for'],
cookie: req.headers.cookie,
},
};
}

if (!originalReqHeaders || !adapterContext) {
throw new Error('Missing original request headers or adapter context');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type {Request} from '@gravity-ui/expresskit';
import type {AppContext} from '@gravity-ui/nodekit';
import {flow} from 'lodash';

Expand Down Expand Up @@ -53,16 +52,11 @@ export class ProcessorHooks {
}

async init({
req,
config,
isEditMode,
ctx,
hooksContext,
}: {
/**
* @deprecated will be removed
*/
req: Request;
config: Record<string, any>;
isEditMode: boolean;
ctx: AppContext;
Expand All @@ -77,7 +71,6 @@ export class ProcessorHooks {
try {
ctx.log(`Hook ${hookName} init`);
const hook = processHook.init({
req,
config,
isEditMode,
ctx,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {transformParamsToActionParams} from '@gravity-ui/dashkit/helpers';
import type {Request} from '@gravity-ui/expresskit';
import {type AppContext, REQUEST_ID_PARAM_NAME} from '@gravity-ui/nodekit';
import {AxiosError} from 'axios';
import JSONfn from 'json-fn';
Expand Down Expand Up @@ -152,10 +151,6 @@ export type ProcessorParams = {
userLang: string | null;
userId: string | null;
iamToken: string | null;
/**
* @deprecated will be removed
*/
req: Request;
responseOptions?: Record<string, string | boolean>;
uiOnly?: boolean;
isEditMode: boolean;
Expand Down Expand Up @@ -188,7 +183,6 @@ export class Processor {
userLogin,
userId = null,
iamToken = null,
req,
responseOptions = {},
uiOnly = false,
isEditMode,
Expand Down Expand Up @@ -330,7 +324,6 @@ export class Processor {
ctx.log('EditorEngine::ConfigResolved', {duration: getDuration(hrStart)});

const resultHooksInit = await hooks.init({
req,
config: {
...config,
entryId: config.entryId || configId,
Expand Down
1 change: 0 additions & 1 deletion src/server/components/charts-engine/runners/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ export function commonRunner({
userLogin: res.locals && res.locals.login,
userId: res.locals && res.locals.userId,
subrequestHeaders: res.locals.subrequestHeaders,
req,
iamToken,
isEditMode: Boolean(res.locals.editMode),
configResolving,
Expand Down

0 comments on commit c6b7ead

Please sign in to comment.