Skip to content

Commit c9fe94d

Browse files
committed
fix: build errors
1 parent 59622b7 commit c9fe94d

File tree

9 files changed

+24
-10
lines changed

9 files changed

+24
-10
lines changed

src/apm/loki/envConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Environment } from '../../utils/env';
33
const requiredEnvVars = ['NODE_ENV', 'SERVICE_NAME', 'LOKI_AUTH', 'LOKI_HOST'];
44

55
export const loadAndValidateEnv = () => {
6-
const env = Environment({}) as Record<string, string>;
6+
const env = Environment() as Record<string, string>;
77
requiredEnvVars.forEach((varName) => {
88
if (!env[varName]) {
99
console.error(`Missing required environment variable: ${varName}`);

src/apm/loki/logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ let LokiLogger: any;
44

55
try {
66
const { createLogger, transports, format } = await import('winston');
7-
const LokiTransport = await import('winston-loki');
7+
const LokiTransport = (await import('winston-loki')).default;
88

99
const envVars = loadAndValidateEnv();
1010

src/apm/prometheus/envConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const requiredEnvVars = [
88
];
99

1010
export const loadAndValidateEnv = (): { [key: string]: string } => {
11-
const env = Environment({}) as Record<string, string>;
11+
const env = Environment() as Record<string, string>;
1212
requiredEnvVars.forEach((varName) => {
1313
if (!env[varName]) {
1414
console.error(`Missing required environment variable: ${varName}`);

src/apm/prometheus/prometheusClient.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ client.collectDefaultMetrics({
2323

2424
const loadMetadataKeys = () => {
2525
return (
26-
Environment({})
26+
Environment()
2727
.PROMETHEUS_LABELS_METADATA_ALLOWED_KEYS?.replaceAll(' ', '')
2828
.split(',') ?? []
2929
).map((key: string) => `metadata_${key}`);
@@ -305,7 +305,7 @@ export const llmCacheProcessingDurationMilliseconds = new client.Histogram({
305305
export const getCustomLabels = (metadata: string | undefined) => {
306306
let customLabels: Record<string, any> = {};
307307
const allowedKeys =
308-
Environment({}).PROMETHEUS_LABELS_METADATA_ALLOWED_KEYS?.split(',') ?? [];
308+
Environment().PROMETHEUS_LABELS_METADATA_ALLOWED_KEYS?.split(',') ?? [];
309309
if (typeof metadata === 'string') {
310310
try {
311311
const parsedMetadata = JSON.parse(metadata);

src/globals.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,5 +279,19 @@ export const AtomicOperations = {
279279
export enum RateLimiterKeyTypes {
280280
VIRTUAL_KEY = 'VIRTUAL_KEY',
281281
API_KEY = 'API_KEY',
282+
WORKSPACE = 'WORKSPACE',
282283
INTEGRATION_WORKSPACE = 'INTEGRATION_WORKSPACE',
283284
}
285+
286+
export const METRICS_KEYS = {
287+
AUTH_N_MIDDLEWARE_START: 'authNMiddlewareStart',
288+
AUTH_N_MIDDLEWARE_END: 'authNMiddlewareEnd',
289+
API_KEY_RATE_LIMIT_CHECK_START: 'apiKeyRateLimitCheckStart',
290+
API_KEY_RATE_LIMIT_CHECK_END: 'apiKeyRateLimitCheckEnd',
291+
PORTKEY_MIDDLEWARE_PRE_REQUEST_START: 'portkeyMiddlewarePreRequestStart',
292+
PORTKEY_MIDDLEWARE_PRE_REQUEST_END: 'portkeyMiddlewarePreRequestEnd',
293+
PORTKEY_MIDDLEWARE_POST_REQUEST_START: 'portkeyMiddlewarePostRequestStart',
294+
PORTKEY_MIDDLEWARE_POST_REQUEST_END: 'portkeyMiddlewarePostRequestEnd',
295+
LLM_CACHE_GET_START: 'llmCacheGetStart',
296+
LLM_CACHE_GET_END: 'llmCacheGetEnd',
297+
};

src/middlewares/requestValidator/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const BLOCKED_TLDS = [
4747

4848
// Parse allowed custom hosts from environment variable
4949
// Format: comma-separated list of domains/IPs (e.g., "localhost,127.0.0.1,example.com")
50-
const TRUSTED_CUSTOM_HOSTS = (c: Context) => {
50+
const TRUSTED_CUSTOM_HOSTS = (c?: Context) => {
5151
const envVar = Environment(c)?.TRUSTED_CUSTOM_HOSTS;
5252
if (!envVar) {
5353
// Default allowed hosts for local development

src/providers/google-vertex-ai/chatComplete.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export const VertexGoogleChatCompleteConfig: ProviderConfig = {
9898
functionResponse: {
9999
name: message.name ?? 'gateway-tool-filler-name',
100100
response: {
101-
output: message.content,
101+
output: message.content ?? '',
102102
},
103103
},
104104
});

src/providers/google/chatComplete.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
SYSTEM_MESSAGE_ROLES,
1010
MESSAGE_ROLES,
1111
} from '../../types/requestBody';
12-
import { buildGoogleSearchRetrievalTool } from '../google-vertex-ai/chatComplete';
1312
import { VERTEX_MODALITY } from '../google-vertex-ai/types';
1413
import {
1514
getMimeType,
@@ -111,7 +110,7 @@ interface GoogleFunctionResponseMessagePart {
111110
name: string;
112111
response: {
113112
name?: string;
114-
content: string | ContentType[];
113+
output: string | ContentType[];
115114
};
116115
};
117116
}
@@ -210,7 +209,7 @@ export const GoogleChatCompleteConfig: ProviderConfig = {
210209
functionResponse: {
211210
name: message.name ?? 'gateway-tool-filler-name',
212211
response: {
213-
output: message.content,
212+
output: message.content ?? '',
214213
},
215214
},
216215
});

src/providers/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export interface ProviderAPIConfig {
5353
transformedRequestBody: Record<string, any>;
5454
transformedRequestUrl: string;
5555
gatewayRequestBody?: Params;
56+
headers?: Record<string, string>;
5657
}) => Promise<Record<string, any>> | Record<string, any>;
5758
/** A function to generate the baseURL based on parameters */
5859
getBaseURL: (args: {

0 commit comments

Comments
 (0)