fix: merge duplicate imports in packages/core (3/4) (#20928)

This commit is contained in:
nityam
2026-03-04 05:42:59 +05:30
committed by GitHub
parent d25088956d
commit 28af4e127f
143 changed files with 909 additions and 712 deletions
+2 -4
View File
@@ -4,12 +4,10 @@
* SPDX-License-Identifier: Apache-2.0
*/
import type { ContentGenerator } from '../core/contentGenerator.js';
import { AuthType } from '../core/contentGenerator.js';
import { AuthType, type ContentGenerator } from '../core/contentGenerator.js';
import { getOauthClient } from './oauth2.js';
import { setupUser } from './setup.js';
import type { HttpOptions } from './server.js';
import { CodeAssistServer } from './server.js';
import { CodeAssistServer, type HttpOptions } from './server.js';
import type { Config } from '../config/config.js';
import { LoggingContentGenerator } from '../core/loggingContentGenerator.js';
@@ -5,21 +5,19 @@
*/
import { describe, it, expect } from 'vitest';
import type { CaGenerateContentResponse } from './converter.js';
import {
toGenerateContentRequest,
fromGenerateContentResponse,
toContents,
type CaGenerateContentResponse,
} from './converter.js';
import type {
ContentListUnion,
GenerateContentParameters,
Part,
} from '@google/genai';
import {
GenerateContentResponse,
FinishReason,
BlockedReason,
type ContentListUnion,
type GenerateContentParameters,
type Part,
} from '@google/genai';
describe('converter', () => {
+22 -22
View File
@@ -4,29 +4,29 @@
* SPDX-License-Identifier: Apache-2.0
*/
import type {
Content,
ContentListUnion,
ContentUnion,
GenerateContentConfig,
GenerateContentParameters,
CountTokensParameters,
CountTokensResponse,
GenerationConfigRoutingConfig,
MediaResolution,
Candidate,
ModelSelectionConfig,
GenerateContentResponsePromptFeedback,
GenerateContentResponseUsageMetadata,
Part,
SafetySetting,
PartUnion,
SpeechConfigUnion,
ThinkingConfig,
ToolListUnion,
ToolConfig,
import {
GenerateContentResponse,
type Content,
type ContentListUnion,
type ContentUnion,
type GenerateContentConfig,
type GenerateContentParameters,
type CountTokensParameters,
type CountTokensResponse,
type GenerationConfigRoutingConfig,
type MediaResolution,
type Candidate,
type ModelSelectionConfig,
type GenerateContentResponsePromptFeedback,
type GenerateContentResponseUsageMetadata,
type Part,
type SafetySetting,
type PartUnion,
type SpeechConfigUnion,
type ThinkingConfig,
type ToolListUnion,
type ToolConfig,
} from '@google/genai';
import { GenerateContentResponse } from '@google/genai';
import { debugLogger } from '../utils/debugLogger.js';
import type { Credits } from './types.js';
+15 -4
View File
@@ -4,9 +4,21 @@
* SPDX-License-Identifier: Apache-2.0
*/
import type { Credentials } from 'google-auth-library';
import type { Mock } from 'vitest';
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import {
OAuth2Client,
Compute,
GoogleAuth,
type Credentials,
} from 'google-auth-library';
import {
describe,
it,
expect,
vi,
beforeEach,
afterEach,
type Mock,
} from 'vitest';
import {
getOauthClient,
resetOauthClientForTesting,
@@ -15,7 +27,6 @@ import {
authEvents,
} from './oauth2.js';
import { UserAccountManager } from '../utils/userAccountManager.js';
import { OAuth2Client, Compute, GoogleAuth } from 'google-auth-library';
import * as fs from 'node:fs';
import * as path from 'node:path';
import http from 'node:http';
+3 -1
View File
@@ -4,12 +4,14 @@
* SPDX-License-Identifier: Apache-2.0
*/
import type { Credentials, AuthClient, JWTInput } from 'google-auth-library';
import {
OAuth2Client,
Compute,
CodeChallengeMethod,
GoogleAuth,
type Credentials,
type AuthClient,
type JWTInput,
} from 'google-auth-library';
import * as http from 'node:http';
import url from 'node:url';
+21 -23
View File
@@ -5,26 +5,26 @@
*/
import type { AuthClient } from 'google-auth-library';
import type {
CodeAssistGlobalUserSettingResponse,
LoadCodeAssistRequest,
LoadCodeAssistResponse,
LongRunningOperationResponse,
OnboardUserRequest,
SetCodeAssistGlobalUserSettingRequest,
ClientMetadata,
RetrieveUserQuotaRequest,
RetrieveUserQuotaResponse,
FetchAdminControlsRequest,
FetchAdminControlsResponse,
ConversationOffered,
ConversationInteraction,
StreamingLatency,
RecordCodeAssistMetricsRequest,
GeminiUserTier,
Credits,
import {
UserTierId,
type CodeAssistGlobalUserSettingResponse,
type LoadCodeAssistRequest,
type LoadCodeAssistResponse,
type LongRunningOperationResponse,
type OnboardUserRequest,
type SetCodeAssistGlobalUserSettingRequest,
type ClientMetadata,
type RetrieveUserQuotaRequest,
type RetrieveUserQuotaResponse,
type FetchAdminControlsRequest,
type FetchAdminControlsResponse,
type ConversationOffered,
type ConversationInteraction,
type StreamingLatency,
type RecordCodeAssistMetricsRequest,
type GeminiUserTier,
type Credits,
} from './types.js';
import { UserTierId } from './types.js';
import type {
ListExperimentsRequest,
ListExperimentsResponse,
@@ -49,15 +49,13 @@ import {
} from '../billing/billing.js';
import { logBillingEvent } from '../telemetry/loggers.js';
import { CreditsUsedEvent } from '../telemetry/billingEvents.js';
import type {
CaCountTokenResponse,
CaGenerateContentResponse,
} from './converter.js';
import {
fromCountTokenResponse,
fromGenerateContentResponse,
toCountTokenRequest,
toGenerateContentRequest,
type CaCountTokenResponse,
type CaGenerateContentResponse,
} from './converter.js';
import {
formatProtoJsonDuration,
+1 -2
View File
@@ -14,8 +14,7 @@ import { ValidationRequiredError } from '../utils/googleQuotaErrors.js';
import { ChangeAuthRequestedError } from '../utils/errors.js';
import { CodeAssistServer } from '../code_assist/server.js';
import type { OAuth2Client } from 'google-auth-library';
import type { GeminiUserTier } from './types.js';
import { UserTierId } from './types.js';
import { UserTierId, type GeminiUserTier } from './types.js';
vi.mock('../code_assist/server.js');
+9 -9
View File
@@ -4,16 +4,16 @@
* SPDX-License-Identifier: Apache-2.0
*/
import type {
ClientMetadata,
GeminiUserTier,
IneligibleTier,
LoadCodeAssistResponse,
OnboardUserRequest,
import {
UserTierId,
IneligibleTierReasonCode,
type ClientMetadata,
type GeminiUserTier,
type IneligibleTier,
type LoadCodeAssistResponse,
type OnboardUserRequest,
} from './types.js';
import { UserTierId, IneligibleTierReasonCode } from './types.js';
import type { HttpOptions } from './server.js';
import { CodeAssistServer } from './server.js';
import { CodeAssistServer, type HttpOptions } from './server.js';
import type { AuthClient } from 'google-auth-library';
import type { ValidationHandler } from '../fallback/types.js';
import { ChangeAuthRequestedError } from '../utils/errors.js';